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