[Box Backup-dev] COMMIT r575 - in box/chris/general: . lib/common lib/raidfile lib/win32 test/raidfile

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat May 20 19:58:53 BST 2006


Author: chris
Date: 2006-05-20 18:58:21 +0000 (Sat, 20 May 2006)
New Revision: 575

Modified:
   box/chris/general/configure.ac
   box/chris/general/lib/common/BoxPlatform.h
   box/chris/general/lib/raidfile/RaidFileRead.cpp
   box/chris/general/lib/raidfile/RaidFileWrite.cpp
   box/chris/general/lib/win32/emu.cpp
   box/chris/general/lib/win32/emu.h
   box/chris/general/modules.txt
   box/chris/general/test/raidfile/intercept.cpp
   box/chris/general/test/raidfile/testraidfile.cpp
Log:
* test/raidfile/testraidfile.cpp
* test/raidfile/intercept.cpp
* modules.txt
* configure.ac
* lib/raidfile/RaidFileWrite.cpp
* lib/raidfile/RaidFileRead.cpp
* lib/win32/emu.cpp
* lib/win32/emu.h
* lib/common/BoxPlatform.h
- Made raidfile and tests compile on Win32


Modified: box/chris/general/configure.ac
===================================================================
--- box/chris/general/configure.ac	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/configure.ac	2006-05-20 18:58:21 UTC (rev 575)
@@ -92,7 +92,7 @@
 AC_CHECK_HEADERS([syslog.h time.h])
 AC_CHECK_HEADERS([netinet/in.h])
 AC_CHECK_HEADERS([sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h])
-AC_CHECK_HEADERS([sys/xattr.h])
+AC_CHECK_HEADERS([sys/uio.h sys/xattr.h])
 
 AC_CHECK_HEADER([regex.h], [have_regex_h=yes])
 

Modified: box/chris/general/lib/common/BoxPlatform.h
===================================================================
--- box/chris/general/lib/common/BoxPlatform.h	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/lib/common/BoxPlatform.h	2006-05-20 18:58:21 UTC (rev 575)
@@ -41,7 +41,7 @@
 #endif
 
 // Slight hack; disable interception on Darwin within raidfile test
-#ifdef __APPLE__
+#if defined __APPLE__ || defined WIN32
 	// TODO: Replace with autoconf test
 	#define PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 #endif

Modified: box/chris/general/lib/raidfile/RaidFileRead.cpp
===================================================================
--- box/chris/general/lib/raidfile/RaidFileRead.cpp	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/lib/raidfile/RaidFileRead.cpp	2006-05-20 18:58:21 UTC (rev 575)
@@ -14,10 +14,20 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/stat.h>
+
+#ifdef HAVE_SYS_UIO_H
 #include <sys/uio.h>
+#endif
+
+#ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#endif
+
 #include <stdarg.h>
+
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>

Modified: box/chris/general/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/chris/general/lib/raidfile/RaidFileWrite.cpp	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/lib/raidfile/RaidFileWrite.cpp	2006-05-20 18:58:21 UTC (rev 575)
@@ -115,7 +115,7 @@
 #ifdef HAVE_FLOCK
 	int errnoBlock = EWOULDBLOCK;
 	if(::flock(mOSFileHandle, LOCK_EX | LOCK_NB) != 0)
-#else
+#elif HAVE_DECL_F_SETLK
 	int errnoBlock = EAGAIN;
 	struct flock desc;
 	desc.l_type = F_WRLCK;
@@ -123,6 +123,9 @@
 	desc.l_start = 0;
 	desc.l_len = 0;
 	if(::fcntl(mOSFileHandle, F_SETLK, &desc) != 0)
+#else
+	int errnoBlock = ENOSYS;
+	if (0)
 #endif
 	{
 		// Lock was not obtained.

Modified: box/chris/general/lib/win32/emu.cpp
===================================================================
--- box/chris/general/lib/win32/emu.cpp	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/lib/win32/emu.cpp	2006-05-20 18:58:21 UTC (rev 575)
@@ -1374,4 +1374,40 @@
 	return strlen(pBuffer);
 }
 
+int readv (int filedes, const struct iovec *vector, size_t count)
+{
+	int bytes = 0;
+	
+	for (int i = 0; i < count; i++)
+	{
+		int result = read(filedes, vector[i].iov_base, 
+			vector[i].iov_len);
+		if (result < 0)
+		{
+			return result;
+		}
+		bytes += result;
+	}
+
+	return bytes;
+}
+
+int writev(int filedes, const struct iovec *vector, size_t count)
+{
+	int bytes = 0;
+	
+	for (int i = 0; i < count; i++)
+	{
+		int result = write(filedes, vector[i].iov_base, 
+			vector[i].iov_len);
+		if (result < 0)
+		{
+			return result;
+		}
+		bytes += result;
+	}
+
+	return bytes;
+}
+
 #endif // WIN32

Modified: box/chris/general/lib/win32/emu.h
===================================================================
--- box/chris/general/lib/win32/emu.h	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/lib/win32/emu.h	2006-05-20 18:58:21 UTC (rev 575)
@@ -278,6 +278,7 @@
 #define LOG_WARNING 4
 #define LOG_ERR 3
 #define LOG_PID 0
+#define LOG_LOCAL5 0
 #define LOG_LOCAL6 0
 
 void openlog (const char * daemonName, int, int);
@@ -409,4 +410,12 @@
 // replacement for _cgetws which requires a relatively recent C runtime lib
 int console_read(char* pBuffer, size_t BufferSize);
 
+struct iovec {
+	void *iov_base;   /* Starting address */
+	size_t iov_len;   /* Number of bytes */
+};
+
+int readv (int filedes, const struct iovec *vector, size_t count);
+int writev(int filedes, const struct iovec *vector, size_t count);
+
 #endif // !EMU_INCLUDE && WIN32

Modified: box/chris/general/modules.txt
===================================================================
--- box/chris/general/modules.txt	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/modules.txt	2006-05-20 18:58:21 UTC (rev 575)
@@ -9,10 +9,8 @@
 
 # Generic support code and modules
 
-OMIT:mingw32
-OMIT:mingw32msvc
 OMIT:CYGWIN
-lib/raidfile
+lib/raidfile		lib/win32
 END-OMIT
 
 lib/crypto
@@ -26,8 +24,10 @@
 OMIT:mingw32
 OMIT:mingw32msvc
 test/basicserver	lib/server	lib/win32
+END-OMIT
+
 OMIT:CYGWIN
-test/raidfile		lib/raidfile
+test/raidfile		lib/raidfile	lib/win32
 END-OMIT
 
 # IF_DISTRIBUTION(boxbackup)

Modified: box/chris/general/test/raidfile/intercept.cpp
===================================================================
--- box/chris/general/test/raidfile/intercept.cpp	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/test/raidfile/intercept.cpp	2006-05-20 18:58:21 UTC (rev 575)
@@ -14,7 +14,11 @@
 #endif
 #include <sys/types.h>
 #include <unistd.h>
+
+#ifdef HAVE_SYS_UIO_H
 #include <sys/uio.h>
+#endif
+
 #include <errno.h>
 
 #ifndef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE

Modified: box/chris/general/test/raidfile/testraidfile.cpp
===================================================================
--- box/chris/general/test/raidfile/testraidfile.cpp	2006-05-20 18:10:38 UTC (rev 574)
+++ box/chris/general/test/raidfile/testraidfile.cpp	2006-05-20 18:58:21 UTC (rev 575)
@@ -12,7 +12,10 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
+
+#ifdef HAVE_SYSCALL
 #include <sys/syscall.h>
+#endif
 
 #include <string.h>
 




More information about the Boxbackup-dev mailing list