[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-expunge.c,1.24,1.25 mbox-list.c,1.8,1.9 mbox-save.c,1.29,1.30 mbox-storage.c,1.29,1.30 mbox-storage.h,1.10,1.11

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 15:09:55 EET 2003


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory danu:/tmp/cvs-serv25916/src/lib-storage/index/mbox

Modified Files:
	mbox-expunge.c mbox-list.c mbox-save.c mbox-storage.c 
	mbox-storage.h 
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.



Index: mbox-expunge.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-expunge.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mbox-expunge.c	20 Dec 2002 07:53:52 -0000	1.24
+++ mbox-expunge.c	5 Jan 2003 13:09:53 -0000	1.25
@@ -10,8 +10,9 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-static int expunge_real(IndexMailbox *ibox, MailIndexRecord *rec,
-			unsigned int seq, IStream *input, OStream *output,
+static int expunge_real(struct index_mailbox *ibox,
+			struct mail_index_record *rec, unsigned int seq,
+			struct istream *input, struct ostream *output,
 			int notify)
 {
 	uoff_t offset, hdr_size, body_size;
@@ -101,11 +102,11 @@
 	return o_stream_send_istream(output, input) >= 0;
 }
 
-int mbox_expunge_locked(IndexMailbox *ibox, int notify)
+int mbox_expunge_locked(struct index_mailbox *ibox, int notify)
 {
-	MailIndexRecord *rec;
-	IStream *input;
-	OStream *output;
+	struct mail_index_record *rec;
+	struct istream *input;
+	struct ostream *output;
 	unsigned int seq;
 	int failed;
 
@@ -118,7 +119,7 @@
 	}
 
 	/* mbox must be already opened, synced and locked at this point.
-	   we just want the IStream. */
+	   we just want the istream. */
 	input = mbox_get_stream(ibox->index, 0, MAIL_LOCK_EXCLUSIVE);
 	if (input == NULL)
 		return FALSE;

Index: mbox-list.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-list.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mbox-list.c	20 Dec 2002 07:53:52 -0000	1.8
+++ mbox-list.c	5 Jan 2003 13:09:53 -0000	1.9
@@ -10,12 +10,13 @@
 #include <dirent.h>
 #include <sys/stat.h>
 
-typedef struct {
+struct find_subscribed_context {
 	MailboxFunc func;
 	void *context;
-} FindSubscribedContext;
+};
 
-static int mbox_find_path(MailStorage *storage, ImapMatchGlob *glob,
+static int mbox_find_path(struct mail_storage *storage,
+			  struct imap_match_glob *glob,
 			  MailboxFunc func, void *context,
 			  const char *relative_dir)
 {
@@ -146,10 +147,10 @@
 	return last_dir != NULL ? t_strdup_until(mask, last_dir) : NULL;
 }
 
-int mbox_find_mailboxes(MailStorage *storage, const char *mask,
+int mbox_find_mailboxes(struct mail_storage *storage, const char *mask,
 			MailboxFunc func, void *context)
 {
-	ImapMatchGlob *glob;
+	struct imap_match_glob *glob;
 	const char *relative_dir;
 
 	/* check that we're not trying to do any "../../" lists */
@@ -176,11 +177,11 @@
 	return TRUE;
 }
 
-static int mbox_subs_func(MailStorage *storage, const char *name,
+static int mbox_subs_func(struct mail_storage *storage, const char *name,
 			  void *context)
 {
-	FindSubscribedContext *ctx = context;
-	MailboxFlags flags;
+	struct find_subscribed_context *ctx = context;
+	enum mailbox_flags flags;
 	struct stat st;
 	char path[PATH_MAX];
 
@@ -198,10 +199,10 @@
 	return TRUE;
 }
 
-int mbox_find_subscribed(MailStorage *storage, const char *mask,
+int mbox_find_subscribed(struct mail_storage *storage, const char *mask,
 			 MailboxFunc func, void *context)
 {
-	FindSubscribedContext ctx;
+	struct find_subscribed_context ctx;
 
 	ctx.func = func;
 	ctx.context = context;

Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mbox-save.c	20 Dec 2002 07:53:52 -0000	1.29
+++ mbox-save.c	5 Jan 2003 13:09:53 -0000	1.30
@@ -16,7 +16,7 @@
 
 static char my_hostdomain[256] = "";
 
-static int write_error(MailStorage *storage, const char *mbox_path)
+static int write_error(struct mail_storage *storage, const char *mbox_path)
 {
 	if (errno == ENOSPC)
 		mail_storage_set_error(storage, "Not enough disk space");
@@ -28,7 +28,7 @@
 	return FALSE;
 }
 
-static int mbox_seek_to_end(MailStorage *storage, int fd,
+static int mbox_seek_to_end(struct mail_storage *storage, int fd,
 			    const char *mbox_path, off_t *pos)
 {
 	struct stat st;
@@ -65,7 +65,7 @@
 	return TRUE;
 }
 
-static int mbox_append_lf(MailStorage *storage, OStream *output,
+static int mbox_append_lf(struct mail_storage *storage, struct ostream *output,
 			  const char *mbox_path)
 {
 	if (o_stream_send(output, "\n", 1) < 0)
@@ -74,7 +74,7 @@
 	return TRUE;
 }
 
-static int write_from_line(MailStorage *storage, OStream *output,
+static int write_from_line(struct mail_storage *storage, struct ostream *output,
 			   const char *mbox_path, time_t internal_date)
 {
 	const char *sender, *line, *name;
@@ -105,9 +105,9 @@
 	return TRUE;
 }
 
-static int write_flags(MailStorage *storage, OStream *output,
+static int write_flags(struct mail_storage *storage, struct ostream *output,
 		       const char *mbox_path,
-		       MailFlags flags, const char *custom_flags[])
+		       enum mail_flags flags, const char *custom_flags[])
 {
 	const char *str;
 	unsigned int field;
@@ -156,15 +156,16 @@
 	return TRUE;
 }
 
-int mbox_storage_save(Mailbox *box, MailFlags flags, const char *custom_flags[],
-		      time_t internal_date, int timezone_offset __attr_unused__,
-		      IStream *data, uoff_t data_size)
+int mbox_storage_save(struct mailbox *box, enum mail_flags flags,
+		      const char *custom_flags[], time_t internal_date,
+		      int timezone_offset __attr_unused__,
+		      struct istream *data, uoff_t data_size)
 {
-	IndexMailbox *ibox = (IndexMailbox *) box;
-	MailIndex *index;
-	MailFlags real_flags;
+	struct index_mailbox *ibox = (struct index_mailbox *) box;
+	struct mail_index *index;
+	enum mail_flags real_flags;
 	const char *mbox_path;
-	OStream *output;
+	struct ostream *output;
 	int failed;
 	off_t pos;
 

Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mbox-storage.c	2 Jan 2003 13:01:52 -0000	1.29
+++ mbox-storage.c	5 Jan 2003 13:09:53 -0000	1.30
@@ -16,8 +16,8 @@
 
 #define CREATE_MODE 0770 /* umask() should limit it more */
 
-extern MailStorage mbox_storage;
-extern Mailbox mbox_mailbox;
+extern struct mail_storage mbox_storage;
+extern struct mailbox mbox_mailbox;
 
 static int mkdir_parents(const char *path)
 {
@@ -98,9 +98,9 @@
 	return NULL;
 }
 
-static MailStorage *mbox_create(const char *data, const char *user)
+static struct mail_storage *mbox_create(const char *data, const char *user)
 {
-	MailStorage *storage;
+	struct mail_storage *storage;
 	const char *root_dir, *inbox_file, *index_dir, *p;
 	struct stat st;
 
@@ -148,18 +148,18 @@
 	if (index_dir == NULL)
 		index_dir = root_dir;
 
-	storage = i_new(MailStorage, 1);
-	memcpy(storage, &mbox_storage, sizeof(MailStorage));
+	storage = i_new(struct mail_storage, 1);
+	memcpy(storage, &mbox_storage, sizeof(struct mail_storage));
 
 	storage->dir = i_strdup(root_dir);
 	storage->inbox_file = i_strdup(inbox_file);
 	storage->index_dir = i_strdup(index_dir);
 	storage->user = i_strdup(user);
-	storage->callbacks = i_new(MailStorageCallbacks, 1);
+	storage->callbacks = i_new(struct mail_storage_callbacks, 1);
 	return storage;
 }
 
-static void mbox_free(MailStorage *storage)
+static void mbox_free(struct mail_storage *storage)
 {
 	i_free(storage->dir);
 	i_free(storage->inbox_file);
@@ -187,7 +187,7 @@
 	return TRUE;
 }
 
-static int mbox_is_valid_name(MailStorage *storage, const char *name)
+static int mbox_is_valid_name(struct mail_storage *storage, const char *name)
 {
 	return name[0] != '\0' && name[0] != storage->hierarchy_sep &&
 		name[strlen(name)-1] != storage->hierarchy_sep &&
@@ -195,7 +195,8 @@
 		mbox_is_valid_mask(name);
 }
 
-static const char *mbox_get_index_dir(MailStorage *storage, const char *name)
+static const char *mbox_get_index_dir(struct mail_storage *storage,
+				      const char *name)
 {
 	const char *p;
 
@@ -208,8 +209,8 @@
 	}
 }
 
-static int create_mbox_index_dirs(MailStorage *storage, const char *name,
-				  int verify)
+static int create_mbox_index_dirs(struct mail_storage *storage,
+				  const char *name, int verify)
 {
 	const char *index_dir, *imap_dir;
 
@@ -224,7 +225,7 @@
 	return TRUE;
 }
 
-static void verify_inbox(MailStorage *storage)
+static void verify_inbox(struct mail_storage *storage)
 {
 	int fd;
 
@@ -237,7 +238,7 @@
 	(void)create_mbox_index_dirs(storage, "INBOX", TRUE);
 }
 
-static const char *mbox_get_path(MailStorage *storage, const char *name)
+static const char *mbox_get_path(struct mail_storage *storage, const char *name)
 {
 	if (strcasecmp(name, "INBOX") == 0)
 		return storage->inbox_file;
@@ -245,11 +246,11 @@
 		return t_strconcat(storage->dir, "/", name, NULL);
 }
 
-static Mailbox *mbox_open(MailStorage *storage, const char *name,
-			  int readonly, int fast)
+static struct mailbox *mbox_open(struct mail_storage *storage, const char *name,
+				 int readonly, int fast)
 {
-	IndexMailbox *ibox;
-	MailIndex *index;
+	struct index_mailbox *ibox;
+	struct mail_index *index;
 	const char *path, *index_dir;
 
 	if (strcasecmp(name, "INBOX") == 0) {
@@ -278,11 +279,12 @@
 		ibox->expunge_locked = mbox_expunge_locked;
 		index_mailbox_check_add(ibox, index->mailbox_path);
 	}
-	return (Mailbox *) ibox;
+	return (struct mailbox *) ibox;
 }
 
-static Mailbox *mbox_open_mailbox(MailStorage *storage, const char *name,
-				  int readonly, int fast)
+static struct mailbox *
+mbox_open_mailbox(struct mail_storage *storage,
+		  const char *name, int readonly, int fast)
 {
 	const char *path;
 	struct stat st;
@@ -324,7 +326,7 @@
 	}
 }
 
-static int mbox_create_mailbox(MailStorage *storage, const char *name)
+static int mbox_create_mailbox(struct mail_storage *storage, const char *name)
 {
 	const char *path, *p;
 	struct stat st;
@@ -364,8 +366,8 @@
 	if (p != NULL) {
 		if (mkdir_parents(t_strdup_until(path, p)) < 0) {
 			mail_storage_set_critical(storage,
-						  "mkdir_parents() failed for mbox path "
-						  "%s: %m", path);
+				"mkdir_parents() failed for mbox path %s: %m",
+				path);
 			return FALSE;
 		}
 	}
@@ -386,7 +388,7 @@
 	}
 }
 
-static int mbox_delete_mailbox(MailStorage *storage, const char *name)
+static int mbox_delete_mailbox(struct mail_storage *storage, const char *name)
 {
 	const char *index_dir, *path;
 	struct stat st;
@@ -456,8 +458,8 @@
 	return TRUE;
 }
 
-static int mbox_rename_mailbox(MailStorage *storage, const char *oldname,
-			       const char *newname)
+static int mbox_rename_mailbox(struct mail_storage *storage,
+			       const char *oldname, const char *newname)
 {
 	const char *oldpath, *newpath, *old_indexdir, *new_indexdir, *p;
 
@@ -508,8 +510,9 @@
 	return TRUE;
 }
 
-static int mbox_get_mailbox_name_status(MailStorage *storage, const char *name,
-					MailboxNameStatus *status)
+static int mbox_get_mailbox_name_status(struct mail_storage *storage,
+					const char *name,
+					enum mailbox_name_status *status)
 {
 	struct stat st;
 	const char *path;
@@ -541,9 +544,9 @@
 	}
 }
 
-static int mbox_storage_close(Mailbox *box)
+static int mbox_storage_close(struct mailbox *box)
 {
-	IndexMailbox *ibox = (IndexMailbox *) box;
+	struct index_mailbox *ibox = (struct index_mailbox *) box;
 	int failed = FALSE;
 
 	/* update flags by rewrite mbox file */
@@ -555,7 +558,7 @@
 	return index_storage_close(box) && !failed;
 }
 
-MailStorage mbox_storage = {
+struct mail_storage mbox_storage = {
 	"mbox", /* name */
 
 	'/', /* hierarchy_sep - can't be changed */
@@ -584,7 +587,7 @@
 	0
 };
 
-Mailbox mbox_mailbox = {
+struct mailbox mbox_mailbox = {
 	NULL, /* name */
 	NULL, /* storage */
 

Index: mbox-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mbox-storage.h	6 Dec 2002 01:09:23 -0000	1.10
+++ mbox-storage.h	5 Jan 2003 13:09:53 -0000	1.11
@@ -3,18 +3,19 @@
 
 #include "index-storage.h"
 
-int mbox_storage_copy(Mailbox *box, Mailbox *destbox,
+int mbox_storage_copy(struct mailbox *box, struct mailbox *destbox,
 		      const char *messageset, int uidset);
-int mbox_storage_save(Mailbox *box, MailFlags flags, const char *custom_flags[],
-		      time_t internal_date, int timezone_offset,
-		      IStream *data, uoff_t data_size);
+int mbox_storage_save(struct mailbox *box, enum mail_flags flags,
+		      const char *custom_flags[], time_t internal_date,
+		      int timezone_offset,
+		      struct istream *data, uoff_t data_size);
 
-int mbox_find_mailboxes(MailStorage *storage, const char *mask,
+int mbox_find_mailboxes(struct mail_storage *storage, const char *mask,
 			MailboxFunc func, void *context);
-int mbox_find_subscribed(MailStorage *storage, const char *mask,
+int mbox_find_subscribed(struct mail_storage *storage, const char *mask,
 			 MailboxFunc func, void *context);
 
-int mbox_expunge_locked(IndexMailbox *ibox, int notify);
+int mbox_expunge_locked(struct index_mailbox *ibox, int notify);
 
 int mbox_is_valid_mask(const char *mask);
 




More information about the dovecot-cvs mailing list