diff options
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/src/wydawca.h b/src/wydawca.h index 5de1f3e..722fc9b 100644 --- a/src/wydawca.h +++ b/src/wydawca.h @@ -205,6 +205,7 @@ struct file_triplet struct virt_tab { + const char *(*get_path) (struct spool *sp); int (*test_url) (mu_url_t url, grecs_locus_t *loc); int (*move_file) (struct file_triplet *trp, enum file_type file_id); int (*archive_file) (struct file_triplet *trp, const char *file_name); @@ -229,6 +230,7 @@ struct spool time_t file_sweep_time; /* Remove invalid/unprocessed files after this amount of time */ struct dictionary *dictionary[dictionary_count]; + int dict_inited; struct archive_descr archive; /* Archivation data */ struct notification *notification; char *check_script; @@ -372,6 +374,9 @@ extern char *temp_homedir; extern unsigned min_directive_version; extern unsigned max_directive_version; +extern struct spool fake_spool; +extern struct spool inotify_spool; + #define UPDATE_STATS(what) \ do \ { \ @@ -409,19 +414,31 @@ enum exec_result wydawca_exec (int argc, const char **argv, int *retcode); /* Directory scanning and registering */ -int scan_spool (const struct spool *spool, int uc, uid_t *uv); +int scan_spool (struct spool *spool, int uc, uid_t *uv); int scan_all_spools (int, uid_t *); void spool_create_timers (void); +int spool_add_new_file (const struct spool *spool, const char *name, + int uc, uid_t *uv); +int spool_cwd_add_new_file (const struct spool *spool, const char *name, + int uc, uid_t *uv); +int spool_open_dictionaries (struct spool *spool); +void spool_close_dictionaries (struct spool *spool); + +int for_each_spool (int (*fun) (struct spool *, void *), void *data); void register_spool (struct spool *spool); struct spool *wydawca_find_spool (const char *name); void register_file (struct file_info *finfo, const struct spool *spool); -void enumerate_triplets (const struct spool *); +void spool_commit_triplets (struct spool *); size_t count_collected_triplets (void); +size_t count_processable_triplets (void); + char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); char *triplet_expand_dictionary_query (struct dictionary *dict, void *handle, struct file_triplet *trp); +void triplet_remove_file (struct spool *spool, const char *name); + /* General-purpose dictionary support */ struct dictionary *dictionary_new (enum dictionary_id id, enum dictionary_type type); @@ -442,7 +459,7 @@ unsigned dictionary_num_rows (struct dictionary *dict); unsigned dictionary_num_cols (struct dictionary *dict); /* Verification functions */ -int verify_directive_file (struct file_triplet *trp); +int verify_directive_file (struct file_triplet *trp, int noath); int verify_directive_signature (struct file_triplet *trp); int verify_detached_signature (struct file_triplet *trp); int fill_project_name (struct file_triplet *trp); @@ -485,21 +502,19 @@ int assert_string_arg (grecs_locus_t *, enum grecs_callback_command, /* vtab.c */ int url_to_vtab (mu_url_t url, struct virt_tab *vtab); -int -move_file (struct file_triplet *trp, enum file_type file_id); -int -archive_file (struct file_triplet *trp, const char *file_name); -int -symlink_file (struct file_triplet *trp, - const char *wanted_src, const char *wanted_dst); -int -rmsymlink_file (struct file_triplet *trp, const char *file_name); +const char *get_path (struct spool *sp); +int move_file (struct file_triplet *trp, enum file_type file_id); +int archive_file (struct file_triplet *trp, const char *file_name); +int symlink_file (struct file_triplet *trp, + const char *wanted_src, const char *wanted_dst); +int rmsymlink_file (struct file_triplet *trp, const char *file_name); /* diskio.c */ char *concat_dir (const char *base, const char *name, size_t *pbaselen); int copy_file (const char *file, const char *dst_file); +const char *dir_get_path (struct spool *sp); int dir_test_url (mu_url_t url, grecs_locus_t *locus); int dir_move_file (struct file_triplet *trp, enum file_type file_id); int dir_archive_file (struct file_triplet *trp, const char *reldir); @@ -538,7 +553,7 @@ extern char *report_string; /* job.c */ -void schedule_job (const struct spool *spool, uid_t uid); +void schedule_job (struct spool *spool, uid_t uid); void job_init (void); void job_queue_runner (void); @@ -588,3 +603,11 @@ void txtacc_grow (struct txtacc *acc, const char *buf, size_t size); } \ while (0) char *txtacc_finish (struct txtacc *acc, int steal); + +#ifdef WITH_INOTIFY +int watcher_init (void); +int watcher_run (int); +#else +# define watcher_init() -1 +# define watcher_run(c) +#endif |