2005-04-16 16:20:36 -06: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 01:09:47 -07:00
|
|
|
#include <linux/wait.h>
|
2006-03-23 04:00:38 -07:00
|
|
|
#include <linux/mutex.h>
|
2012-10-13 03:46:48 -06:00
|
|
|
#include <uapi/linux/nbd.h>
|
2006-01-06 01:09:47 -07:00
|
|
|
|
|
|
|
struct request;
|
|
|
|
|
2005-04-16 16:20:36 -06: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 01:09:47 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
spinlock_t queue_lock;
|
2008-04-29 02:02:46 -06:00
|
|
|
struct list_head queue_head; /* Requests waiting result */
|
2006-01-06 01:09:47 -07:00
|
|
|
struct request *active_req;
|
|
|
|
wait_queue_head_t active_wq;
|
2008-04-29 02:02:46 -06:00
|
|
|
struct list_head waiting_queue; /* Requests to be sent */
|
|
|
|
wait_queue_head_t waiting_wq;
|
2006-01-06 01:09:47 -07:00
|
|
|
|
2006-03-23 04:00:38 -07:00
|
|
|
struct mutex tx_lock;
|
2005-04-16 16:20:36 -06:00
|
|
|
struct gendisk *disk;
|
|
|
|
int blksize;
|
|
|
|
u64 bytesize;
|
2006-12-06 21:40:53 -07:00
|
|
|
pid_t pid; /* pid of nbd-client, if attached */
|
2007-10-17 00:27:37 -06:00
|
|
|
int xmit_timeout;
|
2013-07-03 16:09:04 -06:00
|
|
|
int disconnect; /* a disconnect has been requested by user */
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|