summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-11-30 13:59:05 +0100
committerSimon Rettberg2015-11-30 13:59:05 +0100
commit9ffb0038ded686a177b06f268f08c9bcd48128b2 (patch)
tree8d50f7f92db37b2ce9a9e0933072f4203d587ac6
parent[FUSE] Mid-refactoring, does not compile (diff)
downloaddnbd3-9ffb0038ded686a177b06f268f08c9bcd48128b2.tar.gz
dnbd3-9ffb0038ded686a177b06f268f08c9bcd48128b2.tar.xz
dnbd3-9ffb0038ded686a177b06f268f08c9bcd48128b2.zip
[FUSE] Compiles again
-rw-r--r--src/fuse/helper.c10
-rw-r--r--src/fuse/helper.h2
-rw-r--r--src/fuse/log.h43
-rw-r--r--src/shared/log.c (renamed from src/server/log.c)0
-rw-r--r--src/shared/log.h (renamed from src/server/log.h)0
-rw-r--r--src/shared/sockhelper.c8
6 files changed, 4 insertions, 59 deletions
diff --git a/src/fuse/helper.c b/src/fuse/helper.c
index 6e46352..853b021 100644
--- a/src/fuse/helper.c
+++ b/src/fuse/helper.c
@@ -37,13 +37,3 @@ void printLog( log_info *info )
fprintf( logFile, "\n" );
fclose( logFile );
}
-
-bool sock_printable( struct sockaddr *addr, socklen_t addrLen, char *output, int len )
-{
- char host[100], port[10];
- int ret = getnameinfo( addr, addrLen, host, 100, port, 10, NI_NUMERICHOST | NI_NUMERICSERV );
- if ( ret == 0 ) {
- snprintf( output, len, "[%s]:%s", host, port );
- }
- return ret == 0;
-}
diff --git a/src/fuse/helper.h b/src/fuse/helper.h
index 35cdc8a..0b98ded 100644
--- a/src/fuse/helper.h
+++ b/src/fuse/helper.h
@@ -20,8 +20,6 @@ typedef struct log_info {
void printLog(log_info *info);
-bool sock_printable(struct sockaddr *addr, socklen_t addrLen, char *output, int len);
-
int connect_to_server(char *server_adress, int port);
static inline bool isSameAddressPort(const dnbd3_host_t * const a, const dnbd3_host_t * const b)
diff --git a/src/fuse/log.h b/src/fuse/log.h
deleted file mode 100644
index e429861..0000000
--- a/src/fuse/log.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef LOG_H_
-#define LOG_H_
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-typedef unsigned int logmask_t;
-#define LOG_ERROR ((logmask_t)1) // Fatal error, server will terminate
-#define LOG_WARNING ((logmask_t)2) // Major issue, something is broken but keep running
-#define LOG_MINOR ((logmask_t)4) // Minor issue, more of a hickup than serious problem
-#define LOG_INFO ((logmask_t)8) // Informational message
-#define LOG_DEBUG1 ((logmask_t)16) // Debug information, use this for non-spammy stuff
-#define LOG_DEBUG2 ((logmask_t)32) // Use this for debug messages that will show up a lot
-
-//void log_setFileMask(logmask_t mask);
-
-//void log_setConsoleMask(logmask_t mask);
-
-/**
- * Open or reopen the log file. If path is NULL and the
- * function was called with a path before, the same path
- * will be used again.
- */
-//bool log_openLogFile(const char *path);
-
-/**
- * Add a line to the log
- */
-void logadd(const logmask_t mask, const char *text, ...)
-{
- va_list args;
- va_start( args, text );
- vprintf( text, args );
- va_end( args );
-}
-
-/**
- * Return last size bytes of log.
- */
-//bool log_fetch(char *buffer, int size);
-
-#endif /* LOG_H_ */
diff --git a/src/server/log.c b/src/shared/log.c
index 6d77dc5..6d77dc5 100644
--- a/src/server/log.c
+++ b/src/shared/log.c
diff --git a/src/server/log.h b/src/shared/log.h
index f273cab..f273cab 100644
--- a/src/server/log.h
+++ b/src/shared/log.h
diff --git a/src/shared/sockhelper.c b/src/shared/sockhelper.c
index 0b7a1db..3748d38 100644
--- a/src/shared/sockhelper.c
+++ b/src/shared/sockhelper.c
@@ -1,5 +1,5 @@
#include "sockhelper.h"
-//#include "log.h"
+#include "log.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h> // inet_ntop
@@ -80,7 +80,7 @@ int sock_resolveToDnbd3Host(const char * const address, dnbd3_host_t * const des
// See if we have a port
snprintf( bufferAddr, sizeof bufferAddr, "%s", address );
- const char *c1, *c2;
+ char *c1, *c2;
c1 = strchr( addr, ':' );
if ( c1 != NULL ) {
c2 = strchr( c1 + 1, ':' );
@@ -93,8 +93,8 @@ int sock_resolveToDnbd3Host(const char * const address, dnbd3_host_t * const des
c1 = strchr( c2 + 1, ':' );
if ( c1 != NULL ) c2 = c1;
} while ( c1 != NULL );
- if ( c2[-1] == ']' ) {
- c2[-1] = '\0';
+ if ( *(c2 - 1 ) == ']' ) {
+ *( c2 - 1 ) = '\0';
*c2 = '\0';
addr += 1;
portStr = c2 + 1;