nbd.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. */
  14. #ifndef LINUX_NBD_H
  15. #define LINUX_NBD_H
  16. #include <linux/wait.h>
  17. #include <linux/mutex.h>
  18. #include <uapi/linux/nbd.h>
  19. struct request;
  20. struct nbd_device {
  21. int flags;
  22. int harderror; /* Code of hard error */
  23. struct socket * sock;
  24. struct file * file; /* If == NULL, device is not ready, yet */
  25. int magic;
  26. spinlock_t queue_lock;
  27. struct list_head queue_head; /* Requests waiting result */
  28. struct request *active_req;
  29. wait_queue_head_t active_wq;
  30. struct list_head waiting_queue; /* Requests to be sent */
  31. wait_queue_head_t waiting_wq;
  32. struct mutex tx_lock;
  33. struct gendisk *disk;
  34. int blksize;
  35. u64 bytesize;
  36. pid_t pid; /* pid of nbd-client, if attached */
  37. int xmit_timeout;
  38. int disconnect; /* a disconnect has been requested by user */
  39. };
  40. #endif