|
Network Block Device @PACKAGE_VERSION@
|
#include <errno.h>#include <string.h>#include <netdb.h>#include <netinet/tcp.h>#include <netinet/in.h>#include <stdlib.h>#include "nbd.h"Go to the source code of this file.
Defines | |
| #define | __be32 u32 |
| #define | __be64 u64 |
| #define | fdatasync(arg) fsync(arg) |
| #define | G_GNUC_NORETURN |
| #define | G_GNUC_UNUSED |
| #define | INIT_PASSWD "NBDMAGIC" |
| #define | INFO(a) do { } while(0) |
| #define | htonll ntohll |
| #define | NBD_DEFAULT_PORT "10809" |
| #define | NBD_OPT_EXPORT_NAME (1) |
| #define | NBD_OPT_ABORT (2) |
| #define | NBD_OPT_LIST (3) |
| #define | NBD_REP_ACK (1) |
| #define | NBD_REP_SERVER (2) |
| #define | NBD_REP_FLAG_ERROR (1 << 31) |
| #define | NBD_REP_ERR_UNSUP (1 | NBD_REP_FLAG_ERROR) |
| #define | NBD_REP_ERR_POLICY (2 | NBD_REP_FLAG_ERROR) |
| #define | NBD_REP_ERR_INVALID (3 | NBD_REP_FLAG_ERROR) |
| #define | NBD_REP_ERR_PLATFORM (4 | NBD_REP_FLAG_ERROR) |
| #define | NBD_FLAG_FIXED_NEWSTYLE (1 << 0) |
| #define | NBD_FLAG_NO_ZEROES (1 << 1) |
| #define | NBD_FLAG_C_FIXED_NEWSTYLE NBD_FLAG_FIXED_NEWSTYLE |
| #define | NBD_FLAG_C_NO_ZEROES NBD_FLAG_NO_ZEROES |
Functions | |
| void | setmysockopt (int sock) |
| void | err_nonfatal (const char *s) |
| void | err (const char *s) G_GNUC_NORETURN |
| void | logging (const char *name) |
| uint64_t | ntohll (uint64_t a) |
| void | readit (int f, void *buf, size_t len) |
| Read data from a file descriptor into a buffer. | |
Variables | |
| const u64 | cliserv_magic |
| const u64 | opts_magic |
| const u64 | rep_magic |
| #define fdatasync | ( | arg | ) | fsync(arg) |
Definition at line 44 of file cliserv.h.
Referenced by expwrite(), and rawexpwrite().
| #define htonll ntohll |
Definition at line 86 of file cliserv.h.
Referenced by ask_list(), main(), negotiate(), send_export_info(), and send_reply().
| #define INFO | ( | a | ) | do { } while(0) |
Definition at line 73 of file cliserv.h.
Referenced by setmysockopt().
| #define INIT_PASSWD "NBDMAGIC" |
Definition at line 71 of file cliserv.h.
Referenced by negotiate().
| #define NBD_DEFAULT_PORT "10809" |
Definition at line 91 of file cliserv.h.
Referenced by main(), and open_modern().
| #define NBD_FLAG_C_FIXED_NEWSTYLE NBD_FLAG_FIXED_NEWSTYLE |
| #define NBD_FLAG_C_NO_ZEROES NBD_FLAG_NO_ZEROES |
Definition at line 113 of file cliserv.h.
Referenced by negotiate().
| #define NBD_FLAG_FIXED_NEWSTYLE (1 << 0) |
Definition at line 109 of file cliserv.h.
Referenced by main(), and negotiate().
| #define NBD_FLAG_NO_ZEROES (1 << 1) |
Definition at line 110 of file cliserv.h.
Referenced by negotiate().
| #define NBD_OPT_ABORT (2) |
Definition at line 96 of file cliserv.h.
Referenced by ask_list(), and negotiate().
| #define NBD_OPT_EXPORT_NAME (1) |
Definition at line 95 of file cliserv.h.
Referenced by negotiate().
| #define NBD_OPT_LIST (3) |
Definition at line 97 of file cliserv.h.
Referenced by ask_list(), and negotiate().
| #define NBD_REP_ACK (1) |
Definition at line 100 of file cliserv.h.
Referenced by ask_list(), and handle_list().
| #define NBD_REP_ERR_INVALID (3 | NBD_REP_FLAG_ERROR) |
Definition at line 105 of file cliserv.h.
Referenced by handle_list().
| #define NBD_REP_ERR_POLICY (2 | NBD_REP_FLAG_ERROR) |
Definition at line 104 of file cliserv.h.
Referenced by ask_list(), and handle_list().
| #define NBD_REP_ERR_UNSUP (1 | NBD_REP_FLAG_ERROR) |
Definition at line 103 of file cliserv.h.
Referenced by negotiate().
| #define NBD_REP_FLAG_ERROR (1 << 31) |
Definition at line 102 of file cliserv.h.
Referenced by ask_list().
| #define NBD_REP_SERVER (2) |
Definition at line 101 of file cliserv.h.
Referenced by ask_list(), and handle_list().
| void err | ( | const char * | s | ) |
Definition at line 59 of file cliserv.c.
References err_nonfatal().
Referenced by ask_list(), construct_path(), copyonwrite_prepare(), daemonize(), disconnect(), dousers(), finish_sock(), handle_export_name(), handle_list(), handle_read(), main(), mainloop(), mainloop_threaded(), mkdir_path(), myseek(), negotiate(), open_treefile(), opennet(), parse_cfile(), readit(), send_export_info(), serveloop(), set_timeout(), setsizes(), setup_servers(), setupexport(), and writeit().
| void err_nonfatal | ( | const char * | s | ) |
Definition at line 33 of file cliserv.c.
Referenced by err(), handle_list(), negotiate(), opennet(), openunix(), and socket_accept().
| uint64_t ntohll | ( | uint64_t | a | ) |
Definition at line 78 of file cliserv.c.
Referenced by ask_list(), main(), mainloop(), mainloop_threaded(), and negotiate().
| void readit | ( | int | f, |
| void * | buf, | ||
| size_t | len | ||
| ) |
Read data from a file descriptor into a buffer.
| f | a file descriptor |
| buf | a buffer |
| len | the number of bytes to be read |
Definition at line 95 of file cliserv.c.
Referenced by consume(), mainloop(), mainloop_threaded(), and negotiate().
| void setmysockopt | ( | int | sock | ) |
Definition at line 15 of file cliserv.c.
References INFO.
Referenced by opennet(), and serveconnection().
| const u64 cliserv_magic |
Definition at line 11 of file cliserv.c.
Referenced by negotiate().
| const u64 opts_magic |
Definition at line 12 of file cliserv.c.
Referenced by ask_list(), and negotiate().
| const u64 rep_magic |
Definition at line 13 of file cliserv.c.
Referenced by ask_list().
1.7.3