[vhffs-dev] [1379] improved vhffsfssync_manage_event_create(), delete sendfile argument , replaced by a check on the size of the file

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


Revision: 1379
Author:   gradator
Date:     2009-03-15 22:44:12 +0100 (Sun, 15 Mar 2009)

Log Message:
-----------
improved vhffsfssync_manage_event_create(), delete sendfile argument, replaced by a check on the size of the file

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


Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c	2009-03-15 21:22:17 UTC (rev 1378)
+++ trunk/vhffs-fssync/vhffsfssync_master.c	2009-03-15 21:44:12 UTC (rev 1379)
@@ -83,7 +83,7 @@
 int vhffsfssync_del_watch(int inotifyfd, const char *pathname, int wd);
 int vhffsfssync_add_watch_recursively(int inotifyfd, const char *pathname, uint32_t mask);
 int vhffsfssync_manage_event_remove(int inotifyfd, char *pathname);
-int vhffsfssync_manage_event_create(int inotifyfd, char *pathname, gboolean sendfile);
+int vhffsfssync_manage_event_create(int inotifyfd, char *pathname);
 int vhffsfssync_manage_event(int inotifyfd, struct inotify_event *event);
 int vhffsfssync_fake_events_recursively(int inotifyfd, char *pathname);
 
@@ -1283,7 +1283,7 @@
 }
 
 
-int vhffsfssync_manage_event_create(int inotifyfd, char *pathname, gboolean sendfile)  {
+int vhffsfssync_manage_event_create(int inotifyfd, char *pathname)  {
 	struct stat st;
 
 	if(! lstat(pathname, &st) )  {
@@ -1292,7 +1292,7 @@
 #if DEBUG_INOTIFY
 			printf("==> CREATE %s\n", pathname);
 #endif
-			if(!sendfile)  {
+			if(!st.st_size)  {
 				vhffsfssync_net_broadcast_event( g_strdup_printf("create%c%s%c", '\0', pathname, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
 			}
 			else {
@@ -1392,7 +1392,7 @@
 #if DEBUG_INOTIFY
 		printf("IN_CREATE\n");
 #endif
-		vhffsfssync_manage_event_create(inotifyfd, pathname, TRUE);
+		vhffsfssync_manage_event_create(inotifyfd, pathname);
 
 	// deleted file, directory or symlink
 	} else if( event->mask & IN_DELETE )  {
@@ -1466,7 +1466,7 @@
 			}
 			else {
 				vhffsfssync_manage_event_remove(inotifyfd, vhffsfssync_cookie.from);
-				vhffsfssync_manage_event_create(inotifyfd, pathname, TRUE);
+				vhffsfssync_manage_event_create(inotifyfd, pathname);
 			}
 
 			vhffsfssync_cookie.id = 0;
@@ -1474,7 +1474,7 @@
 		}
 		// create
 		else  {
-			vhffsfssync_manage_event_create(inotifyfd, pathname, TRUE);
+			vhffsfssync_manage_event_create(inotifyfd, pathname);
 		}
 
 	// watch deleted, clean it
@@ -1509,7 +1509,7 @@
 
 				// recursivity is done through vhffsfssync_manage_event_create()
 				// which calls this function
-				vhffsfssync_manage_event_create(inotifyfd, path, TRUE);
+				vhffsfssync_manage_event_create(inotifyfd, path);
 				free(path);
 			}
 		}


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