flexnbd: Add some more information to nbdtypes.h

This commit is contained in:
nick
2013-02-08 17:05:22 +00:00
parent ecfd108a53
commit f63be84d80
2 changed files with 15 additions and 9 deletions

View File

@@ -55,3 +55,4 @@ void nbd_h2r_reply( struct nbd_reply * from, struct nbd_reply_raw * to )
to->error = be32toh( from->error ); to->error = be32toh( from->error );
memcpy( to->handle, from->handle, 8 ); memcpy( to->handle, from->handle, 8 );
} }

View File

@@ -11,6 +11,12 @@
#define REQUEST_WRITE 1 #define REQUEST_WRITE 1
#define REQUEST_DISCONNECT 2 #define REQUEST_DISCONNECT 2
/* 1MiB is the de-facto standard for maximum size of header + data */
#define NBD_MAX_SIZE ( 1024 * 1024 )
#define NBD_REQUEST_SIZE ( sizeof( struct nbd_request_raw ) )
#define NBD_REPLY_SIZE ( sizeof( struct nbd_reply_raw ) )
#include <linux/types.h> #include <linux/types.h>
#include <inttypes.h> #include <inttypes.h>
@@ -51,7 +57,7 @@ struct nbd_init {
struct nbd_request { struct nbd_request {
uint32_t magic; uint32_t magic;
uint32_t type; /* == READ || == WRITE */ uint32_t type; /* == READ || == WRITE || == DISCONNECT */
char handle[8]; char handle[8];
uint64_t from; uint64_t from;
uint32_t len; uint32_t len;
@@ -63,7 +69,6 @@ struct nbd_reply {
char handle[8]; /* handle you got from request */ char handle[8]; /* handle you got from request */
}; };
void nbd_r2h_init( struct nbd_init_raw * from, struct nbd_init * to ); void nbd_r2h_init( struct nbd_init_raw * from, struct nbd_init * to );
void nbd_r2h_request( struct nbd_request_raw *from, struct nbd_request * to ); void nbd_r2h_request( struct nbd_request_raw *from, struct nbd_request * to );
void nbd_r2h_reply( struct nbd_reply_raw * from, struct nbd_reply * to ); void nbd_r2h_reply( struct nbd_reply_raw * from, struct nbd_reply * to );