4 #define NBD_SET_SOCK _IO( 0xab, 0 )
5 #define NBD_SET_BLKSIZE _IO( 0xab, 1 )
6 #define NBD_SET_SIZE _IO( 0xab, 2 )
7 #define NBD_DO_IT _IO( 0xab, 3 )
8 #define NBD_CLEAR_SOCK _IO( 0xab, 4 )
9 #define NBD_CLEAR_QUE _IO( 0xab, 5 )
10 #define NBD_PRINT_DEBUG _IO( 0xab, 6 )
11 #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
15 #include <linux/locks.h>
16 #include <asm/semaphore.h>
18 #define LOCAL_END_REQUEST
20 #include <linux/blk.h>
23 extern int requests_in
;
24 extern int requests_out
;
28 nbd_end_request(struct request
*req
)
33 if (end_that_request_first( req
, !req
->errors
, "nbd" ))
35 end_that_request_last( req
);
43 int harderror
; /* Code of hard error */
44 #define NBD_READ_ONLY 0x0001
45 #define NBD_WRITE_NOCHK 0x0002
46 #define NBD_INITIALISED 0x0004
48 struct file
* file
; /* If == NULL, device is not ready, yet */
49 int magic
; /* FIXME: not if debugging is off */
50 struct request
*head
; /* Requests are added here... */
52 struct semaphore queue_lock
;
56 /* This now IS in some kind of include file... */
58 /* These are send over network in request/reply magic field */
60 #define NBD_REQUEST_MAGIC 0x25609513
61 #define NBD_REPLY_MAGIC 0x67446698
62 /* Do *not* use magics: 0x12560953 0x96744668. */
65 * This is packet used for communication between client and
66 * server. All data are in network byte order.
70 u32 type
; /* == READ || == WRITE */
76 __attribute__ ((packed
))
82 u32 error
; /* 0 = ok, else error */
83 char handle
[8]; /* handle you got from request */