15 #include <netinet/tcp.h> 16 #include <netinet/in.h> 19 #if SIZEOF_UNSIGNED_SHORT_INT==4 20 typedef unsigned short u32;
21 #elif SIZEOF_UNSIGNED_INT==4 22 typedef unsigned int u32;
23 #elif SIZEOF_UNSIGNED_LONG_INT==4 24 typedef unsigned long u32;
26 #error I need at least some 32-bit type 29 #if SIZEOF_UNSIGNED_INT==8 30 typedef unsigned int u64;
31 #elif SIZEOF_UNSIGNED_LONG_INT==8 32 typedef unsigned long u64;
33 #elif SIZEOF_UNSIGNED_LONG_LONG_INT==8 34 typedef unsigned long long u64;
36 #error I need at least some 64-bit type 43 #ifndef HAVE_FDATASYNC 44 #define fdatasync(arg) fsync(arg) 51 #ifndef _LARGEFILE_SOURCE 52 #define _LARGEFILE_SOURCE 54 #define _FILE_OFFSET_BITS 64 57 #ifndef G_GNUC_NORETURN 58 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) 59 #define G_GNUC_NORETURN __attribute__((__noreturn__)) 60 #define G_GNUC_UNUSED __attribute__((unused)) 62 #define G_GNUC_NORETURN 71 #define INIT_PASSWD "NBDMAGIC" 73 #define INFO(a) do { } while(0) 82 uint64_t
ntohll(uint64_t a);
85 #define NBD_DEFAULT_PORT "10809" 89 #define NBD_OPT_EXPORT_NAME (1) 90 #define NBD_OPT_ABORT (2) 91 #define NBD_OPT_LIST (3) 94 #define NBD_REP_ACK (1) 95 #define NBD_REP_SERVER (2) 96 #define NBD_REP_FLAG_ERROR (1 << 31) 97 #define NBD_REP_ERR_UNSUP (1 | NBD_REP_FLAG_ERROR) 98 #define NBD_REP_ERR_POLICY (2 | NBD_REP_FLAG_ERROR) 99 #define NBD_REP_ERR_INVALID (3 | NBD_REP_FLAG_ERROR) 100 #define NBD_REP_ERR_PLATFORM (4 | NBD_REP_FLAG_ERROR) 103 #define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) 104 #define NBD_FLAG_NO_ZEROES (1 << 1) 106 #define NBD_FLAG_C_FIXED_NEWSTYLE NBD_FLAG_FIXED_NEWSTYLE 107 #define NBD_FLAG_C_NO_ZEROES NBD_FLAG_NO_ZEROES
uint64_t ntohll(uint64_t a)
void setmysockopt(int sock)
void err_nonfatal(const char *s)
void err(const char *s) G_GNUC_NORETURN
void logging(const char *name)