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