Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL. |
| 3 | * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne) |
| 4 | * Made nbd_end_request() use the io_request_lock |
| 5 | * 2001 Copyright (C) Steven Whitehouse |
| 6 | * New nbd_end_request() for compatibility with new linux block |
| 7 | * layer code. |
| 8 | * 2003/06/24 Louis D. Langholtz <ldl@aros.net> |
| 9 | * Removed unneeded blksize_bits field from nbd_device struct. |
| 10 | * Cleanup PARANOIA usage & code. |
| 11 | * 2004/02/19 Paul Clements |
| 12 | * Removed PARANOIA, plus various cleanup and comments |
| 13 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #ifndef LINUX_NBD_H |
| 15 | #define LINUX_NBD_H |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 18 | #include <linux/wait.h> |
Ingo Molnar | 82d4dc5 | 2006-03-23 03:00:38 -0800 | [diff] [blame] | 19 | #include <linux/mutex.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 20 | #include <uapi/linux/nbd.h> |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 21 | |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 22 | struct request; |
| 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | struct nbd_device { |
| 25 | int flags; |
| 26 | int harderror; /* Code of hard error */ |
| 27 | struct socket * sock; |
| 28 | struct file * file; /* If == NULL, device is not ready, yet */ |
| 29 | int magic; |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | spinlock_t queue_lock; |
Laurent Vivier | 48cf606 | 2008-04-29 01:02:46 -0700 | [diff] [blame] | 32 | struct list_head queue_head; /* Requests waiting result */ |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 33 | struct request *active_req; |
| 34 | wait_queue_head_t active_wq; |
Laurent Vivier | 48cf606 | 2008-04-29 01:02:46 -0700 | [diff] [blame] | 35 | struct list_head waiting_queue; /* Requests to be sent */ |
| 36 | wait_queue_head_t waiting_wq; |
Herbert Xu | 4b2f026 | 2006-01-06 00:09:47 -0800 | [diff] [blame] | 37 | |
Ingo Molnar | 82d4dc5 | 2006-03-23 03:00:38 -0800 | [diff] [blame] | 38 | struct mutex tx_lock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | struct gendisk *disk; |
| 40 | int blksize; |
| 41 | u64 bytesize; |
Paul Clements | 6b39bb6 | 2006-12-06 20:40:53 -0800 | [diff] [blame] | 42 | pid_t pid; /* pid of nbd-client, if attached */ |
Paul Clements | 7fdfd40 | 2007-10-16 23:27:37 -0700 | [diff] [blame] | 43 | int xmit_timeout; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | #endif |