diff options
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 47 |
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 | ||
206 | struct virt_tab | 206 | struct 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; | |||
372 | extern unsigned min_directive_version; | 374 | extern unsigned min_directive_version; |
373 | extern unsigned max_directive_version; | 375 | extern unsigned max_directive_version; |
374 | 376 | ||
377 | extern struct spool fake_spool; | ||
378 | extern 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 */ |
412 | int scan_spool (const struct spool *spool, int uc, uid_t *uv); | 417 | int scan_spool (struct spool *spool, int uc, uid_t *uv); |
413 | int scan_all_spools (int, uid_t *); | 418 | int scan_all_spools (int, uid_t *); |
414 | void spool_create_timers (void); | 419 | void spool_create_timers (void); |
415 | 420 | ||
421 | int spool_add_new_file (const struct spool *spool, const char *name, | ||
422 | int uc, uid_t *uv); | ||
423 | int spool_cwd_add_new_file (const struct spool *spool, const char *name, | ||
424 | int uc, uid_t *uv); | ||
425 | int spool_open_dictionaries (struct spool *spool); | ||
426 | void spool_close_dictionaries (struct spool *spool); | ||
427 | |||
428 | int for_each_spool (int (*fun) (struct spool *, void *), void *data); | ||
416 | void register_spool (struct spool *spool); | 429 | void register_spool (struct spool *spool); |
417 | struct spool *wydawca_find_spool (const char *name); | 430 | struct spool *wydawca_find_spool (const char *name); |
418 | void register_file (struct file_info *finfo, const struct spool *spool); | 431 | void register_file (struct file_info *finfo, const struct spool *spool); |
419 | void enumerate_triplets (const struct spool *); | 432 | void spool_commit_triplets (struct spool *); |
420 | size_t count_collected_triplets (void); | 433 | size_t count_collected_triplets (void); |
434 | size_t count_processable_triplets (void); | ||
435 | |||
421 | char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); | 436 | char *triplet_expand_param (const char *tmpl, struct file_triplet *trp); |
422 | char *triplet_expand_dictionary_query (struct dictionary *dict, void *handle, | 437 | char *triplet_expand_dictionary_query (struct dictionary *dict, void *handle, |
423 | struct file_triplet *trp); | 438 | struct file_triplet *trp); |
424 | 439 | ||
440 | void triplet_remove_file (struct spool *spool, const char *name); | ||
441 | |||
425 | /* General-purpose dictionary support */ | 442 | /* General-purpose dictionary support */ |
426 | struct dictionary *dictionary_new (enum dictionary_id id, | 443 | struct 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); | |||
442 | unsigned dictionary_num_cols (struct dictionary *dict); | 459 | unsigned dictionary_num_cols (struct dictionary *dict); |
443 | 460 | ||
444 | /* Verification functions */ | 461 | /* Verification functions */ |
445 | int verify_directive_file (struct file_triplet *trp); | 462 | int verify_directive_file (struct file_triplet *trp, int noath); |
446 | int verify_directive_signature (struct file_triplet *trp); | 463 | int verify_directive_signature (struct file_triplet *trp); |
447 | int verify_detached_signature (struct file_triplet *trp); | 464 | int verify_detached_signature (struct file_triplet *trp); |
448 | int fill_project_name (struct file_triplet *trp); | 465 | int 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 */ |
486 | int url_to_vtab (mu_url_t url, struct virt_tab *vtab); | 503 | int url_to_vtab (mu_url_t url, struct virt_tab *vtab); |
487 | 504 | ||
488 | int | 505 | const char *get_path (struct spool *sp); |
489 | move_file (struct file_triplet *trp, enum file_type file_id); | 506 | int move_file (struct file_triplet *trp, enum file_type file_id); |
490 | int | 507 | int archive_file (struct file_triplet *trp, const char *file_name); |
491 | archive_file (struct file_triplet *trp, const char *file_name); | 508 | int symlink_file (struct file_triplet *trp, |
492 | int | ||
493 | symlink_file (struct file_triplet *trp, | ||
494 | const char *wanted_src, const char *wanted_dst); | 509 | const char *wanted_src, const char *wanted_dst); |
495 | int | 510 | int rmsymlink_file (struct file_triplet *trp, const char *file_name); |
496 | rmsymlink_file (struct file_triplet *trp, const char *file_name); | ||
497 | 511 | ||
498 | 512 | ||
499 | /* diskio.c */ | 513 | /* diskio.c */ |
500 | char *concat_dir (const char *base, const char *name, size_t *pbaselen); | 514 | char *concat_dir (const char *base, const char *name, size_t *pbaselen); |
501 | int copy_file (const char *file, const char *dst_file); | 515 | int copy_file (const char *file, const char *dst_file); |
502 | 516 | ||
517 | const char *dir_get_path (struct spool *sp); | ||
503 | int dir_test_url (mu_url_t url, grecs_locus_t *locus); | 518 | int dir_test_url (mu_url_t url, grecs_locus_t *locus); |
504 | int dir_move_file (struct file_triplet *trp, enum file_type file_id); | 519 | int dir_move_file (struct file_triplet *trp, enum file_type file_id); |
505 | int dir_archive_file (struct file_triplet *trp, const char *reldir); | 520 | int 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 */ |
541 | void schedule_job (const struct spool *spool, uid_t uid); | 556 | void schedule_job (struct spool *spool, uid_t uid); |
542 | void job_init (void); | 557 | void job_init (void); |
543 | void job_queue_runner (void); | 558 | void 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) |
590 | char *txtacc_finish (struct txtacc *acc, int steal); | 605 | char *txtacc_finish (struct txtacc *acc, int steal); |
606 | |||
607 | #ifdef WITH_INOTIFY | ||
608 | int watcher_init (void); | ||
609 | int watcher_run (int); | ||
610 | #else | ||
611 | # define watcher_init() -1 | ||
612 | # define watcher_run(c) | ||
613 | #endif | ||