if you happen to use inotify 0.21



As those of you "in the know" might know, I released inotify 0.21
yesterday to an amazing showing of solidarity and unity.

I did not, however, update Beagle for the new inotify interface, which
is subsequently different and altogether not the same as it was in 0.20,
due to changes and suggestions proffered by Mr Andrew Morton and
consequently breaking things named with esoteric acronyms, such as "ABI"
or "API".

I did this with reason and without malice.  Beagle is currently frozen
and I exercised judgment against instituting new inotify support in the
middle of the freeze and forcing everyone to upgrade to new kernels with
a nascent inotify version.

I think you all understand.

Some of you, however, for various rationalizations and motivations, may
upgrade to the new inotify.  I won't fault you for that.  Nor will I
question your raison d'etre.

In lieu, I attach a patch to make Beagle work with Inotify 0.21 and bid
thee all: Good Day.

	Robert Love

Updated Beagle to use the new Inotify interface.

 inotify-glue.c |   15 +++++++++------
 inotify.h      |    2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)

Index: inotify-glue.c
===================================================================
RCS file: /cvs/gnome/beagle/glue/inotify-glue.c,v
retrieving revision 1.18
diff -u -r1.18 inotify-glue.c
--- inotify-glue.c	12 Mar 2005 04:36:25 -0000	1.18
+++ inotify-glue.c	16 Mar 2005 20:56:53 -0000
@@ -85,20 +85,23 @@
 inotify_glue_watch (int fd, const char *filename, __u32 mask)
 {
 	struct inotify_watch_request iwr;
-	__s32 wd;
+	int file_fd, wd;
 
-	iwr.mask = mask;
-	iwr.name = strdup (filename);
-	if (!iwr.name) {
-		perror ("strdup");
+	file_fd = open (filename, O_RDONLY);
+	if (file_fd < 0) {
+		perror ("open");
 		return -1;
 	}
 
+	iwr.fd = file_fd;
+	iwr.mask = mask;
+
 	wd = ioctl (fd, INOTIFY_WATCH, &iwr);
 	if (wd < 0)
 		perror ("ioctl");
 
-	free (iwr.name);
+	if (close (file_fd))
+		perror ("close");
 
 	return wd;
 }
Index: inotify.h
===================================================================
RCS file: /cvs/gnome/beagle/glue/inotify.h,v
retrieving revision 1.10
diff -u -r1.10 inotify.h
--- inotify.h	7 Mar 2005 22:17:05 -0000	1.10
+++ inotify.h	16 Mar 2005 20:56:53 -0000
@@ -30,7 +30,7 @@
  * Pass to the inotify device via the INOTIFY_WATCH ioctl
  */
 struct inotify_watch_request {
-	char		*name;		/* filename name */
+	int		fd;		/* fd of filename to watch */
 	__u32		mask;		/* event mask */
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]