[vhffs-dev] [1288] Code cleaning, nothing more.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1288
Author:   gradator
Date:     2008-10-15 23:39:32 +0200 (Wed, 15 Oct 2008)

Log Message:
-----------
Code cleaning, nothing more.

Modified Paths:
--------------
    trunk/vhffs-fssync/vhffsfssync_master.c
    trunk/vhffs-fssync/vhffsfssync_slave.c


Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c	2008-10-15 20:59:19 UTC (rev 1287)
+++ trunk/vhffs-fssync/vhffsfssync_master.c	2008-10-15 21:39:32 UTC (rev 1288)
@@ -1,3 +1,7 @@
+#ifndef __linux__
+#error This software is only running on Linux-based OS, bye!
+#endif
+
 #define _FILE_OFFSET_BITS 64
 
 #define DEBUG_NET 0
@@ -29,8 +33,9 @@
 /* -- inotify stuff -- */
 
 #define VHFFSFSSYNC_BUF_LEN 4096
-#define VHFFSFSSYNC_WATCH_MASK IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MODIFY|IN_MOVE_SELF|IN_MOVED_FROM|IN_MOVED_TO|IN_DONT_FOLLOW|IN_ONLYDIR
-// Not used: IN_ACCESS, IN_CLOSE_NOWRITE, IN_OPEN
+#define VHFFSFSSYNC_WATCH_MASK IN_CREATE|IN_DELETE|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_DONT_FOLLOW|IN_ONLYDIR
+// Not used yet: IN_ATTRIB, IN_DELETE_SELF, IN_MODIFY, IN_MOVE_SELF
+// Will never be used: IN_ACCESS, IN_OPEN, IN_CLOSE_NOWRITE
 
 // the maximum number of files simultaneously opened
 // huge values offer better performance
@@ -125,7 +130,7 @@
 
 typedef struct {
 	__VHFFSFSSYNC_NET_MESSAGE_COMMON(msg_);
-	char msg_data[200];
+	char msg_data[32];
 } vhffsfssync_net_message;
 
 /* message - common data */
@@ -1054,7 +1059,6 @@
 			//printf("%s\n", path);
 
 			// we can cancel the recursion here at anytime
-//			if( rand() < (RAND_MAX/10)*7 ) {
  			if(conn->messages_num < 10 && conn->fullviewtimerset > 0) {
 				// do nothing, this is here because it matchs most of the time
 			}
@@ -1103,9 +1107,12 @@
 		conn->fullviewtree = g_list_delete_link(conn->fullviewtree, g_list_last(conn->fullviewtree) );
 	}
 
-/*	if(!conn->fullviewtree)  {
-		printf("%ld: CLEAN UP SUCCESSFULL\n", time(NULL));
-	} */
+	if(!conn->fullviewtree)  {
+//		printf("%ld: CLEAN UP SUCCESSFULL\n", time(NULL));
+		conn->fullviewcur = NULL;
+		conn->fullviewtimerset = 0;
+		signal(SIGALRM, SIG_IGN);
+	}
 	return 0;
 }
 
@@ -1504,8 +1511,6 @@
 	uint16_t bindport;
 	struct sockaddr_in src;
 
-//	srand(time(NULL));
-
 	/* chdir() to the filesystem to monitor */
 	root = argv[1];
 	if(!root) return -1;
@@ -1596,7 +1601,6 @@
 		int max_fd = 0;
 		fd_set readfs;
 		fd_set writefs;
-		//struct timeval tv;
 		GList *conns;
 		int ret;
 
@@ -1632,10 +1636,6 @@
 			if(conn->fd > max_fd) max_fd = conn->fd;
 		}
 
-		//printf("%ld: SELECT\n", time(NULL));
-
-		//tv.tv_sec = 3600;
-		//tv.tv_usec = 0;
 		ret = select(max_fd + 1, &readfs, &writefs, NULL, NULL);
 		if(ret < 0)  {
 			switch(errno)  {

Modified: trunk/vhffs-fssync/vhffsfssync_slave.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_slave.c	2008-10-15 20:59:19 UTC (rev 1287)
+++ trunk/vhffs-fssync/vhffsfssync_slave.c	2008-10-15 21:39:32 UTC (rev 1288)
@@ -1,3 +1,8 @@
+
+#ifndef __linux__
+#error This software is only running on Linux-based OS, bye!
+#endif
+
 #define _FILE_OFFSET_BITS 64
 #define _ATFILE_SOURCE
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/