2005-04-17 05:20:36 +07: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 15:09:47 +07:00
|
|
|
#include <linux/wait.h>
|
2006-03-23 18:00:38 +07:00
|
|
|
#include <linux/mutex.h>
|
2012-10-13 16:46:48 +07:00
|
|
|
#include <uapi/linux/nbd.h>
|
2006-01-06 15:09:47 +07:00
|
|
|
|
|
|
|
struct request;
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct nbd_device {
|
|
|
|
int flags;
|
|
|
|
int harderror; /* Code of hard error */
|
2014-03-06 08:41:36 +07:00
|
|
|
struct socket * sock; /* If == NULL, device is not ready, yet */
|
2005-04-17 05:20:36 +07:00
|
|
|
int magic;
|
2006-01-06 15:09:47 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
spinlock_t queue_lock;
|
2008-04-29 15:02:46 +07:00
|
|
|
struct list_head queue_head; /* Requests waiting result */
|
2006-01-06 15:09:47 +07:00
|
|
|
struct request *active_req;
|
|
|
|
wait_queue_head_t active_wq;
|
2008-04-29 15:02:46 +07:00
|
|
|
struct list_head waiting_queue; /* Requests to be sent */
|
|
|
|
wait_queue_head_t waiting_wq;
|
2006-01-06 15:09:47 +07:00
|
|
|
|
2006-03-23 18:00:38 +07:00
|
|
|
struct mutex tx_lock;
|
2005-04-17 05:20:36 +07:00
|
|
|
struct gendisk *disk;
|
|
|
|
int blksize;
|
|
|
|
u64 bytesize;
|
2006-12-07 11:40:53 +07:00
|
|
|
pid_t pid; /* pid of nbd-client, if attached */
|
2007-10-17 13:27:37 +07:00
|
|
|
int xmit_timeout;
|
2013-07-04 05:09:04 +07:00
|
|
|
int disconnect; /* a disconnect has been requested by user */
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|