<commit_before>#ifndef __INDEX_STORAGE_H
#define __INDEX_STORAGE_H

#include "file-dotlock.h"
#include "mail-storage-private.h"
#include "mail-index.h"
#include "index-mail.h"

/* Max. mmap()ed size for a message */
#define MAIL_MMAP_BLOCK_SIZE (1024*256)
/* Block size when read()ing message. */
#define MAIL_READ_BLOCK_SIZE (1024*8)

#define MAILBOX_FULL_SYNC_INTERVAL 5

enum mailbox_lock_notify_type {
	MAILBOX_LOCK_NOTIFY_NONE,

	/* Mailbox is locked, will abort in secs_left */
	MAILBOX_LOCK_NOTIFY_MAILBOX_ABORT,
	/* Mailbox lock looks stale, will override in secs_left */
	MAILBOX_LOCK_NOTIFY_MAILBOX_OVERRIDE
};

struct index_autosync_file {
	struct index_autosync_file *next;

	char *path;
	time_t last_stamp;
};

struct index_autosync_io {
	struct index_autosync_io *next;
	struct io *io;
	int fd;
};

struct index_storage {
	struct mail_storage storage;

	char *dir; /* root directory */
	char *index_dir;
	char *control_dir;
	char *inbox_path; /* INBOX location */
        char *temp_prefix; /* prefix for temporary files */

	char *user; /* name of user accessing the storage */

	struct mail_storage_callbacks *callbacks;
	void *callback_context;
};

struct index_mailbox {
	struct mailbox box;
	struct index_storage *storage;
	char *path, *control_dir;

	struct mail_index *index;
	struct mail_index_view *view;
	struct mail_cache *cache;
	struct mail_cache_view *cache_view;
	struct mail *mail_interface;

	uint32_t (*get_recent_count)(struct index_mailbox *ibox);
	void (*mail_deinit)(struct index_mail *mail);
	unsigned int last_recent_count;

	struct timeout *autosync_to;
	struct index_autosync_file *autosync_files;
        struct index_autosync_io *autosync_ios;
	enum mailbox_sync_flags autosync_flags;
	time_t sync_last_check, sync_last_notify;
	unsigned int min_newmail_notify_interval;

	time_t next_lock_notify; /* temporary */
	enum mailbox_lock_notify_type last_notify_type;

	uint32_t commit_log_file_seq;
	uoff_t commit_log_file_offset;

	/* mbox: */
	int mbox_fd;
	struct istream *mbox_stream, *mbox_file_stream;
	int mbox_lock_type;
	dev_t mbox_dev;
	ino_t mbox_ino;
	unsigned int mbox_locks;
	struct dotlock mbox_dotlock;
	unsigned int mbox_lock_id, mbox_mail_lock_id;
	int mbox_readonly;

	uint32_t mbox_extra_idx;

	/* maildir sync: */
	struct maildir_uidlist *uidlist;
	time_t last_new_mtime, last_cur_mtime, last_new_sync_time;
	time_t dirty_cur_time;

        mode_t mail_create_mode;
	unsigned int private_flags_mask;

	unsigned int readonly:1;
	unsigned int keep_recent:1;
	unsigned int sent_diskspace_warning:1;
	unsigned int sent_readonly_flags_warning:1;
	unsigned int autosync_pending:1;
	unsigned int mail_read_mmaped:1;
	unsigned int last_recent_count_initialized:1;
};
<commit_msg>continuing maildir sync fix commit<commit_after>#ifndef __INDEX_STORAGE_H
#define __INDEX_STORAGE_H

#include "file-dotlock.h"
#include "mail-storage-private.h"
#include "mail-index.h"
#include "index-mail.h"

/* Max. mmap()ed size for a message */
#define MAIL_MMAP_BLOCK_SIZE (1024*256)
/* Block size when read()ing message. */
#define MAIL_READ_BLOCK_SIZE (1024*8)

#define MAILBOX_FULL_SYNC_INTERVAL 5

enum mailbox_lock_notify_type {
	MAILBOX_LOCK_NOTIFY_NONE,

	/* Mailbox is locked, will abort in secs_left */
	MAILBOX_LOCK_NOTIFY_MAILBOX_ABORT,
	/* Mailbox lock looks stale, will override in secs_left */
	MAILBOX_LOCK_NOTIFY_MAILBOX_OVERRIDE
};

struct index_autosync_file {
	struct index_autosync_file *next;

	char *path;
	time_t last_stamp;
};

struct index_autosync_io {
	struct index_autosync_io *next;
	struct io *io;
	int fd;
};

struct index_storage {
	struct mail_storage storage;

	char *dir; /* root directory */
	char *index_dir;
	char *control_dir;
	char *inbox_path; /* INBOX location */
        char *temp_prefix; /* prefix for temporary files */

	char *user; /* name of user accessing the storage */

	struct mail_storage_callbacks *callbacks;
	void *callback_context;
};

struct index_mailbox {
	struct mailbox box;
	struct index_storage *storage;
	char *path, *control_dir;

	struct mail_index *index;
	struct mail_index_view *view;
	struct mail_cache *cache;
	struct mail_cache_view *cache_view;
	struct mail *mail_interface;

	uint32_t (*get_recent_count)(struct index_mailbox *ibox);
	void (*mail_deinit)(struct index_mail *mail);
	unsigned int last_recent_count;

	struct timeout *autosync_to;
	struct index_autosync_file *autosync_files;
        struct index_autosync_io *autosync_ios;
	enum mailbox_sync_flags autosync_flags;
	time_t sync_last_check, sync_last_notify;
	unsigned int min_newmail_notify_interval;

	time_t next_lock_notify; /* temporary */
	enum mailbox_lock_notify_type last_notify_type;

	uint32_t commit_log_file_seq;
	uoff_t commit_log_file_offset;

	/* mbox: */
	int mbox_fd;
	struct istream *mbox_stream, *mbox_file_stream;
	int mbox_lock_type;
	dev_t mbox_dev;
	ino_t mbox_ino;
	unsigned int mbox_locks;
	struct dotlock mbox_dotlock;
	unsigned int mbox_lock_id, mbox_mail_lock_id;
	int mbox_readonly;

	uint32_t mbox_extra_idx;

	/* maildir sync: */
	struct maildir_uidlist *uidlist;
	time_t last_new_mtime, last_cur_mtime, last_new_sync_time;
	time_t dirty_cur_time;

        mode_t mail_create_mode;
	unsigned int private_flags_mask;

	unsigned int readonly:1;
	unsigned int keep_recent:1;
	unsigned int sent_diskspace_warning:1;
	unsigned int sent_readonly_flags_warning:1;
	unsigned int autosync_pending:1;
	unsigned int mail_read_mmaped:1;
	unsigned int last_recent_count_initialized:1;
	unsigned int syncing_commit:1;
};

{'fraction_non_alphanumeric': 0.07836023943406493, 'fraction_numerical': 0.009613640486123707, 'mean_word_length': 5.651387213510254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4025848', 'n_tokens_mistral': 2084, 'n_tokens_neox': 2023, 'n_words': 479}