aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wydawca.h')
-rw-r--r--src/wydawca.h47
1 files changed, 35 insertions, 12 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
205 205
206struct virt_tab 206struct virt_tab
207{ 207{
208 const char *(*get_path) (struct spool *sp);
208 int (*test_url) (mu_url_t url, grecs_locus_t *loc); 209 int (*test_url) (mu_url_t url, grecs_locus_t *loc);
209 int (*move_file) (struct file_triplet *trp, enum file_type file_id); 210 int (*move_file) (struct file_triplet *trp, enum file_type file_id);
210 int (*archive_file) (struct file_triplet *trp, const char *file_name); 211 int (*archive_file) (struct file_triplet *trp, const char *file_name);
@@ -229,6 +230,7 @@ struct spool
229 time_t file_sweep_time; /* Remove invalid/unprocessed files 230 time_t file_sweep_time; /* Remove invalid/unprocessed files
230 after this amount of time */ 231 after this amount of time */
231 struct dictionary *dictionary[dictionary_count]; 232 struct dictionary *dictionary[dictionary_count];
233 int dict_inited;
232 struct archive_descr archive; /* Archivation data */ 234 struct archive_descr archive; /* Archivation data */
233 struct notification *notification; 235 struct notification *notification;
234 char *check_script; 236 char *check_script;
@@ -372,6 +374,9 @@ extern char *temp_homedir;
372extern unsigned min_directive_version; 374extern unsigned min_directive_version;
373extern unsigned max_directive_version; 375extern unsigned max_directive_version;
374 376
377extern struct spool fake_spool;
378extern struct spool inotify_spool;
379
375#define UPDATE_STATS(what) \ 380#define UPDATE_STATS(what) \
376 do \ 381 do \
377 { \ 382 { \
@@ -409,19 +414,31 @@ enum exec_result wydawca_exec (int argc, const char **argv, int *retcode);
409 414
410 415
411/* Directory scanning and registering */ 416/* Directory scanning and registering */
412int scan_spool (const struct spool *spool, int uc, uid_t *uv); 417int scan_spool (struct spool *spool, int uc, uid_t *uv);
413int scan_all_spools (int, uid_t *); 418int scan_all_spools (int, uid_t *);
414void spool_create_timers (void); 419void spool_create_timers (void);
415 420
421int spool_add_new_file (const struct spool *spool, const char *name,
422 int uc, uid_t *uv);
423int spool_cwd_add_new_file (const struct spool *spool, const char *name,
424 int uc, uid_t *uv);
425int spool_open_dictionaries (struct spool *spool);
426void spool_close_dictionaries (struct spool *spool);
427
428int for_each_spool (int (*fun) (struct spool *, void *), void *data);
416void register_spool (struct spool *spool); 429void register_spool (struct spool *spool);
417struct spool *wydawca_find_spool (const char *name); 430struct spool *wydawca_find_spool (const char *name);
418void register_file (struct file_info *finfo, const struct spool *spool); 431void register_file (struct file_info *finfo, const struct spool *spool);
419void enumerate_triplets (const struct spool *); 432void spool_commit_triplets (struct spool *);
420size_t count_collected_triplets (void); 433size_t count_collected_triplets (void);
434size_t count_processable_triplets (void);
435
421char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); 436char *triplet_expand_param (const char *tmpl, struct file_triplet *trp);
422char *triplet_expand_dictionary_query (struct dictionary *dict, void *handle, 437char *triplet_expand_dictionary_query (struct dictionary *dict, void *handle,
423 struct file_triplet *trp); 438 struct file_triplet *trp);
424 439
440void triplet_remove_file (struct spool *spool, const char *name);
441
425/* General-purpose dictionary support */ 442/* General-purpose dictionary support */
426struct dictionary *dictionary_new (enum dictionary_id id, 443struct dictionary *dictionary_new (enum dictionary_id id,
427 enum dictionary_type type); 444 enum dictionary_type type);
@@ -442,7 +459,7 @@ unsigned dictionary_num_rows (struct dictionary *dict);
442unsigned dictionary_num_cols (struct dictionary *dict); 459unsigned dictionary_num_cols (struct dictionary *dict);
443 460
444/* Verification functions */ 461/* Verification functions */
445int verify_directive_file (struct file_triplet *trp); 462int verify_directive_file (struct file_triplet *trp, int noath);
446int verify_directive_signature (struct file_triplet *trp); 463int verify_directive_signature (struct file_triplet *trp);
447int verify_detached_signature (struct file_triplet *trp); 464int verify_detached_signature (struct file_triplet *trp);
448int fill_project_name (struct file_triplet *trp); 465int fill_project_name (struct file_triplet *trp);
@@ -485,21 +502,19 @@ int assert_string_arg (grecs_locus_t *, enum grecs_callback_command,
485/* vtab.c */ 502/* vtab.c */
486int url_to_vtab (mu_url_t url, struct virt_tab *vtab); 503int url_to_vtab (mu_url_t url, struct virt_tab *vtab);
487 504
488int 505const char *get_path (struct spool *sp);
489move_file (struct file_triplet *trp, enum file_type file_id); 506int move_file (struct file_triplet *trp, enum file_type file_id);
490int 507int archive_file (struct file_triplet *trp, const char *file_name);
491archive_file (struct file_triplet *trp, const char *file_name); 508int symlink_file (struct file_triplet *trp,
492int
493symlink_file (struct file_triplet *trp,
494 const char *wanted_src, const char *wanted_dst); 509 const char *wanted_src, const char *wanted_dst);
495int 510int rmsymlink_file (struct file_triplet *trp, const char *file_name);
496rmsymlink_file (struct file_triplet *trp, const char *file_name);
497 511
498 512
499/* diskio.c */ 513/* diskio.c */
500char *concat_dir (const char *base, const char *name, size_t *pbaselen); 514char *concat_dir (const char *base, const char *name, size_t *pbaselen);
501int copy_file (const char *file, const char *dst_file); 515int copy_file (const char *file, const char *dst_file);
502 516
517const char *dir_get_path (struct spool *sp);
503int dir_test_url (mu_url_t url, grecs_locus_t *locus); 518int dir_test_url (mu_url_t url, grecs_locus_t *locus);
504int dir_move_file (struct file_triplet *trp, enum file_type file_id); 519int dir_move_file (struct file_triplet *trp, enum file_type file_id);
505int dir_archive_file (struct file_triplet *trp, const char *reldir); 520int dir_archive_file (struct file_triplet *trp, const char *reldir);
@@ -538,7 +553,7 @@ extern char *report_string;
538 553
539 554
540/* job.c */ 555/* job.c */
541void schedule_job (const struct spool *spool, uid_t uid); 556void schedule_job (struct spool *spool, uid_t uid);
542void job_init (void); 557void job_init (void);
543void job_queue_runner (void); 558void job_queue_runner (void);
544 559
@@ -588,3 +603,11 @@ void txtacc_grow (struct txtacc *acc, const char *buf, size_t size);
588 } \ 603 } \
589 while (0) 604 while (0)
590char *txtacc_finish (struct txtacc *acc, int steal); 605char *txtacc_finish (struct txtacc *acc, int steal);
606
607#ifdef WITH_INOTIFY
608int watcher_init (void);
609int watcher_run (int);
610#else
611# define watcher_init() -1
612# define watcher_run(c)
613#endif

Return to:

Send suggestions and report system problems to the System administrator.