2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL.
|
|
|
|
* 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne)
|
|
|
|
* Made nbd_end_request() use the io_request_lock
|
|
|
|
* 2001 Copyright (C) Steven Whitehouse
|
|
|
|
* New nbd_end_request() for compatibility with new linux block
|
|
|
|
* layer code.
|
|
|
|
* 2003/06/24 Louis D. Langholtz <ldl@aros.net>
|
|
|
|
* Removed unneeded blksize_bits field from nbd_device struct.
|
|
|
|
* Cleanup PARANOIA usage & code.
|
|
|
|
* 2004/02/19 Paul Clements
|
|
|
|
* Removed PARANOIA, plus various cleanup and comments
|
|
|
|
*/
|
|
|
|
#ifndef LINUX_NBD_H
|
|
|
|
#define LINUX_NBD_H
|
|
|
|
|
|
|
|
|
2006-01-06 08:09:47 +00:00
|
|
|
#include <linux/wait.h>
|
2006-03-23 11:00:38 +00:00
|
|
|
#include <linux/mutex.h>
|
2012-10-13 09:46:48 +00:00
|
|
|
#include <uapi/linux/nbd.h>
|
2006-01-06 08:09:47 +00:00
|
|
|
|
|
|
|
struct request;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct nbd_device {
|
|
|
|
int flags;
|
|
|
|
int harderror; /* Code of hard error */
|
|
|
|
struct socket * sock;
|
|
|
|
struct file * file; /* If == NULL, device is not ready, yet */
|
|
|
|
int magic;
|
2006-01-06 08:09:47 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
spinlock_t queue_lock;
|
2008-04-29 08:02:46 +00:00
|
|
|
struct list_head queue_head; /* Requests waiting result */
|
2006-01-06 08:09:47 +00:00
|
|
|
struct request *active_req;
|
|
|
|
wait_queue_head_t active_wq;
|
2008-04-29 08:02:46 +00:00
|
|
|
struct list_head waiting_queue; /* Requests to be sent */
|
|
|
|
wait_queue_head_t waiting_wq;
|
2006-01-06 08:09:47 +00:00
|
|
|
|
2006-03-23 11:00:38 +00:00
|
|
|
struct mutex tx_lock;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct gendisk *disk;
|
|
|
|
int blksize;
|
|
|
|
u64 bytesize;
|
2006-12-07 04:40:53 +00:00
|
|
|
pid_t pid; /* pid of nbd-client, if attached */
|
2007-10-17 06:27:37 +00:00
|
|
|
int xmit_timeout;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|