summaryrefslogtreecommitdiffabout
path: root/src/wydawca.h
Side-by-side diff
Diffstat (limited to 'src/wydawca.h') (more/less context) (ignore whitespace changes)
-rw-r--r--src/wydawca.h49
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
@@ -202,12 +202,13 @@ struct file_triplet
#define TRIPLET_GID(t) ((t)->file[file_directive].sb.st_gid)
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);
int (*symlink_file) (struct file_triplet *trp,
const char *wanted_src,
const char *wanted_dst);
@@ -226,12 +227,13 @@ struct spool
const char *dest_dir; /* Directory part of the above */
struct virt_tab vtab; /* Virtual method table */
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;
};
#define ASGN_SPOOL(spool, trp, faction) \
@@ -369,12 +371,15 @@ extern char *wydawca_gpg_homedir;
extern char *default_check_script;
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 \
{ \
if (what >= MAX_STAT) abort(); \
wydawca_stat[what]++; \
} \
@@ -406,25 +411,37 @@ enum exec_result
};
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);
int dictionary_init (struct dictionary *dict);
int dictionary_done (struct dictionary *dict);
void *dictionary_open (struct dictionary *dict);
@@ -439,13 +456,13 @@ int dictionary_quote_string (struct dictionary *dict, void *handle,
const char *input, char **poutput, size_t *psize);
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);
struct uploader_info *uploader_find_frp (struct uploader_info *list,
const char *frp);
@@ -482,27 +499,25 @@ int assert_string_arg (grecs_locus_t *, enum grecs_callback_command,
const grecs_value_t *);
/* 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);
int dir_symlink_file (struct file_triplet *trp,
const char *wanted_src, const char *wanted_dst);
int dir_rmsymlink_file (struct file_triplet *trp, const char *file_name);
@@ -535,13 +550,13 @@ void report_init (void);
void report_add (const char *fmt, ...);
void report_finish (void);
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);
/* profile.c */
void check_pidfile (void);
@@ -585,6 +600,14 @@ void txtacc_grow (struct txtacc *acc, const char *buf, size_t size);
{ \
char __ch = c; \
txtacc_grow (acc, &__ch, 1); \
} \
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

Return to:

Send suggestions and report system problems to the System administrator.