[dovecot-cvs] dovecot/src/lib-storage/index index-mailbox-check.c,
1.11, 1.12 index-storage.h, 1.94, 1.95
cras at dovecot.org
cras at dovecot.org
Mon Aug 15 00:54:26 EEST 2005
- Previous message: [dovecot-cvs] dovecot/src/lib ioloop-internal.h, 1.14,
1.15 ioloop-notify-dn.c, 1.6, 1.7 ioloop-notify-inotify.c, 1.4,
1.5 ioloop-notify-none.c, 1.3, 1.4 ioloop.c, 1.27,
1.28 ioloop.h, 1.11, 1.12
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir
maildir-storage.c, 1.103, 1.104 maildir-uidlist.c, 1.40, 1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv17029/lib-storage/index
Modified Files:
index-mailbox-check.c index-storage.h
Log Message:
New inotify code and notify API change. Patch by Johannes Berg
Index: index-mailbox-check.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mailbox-check.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- index-mailbox-check.c 19 Oct 2004 01:47:55 -0000 1.11
+++ index-mailbox-check.c 14 Aug 2005 21:54:24 -0000 1.12
@@ -19,7 +19,6 @@
struct index_notify_io {
struct index_notify_io *next;
struct io *io;
- int fd;
};
static void check_timeout(void *context)
@@ -70,42 +69,31 @@
}
void index_mailbox_check_add(struct index_mailbox *ibox,
- const char *path, int dir)
+ const char *path)
{
struct index_notify_file *file;
struct stat st;
struct io *io = NULL;
struct index_notify_io *aio;
- int fd;
- fd = open(path, O_RDONLY);
- if (fd >= 0) {
- io = io_add(fd, dir ? IO_DIR_NOTIFY : IO_FILE_NOTIFY,
- notify_callback, ibox);
- if (io != NULL) {
- aio = i_new(struct index_notify_io, 1);
- aio->io = io;
- aio->fd = fd;
- aio->next = ibox->notify_ios;
- ibox->notify_ios = aio;
- }
+ io = io_add_notify(path, notify_callback, ibox);
+ if (io != NULL) {
+ aio = i_new(struct index_notify_io, 1);
+ aio->io = io;
+ aio->next = ibox->notify_ios;
+ ibox->notify_ios = aio;
}
file = i_new(struct index_notify_file, 1);
file->path = i_strdup(path);
- if (fd < 0)
- file->last_stamp = stat(path, &st) < 0 ? 0 : st.st_mtime;
- else
- file->last_stamp = fstat(fd, &st) < 0 ? 0 : st.st_mtime;
-
- if (io == NULL) {
- /* we couldn't add it to notify list */
- (void)close(fd);
- }
+ file->last_stamp = stat(path, &st) < 0 ? 0 : st.st_mtime;
file->next = ibox->notify_files;
- ibox->notify_files = file;
+ ibox->notify_files = file;
+ /* we still add a timeout if we don't have one already,
+ * because we don't know what happens with [di]notify
+ * when the filesystem is remote (NFS, ...) */
if (ibox->notify_to == NULL)
ibox->notify_to = timeout_add(1000, check_timeout, ibox);
}
@@ -131,8 +119,6 @@
ibox->notify_ios = aio->next;
io_remove(aio->io);
- if (close(aio->fd) < 0)
- i_error("close(notify_io) failed: %m");
i_free(aio);
}
Index: index-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- index-storage.h 29 Jul 2005 08:43:05 -0000 1.94
+++ index-storage.h 14 Aug 2005 21:54:24 -0000 1.95
@@ -130,7 +130,7 @@
unsigned int index_storage_get_recent_count(struct mail_index_view *view);
void index_mailbox_check_add(struct index_mailbox *ibox,
- const char *path, int dir);
+ const char *path);
void index_mailbox_check_remove_all(struct index_mailbox *ibox);
struct mailbox_sync_context *
- Previous message: [dovecot-cvs] dovecot/src/lib ioloop-internal.h, 1.14,
1.15 ioloop-notify-dn.c, 1.6, 1.7 ioloop-notify-inotify.c, 1.4,
1.5 ioloop-notify-none.c, 1.3, 1.4 ioloop.c, 1.27,
1.28 ioloop.h, 1.11, 1.12
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir
maildir-storage.c, 1.103, 1.104 maildir-uidlist.c, 1.40, 1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list