aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-22 13:37:20 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-02-22 13:37:20 +0200
commitd1ee123b443c2de4fb6e1622068611ab631a1f27 (patch)
tree86f73699689f12ff9d0882723205c595130869a3
parent5dd37baedfb74ad33fd7b785fe316e40e3b93551 (diff)
downloadwydawca-d1ee123b443c2de4fb6e1622068611ab631a1f27.tar.gz
wydawca-d1ee123b443c2de4fb6e1622068611ab631a1f27.tar.bz2
Rename directory_pair to spool
-rw-r--r--src/config.c76
-rw-r--r--src/directive.c18
-rw-r--r--src/diskio.c40
-rw-r--r--src/gpg.c10
-rw-r--r--src/mail.c4
-rw-r--r--src/null.c16
-rw-r--r--src/process.c60
-rw-r--r--src/triplet.c26
-rw-r--r--src/update-2.0.awk2
-rw-r--r--src/verify.c14
-rw-r--r--src/vtab.c16
-rw-r--r--src/wydawca.c2
-rw-r--r--src/wydawca.h52
-rw-r--r--tests/etc/wydawca.rcin2
14 files changed, 169 insertions, 169 deletions
diff --git a/src/config.c b/src/config.c
index b8c31f7..c4f50b2 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1121,36 +1121,36 @@ cb_destination_url (enum gconf_callback_command cmd,
}
-static struct gconf_keyword directory_kw[] = {
+static struct gconf_keyword spool_kw[] = {
{ "source", N_("dir"), N_("Source directory"),
- gconf_type_string, NULL, offsetof(struct directory_pair, source_dir) },
+ gconf_type_string, NULL, offsetof(struct spool, source_dir) },
{ "destination", N_("dir"), N_("Destination directory"),
- gconf_type_string, NULL, offsetof(struct directory_pair, dest_url),
+ gconf_type_string, NULL, offsetof(struct spool, dest_url),
cb_destination_url },
{ "file-sweep-time", N_("interval"), N_("Define file sweep time"),
- gconf_type_string, NULL, offsetof(struct directory_pair, file_sweep_time),
+ gconf_type_string, NULL, offsetof(struct spool, file_sweep_time),
cb_interval },
{ "access-method", N_("ident"), N_("Define access method"),
- gconf_type_section, NULL, offsetof(struct directory_pair, access_method),
+ gconf_type_section, NULL, offsetof(struct spool, access_method),
cb_access_method, NULL, access_method_kw },
{ "archive", N_("type: string"), N_("Set up archivation"),
- gconf_type_section, NULL, offsetof(struct directory_pair, archive),
+ gconf_type_section, NULL, offsetof(struct spool, archive),
cb_archive, NULL, archive_kw },
{ "notify-event", NULL, N_("Configure notification"),
- gconf_type_section, NULL, offsetof(struct directory_pair, notification),
+ gconf_type_section, NULL, offsetof(struct spool, notification),
cb_notify_event, NULL, notify_event_kw },
{ NULL }
};
static int
-cb_directory (enum gconf_callback_command cmd,
- gconf_locus_t *locus,
- void *varptr,
- gconf_value_t *value,
- void *cb_data)
+cb_spool (enum gconf_callback_command cmd,
+ gconf_locus_t *locus,
+ void *varptr,
+ gconf_value_t *value,
+ void *cb_data)
{
- struct directory_pair *dpair;
+ struct spool *spool;
void **pdata = cb_data;
int rc, ec, i;
const char *ep = NULL;
@@ -1163,50 +1163,50 @@ cb_directory (enum gconf_callback_command cmd,
gconf_error (locus, 0, _("tag must be a string"));
return 1;
}
- dpair = xzalloc (sizeof (*dpair));
- dpair->url = xstrdup (value->v.string);
- dpair->file_sweep_time = file_sweep_time;
- for (i = 0; i < NITEMS (dpair->access_method); i++)
- dpair->access_method[i] = default_access_method[i];
- dpair->archive = default_archive_descr;
- *pdata = dpair;
+ spool = xzalloc (sizeof (*spool));
+ spool->url = xstrdup (value->v.string);
+ spool->file_sweep_time = file_sweep_time;
+ for (i = 0; i < NITEMS (spool->access_method); i++)
+ spool->access_method[i] = default_access_method[i];
+ spool->archive = default_archive_descr;
+ *pdata = spool;
break;
case gconf_callback_section_end:
rc = 0;
- dpair = *pdata;
- if (!dpair->source_dir)
+ spool = *pdata;
+ if (!spool->source_dir)
{
gconf_error (locus, 0, _("source is not given"));
rc = 1;
}
- else if (test_dir (dpair->source_dir, &ec))
+ else if (test_dir (spool->source_dir, &ec))
{
if (ec)
- gconf_error (locus, ec, _("cannot access %s"), dpair->source_dir);
+ gconf_error (locus, ec, _("cannot access %s"), spool->source_dir);
else
gconf_error (locus, 0, _("%s is not a directory"),
- dpair->source_dir);
+ spool->source_dir);
rc = 1;
}
- if (!dpair->dest_url)
+ if (!spool->dest_url)
{
gconf_error (locus, 0, _("destination is not given"));
rc = 1;
}
- else if (url_to_vtab (dpair->dest_url, &dpair->vtab))
+ else if (url_to_vtab (spool->dest_url, &spool->vtab))
{
gconf_error (locus, 0, _("unsupported url: %s"),
- mu_url_to_string (dpair->dest_url));
+ mu_url_to_string (spool->dest_url));
rc = 1;
}
- else if (dpair->vtab.test_url
- && dpair->vtab.test_url (dpair->dest_url, locus))
+ else if (spool->vtab.test_url
+ && spool->vtab.test_url (spool->dest_url, locus))
rc = 1;
for (i = 0; i < access_method_count; i++)
- if (dpair->access_method[i]->type == method_external)
+ if (spool->access_method[i]->type == method_external)
{
gconf_error (locus, 0,
_("Sorry, method type `external' is not yet supported"));
@@ -1216,11 +1216,11 @@ cb_directory (enum gconf_callback_command cmd,
if (rc)
return rc;
- if (!dpair->notification)
- dpair->notification = default_notification;
- mu_url_sget_path (dpair->dest_url, &dpair->dest_dir);
- register_directory_pair (dpair);
- free (dpair);
+ if (!spool->notification)
+ spool->notification = default_notification;
+ mu_url_sget_path (spool->dest_url, &spool->dest_dir);
+ register_spool (spool);
+ free (spool);
*pdata = NULL;
break;
@@ -1280,9 +1280,9 @@ static struct gconf_keyword wydawca_kw[] = {
gconf_type_section, default_access_method, 0,
cb_access_method, NULL, access_method_kw },
- { "directory", NULL, N_("Define distribution directory"),
+ { "spool", NULL, N_("Define distribution spool"),
gconf_type_section, NULL, 0,
- cb_directory, NULL, directory_kw },
+ cb_spool, NULL, spool_kw },
{ NULL }
};
diff --git a/src/directive.c b/src/directive.c
index f18479c..654dc61 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -300,9 +300,9 @@ verify_directive_format (struct file_triplet *trp)
return 0;
}
-/* Process the directives from TRP, using directory pair DPAIR */
+/* Process the directives from TRP, using given SPOOL */
int
-process_directives (struct file_triplet *trp, struct directory_pair *dpair)
+process_directives (struct file_triplet *trp, struct spool *spool)
{
int n;
const char *key, *val;
@@ -337,10 +337,10 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair)
break;
case filename_dir:
- if (verify_detached_signature (trp, dpair) == 0)
+ if (verify_detached_signature (trp, spool) == 0)
{
- if (move_file (trp, dpair, file_dist, relative_dir)
- || move_file (trp, dpair, file_signature, relative_dir))
+ if (move_file (trp, spool, file_dist, relative_dir)
+ || move_file (trp, spool, file_signature, relative_dir))
return 1;
}
else
@@ -355,7 +355,7 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair)
break;
case archive_dir:
- if (archive_file (trp, dpair, relative_dir, val))
+ if (archive_file (trp, spool, relative_dir, val))
return 1;
break;
@@ -380,7 +380,7 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair)
key, val);
}
else
- rc = symlink_file (trp, dpair, relative_dir, argv[0], argv[1]);
+ rc = symlink_file (trp, spool, relative_dir, argv[0], argv[1]);
argcv_free (argc, argv);
if (rc)
@@ -389,7 +389,7 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair)
break;
case rmsymlink_dir:
- if (rmsymlink_file (trp, dpair, relative_dir, val))
+ if (rmsymlink_file (trp, spool, relative_dir, val))
return 1;
}
}
@@ -404,6 +404,6 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair)
UPDATE_STATS (STAT_TRIPLET_SUCCESS);
report_finish ();
timer_stop ("triplet");
- notify (dpair->notification, trp, ev_success);
+ notify (spool->notification, trp, ev_success);
return 0;
}
diff --git a/src/diskio.c b/src/diskio.c
index 0548972..9df7a1a 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -441,12 +441,12 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file,
Do nothing if dry_run_mode is set. */
int
-dir_move_file (struct file_triplet *trp, struct directory_pair *dpair,
+dir_move_file (struct file_triplet *trp, struct spool *spool,
enum file_type file_id, const char *reldir)
{
char *dst_file;
int rc = 0;
- char *dst_dir = create_directory (dpair->dest_dir, reldir,
+ char *dst_dir = create_directory (spool->dest_dir, reldir,
TRIPLET_UID (trp), TRIPLET_GID (trp));
if (!dst_dir)
@@ -459,7 +459,7 @@ dir_move_file (struct file_triplet *trp, struct directory_pair *dpair,
if (access (dst_file, F_OK) == 0)
rc = do_archive_file (dst_file, dst_dir, trp->file[file_id].name,
- &dpair->archive,
+ &spool->archive,
TRIPLET_UID (trp), TRIPLET_GID (trp), reldir);
if (!dry_run_mode && rc == 0)
@@ -478,23 +478,23 @@ dir_move_file (struct file_triplet *trp, struct directory_pair *dpair,
Do nothing if dry_run_mode is set.
*/
int
-archive_single_file (struct file_triplet *trp, struct directory_pair *dpair,
+archive_single_file (struct file_triplet *trp, struct spool *spool,
const char *file_name, const char *reldir,
int noentok)
{
char *dst_file;
int rc = 0;
- char *dst_dir = create_directory (dpair->dest_dir, reldir,
+ char *dst_dir = create_directory (spool->dest_dir, reldir,
TRIPLET_UID (trp), TRIPLET_GID (trp));
if (!dst_dir)
return 1;
dst_file = safe_file_name (concat_dir (dst_dir, file_name, NULL));
- if (!sub_dir_p (dst_file, dpair->dest_dir))
+ if (!sub_dir_p (dst_file, spool->dest_dir))
{
logmsg (LOG_ERR, "file to be archived `%s' does not lie under `%s'",
- dst_file, dpair->dest_dir);
+ dst_file, spool->dest_dir);
free (dst_file);
free (dst_dir);
return 1;
@@ -504,7 +504,7 @@ archive_single_file (struct file_triplet *trp, struct directory_pair *dpair,
{
if (debug_level)
logmsg (LOG_DEBUG, "Archiving file `%s'", dst_file);
- rc = do_archive_file (dst_file, dst_dir, file_name, &dpair->archive,
+ rc = do_archive_file (dst_file, dst_dir, file_name, &spool->archive,
TRIPLET_UID (trp), TRIPLET_GID (trp), reldir);
if (rc == 0)
UPDATE_STATS (STAT_ARCHIVES);
@@ -548,16 +548,16 @@ make_signame (const char *file_name)
Do nothing if dry_run_mode is set.
*/
int
-dir_archive_file (struct file_triplet *trp, struct directory_pair *dpair,
+dir_archive_file (struct file_triplet *trp, struct spool *spool,
const char *reldir, const char *file_name)
{
int rc;
char *signame;
- rc = archive_single_file (trp, dpair, file_name, reldir, 0);
+ rc = archive_single_file (trp, spool, file_name, reldir, 0);
if (rc == 0 && archive_signatures && (signame = make_signame (file_name)))
{
- rc = archive_single_file (trp, dpair, signame, reldir, 1);
+ rc = archive_single_file (trp, spool, signame, reldir, 1);
free (signame);
}
return rc;
@@ -568,13 +568,13 @@ dir_archive_file (struct file_triplet *trp, struct directory_pair *dpair,
Do nothing if dry_run_mode is set. */
int
-dir_symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+dir_symlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir,
const char *wanted_src, const char *wanted_dst)
{
int rc = 0;
struct saved_cwd cwd;
- char *dst_dir = create_directory (dpair->dest_dir, reldir,
+ char *dst_dir = create_directory (spool->dest_dir, reldir,
TRIPLET_UID (trp), TRIPLET_GID (trp));
char *src, *dst;
@@ -592,7 +592,7 @@ dir_symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
if (!src || src[0] == '/')
{
logmsg (LOG_ERR, "symlink source `%s' does not lie under `%s'",
- wanted_src, dpair->dest_dir);
+ wanted_src, spool->dest_dir);
free (src);
return 1;
}
@@ -601,7 +601,7 @@ dir_symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
if (!dst || dst[0] == '/')
{
logmsg (LOG_ERR, "symlink destination `%s' does not lie under `%s'",
- wanted_dst, dpair->dest_dir);
+ wanted_dst, spool->dest_dir);
free (src);
free (dst);
return 1;
@@ -619,7 +619,7 @@ dir_symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
char *dir;
*p = 0;
- dir = create_directory (dpair->dest_dir, dst,
+ dir = create_directory (spool->dest_dir, dst,
TRIPLET_UID (trp), TRIPLET_GID (trp));
if (!dir)
rc = 1;
@@ -728,24 +728,24 @@ do_rmsymlink_file (const char *dst_file, int noentok)
Do nothing if dry_run_mode is set. */
int
-dir_rmsymlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+dir_rmsymlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir, const char *file_name)
{
char *dst_file;
int rc = 0;
char *signame;
- char *dst_dir = create_directory (dpair->dest_dir, reldir,
+ char *dst_dir = create_directory (spool->dest_dir, reldir,
TRIPLET_UID (trp), TRIPLET_GID (trp));
if (!dst_dir)
return 1;
dst_file = safe_file_name (concat_dir (dst_dir, file_name, NULL));
- if (!sub_dir_p (dst_file, dpair->dest_dir))
+ if (!sub_dir_p (dst_file, spool->dest_dir))
{
logmsg (LOG_ERR, "refusing to remove a symlink `%s' that is not "
"located under `%s'",
- dst_file, dpair->dest_dir);
+ dst_file, spool->dest_dir);
free (dst_file);
free (dst_dir);
return 1;
diff --git a/src/gpg.c b/src/gpg.c
index 327ff77..453a908 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -199,10 +199,10 @@ gpg_sig_ok_p (gpgme_ctx_t ctx, gpgme_signature_t sig)
}
/* Verify the directive file from TRP using public key PUBKEY */
-/* FIXME: dpair currently unused */
+/* FIXME: spool currently unused */
int
verify_directive_signature (struct file_triplet *trp,
- struct directory_pair *dpair, const char *pubkey)
+ struct spool *spool, const char *pubkey)
{
gpgme_ctx_t ctx;
gpgme_data_t key_data, directive_data, plain;
@@ -237,7 +237,7 @@ verify_directive_signature (struct file_triplet *trp,
if (!gpg_sig_ok_p (ctx, result->signatures))
{
UPDATE_STATS (STAT_BAD_SIGNATURE);
- notify (dpair->notification, trp, ev_bad_directive_signature);
+ notify (spool->notification, trp, ev_bad_directive_signature);
rc = 1;
}
}
@@ -260,7 +260,7 @@ verify_directive_signature (struct file_triplet *trp,
a previous call to verify_directive_signature). */
int
verify_detached_signature (struct file_triplet *trp,
- struct directory_pair *dpair)
+ struct spool *spool)
{
gpgme_engine_info_t info;
const char *argv[5];
@@ -293,7 +293,7 @@ verify_detached_signature (struct file_triplet *trp,
case exec_fail:
UPDATE_STATS (STAT_BAD_SIGNATURE);
logmsg (LOG_ERR, "BAD detached signature for %s", trp->name);
- notify (dpair->notification, trp, ev_bad_detached_signature);
+ notify (spool->notification, trp, ev_bad_detached_signature);
break;
case exec_error:
diff --git a/src/mail.c b/src/mail.c
index 5449fc8..d44d692 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -336,12 +336,12 @@ do_notify (struct file_triplet *trp, enum notification_event ev,
break;
case notify_user:
- rcpt = get_recipient (trp->dpair->access_method[user_data_method],
+ rcpt = get_recipient (trp->spool->access_method[user_data_method],
trp, &errp);
break;
case notify_owner:
- rcpt = get_recipient (trp->dpair->access_method[project_owner_method],
+ rcpt = get_recipient (trp->spool->access_method[project_owner_method],
trp, &errp);
}
diff --git a/src/null.c b/src/null.c
index 3c17361..667f229 100644
--- a/src/null.c
+++ b/src/null.c
@@ -17,42 +17,42 @@
#include "wydawca.h"
int
-null_move_file (struct file_triplet *trp, struct directory_pair *dpair,
+null_move_file (struct file_triplet *trp, struct spool *spool,
enum file_type file_id, const char *reldir)
{
if (debug_level)
logmsg (LOG_DEBUG, "%s: installing file `%s/%s'",
- dpair->url, reldir, trp->file[file_id].name);
+ spool->url, reldir, trp->file[file_id].name);
return 0;
}
int
-null_archive_file (struct file_triplet *trp, struct directory_pair *dpair,
+null_archive_file (struct file_triplet *trp, struct spool *spool,
const char *file_name, const char *reldir)
{
if (debug_level)
- logmsg (LOG_DEBUG, "%s: archiving `%s'", dpair->url, file_name);
+ logmsg (LOG_DEBUG, "%s: archiving `%s'", spool->url, file_name);
return 0;
}
int
-null_symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+null_symlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir,
const char *wanted_src, const char *wanted_dst)
{
if (debug_level)
logmsg (LOG_DEBUG, "%s: symlinking `%s' to `%s'",
- dpair->url, wanted_src, wanted_dst);
+ spool->url, wanted_src, wanted_dst);
return 0;
}
int
-null_rmsymlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+null_rmsymlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir, const char *file_name)
{
if (debug_level)
logmsg (LOG_DEBUG, "%s: removing symlink `%s/%s'",
- dpair->url, reldir, file_name);
+ spool->url, reldir, file_name);
return 0;
}
diff --git a/src/process.c b/src/process.c
index c019a65..eef7158 100644
--- a/src/process.c
+++ b/src/process.c
@@ -16,21 +16,21 @@
#include "wydawca.h"
-struct directory_list
+struct spool_list
{
- struct directory_list *next;
- struct directory_pair pair;
+ struct spool_list *next;
+ struct spool spool;
};
-static struct directory_list *dlist;
+static struct spool_list *spool_list;
void
-register_directory_pair (struct directory_pair *dpair)
+register_spool (struct spool *spool)
{
- struct directory_list *dl = xmalloc (sizeof *dl);
- dl->pair = *dpair;
- dl->next = dlist;
- dlist = dl;
+ struct spool_list *sp = xmalloc (sizeof *sp);
+ sp->spool = *spool;
+ sp->next = spool_list;
+ spool_list = sp;
}
/* Return true if NAME is a directory. If stat fails, return the error
@@ -103,18 +103,18 @@ parse_file_name (const char *name, struct file_info *finfo)
/* Scan upload directory from the DPAIR and register all files found
there, forming triplets when possible */
void
-scan_directory_pair (struct directory_pair *dpair)
+scan_spool (struct spool *spool)
{
DIR *dir;
struct dirent *ent;
if (debug_level)
- logmsg (LOG_DEBUG, "%s -> %s", dpair->source_dir,
- mu_url_to_string (dpair->dest_url));
+ logmsg (LOG_DEBUG, "%s -> %s", spool->source_dir,
+ mu_url_to_string (spool->dest_url));
- if (chdir (dpair->source_dir))
+ if (chdir (spool->source_dir))
{
- logmsg (LOG_ERR, "cannot chdir to %s: %s", dpair->source_dir,
+ logmsg (LOG_ERR, "cannot chdir to %s: %s", spool->source_dir,
strerror (errno));
return;
}
@@ -122,13 +122,13 @@ scan_directory_pair (struct directory_pair *dpair)
dir = opendir (".");
if (!dir)
{
- logmsg (LOG_ERR, "cannot open directory %s: %s", dpair->source_dir,
+ logmsg (LOG_ERR, "cannot open directory %s: %s", spool->source_dir,
strerror (errno));
return;
}
timer_start ("directory");
- timer_start (dpair->url);
+ timer_start (spool->url);
while ((ent = readdir (dir)))
{
struct stat st;
@@ -140,7 +140,7 @@ scan_directory_pair (struct directory_pair *dpair)
if (stat (ent->d_name, &st))
{
logmsg (LOG_ERR, "cannot stat file %s/%s: %s",
- dpair->source_dir, ent->d_name,
+ spool->source_dir, ent->d_name,
strerror (errno));
continue;
}
@@ -148,7 +148,7 @@ scan_directory_pair (struct directory_pair *dpair)
if (!S_ISREG (st.st_mode))
{
logmsg (LOG_NOTICE, "not a regular file: %s/%s",
- dpair->source_dir, ent->d_name);
+ spool->source_dir, ent->d_name);
continue;
}
@@ -156,7 +156,7 @@ scan_directory_pair (struct directory_pair *dpair)
{
if (debug_level)
logmsg (LOG_DEBUG, "ignoring file: %s/%s",
- dpair->source_dir, ent->d_name);
+ spool->source_dir, ent->d_name);
continue;
}
@@ -182,39 +182,39 @@ scan_directory_pair (struct directory_pair *dpair)
for (i = 0; i < access_method_count; i++)
{
- if (method_init (dpair->access_method[i]))
+ if (method_init (spool->access_method[i]))
{
logmsg (LOG_ERR, "failed to initialize access method %d", i);
return;
}
}
- enumerate_triplets (dpair);
+ enumerate_triplets (spool);
}
- timer_stop (dpair->url);
+ timer_stop (spool->url);
timer_stop ("directory");
}
static void
-close_methods (struct directory_pair *dpair)
+close_methods (struct spool *spool)
{
int i;
- for (i = 0; i < NITEMS (dpair->access_method); i++)
- method_done (dpair->access_method[i]);
+ for (i = 0; i < NITEMS (spool->access_method); i++)
+ method_done (spool->access_method[i]);
}
/* Scan all configured update directories */
void
scan_directories ()
{
- struct directory_list *dp;
+ struct spool_list *sp;
timer_start ("wydawca");
- for (dp = dlist; dp; dp = dp->next)
- scan_directory_pair (&dp->pair);
+ for (sp = spool_list; sp; sp = sp->next)
+ scan_spool (&sp->spool);
- for (dp = dlist; dp; dp = dp->next)
- close_methods (&dp->pair);
+ for (sp = spool_list; sp; sp = sp->next)
+ close_methods (&sp->spool);
timer_stop ("wydawca");
}
diff --git a/src/triplet.c b/src/triplet.c
index 3cfc4d0..d597ed1 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -127,7 +127,7 @@ enum triplet_state
static enum triplet_state
check_triplet_state (struct file_triplet *trp)
{
- if (verify_directive_file (trp, trp->dpair))
+ if (verify_directive_file (trp, trp->spool))
return triplet_bad;
if (trp->file[file_directive].name)
@@ -182,9 +182,9 @@ static bool
triplet_processor (void *data, void *proc_data)
{
struct file_triplet *trp = data;
- struct directory_pair *dpair = proc_data;
+ struct spool *spool = proc_data;
- trp->dpair = dpair;
+ trp->spool = spool;
if (debug_level)
logmsg (LOG_DEBUG, "FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
@@ -199,7 +199,7 @@ triplet_processor (void *data, void *proc_data)
case triplet_complete:
if (debug_level)
logmsg (LOG_DEBUG, "Processing triplet `%s'", trp->name);
- process_directives (trp, dpair);
+ process_directives (trp, spool);
return true;
case triplet_incomplete:
@@ -215,7 +215,7 @@ triplet_processor (void *data, void *proc_data)
return true;
}
- if (triplet_expired_p (trp, dpair->file_sweep_time))
+ if (triplet_expired_p (trp, spool->file_sweep_time))
{
UPDATE_STATS (STAT_EXPIRED_TRIPLETS);
remove_triplet (trp);
@@ -224,16 +224,16 @@ triplet_processor (void *data, void *proc_data)
return true;
}
-/* Process all triplets from the table according to the directory pair DPAIR */
+/* Process all triplets from the table according to the SPOOL */
void
-enumerate_triplets (struct directory_pair *dpair)
+enumerate_triplets (struct spool *spool)
{
if (debug_level)
logmsg (LOG_DEBUG, "Processing files for %s (%s)",
- dpair->url, mu_url_to_string (dpair->dest_url));
+ spool->url, mu_url_to_string (spool->dest_url));
if (triplet_table)
{
- hash_do_for_each (triplet_table, triplet_processor, dpair);
+ hash_do_for_each (triplet_table, triplet_processor, spool);
hash_clear (triplet_table);
}
}
@@ -256,7 +256,7 @@ static const char *
expand_url (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
- return trp->dpair->url;
+ return trp->spool->url;
}
static const char *
@@ -271,14 +271,14 @@ static const char *
expand_dest_dir (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
- return trp->dpair->dest_dir;
+ return trp->spool->dest_dir;
}
static const char *
expand_source_dir (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
- return trp->dpair->source_dir;
+ return trp->spool->source_dir;
}
static void
@@ -471,7 +471,7 @@ static void
fill_user_data (struct file_triplet *trp)
{
int rc;
- struct access_method *method = trp->dpair->access_method[user_data_method];
+ struct access_method *method = trp->spool->access_method[user_data_method];
char *text;
unsigned nrows, ncols;
struct metadef def[5];
diff --git a/src/update-2.0.awk b/src/update-2.0.awk
index 3a25244..3027275 100644
--- a/src/update-2.0.awk
+++ b/src/update-2.0.awk
@@ -129,7 +129,7 @@ $1 == "sql" {
}
$1 == "directory" {
- printf("directory ")
+ printf("spool ")
if (NF > 1)
printf("%s ", $2)
print "{"
diff --git a/src/verify.c b/src/verify.c
index cc3121c..5d82d2f 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -92,10 +92,10 @@ make_default_meta (struct metadef def[5], const char *user,
/* Verify if USER has upload rights on the directory (project) requested
by TRP */
int
-check_access_rights (struct file_triplet *trp, struct directory_pair *dpair,
+check_access_rights (struct file_triplet *trp, struct spool *spool,
const char *user)
{
- struct access_method *method = dpair->access_method[verify_method];
+ struct access_method *method = spool->access_method[verify_method];
int rc;
char *command;
const char *result;
@@ -135,7 +135,7 @@ check_access_rights (struct file_triplet *trp, struct directory_pair *dpair,
UPDATE_STATS (STAT_ACCESS_VIOLATIONS);
logmsg (LOG_ERR, "%s: %s has no rights on %s",
trp->name, user, trp->project);
- notify (dpair->notification, trp, ev_bad_ownership);
+ notify (spool->notification, trp, ev_bad_ownership);
return 1;
}
@@ -143,11 +143,11 @@ check_access_rights (struct file_triplet *trp, struct directory_pair *dpair,
}
int
-verify_directive_file (struct file_triplet *trp, struct directory_pair *dpair)
+verify_directive_file (struct file_triplet *trp, struct spool *spool)
{
struct passwd *pw;
char *command;
- struct access_method *method = dpair->access_method[gpg_key_method];
+ struct access_method *method = spool->access_method[gpg_key_method];
const char *pubkey;
int rc;
struct metadef def[5];
@@ -195,7 +195,7 @@ verify_directive_file (struct file_triplet *trp, struct directory_pair *dpair)
if (debug_level > 3)
logmsg (LOG_DEBUG, "Public key: %s", pubkey);
- if (verify_directive_signature (trp, dpair, pubkey))
+ if (verify_directive_signature (trp, spool, pubkey))
{
/*FIXME: Update stats */
logmsg (LOG_ERR, "invalid signature for %s", trp->name);
@@ -217,7 +217,7 @@ verify_directive_file (struct file_triplet *trp, struct directory_pair *dpair)
if (verify_directive_format (trp))
return 1;
- if (check_access_rights (trp, dpair, trp->user))
+ if (check_access_rights (trp, spool, trp->user))
return 1;
return 0;
diff --git a/src/vtab.c b/src/vtab.c
index 83003d9..c34896c 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -51,31 +51,31 @@ url_to_vtab (mu_url_t url, struct virt_tab *vtab)
int
-move_file (struct file_triplet *trp, struct directory_pair *dpair,
+move_file (struct file_triplet *trp, struct spool *spool,
enum file_type file_id, const char *reldir)
{
- int rc = dpair->vtab.move_file (trp, dpair, file_id, reldir);
+ int rc = spool->vtab.move_file (trp, spool, file_id, reldir);
report_add ("Move %s to %s: %s", trp->file[file_id].name, reldir,
rc == 0 ? "OK" : "FAILED");
return rc;
}
int
-archive_file (struct file_triplet *trp, struct directory_pair *dpair,
+archive_file (struct file_triplet *trp, struct spool *spool,
const char *reldir, const char *file_name)
{
- int rc = dpair->vtab.archive_file (trp, dpair, reldir, file_name);
+ int rc = spool->vtab.archive_file (trp, spool, reldir, file_name);
report_add ("Archive and remove %s/%s: %s", reldir, file_name,
rc == 0 ? "OK" : "FAILED");
return rc;
}
int
-symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+symlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir,
const char *wanted_src, const char *wanted_dst)
{
- int rc = dpair->vtab.symlink_file (trp, dpair, reldir,
+ int rc = spool->vtab.symlink_file (trp, spool, reldir,
wanted_src, wanted_dst);
report_add ("Symlink %s to %s in %s/: %s", wanted_src, wanted_dst,
reldir,
@@ -84,10 +84,10 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair,
}
int
-rmsymlink_file (struct file_triplet *trp, struct directory_pair *dpair,
+rmsymlink_file (struct file_triplet *trp, struct spool *spool,
const char *reldir, const char *file_name)
{
- int rc = dpair->vtab.rmsymlink_file (trp, dpair, reldir, file_name);
+ int rc = spool->vtab.rmsymlink_file (trp, spool, reldir, file_name);
report_add ("Remove symlink %s/%s: %s", reldir, file_name,
rc == 0 ? "OK" : "FAILED");
return rc;
diff --git a/src/wydawca.c b/src/wydawca.c
index 8dd7c98..40c782c 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -245,7 +245,7 @@ gconf_print_diag (gconf_locus_t *locus, int err, int errcode, const char *msg)
static int uidc;
-static char **uidv;
+static char *uidv;
static int
collect_uids (int argc, char **argv)
diff --git a/src/wydawca.h b/src/wydawca.h
index 5b57ed0..21e4de4 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -156,7 +156,7 @@ struct file_triplet
char *name; /* Triplet base name */
gid_t gid; /* Owner GID */
struct file_info file[FILE_TYPE_COUNT]; /* Components */
- struct directory_pair *dpair; /* Owning directory pair */
+ struct spool *spool; /* Owning spool */
char **directive; /* Decoded directive pairs (key: value\0) */
char *blurb; /* Block of directives: directive[i] points here */
char *tmp; /* Temporary storage */
@@ -179,27 +179,27 @@ struct virt_tab
{
int (*test_url) (mu_url_t url, gconf_locus_t *loc);
int (*move_file) (struct file_triplet *trp,
- struct directory_pair *dpair,
+ struct spool *spool,
enum file_type file_id,
const char *reldir);
int (*archive_file) (struct file_triplet *trp,
- struct directory_pair *dpair,
+ struct spool *spool,
const char *reldir,
const char *file_name);
int (*symlink_file) (struct file_triplet *trp,
- struct directory_pair *dpair,
+ struct spool *spool,
const char *reldir,
const char *wanted_src,
const char *wanted_dst);
int (*rmsymlink_file)(struct file_triplet *trp,
- struct directory_pair *dpair,
+ struct spool *spool,
const char *reldir,
const char *file_name);
};
-/* A source/destination directory pair. This structure contains all the
- data necessary for releasing files from source to destination */
-struct directory_pair
+/* An upload spool. This structure contains all data necessary for releasing
+ files from source to destination */
+struct spool
{
char *url; /* Download URL */
char *source_dir; /* Source directory */
@@ -343,9 +343,9 @@ enum exec_result wydawca_exec (int argc, const char **argv, int *retcode);
/* Directory scanning and registering */
void scan_directories (void);
-void register_directory_pair (struct directory_pair *dpair);