Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ OTHER DEALINGS IN THE SOFTWARE.
#include <sys/types.h>

#include "buffer.h"
#include <stdlib.h>


struct buffer
{
Expand Down
2 changes: 1 addition & 1 deletion buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
#ifndef __TLSPROXY_BUFFERS_H
#define __TLSPROXY_BUFFERS_H

#include <stdlib.h>
//#include <stdlib.h>
#include <sys/types.h>

typedef struct buffer buffer_t;
Expand Down
1 change: 1 addition & 0 deletions cliserv.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <config.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <syslog.h>
Expand Down
4 changes: 2 additions & 2 deletions cliserv.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
Send 128 bytes of zeros (reserved for future use)
*/

#include <errno.h>
// #include <errno.h>
#include <string.h>
#include <netdb.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <stdlib.h>

#include "nbd.h"
//#include "nbd.h"

#ifndef HAVE_FDATASYNC
#define fdatasync(arg) fsync(arg)
Expand Down
11 changes: 6 additions & 5 deletions nbd-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
*/

#include "config.h"
#include "lfs.h"
// #include "lfs.h"
#include "nbd.h"

#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/tcp.h>
// #include <netinet/tcp.h>
#include <netinet/in.h>
#include <netdb.h>
#include "netdb-compat.h"
// #include "netdb-compat.h"
#include <inttypes.h>
#include <stdio.h>
#include <fcntl.h>
Expand All @@ -39,12 +40,12 @@
#include <sys/mman.h>
#include <signal.h>
#include <errno.h>
#include <getopt.h>
// #include <getopt.h>
#include <stdarg.h>
#include <stdbool.h>
#include <time.h>

#include <linux/ioctl.h>
// #include <linux/ioctl.h>

#if HAVE_NETLINK
#include "nbd-netlink.h"
Expand Down
17 changes: 8 additions & 9 deletions nbd-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#include <sys/param.h>
// #include <sys/param.h>
#include <signal.h>
#include <errno.h>
#include <libgen.h>
#include <netinet/tcp.h>
// #include <netinet/tcp.h>
#include <netinet/in.h>
#include <netdb.h>
#include <syslog.h>
Expand All @@ -98,8 +98,8 @@
#if HAVE_BLKDISCARD
#include <linux/fs.h>
#endif
#include <arpa/inet.h>
#include <strings.h>
// #include <arpa/inet.h>
// #include <strings.h>
#include <dirent.h>
#ifdef HAVE_SYS_DIR_H
#include <sys/dir.h>
Expand All @@ -111,7 +111,7 @@
#include <pwd.h>
#include <grp.h>
#include <dirent.h>
#include <ctype.h>
// #include <ctype.h>
#include <inttypes.h>

#include <glib.h>
Expand All @@ -120,7 +120,7 @@
#define MY_NAME "nbd_server"
#include "cliserv.h"
#include "nbd-debug.h"
#include "netdb-compat.h"
// #include "netdb-compat.h"
#include "backend.h"
#include "treefiles.h"
#include "nbd-helper.h"
Expand Down Expand Up @@ -379,9 +379,8 @@ static void socket_read(CLIENT* client, void *buf, size_t len) {
* @param bufsiz the size of the buffer
**/
static inline void consume(CLIENT* c, size_t len, void * buf, size_t bufsiz) {
size_t curlen;
while (len>0) {
curlen = (len>bufsiz)?bufsiz:len;
const size_t curlen = (len>bufsiz)?bufsiz:len;
socket_read(c, buf, curlen);
len -= curlen;
}
Expand Down Expand Up @@ -555,7 +554,7 @@ SERVER* cmdline(int argc, char *argv[], struct generic_conf *genconf) {
int i=0;
int nonspecial=0;
int c;
struct option long_options[] = {
const struct option long_options[] = {
{"read-only", no_argument, NULL, 'r'},
{"multi-file", no_argument, NULL, 'm'},
{"copy-on-write", no_argument, NULL, 'c'},
Expand Down
2 changes: 1 addition & 1 deletion nbd-trdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
// #include <sys/time.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
Expand Down
3 changes: 2 additions & 1 deletion nbd-trplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/

#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
// #include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion nbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef LINUX_NBD_H
#define LINUX_NBD_H

//#include <linux/types.h>
#include <stdint.h>

#define NBD_SET_SOCK _IO( 0xab, 0 )
#define NBD_SET_BLKSIZE _IO( 0xab, 1 )
Expand Down
5 changes: 4 additions & 1 deletion nbdclt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef NBDCLT_H
#define NBDCLT_H

#include <stdint.h>
#include <stdbool.h>

typedef struct {
char *name;
char *dev;
Expand All @@ -23,7 +26,7 @@ typedef struct {
bool preinit;
bool force_ro;
bool tls;
bool persist_mode;
bool persist_mode;
char *priority;
int dead_conn_timeout;
} CLIENT;
Expand Down
3 changes: 2 additions & 1 deletion nbdsrv.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#ifndef NBDSRV_H
#define NBDSRV_H

#include "lfs.h"
// #include "lfs.h"

#include <glib.h>
#include <stdbool.h>
#include <stdint.h>
#include <pthread.h>

#include <sys/socket.h>
#include <sys/types.h>
Expand Down
3 changes: 2 additions & 1 deletion treefiles.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h> // for PATH_MAX
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
// #include <sys/types.h>

#include "config.h"
#include "cliserv.h"
Expand Down