From 46bce52552eae85045a274ed9a223149b6c1b9f5 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 11 Apr 2006 16:23:37 +0000 Subject: [PATCH] 11Apr06 - More work on migration. - Implement wild program in tools directory for testing wild-cards. Almost identical to the regex program. - Up port VSS single thread locking code. - Replace N_(..) by NT_(...) to inhibit translation of commands. - Modify Makefile to change the permissions on Working Directory to 770 if the directory is created. - Do not fail the Makefile if changing the permissions or owner/group on WorkingDir fails. - Remove early selection of Scratch Volumes in the recycling algorithm. - Correct the old recycling algorithm so that Scratch Volumes are selected when looking for a Volume in the changer. - Correct a typo in the Verify SQL reported by Joe Park. 10Apr06 - Remove automatic case folding on Windows FDs. You must explictly use the 'Ignore Case = yes' option. - Remove the code added to 1.38.6 and 1.38.7 that pulls a scratch volume in an Autochanger early in the 'recycling' algorithm. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2895 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/Makefile.in | 29 ++-- bacula/kes-1.38 | 27 ++++ bacula/kes-1.39 | 22 ++++ bacula/src/cats/sql_update.c | 2 +- bacula/src/dird/expand.c | 240 +++++++++++++++++----------------- bacula/src/dird/migrate.c | 82 +++++++++--- bacula/src/dird/next_vol.c | 34 +++-- bacula/src/dird/run_conf.c | 106 +++++++-------- bacula/src/dird/ua_cmds.c | 92 ++++++------- bacula/src/dird/ua_dotcmds.c | 32 ++--- bacula/src/dird/ua_label.c | 2 +- bacula/src/dird/ua_output.c | 88 ++++++------- bacula/src/dird/ua_prune.c | 6 +- bacula/src/dird/ua_purge.c | 20 +-- bacula/src/dird/ua_restore.c | 6 +- bacula/src/dird/ua_run.c | 4 +- bacula/src/dird/ua_select.c | 26 ++-- bacula/src/dird/ua_status.c | 18 +-- bacula/src/dird/ua_tree.c | 36 ++--- bacula/src/dird/ua_update.c | 42 +++--- bacula/src/dird/verify.c | 4 +- bacula/src/filed/filed.h | 17 +-- bacula/src/filed/filed_conf.h | 2 +- bacula/src/filed/job.c | 12 +- bacula/src/filed/pythonfd.c | 16 +-- bacula/src/findlib/find.c | 8 +- bacula/src/findlib/find.h | 4 +- bacula/src/stored/btape.c | 56 ++++---- bacula/src/stored/pythonsd.c | 26 ++-- bacula/src/tools/Makefile.in | 7 +- bacula/src/tools/wild.c | 131 +++++++++++++++++++ bacula/src/version.h | 4 +- 32 files changed, 716 insertions(+), 485 deletions(-) create mode 100644 bacula/src/tools/wild.c diff --git a/bacula/Makefile.in b/bacula/Makefile.in index f6cd26a08a..015e38a6db 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -89,11 +89,16 @@ installdirs: $(MKDIR) $(DESTDIR)$(sbindir) $(MKDIR) $(DESTDIR)$(sysconfdir) $(MKDIR) $(DESTDIR)$(scriptdir) - $(MKDIR) $(DESTDIR)$(working_dir) + if test ! -e $(DESTDIR)$(working_dir) ; then \ + $(MKDIR) $(DESTDIR)$(working_dir); \ + -chmod 770 $(DESTDIR)$(working_dir); \ + fi if test "x$(dir_user)" != "x" ; then \ - chown -f $(dir_user) $(DESTDIR)$(working_dir); fi + -chown -f $(dir_user) $(DESTDIR)$(working_dir); \ + fi if test "x$(dir_group)" != "x" ; then \ - chown -f :$(dir_group) $(DESTDIR)$(working_dir); fi + -chown -f :$(dir_group) $(DESTDIR)$(working_dir); \ + fi # $(MKDIR) $(DESTDIR)$(mandir) gnomedirs: @@ -172,18 +177,16 @@ Makefile: Makefile.in Makefiles: $(SHELL) config.status (cd scripts; \ - chmod 755 startmysql stopmysql bacula startit stopit btraceback; \ - chmod 755 mtx-changer bconsole gconsole devel_bacula; \ - chmod 755 dvd-handler) + chmod 755 startmysql stopmysql bacula startit stopit btraceback; \ + chmod 755 mtx-changer bconsole gconsole devel_bacula; \ + chmod 755 dvd-handler) (cd src/cats; \ - chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \ - chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \ - \ - chmod 755 create_@DB_NAME@_database update_@DB_NAME@_tables make_@DB_NAME@_tables; \ - chmod 755 grant_@DB_NAME@_privileges drop_@DB_NAME@_tables drop_@DB_NAME@_database; \ - \ - chmod 755 make_catalog_backup delete_catalog_backup) + chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \ + chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \ + chmod 755 create_@DB_NAME@_database update_@DB_NAME@_tables make_@DB_NAME@_tables; \ + chmod 755 grant_@DB_NAME@_privileges drop_@DB_NAME@_tables drop_@DB_NAME@_database; \ + chmod 755 make_catalog_backup delete_catalog_backup) clean: @for I in ${all_subdirs}; \ diff --git a/bacula/kes-1.38 b/bacula/kes-1.38 index 5e38d64a0d..e9a73444ed 100644 --- a/bacula/kes-1.38 +++ b/bacula/kes-1.38 @@ -2,7 +2,34 @@ Kern Sibbald General: +Release 1.38.8 +11Apr06 +- Modify Makefile to change the permissions on Working Directory + to 770 if the directory is created. +- Do not fail the Makefile if changing the permissions or + owner/group on WorkingDir fails. +- Remove early selection of Scratch Volumes in the recycling + algorithm. +- Correct the old recycling algorithm so that Scratch Volumes + are selected when looking for a Volume in the changer. +- Correct a typo in the Verify SQL reported by Joe Park. +10Apr06 +- Remove automatic case folding on Windows FDs. You must + explictly use the 'Ignore Case = yes' option. +- Remove the code added to 1.38.6 and 1.38.7 that pulls a + scratch volume in an Autochanger early in the 'recycling' + algorithm. +08Apr06 +- Tweak license to include Microsoft restrictions. +- Move mysql.reconnect to after real_connect(). Thanks to + Frank Sweetser for the patch. +- Disallow a backslash in a File = directive (Windows junk) + unless the string is quoted. +- Apply Eric's patch to ua_label.c so that daemon protocol + is not translated. + Release 1.38.7 (06Apr06) released 07Apr06 +06Apr06 - Remove timed wait for VSS on Win2K3 as it is not yet implemented. - Correct bacula.in script to reference bacula-ctl-xx in the diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index bec71496d1..4c5e627ead 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,6 +2,28 @@ Kern Sibbald General: +11Apr06 +- More work on migration. +- Implement wild program in tools directory for testing + wild-cards. Almost identical to the regex program. +- Up port VSS single thread locking code. +- Replace N_(..) by NT_(...) to inhibit translation of + commands. +- Modify Makefile to change the permissions on Working Directory + to 770 if the directory is created. +- Do not fail the Makefile if changing the permissions or + owner/group on WorkingDir fails. +- Remove early selection of Scratch Volumes in the recycling + algorithm. +- Correct the old recycling algorithm so that Scratch Volumes + are selected when looking for a Volume in the changer. +- Correct a typo in the Verify SQL reported by Joe Park. +10Apr06 +- Remove automatic case folding on Windows FDs. You must + explictly use the 'Ignore Case = yes' option. +- Remove the code added to 1.38.6 and 1.38.7 that pulls a + scratch volume in an Autochanger early in the 'recycling' + algorithm. 09Apr06 - Make weof() and clrerror() methods of class DEVICE. 08Apr06 diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 7cd3dedf5b..7829cdd7ff 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -64,7 +64,7 @@ db_add_digest_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *digest, } /* Mark the file record as being visited during database - * verify compare. Stuff JobId into MarkedId field + * verify compare. Stuff JobId into the MarkId field */ int db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId) { diff --git a/bacula/src/dird/expand.c b/bacula/src/dird/expand.c index feded84c14..64221aacf5 100644 --- a/bacula/src/dird/expand.c +++ b/bacula/src/dird/expand.c @@ -33,7 +33,7 @@ static int date_item(JCR *jcr, int code, - const char **val_ptr, int *val_len, int *val_size) + const char **val_ptr, int *val_len, int *val_size) { struct tm tm; time_t now = time(NULL); @@ -42,25 +42,25 @@ static int date_item(JCR *jcr, int code, char buf[10]; switch (code) { - case 1: /* year */ + case 1: /* year */ val = tm.tm_year + 1900; break; - case 2: /* month */ + case 2: /* month */ val = tm.tm_mon + 1; break; - case 3: /* day */ + case 3: /* day */ val = tm.tm_mday; break; - case 4: /* hour */ + case 4: /* hour */ val = tm.tm_hour; break; - case 5: /* minute */ + case 5: /* minute */ val = tm.tm_min; break; - case 6: /* second */ + case 6: /* second */ val = tm.tm_sec; break; - case 7: /* Week day */ + case 7: /* Week day */ val = tm.tm_wday; break; } @@ -72,51 +72,51 @@ static int date_item(JCR *jcr, int code, } static int job_item(JCR *jcr, int code, - const char **val_ptr, int *val_len, int *val_size) + const char **val_ptr, int *val_len, int *val_size) { const char *str = " "; char buf[20]; switch (code) { - case 1: /* Job */ + case 1: /* Job */ str = jcr->job->hdr.name; break; case 2: /* Director's name */ str = my_name; break; - case 3: /* level */ + case 3: /* level */ str = job_level_to_str(jcr->JobLevel); break; - case 4: /* type */ + case 4: /* type */ str = job_type_to_str(jcr->JobType); break; - case 5: /* JobId */ + case 5: /* JobId */ bsnprintf(buf, sizeof(buf), "%d", jcr->JobId); str = buf; break; - case 6: /* Client */ + case 6: /* Client */ str = jcr->client->hdr.name; if (!str) { - str = " "; + str = " "; } break; - case 7: /* NumVols */ + case 7: /* NumVols */ bsnprintf(buf, sizeof(buf), "%d", jcr->NumVols); str = buf; break; - case 8: /* Pool */ + case 8: /* Pool */ str = jcr->pool->hdr.name; break; - case 9: /* Storage */ + case 9: /* Storage */ str = jcr->store->hdr.name; break; - case 10: /* Catalog */ + case 10: /* Catalog */ str = jcr->catalog->hdr.name; break; - case 11: /* MediaType */ + case 11: /* MediaType */ str = jcr->store->media_type; break; - case 12: /* JobName */ + case 12: /* JobName */ str = jcr->Job; break; } @@ -128,32 +128,32 @@ static int job_item(JCR *jcr, int code, struct s_built_in_vars {const char *var_name; int code; int (*func)(JCR *jcr, int code, - const char **val_ptr, int *val_len, int *val_size);}; + const char **val_ptr, int *val_len, int *val_size);}; /* * Table of build in variables */ static struct s_built_in_vars built_in_vars[] = { - { N_("Year"), 1, date_item}, - { N_("Month"), 2, date_item}, - { N_("Day"), 3, date_item}, - { N_("Hour"), 4, date_item}, - { N_("Minute"), 5, date_item}, - { N_("Second"), 6, date_item}, - { N_("WeekDay"), 7, date_item}, - - { N_("Job"), 1, job_item}, - { N_("Dir"), 2, job_item}, - { N_("Level"), 3, job_item}, - { N_("Type"), 4, job_item}, - { N_("JobId"), 5, job_item}, - { N_("Client"), 6, job_item}, - { N_("NumVols"), 7, job_item}, - { N_("Pool"), 8, job_item}, - { N_("Storage"), 9, job_item}, - { N_("Catalog"), 10, job_item}, - { N_("MediaType"), 11, job_item}, - { N_("JobName"), 12, job_item}, + { NT_("Year"), 1, date_item}, + { NT_("Month"), 2, date_item}, + { NT_("Day"), 3, date_item}, + { NT_("Hour"), 4, date_item}, + { NT_("Minute"), 5, date_item}, + { NT_("Second"), 6, date_item}, + { NT_("WeekDay"), 7, date_item}, + + { NT_("Job"), 1, job_item}, + { NT_("Dir"), 2, job_item}, + { NT_("Level"), 3, job_item}, + { NT_("Type"), 4, job_item}, + { NT_("JobId"), 5, job_item}, + { NT_("Client"), 6, job_item}, + { NT_("NumVols"), 7, job_item}, + { NT_("Pool"), 8, job_item}, + { NT_("Storage"), 9, job_item}, + { NT_("Catalog"), 10, job_item}, + { NT_("MediaType"), 11, job_item}, + { NT_("JobName"), 12, job_item}, { NULL, 0, NULL} }; @@ -164,20 +164,20 @@ static struct s_built_in_vars built_in_vars[] = { * call the appropriate subroutine to do the work. */ static var_rc_t lookup_built_in_var(var_t *ctx, void *my_ctx, - const char *var_ptr, int var_len, int var_index, - const char **val_ptr, int *val_len, int *val_size) + const char *var_ptr, int var_len, int var_index, + const char **val_ptr, int *val_len, int *val_size) { JCR *jcr = (JCR *)my_ctx; int stat; for (int i=0; _(built_in_vars[i].var_name); i++) { if (strncmp(_(built_in_vars[i].var_name), var_ptr, var_len) == 0) { - stat = (*built_in_vars[i].func)(jcr, built_in_vars[i].code, - val_ptr, val_len, val_size); - if (stat) { - return VAR_OK; - } - break; + stat = (*built_in_vars[i].func)(jcr, built_in_vars[i].code, + val_ptr, val_len, val_size); + if (stat) { + return VAR_OK; + } + break; } } return VAR_ERR_UNDEFINED_VARIABLE; @@ -188,8 +188,8 @@ static var_rc_t lookup_built_in_var(var_t *ctx, void *my_ctx, * Search counter variables */ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx, - const char *var_ptr, int var_len, int var_inc, int var_index, - const char **val_ptr, int *val_len, int *val_size) + const char *var_ptr, int var_len, int var_inc, int var_index, + const char **val_ptr, int *val_len, int *val_size) { char buf[MAXSTRING]; var_rc_t stat = VAR_ERR_UNDEFINED_VARIABLE; @@ -202,48 +202,48 @@ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx, LockRes(); for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) { if (strcmp(counter->hdr.name, buf) == 0) { - Dmsg2(100, "Counter=%s val=%d\n", buf, counter->CurrentValue); - /* -1 => return size of array */ - if (var_index == -1) { - bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue); - *val_len = bsnprintf(buf, sizeof(buf), "%d", strlen(buf)); - *val_ptr = buf; - *val_size = 0; /* don't try to free val_ptr */ - return VAR_OK; - } else { - bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue); - *val_ptr = bstrdup(buf); - *val_len = strlen(buf); - *val_size = *val_len + 1; - } - if (var_inc) { /* increment the variable? */ - if (counter->CurrentValue == counter->MaxValue) { - counter->CurrentValue = counter->MinValue; - } else { - counter->CurrentValue++; - } - if (counter->Catalog) { /* update catalog if need be */ - COUNTER_DBR cr; - JCR *jcr = (JCR *)my_ctx; - memset(&cr, 0, sizeof(cr)); - bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter)); - cr.MinValue = counter->MinValue; - cr.MaxValue = counter->MaxValue; - cr.CurrentValue = counter->CurrentValue; - Dmsg1(100, "New value=%d\n", cr.CurrentValue); - if (counter->WrapCounter) { - bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter)); - } else { - cr.WrapCounter[0] = 0; - } - if (!db_update_counter_record(jcr, jcr->db, &cr)) { - Jmsg(jcr, M_ERROR, 0, _("Count not update counter %s: ERR=%s\n"), - counter->hdr.name, db_strerror(jcr->db)); - } - } - } - stat = VAR_OK; - break; + Dmsg2(100, "Counter=%s val=%d\n", buf, counter->CurrentValue); + /* -1 => return size of array */ + if (var_index == -1) { + bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue); + *val_len = bsnprintf(buf, sizeof(buf), "%d", strlen(buf)); + *val_ptr = buf; + *val_size = 0; /* don't try to free val_ptr */ + return VAR_OK; + } else { + bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue); + *val_ptr = bstrdup(buf); + *val_len = strlen(buf); + *val_size = *val_len + 1; + } + if (var_inc) { /* increment the variable? */ + if (counter->CurrentValue == counter->MaxValue) { + counter->CurrentValue = counter->MinValue; + } else { + counter->CurrentValue++; + } + if (counter->Catalog) { /* update catalog if need be */ + COUNTER_DBR cr; + JCR *jcr = (JCR *)my_ctx; + memset(&cr, 0, sizeof(cr)); + bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter)); + cr.MinValue = counter->MinValue; + cr.MaxValue = counter->MaxValue; + cr.CurrentValue = counter->CurrentValue; + Dmsg1(100, "New value=%d\n", cr.CurrentValue); + if (counter->WrapCounter) { + bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter)); + } else { + cr.WrapCounter[0] = 0; + } + if (!db_update_counter_record(jcr, jcr->db, &cr)) { + Jmsg(jcr, M_ERROR, 0, _("Count not update counter %s: ERR=%s\n"), + counter->hdr.name, db_strerror(jcr->db)); + } + } + } + stat = VAR_OK; + break; } } UnlockRes(); @@ -255,8 +255,8 @@ static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx, * Called here from "core" expand code to look up a variable */ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, - const char *var_ptr, int var_len, int var_inc, int var_index, - const char **val_ptr, int *val_len, int *val_size) + const char *var_ptr, int var_len, int var_inc, int var_index, + const char **val_ptr, int *val_len, int *val_size) { char buf[MAXSTRING], *val, *p, *v; var_rc_t stat; @@ -264,12 +264,12 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, /* Note, if val_size > 0 and val_ptr!=NULL, the core code will free() it */ if ((stat = lookup_built_in_var(ctx, my_ctx, var_ptr, var_len, var_index, - val_ptr, val_len, val_size)) == VAR_OK) { + val_ptr, val_len, val_size)) == VAR_OK) { return VAR_OK; } if ((stat = lookup_counter_var(ctx, my_ctx, var_ptr, var_len, var_inc, var_index, - val_ptr, val_len, val_size)) == VAR_OK) { + val_ptr, val_len, val_size)) == VAR_OK) { return VAR_OK; } @@ -287,11 +287,11 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, /* He wants to index the "array" */ count = 1; /* Find the size of the "array" - * each element is separated by a | + * each element is separated by a | */ for (p = val; *p; p++) { if (*p == '|') { - count++; + count++; } } Dmsg3(100, "For %s, reqest index=%d have=%d\n", @@ -300,10 +300,10 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, /* -1 => return size of array */ if (var_index == -1) { int len; - if (count == 1) { /* if not array */ - len = strlen(val); /* return length of string */ + if (count == 1) { /* if not array */ + len = strlen(val); /* return length of string */ } else { - len = count; /* else return # array items */ + len = count; /* else return # array items */ } *val_len = bsnprintf(buf, sizeof(buf), "%d", len); *val_ptr = buf; @@ -320,12 +320,12 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, count = 0; for (p=val; *p; ) { if (*p == '|') { - if (count < var_index) { - val = ++p; - count++; - continue; - } - break; + if (count < var_index) { + val = ++p; + count++; + continue; + } + break; } p++; } @@ -352,10 +352,10 @@ static var_rc_t lookup_var(var_t *ctx, void *my_ctx, * out_ptr points to string to be returned */ static var_rc_t operate_var(var_t *var, void *my_ctx, - const char *op_ptr, int op_len, - const char *arg_ptr, int arg_len, - const char *val_ptr, int val_len, - char **out_ptr, int *out_len, int *out_size) + const char *op_ptr, int op_len, + const char *arg_ptr, int arg_len, + const char *val_ptr, int val_len, + char **out_ptr, int *out_len, int *out_size) { var_rc_t stat = VAR_ERR_UNDEFINED_OPERATION; Dmsg0(100, "Enter operate_var\n"); @@ -366,7 +366,7 @@ static var_rc_t operate_var(var_t *var, void *my_ctx, if (op_len == 3 && strncmp(op_ptr, "inc", 3) == 0) { char buf[MAXSTRING]; if (val_len > (int)sizeof(buf) - 1) { - return VAR_ERR_OUT_OF_MEMORY; + return VAR_ERR_OUT_OF_MEMORY; } memcpy(buf, arg_ptr, arg_len); buf[arg_len] = 0; @@ -376,10 +376,10 @@ static var_rc_t operate_var(var_t *var, void *my_ctx, Dmsg1(100, "Val=%s\n", buf); LockRes(); for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) { - if (strcmp(counter->hdr.name, buf) == 0) { - Dmsg2(100, "counter=%s val=%s\n", counter->hdr.name, buf); - break; - } + if (strcmp(counter->hdr.name, buf) == 0) { + Dmsg2(100, "counter=%s val=%s\n", counter->hdr.name, buf); + break; + } } UnlockRes(); return stat; @@ -393,7 +393,7 @@ static var_rc_t operate_var(var_t *var, void *my_ctx, * Expand an input line and return it. * * Returns: 0 on failure - * 1 on success and exp has expanded input + * 1 on success and exp has expanded input */ int variable_expansion(JCR *jcr, char *inp, POOLMEM **exp) { @@ -435,7 +435,7 @@ int variable_expansion(JCR *jcr, char *inp, POOLMEM **exp) /* expand variables */ if ((stat = var_expand(var_ctx, inp, in_len, &outp, &out_len, 0)) != VAR_OK) { Jmsg(jcr, M_ERROR, 0, _("Cannot expand expression \"%s\": ERR=%s\n"), - inp, var_strerror(var_ctx, stat)); + inp, var_strerror(var_ctx, stat)); goto bail_out; } diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 6194de9025..abc2171e58 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -126,11 +126,11 @@ bool do_migration(JCR *jcr) migration_cleanup(jcr, jcr->JobStatus); return true; /* no work */ } - Dmsg4(100, "Target: Name=%s JobId=%d Type=%c Level=%c\n", + Dmsg4(000, "Target: Name=%s JobId=%d Type=%c Level=%c\n", jcr->previous_jr.Name, jcr->previous_jr.JobId, jcr->previous_jr.JobType, jcr->previous_jr.JobLevel); - Dmsg4(100, "Current: Name=%s JobId=%d Type=%c Level=%c\n", + Dmsg4(000, "Current: Name=%s JobId=%d Type=%c Level=%c\n", jcr->jr.Name, jcr->jr.JobId, jcr->jr.JobType, jcr->jr.JobLevel); @@ -219,7 +219,7 @@ bool do_migration(JCR *jcr) set_jcr_job_status(jcr, JS_Running); set_jcr_job_status(tjcr, JS_Running); - Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel); + Dmsg2(000, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel); if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); return false; @@ -325,7 +325,7 @@ static int unique_name_handler(void *ctx, int num_fields, char **row) memset(new_item, 0, sizeof(uitem)); new_item->item = bstrdup(row[0]); - + Dmsg1(000, "Item=%s\n", row[0]); item = (uitem *)list->binary_insert((void *)new_item, item_compare); if (item != new_item) { /* already in list */ free(new_item->item); @@ -370,9 +370,14 @@ const char *sql_client = " Job.PoolId=Media.PoolId"; const char *sql_job = - "SELECT DISTINCT Job.Name from Pool,Media,Job,JobMedia " - " WHERE Media.PoolId=Pool.PoolId AND Pool.Name='%s' AND" - " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId"; + "SELECT DISTINCT Job.Name from Job,Pool" + " WHERE Pool.Name='%s' AND Job.PoolId=Pool.PoolId"; + +const char *sql_jobids_from_job = + "SELECT DISTINCT Job.JobId FROM Job,Pool" + " WHERE Job.Name=%s AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId" + " ORDER by Job.StartTime"; + const char *sql_ujobid = "SELECT DISTINCT Job.Job from Client,Pool,Media,Job,JobMedia " @@ -399,11 +404,14 @@ static bool get_job_to_migrate(JCR *jcr) char *p; dlist *item_chain; uitem *item = NULL; + uitem *last_item = NULL; char prbuf[500]; regex_t preg; + JobIds[0] = 0; if (jcr->MigrateJobId != 0) { jcr->previous_jr.JobId = jcr->MigrateJobId; + Dmsg1(000, "previous jobid=%u\n", jcr->MigrateJobId); } else { switch (jcr->job->selection_type) { case MT_SMALLEST_VOL: @@ -427,7 +435,7 @@ static bool get_job_to_migrate(JCR *jcr) _("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db)); goto bail_out; } - Dmsg1(000, "Jobids=%s\n", JobIds); + Dmsg1(000, "Smallest Vol Jobids=%s\n", JobIds); break; case MT_OLDEST_VOL: Mmsg(query, sql_oldest_vol, jcr->pool->hdr.name); @@ -449,7 +457,7 @@ static bool get_job_to_migrate(JCR *jcr) _("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db)); goto bail_out; } - Dmsg1(000, "Jobids=%s\n", JobIds); + Dmsg1(000, "Oldest Vol Jobids=%s\n", JobIds); break; case MT_POOL_OCCUPANCY: Mmsg(query, sql_pool_bytes, jcr->pool->hdr.name); @@ -464,14 +472,17 @@ static bool get_job_to_migrate(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("No jobs found to migrate.\n")); goto ok_out; } + Dmsg1(000, "Pool Occupancy Jobids=%s\n", JobIds); break; case MT_POOL_TIME: + Dmsg0(000, "Pool time not implemented\n"); break; case MT_CLIENT: if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n")); + Jmsg(jcr, M_FATAL, 0, _("No Migration Client selection pattern specified.\n")); goto bail_out; } + Dmsg1(000, "Client regex=%s\n", jcr->job->selection_pattern); rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED); if (rc != 0) { regerror(rc, &preg, prbuf, sizeof(prbuf)); @@ -502,9 +513,10 @@ static bool get_job_to_migrate(JCR *jcr) break; case MT_VOLUME: if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n")); + Jmsg(jcr, M_FATAL, 0, _("No Migration Volume selection pattern specified.\n")); goto bail_out; } + Dmsg1(000, "Volume regex=%s\n", jcr->job->selection_pattern); rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED); if (rc != 0) { regerror(rc, &preg, prbuf, sizeof(prbuf)); @@ -535,43 +547,78 @@ static bool get_job_to_migrate(JCR *jcr) break; case MT_JOB: if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n")); + Jmsg(jcr, M_FATAL, 0, _("No Migration Job selection pattern specified.\n")); goto bail_out; } + Dmsg1(000, "Job regex=%s\n", jcr->job->selection_pattern); rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED); if (rc != 0) { regerror(rc, &preg, prbuf, sizeof(prbuf)); Jmsg(jcr, M_FATAL, 0, _("Could not compile regex pattern \"%s\" ERR=%s\n"), jcr->job->selection_pattern, prbuf); + goto bail_out; } item_chain = New(dlist(item, &item->link)); Mmsg(query, sql_job, jcr->pool->hdr.name); - Dmsg1(100, "query=%s\n", query.c_str()); + Dmsg1(000, "query=%s\n", query.c_str()); if (!db_sql_query(jcr->db, query.c_str(), unique_name_handler, (void *)item_chain)) { Jmsg(jcr, M_FATAL, 0, _("SQL to get Job failed. ERR=%s\n"), db_strerror(jcr->db)); goto bail_out; } - /* Now apply the regex and create the jobs */ + /* Now apply the regex and remove any item not matched */ foreach_dlist(item, item_chain) { const int nmatch = 30; regmatch_t pmatch[nmatch]; + if (last_item) { + free(last_item->item); + item_chain->remove(last_item); + } + Dmsg1(000, "Jobitem=%s\n", item->item); rc = regexec(&preg, item->item, nmatch, pmatch, 0); if (rc == 0) { - Dmsg1(000, "Do Job=%s\n", item->item); + last_item = NULL; /* keep this one */ + } else { + last_item = item; } - free(item->item); + } + if (last_item) { + free(last_item->item); + item_chain->remove(last_item); } regfree(&preg); + /* + * At this point, we have a list of items in item_chain + * that have been matched by the regex, so now we need + * to look up their jobids. + */ + JobIds = get_pool_memory(PM_MESSAGE); + JobIds[0] = 0; + foreach_dlist(item, item_chain) { + Dmsg1(000, "Got Job: %s\n", item->item); + Mmsg(query, sql_jobids_from_job, item->item, jcr->pool->hdr.name); + if (!db_sql_query(jcr->db, query.c_str(), jobid_handler, (void *)JobIds)) { + Jmsg(jcr, M_FATAL, 0, + _("SQL failed. ERR=%s\n"), db_strerror(jcr->db)); + goto bail_out; + } + } + if (JobIds[0] == 0) { + Jmsg(jcr, M_INFO, 0, _("No jobs found to migrate.\n")); + goto ok_out; + } + Dmsg1(000, "Job Jobids=%s\n", JobIds); + free_pool_memory(JobIds); delete item_chain; break; case MT_SQLQUERY: JobIds[0] = 0; if (!jcr->job->selection_pattern) { - Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n")); + Jmsg(jcr, M_FATAL, 0, _("No Migration SQL selection pattern specified.\n")); goto bail_out; } + Dmsg1(000, "SQL=%s\n", jcr->job->selection_pattern); if (!db_sql_query(jcr->db, query.c_str(), jobid_handler, (void *)JobIds)) { Jmsg(jcr, M_FATAL, 0, _("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db)); @@ -591,6 +638,7 @@ static bool get_job_to_migrate(JCR *jcr) } p = JobIds; + JobId = 0; stat = get_next_jobid_from_list(&p, &JobId); Dmsg2(000, "get_next_jobid stat=%d JobId=%u\n", stat, JobId); if (stat < 0) { diff --git a/bacula/src/dird/next_vol.c b/bacula/src/dird/next_vol.c index bc98a90b26..4b09c70ff4 100644 --- a/bacula/src/dird/next_vol.c +++ b/bacula/src/dird/next_vol.c @@ -63,30 +63,34 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, int index, bool create) */ ok = db_find_next_volume(jcr, jcr->db, index, InChanger, mr); Dmsg2(100, "catreq after find_next_vol ok=%d FW=%d\n", ok, mr->FirstWritten); - /* - * 2. Try pulling a Scratch volume if one exists in the autochanger - */ - if (!ok && InChanger) { - ok = get_scratch_volume(jcr, mr, InChanger); - } if (!ok) { /* - * 3. Try finding a recycled volume + * 2. Try finding a recycled volume */ ok = find_recycled_volume(jcr, InChanger, mr); Dmsg2(100, "find_recycled_volume %d FW=%d\n", ok, mr->FirstWritten); if (!ok) { /* - * 4. Try recycling any purged volume + * 3. Try recycling any purged volume */ ok = recycle_oldest_purged_volume(jcr, InChanger, mr); if (!ok) { /* - * 5. Try pruning Volumes + * 4. Try pruning Volumes */ prune_volumes(jcr); ok = recycle_oldest_purged_volume(jcr, InChanger, mr); + if (!ok) { + /* + * 5. Try pulling a volume from the Scratch pool + */ + ok = get_scratch_volume(jcr, mr, InChanger); + } + /* + * If we are using an Autochanger and have not found + * a volume, retry looking for any volume. + */ if (InChanger) { InChanger = false; if (!ok) { @@ -96,16 +100,10 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, int index, bool create) } } - if (!ok) { - /* - * 6. Try pulling a volume from the Scratch pool - */ - ok = get_scratch_volume(jcr, mr, InChanger); - } if (!ok && create) { /* - * 7. Try "creating" a new Volume + * 6. Try "creating" a new Volume */ ok = newVolume(jcr, mr); } @@ -123,14 +121,14 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, int index, bool create) UAContext *ua; Dmsg0(400, "Try purge.\n"); /* - * 8. Try to purging oldest volume only if not UA calling us. + * 7. Try to purging oldest volume only if not UA calling us. */ ua = new_ua_context(jcr); if (jcr->pool->purge_oldest_volume && create) { Jmsg(jcr, M_INFO, 0, _("Purging oldest volume \"%s\"\n"), mr->VolumeName); ok = purge_jobs_from_volume(ua, mr); /* - * 9. or try recycling the oldest volume + * 8. or try recycling the oldest volume */ } else if (jcr->pool->recycle_oldest_volume) { Jmsg(jcr, M_INFO, 0, _("Pruning oldest volume \"%s\"\n"), mr->VolumeName); diff --git a/bacula/src/dird/run_conf.c b/bacula/src/dird/run_conf.c index 6a9946feb8..162b4945e5 100644 --- a/bacula/src/dird/run_conf.c +++ b/bacula/src/dird/run_conf.c @@ -54,64 +54,64 @@ struct s_keyw { /* Keywords understood by parser */ static struct s_keyw keyw[] = { - {N_("on"), s_none, 0}, - {N_("at"), s_at, 0}, + {NT_("on"), s_none, 0}, + {NT_("at"), s_at, 0}, - {N_("sun"), s_wday, 0}, - {N_("mon"), s_wday, 1}, - {N_("tue"), s_wday, 2}, - {N_("wed"), s_wday, 3}, - {N_("thu"), s_wday, 4}, - {N_("fri"), s_wday, 5}, - {N_("sat"), s_wday, 6}, - {N_("jan"), s_month, 0}, - {N_("feb"), s_month, 1}, - {N_("mar"), s_month, 2}, - {N_("apr"), s_month, 3}, - {N_("may"), s_month, 4}, - {N_("jun"), s_month, 5}, - {N_("jul"), s_month, 6}, - {N_("aug"), s_month, 7}, - {N_("sep"), s_month, 8}, - {N_("oct"), s_month, 9}, - {N_("nov"), s_month, 10}, - {N_("dec"), s_month, 11}, + {NT_("sun"), s_wday, 0}, + {NT_("mon"), s_wday, 1}, + {NT_("tue"), s_wday, 2}, + {NT_("wed"), s_wday, 3}, + {NT_("thu"), s_wday, 4}, + {NT_("fri"), s_wday, 5}, + {NT_("sat"), s_wday, 6}, + {NT_("jan"), s_month, 0}, + {NT_("feb"), s_month, 1}, + {NT_("mar"), s_month, 2}, + {NT_("apr"), s_month, 3}, + {NT_("may"), s_month, 4}, + {NT_("jun"), s_month, 5}, + {NT_("jul"), s_month, 6}, + {NT_("aug"), s_month, 7}, + {NT_("sep"), s_month, 8}, + {NT_("oct"), s_month, 9}, + {NT_("nov"), s_month, 10}, + {NT_("dec"), s_month, 11}, - {N_("sunday"), s_wday, 0}, - {N_("monday"), s_wday, 1}, - {N_("tuesday"), s_wday, 2}, - {N_("wednesday"), s_wday, 3}, - {N_("thursday"), s_wday, 4}, - {N_("friday"), s_wday, 5}, - {N_("saturday"), s_wday, 6}, - {N_("january"), s_month, 0}, - {N_("february"), s_month, 1}, - {N_("march"), s_month, 2}, - {N_("april"), s_month, 3}, - {N_("june"), s_month, 5}, - {N_("july"), s_month, 6}, - {N_("august"), s_month, 7}, - {N_("september"), s_month, 8}, - {N_("october"), s_month, 9}, - {N_("november"), s_month, 10}, - {N_("december"), s_month, 11}, + {NT_("sunday"), s_wday, 0}, + {NT_("monday"), s_wday, 1}, + {NT_("tuesday"), s_wday, 2}, + {NT_("wednesday"), s_wday, 3}, + {NT_("thursday"), s_wday, 4}, + {NT_("friday"), s_wday, 5}, + {NT_("saturday"), s_wday, 6}, + {NT_("january"), s_month, 0}, + {NT_("february"), s_month, 1}, + {NT_("march"), s_month, 2}, + {NT_("april"), s_month, 3}, + {NT_("june"), s_month, 5}, + {NT_("july"), s_month, 6}, + {NT_("august"), s_month, 7}, + {NT_("september"), s_month, 8}, + {NT_("october"), s_month, 9}, + {NT_("november"), s_month, 10}, + {NT_("december"), s_month, 11}, - {N_("daily"), s_daily, 0}, - {N_("weekly"), s_weekly, 0}, - {N_("monthly"), s_monthly, 0}, - {N_("hourly"), s_hourly, 0}, + {NT_("daily"), s_daily, 0}, + {NT_("weekly"), s_weekly, 0}, + {NT_("monthly"), s_monthly, 0}, + {NT_("hourly"), s_hourly, 0}, - {N_("1st"), s_wom, 0}, - {N_("2nd"), s_wom, 1}, - {N_("3rd"), s_wom, 2}, - {N_("4th"), s_wom, 3}, - {N_("5th"), s_wom, 4}, + {NT_("1st"), s_wom, 0}, + {NT_("2nd"), s_wom, 1}, + {NT_("3rd"), s_wom, 2}, + {NT_("4th"), s_wom, 3}, + {NT_("5th"), s_wom, 4}, - {N_("first"), s_wom, 0}, - {N_("second"), s_wom, 1}, - {N_("third"), s_wom, 2}, - {N_("fourth"), s_wom, 3}, - {N_("fifth"), s_wom, 4}, + {NT_("first"), s_wom, 0}, + {NT_("second"), s_wom, 1}, + {NT_("third"), s_wom, 2}, + {NT_("fourth"), s_wom, 3}, + {NT_("fifth"), s_wom, 4}, {NULL, s_none, 0} }; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 254810fe00..4fe9dc9df0 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -87,47 +87,47 @@ int quit_cmd(UAContext *ua, const char *cmd); struct cmdstruct { const char *key; int (*func)(UAContext *ua, const char *cmd); const char *help; }; static struct cmdstruct commands[] = { - { N_("add"), add_cmd, _("add media to a pool")}, - { N_("autodisplay"), autodisplay_cmd, _("autodisplay [on|off] -- console messages")}, - { N_("automount"), automount_cmd, _("automount [on|off] -- after label")}, - { N_("cancel"), cancel_cmd, _("cancel [ | ] -- cancel a job")}, - { N_("create"), create_cmd, _("create DB Pool from resource")}, - { N_("delete"), delete_cmd, _("delete [pool= | media volume=]")}, - { N_("disable"), disable_cmd, _("disable -- disable a job")}, - { N_("enable"), enable_cmd, _("enable -- enable a job")}, - { N_("estimate"), estimate_cmd, _("performs FileSet estimate, listing gives full listing")}, - { N_("exit"), quit_cmd, _("exit = quit")}, - { N_("gui"), gui_cmd, _("gui [on|off] -- non-interactive gui mode")}, - { N_("help"), help_cmd, _("print this command")}, - { N_("list"), list_cmd, _("list [pools | jobs | jobtotals | media | files ]; from catalog")}, - { N_("label"), label_cmd, _("label a tape")}, - { N_("llist"), llist_cmd, _("full or long list like list command")}, - { N_("messages"), messagescmd, _("messages")}, - { N_("mount"), mount_cmd, _("mount ")}, - { N_("prune"), prunecmd, _("prune expired records from catalog")}, - { N_("purge"), purgecmd, _("purge records from catalog")}, - { N_("python"), python_cmd, _("python control commands")}, - { N_("quit"), quit_cmd, _("quit")}, - { N_("query"), querycmd, _("query catalog")}, - { N_("restore"), restore_cmd, _("restore files")}, - { N_("relabel"), relabel_cmd, _("relabel a tape")}, - { N_("release"), release_cmd, _("release ")}, - { N_("reload"), reload_cmd, _("reload conf file")}, - { N_("run"), run_cmd, _("run ")}, - { N_("status"), status_cmd, _("status [storage | client]=")}, - { N_("setdebug"), setdebug_cmd, _("sets debug level")}, - { N_("setip"), setip_cmd, _("sets new client address -- if authorized")}, - { N_("show"), show_cmd, _("show (resource records) [jobs | pools | ... | all]")}, - { N_("sqlquery"), sqlquerycmd, _("use SQL to query catalog")}, - { N_("time"), time_cmd, _("print current time")}, - { N_("trace"), trace_cmd, _("turn on/off trace to file")}, - { N_("unmount"), unmount_cmd, _("unmount ")}, - { N_("umount"), unmount_cmd, _("umount for old-time Unix guys")}, - { N_("update"), update_cmd, _("update Volume, Pool or slots")}, - { N_("use"), use_cmd, _("use catalog xxx")}, - { N_("var"), var_cmd, _("does variable expansion")}, - { N_("version"), version_cmd, _("print Director version")}, - { N_("wait"), wait_cmd, _("wait until no jobs are running [ | | ]")}, + { NT_("add"), add_cmd, _("add media to a pool")}, + { NT_("autodisplay"), autodisplay_cmd, _("autodisplay [on|off] -- console messages")}, + { NT_("automount"), automount_cmd, _("automount [on|off] -- after label")}, + { NT_("cancel"), cancel_cmd, _("cancel [ | ] -- cancel a job")}, + { NT_("create"), create_cmd, _("create DB Pool from resource")}, + { NT_("delete"), delete_cmd, _("delete [pool= | media volume=]")}, + { NT_("disable"), disable_cmd, _("disable -- disable a job")}, + { NT_("enable"), enable_cmd, _("enable -- enable a job")}, + { NT_("estimate"), estimate_cmd, _("performs FileSet estimate, listing gives full listing")}, + { NT_("exit"), quit_cmd, _("exit = quit")}, + { NT_("gui"), gui_cmd, _("gui [on|off] -- non-interactive gui mode")}, + { NT_("help"), help_cmd, _("print this command")}, + { NT_("list"), list_cmd, _("list [pools | jobs | jobtotals | media | files ]; from catalog")}, + { NT_("label"), label_cmd, _("label a tape")}, + { NT_("llist"), llist_cmd, _("full or long list like list command")}, + { NT_("messages"), messagescmd, _("messages")}, + { NT_("mount"), mount_cmd, _("mount ")}, + { NT_("prune"), prunecmd, _("prune expired records from catalog")}, + { NT_("purge"), purgecmd, _("purge records from catalog")}, + { NT_("python"), python_cmd, _("python control commands")}, + { NT_("quit"), quit_cmd, _("quit")}, + { NT_("query"), querycmd, _("query catalog")}, + { NT_("restore"), restore_cmd, _("restore files")}, + { NT_("relabel"), relabel_cmd, _("relabel a tape")}, + { NT_("release"), release_cmd, _("release ")}, + { NT_("reload"), reload_cmd, _("reload conf file")}, + { NT_("run"), run_cmd, _("run ")}, + { NT_("status"), status_cmd, _("status [storage | client]=")}, + { NT_("setdebug"), setdebug_cmd, _("sets debug level")}, + { NT_("setip"), setip_cmd, _("sets new client address -- if authorized")}, + { NT_("show"), show_cmd, _("show (resource records) [jobs | pools | ... | all]")}, + { NT_("sqlquery"), sqlquerycmd, _("use SQL to query catalog")}, + { NT_("time"), time_cmd, _("print current time")}, + { NT_("trace"), trace_cmd, _("turn on/off trace to file")}, + { NT_("unmount"), unmount_cmd, _("unmount ")}, + { NT_("umount"), unmount_cmd, _("umount for old-time Unix guys")}, + { NT_("update"), update_cmd, _("update Volume, Pool or slots")}, + { NT_("use"), use_cmd, _("use catalog xxx")}, + { NT_("var"), var_cmd, _("does variable expansion")}, + { NT_("version"), version_cmd, _("print Director version")}, + { NT_("wait"), wait_cmd, _("wait until no jobs are running [ | | ]")}, }; #define comsize (sizeof(commands)/sizeof(struct cmdstruct)) @@ -629,7 +629,7 @@ static void do_en_disable_cmd(UAContext *ua, bool setting) JOB *job; int i; - i = find_arg_with_value(ua, N_("job")); + i = find_arg_with_value(ua, NT_("job")); if (i < 0) { job = select_job_resource(ua); if (!job) { @@ -1110,9 +1110,9 @@ static int reload_cmd(UAContext *ua, const char *cmd) static int delete_cmd(UAContext *ua, const char *cmd) { static const char *keywords[] = { - N_("volume"), - N_("pool"), - N_("jobid"), + NT_("volume"), + NT_("pool"), + NT_("jobid"), NULL}; if (!open_db(ua)) { @@ -1172,7 +1172,7 @@ static void delete_job(UAContext *ua) JobId_t JobId; char *s,*sep,*tok; - int i = find_arg_with_value(ua, N_("jobid")); + int i = find_arg_with_value(ua, NT_("jobid")); if (i >= 0) { if (strchr(ua->argv[i], ',') != NULL || strchr(ua->argv[i], '-') != NULL) { s = bstrdup(ua->argv[i]); diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index 60f9c62e09..5ddfd9e561 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -58,22 +58,22 @@ static int getmsgscmd(UAContext *ua, const char *cmd); struct cmdstruct { const char *key; int (*func)(UAContext *ua, const char *cmd); const char *help; }; static struct cmdstruct commands[] = { - { N_(".die"), diecmd, NULL}, - { N_(".jobs"), jobscmd, NULL}, - { N_(".filesets"), filesetscmd, NULL}, - { N_(".clients"), clientscmd, NULL}, - { N_(".msgs"), msgscmd, NULL}, - { N_(".pools"), poolscmd, NULL}, - { N_(".types"), typescmd, NULL}, - { N_(".backups"), backupscmd, NULL}, - { N_(".levels"), levelscmd, NULL}, - { N_(".status"), qstatus_cmd, NULL}, - { N_(".storage"), storagecmd, NULL}, - { N_(".defaults"), defaultscmd, NULL}, - { N_(".messages"), getmsgscmd, NULL}, - { N_(".help"), qhelp_cmd, NULL}, - { N_(".quit"), quit_cmd, NULL}, - { N_(".exit"), quit_cmd, NULL} + { NT_(".die"), diecmd, NULL}, + { NT_(".jobs"), jobscmd, NULL}, + { NT_(".filesets"), filesetscmd, NULL}, + { NT_(".clients"), clientscmd, NULL}, + { NT_(".msgs"), msgscmd, NULL}, + { NT_(".pools"), poolscmd, NULL}, + { NT_(".types"), typescmd, NULL}, + { NT_(".backups"), backupscmd, NULL}, + { NT_(".levels"), levelscmd, NULL}, + { NT_(".status"), qstatus_cmd, NULL}, + { NT_(".storage"), storagecmd, NULL}, + { NT_(".defaults"), defaultscmd, NULL}, + { NT_(".messages"), getmsgscmd, NULL}, + { NT_(".help"), qhelp_cmd, NULL}, + { NT_(".quit"), quit_cmd, NULL}, + { NT_(".exit"), quit_cmd, NULL} }; #define comsize (sizeof(commands)/sizeof(struct cmdstruct)) diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 285c7902fe..1c7ad3797b 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -168,7 +168,7 @@ void update_slots(UAContext *ua) set_storage(ua->jcr, store); drive = get_storage_drive(ua, store); - scan = find_arg(ua, N_("scan")) >= 0; + scan = find_arg(ua, NT_("scan")) >= 0; max_slots = get_num_slots_from_SD(ua); Dmsg1(100, "max_slots=%d\n", max_slots); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index dce6f8b876..d53d41ad11 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -49,8 +49,8 @@ static bool list_nextvol(UAContext *ua, int ndays); int autodisplay_cmd(UAContext *ua, const char *cmd) { static const char *kw[] = { - N_("on"), - N_("off"), + NT_("on"), + NT_("off"), NULL}; switch (find_arg_keyword(ua, kw)) { @@ -73,8 +73,8 @@ int autodisplay_cmd(UAContext *ua, const char *cmd) int gui_cmd(UAContext *ua, const char *cmd) { static const char *kw[] = { - N_("on"), - N_("off"), + NT_("on"), + NT_("off"), NULL}; switch (find_arg_keyword(ua, kw)) { @@ -95,19 +95,19 @@ int gui_cmd(UAContext *ua, const char *cmd) struct showstruct {const char *res_name; int type;}; static struct showstruct reses[] = { - {N_("directors"), R_DIRECTOR}, - {N_("clients"), R_CLIENT}, - {N_("counters"), R_COUNTER}, - {N_("devices"), R_DEVICE}, - {N_("jobs"), R_JOB}, - {N_("storages"), R_STORAGE}, - {N_("catalogs"), R_CATALOG}, - {N_("schedules"), R_SCHEDULE}, - {N_("filesets"), R_FILESET}, - {N_("pools"), R_POOL}, - {N_("messages"), R_MSGS}, - {N_("all"), -1}, - {N_("help"), -2}, + {NT_("directors"), R_DIRECTOR}, + {NT_("clients"), R_CLIENT}, + {NT_("counters"), R_COUNTER}, + {NT_("devices"), R_DEVICE}, + {NT_("jobs"), R_JOB}, + {NT_("storages"), R_STORAGE}, + {NT_("catalogs"), R_CATALOG}, + {NT_("schedules"), R_SCHEDULE}, + {NT_("filesets"), R_FILESET}, + {NT_("pools"), R_POOL}, + {NT_("messages"), R_MSGS}, + {NT_("all"), -1}, + {NT_("help"), -2}, {NULL, 0} }; @@ -256,20 +256,20 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) /* Scan arguments looking for things to do */ for (i=1; iargc; i++) { /* List JOBS */ - if (strcasecmp(ua->argk[i], N_("jobs")) == 0) { + if (strcasecmp(ua->argk[i], NT_("jobs")) == 0) { /* Apply any limit */ - j = find_arg_with_value(ua, N_("limit")); + j = find_arg_with_value(ua, NT_("limit")); if (j >= 0) { jr.limit = atoi(ua->argv[j]); } db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist); /* List JOBTOTALS */ - } else if (strcasecmp(ua->argk[i], N_("jobtotals")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("jobtotals")) == 0) { db_list_job_totals(ua->jcr, ua->db, &jr, prtit, ua); /* List JOBID=nn */ - } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0) { if (ua->argv[i]) { jobid = str_to_int64(ua->argv[i]); if (jobid > 0) { @@ -279,28 +279,28 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } /* List JOB=xxx */ - } else if ((strcasecmp(ua->argk[i], N_("job")) == 0 || - strcasecmp(ua->argk[i], N_("jobname")) == 0) && ua->argv[i]) { + } else if ((strcasecmp(ua->argk[i], NT_("job")) == 0 || + strcasecmp(ua->argk[i], NT_("jobname")) == 0) && ua->argv[i]) { bstrncpy(jr.Name, ua->argv[i], MAX_NAME_LENGTH); jr.JobId = 0; db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist); /* List UJOBID=xxx */ - } else if (strcasecmp(ua->argk[i], N_("ujobid")) == 0 && ua->argv[i]) { + } else if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0 && ua->argv[i]) { bstrncpy(jr.Job, ua->argv[i], MAX_NAME_LENGTH); jr.JobId = 0; db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist); /* List FILES */ - } else if (strcasecmp(ua->argk[i], N_("files")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("files")) == 0) { for (j=i+1; jargc; j++) { - if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) { + if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) { bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH); jr.JobId = 0; db_get_job_record(ua->jcr, ua->db, &jr); jobid = jr.JobId; - } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) { + } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) { jobid = str_to_int64(ua->argv[j]); } else { continue; @@ -311,15 +311,15 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } /* List JOBMEDIA */ - } else if (strcasecmp(ua->argk[i], N_("jobmedia")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("jobmedia")) == 0) { int done = FALSE; for (j=i+1; jargc; j++) { - if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) { + if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) { bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH); jr.JobId = 0; db_get_job_record(ua->jcr, ua->db, &jr); jobid = jr.JobId; - } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) { + } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) { jobid = str_to_int64(ua->argv[j]); } else { continue; @@ -333,8 +333,8 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } /* List POOLS */ - } else if (strcasecmp(ua->argk[i], N_("pool")) == 0 || - strcasecmp(ua->argk[i], N_("pools")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("pool")) == 0 || + strcasecmp(ua->argk[i], NT_("pools")) == 0) { POOL_DBR pr; memset(&pr, 0, sizeof(pr)); if (ua->argv[i]) { @@ -342,22 +342,22 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } db_list_pool_records(ua->jcr, ua->db, &pr, prtit, ua, llist); - } else if (strcasecmp(ua->argk[i], N_("clients")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("clients")) == 0) { db_list_client_records(ua->jcr, ua->db, prtit, ua, llist); /* List MEDIA or VOLUMES */ - } else if (strcasecmp(ua->argk[i], N_("media")) == 0 || - strcasecmp(ua->argk[i], N_("volume")) == 0 || - strcasecmp(ua->argk[i], N_("volumes")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("media")) == 0 || + strcasecmp(ua->argk[i], NT_("volume")) == 0 || + strcasecmp(ua->argk[i], NT_("volumes")) == 0) { bool done = false; for (j=i+1; jargc; j++) { - if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) { + if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) { bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH); jr.JobId = 0; db_get_job_record(ua->jcr, ua->db, &jr); jobid = jr.JobId; - } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) { + } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) { jobid = str_to_int64(ua->argv[j]); } else { continue; @@ -380,7 +380,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } /* Is a specific pool wanted? */ for (i=1; iargc; i++) { - if (strcasecmp(ua->argk[i], N_("pool")) == 0) { + if (strcasecmp(ua->argk[i], NT_("pool")) == 0) { if (!get_pool_dbr(ua, &pr)) { bsendmsg(ua, _("No Pool specified.\n")); return 1; @@ -412,10 +412,10 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) return 1; } /* List next volume */ - } else if (strcasecmp(ua->argk[i], N_("nextvol")) == 0 || - strcasecmp(ua->argk[i], N_("nextvolume")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("nextvol")) == 0 || + strcasecmp(ua->argk[i], NT_("nextvolume")) == 0) { n = 1; - j = find_arg_with_value(ua, N_("days")); + j = find_arg_with_value(ua, NT_("days")); if (j >= 0) { n = atoi(ua->argv[j]); if ((n < 0) || (n > 50)) { @@ -424,8 +424,8 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) } } list_nextvol(ua, n); - } else if (strcasecmp(ua->argk[i], N_("limit")) == 0 - || strcasecmp(ua->argk[i], N_("days")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("limit")) == 0 + || strcasecmp(ua->argk[i], NT_("days")) == 0) { /* Ignore it */ } else { bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i])); diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index c6e8dd0d13..d5422f6891 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -158,9 +158,9 @@ int prunecmd(UAContext *ua, const char *cmd) int kw; static const char *keywords[] = { - N_("Files"), - N_("Jobs"), - N_("Volume"), + NT_("Files"), + NT_("Jobs"), + NT_("Volume"), NULL}; if (!open_db(ua)) { diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index 5661d1db72..ede38bb7fb 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -156,21 +156,21 @@ int purgecmd(UAContext *ua, const char *cmd) MEDIA_DBR mr; JOB_DBR jr; static const char *keywords[] = { - N_("files"), - N_("jobs"), - N_("volume"), + NT_("files"), + NT_("jobs"), + NT_("volume"), NULL}; static const char *files_keywords[] = { - N_("Job"), - N_("JobId"), - N_("Client"), - N_("Volume"), + NT_("Job"), + NT_("JobId"), + NT_("Client"), + NT_("Volume"), NULL}; static const char *jobs_keywords[] = { - N_("Client"), - N_("Volume"), + NT_("Client"), + NT_("Volume"), NULL}; bsendmsg(ua, _( @@ -223,7 +223,7 @@ int purgecmd(UAContext *ua, const char *cmd) } /* Volume */ case 2: - while ((i=find_arg(ua, N_("volume"))) >= 0) { + while ((i=find_arg(ua, NT_("volume"))) >= 0) { if (select_media_dbr(ua, &mr)) { purge_jobs_from_volume(ua, &mr); } diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 1ba9dab5e6..1034e1b420 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -190,7 +190,7 @@ int restore_cmd(UAContext *ua, const char *cmd) job->hdr.name, rx.ClientName, rx.store?rx.store->hdr.name:"", jcr->RestoreBootstrap, rx.selected_files, ua->catalog->hdr.name); } - if (find_arg(ua, N_("yes")) > 0) { + if (find_arg(ua, NT_("yes")) > 0) { pm_strcat(ua->cmd, " yes"); /* pass it on to the run command */ } Dmsg1(100, "Submitting: %s\n", ua->cmd); @@ -243,7 +243,7 @@ static int get_client_name(UAContext *ua, RESTORE_CTX *rx) if (!rx->ClientName[0]) { CLIENT_DBR cr; /* try command line argument */ - int i = find_arg_with_value(ua, N_("client")); + int i = find_arg_with_value(ua, NT_("client")); if (i >= 0) { if (!has_value(ua, i)) { return 0; @@ -971,7 +971,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) /* Check MediaType and select storage that corresponds */ get_storage_from_mediatype(ua, &rx->name_list, rx); - if (find_arg(ua, N_("done")) < 0) { + if (find_arg(ua, NT_("done")) < 0) { /* Let the user interact in selecting which files to restore */ OK = user_select_files_from_tree(&tree); } diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index e486bf817a..b4f4172979 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -494,7 +494,7 @@ int run_cmd(UAContext *ua, const char *cmd) jcr->cloned = cloned; - if (find_arg(ua, N_("fdcalled")) > 0) { + if (find_arg(ua, NT_("fdcalled")) > 0) { jcr->file_bsock = dup_bsock(ua->UA_sock); ua->quit = true; } @@ -518,7 +518,7 @@ try_again: } /* Run without prompting? */ - if (ua->batch || find_arg(ua, N_("yes")) > 0) { + if (ua->batch || find_arg(ua, NT_("yes")) > 0) { goto start_job; } diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 451e9ec8c3..242c83d9ce 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -297,8 +297,8 @@ CLIENT *get_client_resource(UAContext *ua) int i; for (i=1; iargc; i++) { - if ((strcasecmp(ua->argk[i], N_("client")) == 0 || - strcasecmp(ua->argk[i], N_("fd")) == 0) && ua->argv[i]) { + if ((strcasecmp(ua->argk[i], NT_("client")) == 0 || + strcasecmp(ua->argk[i], NT_("fd")) == 0) && ua->argv[i]) { if (!acl_access_ok(ua, Client_ACL, ua->argv[i])) { break; } @@ -440,7 +440,7 @@ bool select_pool_dbr(UAContext *ua, POOL_DBR *pr) uint32_t *ids; for (i=1; iargc; i++) { - if (strcasecmp(ua->argk[i], N_("pool")) == 0 && ua->argv[i] && + if (strcasecmp(ua->argk[i], NT_("pool")) == 0 && ua->argv[i] && acl_access_ok(ua, Pool_ACL, ua->argv[i])) { bstrncpy(pr->Name, ua->argv[i], sizeof(pr->Name)); if (!db_get_pool_record(ua->jcr, ua->db, pr)) { @@ -626,10 +626,10 @@ int get_job_dbr(UAContext *ua, JOB_DBR *jr) int i; for (i=1; iargc; i++) { - if (strcasecmp(ua->argk[i], N_("ujobid")) == 0 && ua->argv[i]) { + if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0 && ua->argv[i]) { jr->JobId = 0; bstrncpy(jr->Job, ua->argv[i], sizeof(jr->Job)); - } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0 && ua->argv[i]) { + } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0 && ua->argv[i]) { jr->JobId = str_to_int64(ua->argv[i]); jr->Job[0] = 0; } else { @@ -648,8 +648,8 @@ int get_job_dbr(UAContext *ua, JOB_DBR *jr) jr->Job[0] = 0; for (i=1; iargc; i++) { - if ((strcasecmp(ua->argk[i], N_("jobname")) == 0 || - strcasecmp(ua->argk[i], N_("job")) == 0) && ua->argv[i]) { + if ((strcasecmp(ua->argk[i], NT_("jobname")) == 0 || + strcasecmp(ua->argk[i], NT_("job")) == 0) && ua->argv[i]) { jr->JobId = 0; bstrncpy(jr->Name, ua->argv[i], sizeof(jr->Name)); break; @@ -813,12 +813,12 @@ STORE *get_storage_resource(UAContext *ua, bool use_default) break; } } else { - if (strcasecmp(ua->argk[i], N_("storage")) == 0 || - strcasecmp(ua->argk[i], N_("sd")) == 0) { + if (strcasecmp(ua->argk[i], NT_("storage")) == 0 || + strcasecmp(ua->argk[i], NT_("sd")) == 0) { store_name = ua->argv[i]; break; - } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0) { jobid = str_to_int64(ua->argv[i]); if (jobid <= 0) { bsendmsg(ua, _("Expecting jobid=nn command, got: %s\n"), ua->argk[i]); @@ -832,8 +832,8 @@ STORE *get_storage_resource(UAContext *ua, bool use_default) free_jcr(jcr); break; - } else if (strcasecmp(ua->argk[i], N_("job")) == 0 || - strcasecmp(ua->argk[i], N_("jobname")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("job")) == 0 || + strcasecmp(ua->argk[i], NT_("jobname")) == 0) { if (!ua->argv[i]) { bsendmsg(ua, _("Expecting job=xxx, got: %s.\n"), ua->argk[i]); return NULL; @@ -845,7 +845,7 @@ STORE *get_storage_resource(UAContext *ua, bool use_default) store = jcr->store; free_jcr(jcr); break; - } else if (strcasecmp(ua->argk[i], N_("ujobid")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0) { if (!ua->argv[i]) { bsendmsg(ua, _("Expecting ujobid=xxx, got: %s.\n"), ua->argk[i]); return NULL; diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index aaf6a81b32..c69d2526ad 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -98,14 +98,14 @@ int status_cmd(UAContext *ua, const char *cmd) Dmsg1(20, "status:%s:\n", cmd); for (i=1; iargc; i++) { - if (strcasecmp(ua->argk[i], N_("all")) == 0) { + if (strcasecmp(ua->argk[i], NT_("all")) == 0) { do_all_status(ua); return 1; - } else if (strcasecmp(ua->argk[i], N_("dir")) == 0 || - strcasecmp(ua->argk[i], N_("director")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("dir")) == 0 || + strcasecmp(ua->argk[i], NT_("director")) == 0) { do_director_status(ua); return 1; - } else if (strcasecmp(ua->argk[i], N_("client")) == 0) { + } else if (strcasecmp(ua->argk[i], NT_("client")) == 0) { client = get_client_resource(ua); if (client) { do_client_status(ua, client); @@ -124,10 +124,10 @@ int status_cmd(UAContext *ua, const char *cmd) char prmt[MAX_NAME_LENGTH]; start_prompt(ua, _("Status available for:\n")); - add_prompt(ua, N_("Director")); - add_prompt(ua, N_("Storage")); - add_prompt(ua, N_("Client")); - add_prompt(ua, N_("All")); + add_prompt(ua, NT_("Director")); + add_prompt(ua, NT_("Storage")); + add_prompt(ua, NT_("Client")); + add_prompt(ua, NT_("All")); Dmsg0(20, "do_prompt: select daemon\n"); if ((item=do_prompt(ua, "", _("Select daemon type for status"), prmt, sizeof(prmt))) < 0) { return 1; @@ -448,7 +448,7 @@ static void list_scheduled_jobs(UAContext *ua) Dmsg0(200, "enter list_sched_jobs()\n"); days = 1; - i = find_arg_with_value(ua, N_("days")); + i = find_arg_with_value(ua, NT_("days")); if (i >= 0) { days = atoi(ua->argv[i]); if ((days < 0) || (days > 50)) { diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index ed9c3364fe..4011f18a54 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -55,24 +55,24 @@ static int donecmd(UAContext *ua, TREE_CTX *tree); struct cmdstruct { const char *key; int (*func)(UAContext *ua, TREE_CTX *tree); const char *help; }; static struct cmdstruct commands[] = { - { N_("cd"), cdcmd, _("change current directory")}, - { N_("count"), countcmd, _("count marked files in and below the cd")}, - { N_("dir"), dircmd, _("long list current directory, wildcards allowed")}, - { N_(".dir"), dot_dircmd, _("long list current directory, wildcards allowed")}, - { N_("done"), donecmd, _("leave file selection mode")}, - { N_("estimate"), estimatecmd, _("estimate restore size")}, - { N_("exit"), donecmd, _("same as done command")}, - { N_("find"), findcmd, _("find files, wildcards allowed")}, - { N_("help"), helpcmd, _("print help")}, - { N_("ls"), lscmd, _("list current directory, wildcards allowed")}, - { N_("lsmark"), lsmarkcmd, _("list the marked files in and below the cd")}, - { N_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")}, - { N_("markdir"), markdircmd, _("mark directory name to be restored (no files)")}, - { N_("pwd"), pwdcmd, _("print current working directory")}, - { N_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")}, - { N_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")}, - { N_("quit"), quitcmd, _("quit and do not do restore")}, - { N_("?"), helpcmd, _("print help")}, + { NT_("cd"), cdcmd, _("change current directory")}, + { NT_("count"), countcmd, _("count marked files in and below the cd")}, + { NT_("dir"), dircmd, _("long list current directory, wildcards allowed")}, + { NT_(".dir"), dot_dircmd, _("long list current directory, wildcards allowed")}, + { NT_("done"), donecmd, _("leave file selection mode")}, + { NT_("estimate"), estimatecmd, _("estimate restore size")}, + { NT_("exit"), donecmd, _("same as done command")}, + { NT_("find"), findcmd, _("find files, wildcards allowed")}, + { NT_("help"), helpcmd, _("print help")}, + { NT_("ls"), lscmd, _("list current directory, wildcards allowed")}, + { NT_("lsmark"), lsmarkcmd, _("list the marked files in and below the cd")}, + { NT_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")}, + { NT_("markdir"), markdircmd, _("mark directory name to be restored (no files)")}, + { NT_("pwd"), pwdcmd, _("print current working directory")}, + { NT_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")}, + { NT_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")}, + { NT_("quit"), quitcmd, _("quit and do not do restore")}, + { NT_("?"), helpcmd, _("print help")}, }; #define comsize (sizeof(commands)/sizeof(struct cmdstruct)) diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index 8737ecc61a..e08705d440 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -51,10 +51,10 @@ static int update_pool(UAContext *ua); int update_cmd(UAContext *ua, const char *cmd) { static const char *kw[] = { - N_("media"), /* 0 */ - N_("volume"), /* 1 */ - N_("pool"), /* 2 */ - N_("slots"), /* 3 */ + NT_("media"), /* 0 */ + NT_("volume"), /* 1 */ + NT_("pool"), /* 2 */ + NT_("slots"), /* 3 */ NULL}; if (!open_db(ua)) { @@ -100,14 +100,14 @@ static void update_volstatus(UAContext *ua, const char *val, MEDIA_DBR *mr) { POOL_MEM query(PM_MESSAGE); const char *kw[] = { - N_("Append"), - N_("Archive"), - N_("Disabled"), - N_("Full"), - N_("Used"), - N_("Cleaning"), - N_("Recycle"), - N_("Read-Only"), + NT_("Append"), + NT_("Archive"), + NT_("Disabled"), + NT_("Full"), + NT_("Used"), + NT_("Cleaning"), + NT_("Recycle"), + NT_("Read-Only"), NULL}; bool found = false; int i; @@ -488,16 +488,16 @@ static int update_volume(UAContext *ua) /* Modify Volume Status */ bsendmsg(ua, _("Current Volume status is: %s\n"), mr.VolStatus); start_prompt(ua, _("Possible Values are:\n")); - add_prompt(ua, N_("Append")); - add_prompt(ua, N_("Archive")); - add_prompt(ua, N_("Disabled")); - add_prompt(ua, N_("Full")); - add_prompt(ua, N_("Used")); - add_prompt(ua, N_("Cleaning")); - if (strcmp(mr.VolStatus, N_("Purged")) == 0) { - add_prompt(ua, N_("Recycle")); + add_prompt(ua, NT_("Append")); + add_prompt(ua, NT_("Archive")); + add_prompt(ua, NT_("Disabled")); + add_prompt(ua, NT_("Full")); + add_prompt(ua, NT_("Used")); + add_prompt(ua, NT_("Cleaning")); + if (strcmp(mr.VolStatus, NT_("Purged")) == 0) { + add_prompt(ua, NT_("Recycle")); } - add_prompt(ua, N_("Read-Only")); + add_prompt(ua, NT_("Read-Only")); if (do_prompt(ua, "", _("Choose new Volume Status"), ua->cmd, sizeof(mr.VolStatus)) < 0) { return 1; } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index df5518664b..dd036fec1f 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -708,13 +708,13 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) } /* Now find all the files that are missing -- i.e. all files in - * the database where the MarkedId != current JobId + * the database where the MarkId != current JobId */ jcr->fn_printed = false; bsnprintf(buf, sizeof(buf), "SELECT Path.Path,Filename.Name FROM File,Path,Filename " "WHERE File.JobId=%d " -"AND File.MarkedId!=%d AND File.PathId=Path.PathId " +"AND File.MarkId!=%d AND File.PathId=Path.PathId " "AND File.FilenameId=Filename.FilenameId", JobId, jcr->JobId); /* missing_handler is called for each file found */ diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h index 43a8e3fa92..cfe3e56dec 100644 --- a/bacula/src/filed/filed.h +++ b/bacula/src/filed/filed.h @@ -6,22 +6,17 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2001-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ diff --git a/bacula/src/filed/filed_conf.h b/bacula/src/filed/filed_conf.h index e8ea53b27b..80354326ee 100644 --- a/bacula/src/filed/filed_conf.h +++ b/bacula/src/filed/filed_conf.h @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 579d645f1a..50a60ae353 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -25,6 +25,7 @@ #include "filed.h" #ifdef WIN32_VSS #include "vss.h" +static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER; #endif extern char my_name[]; @@ -739,6 +740,8 @@ static void add_fileset(JCR *jcr, const char *item) static bool term_fileset(JCR *jcr) { FF_PKT *ff = jcr->ff; + +#ifdef xxx findFILESET *fileset = ff->fileset; int i, j, k; @@ -816,6 +819,7 @@ static bool term_fileset(JCR *jcr) Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j)); } } +#endif return ff->fileset->state != state_error; } @@ -946,7 +950,7 @@ static int fileset_cmd(JCR *jcr) } while (bnet_recv(dir) >= 0) { strip_trailing_junk(dir->msg); - Dmsg1(400, "Fileset: %s\n", dir->msg); + Dmsg1(500, "Fileset: %s\n", dir->msg); add_fileset(jcr, dir->msg); } if (!term_fileset(jcr)) { @@ -1237,6 +1241,8 @@ static int backup_cmd(JCR *jcr) #ifdef WIN32_VSS /* START VSS ON WIN 32 */ if (g_pVSSClient && enable_vss) { + /* Run only one at a time */ + P(vss_mutex); if (g_pVSSClient->InitializeForBackup()) { /* tell vss which drives to snapshot */ char szWinDriveLetters[27]; @@ -1329,8 +1335,10 @@ cleanup: #ifdef WIN32_VSS /* STOP VSS ON WIN 32 */ /* tell vss to close the backup session */ - if (g_pVSSClient && enable_vss == 1) + if (g_pVSSClient && enable_vss) { g_pVSSClient->CloseBackup(); + V(vss_mutex); + } #endif bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles, diff --git a/bacula/src/filed/pythonfd.c b/bacula/src/filed/pythonfd.c index 22008eebac..68c3b5397b 100644 --- a/bacula/src/filed/pythonfd.c +++ b/bacula/src/filed/pythonfd.c @@ -70,20 +70,20 @@ struct s_vars { /* Read-only variables */ static struct s_vars getvars[] = { - { N_("FDName"), "s"}, /* 0 */ - { N_("Level"), "s"}, /* 1 */ - { N_("Type"), "s"}, /* 2 */ - { N_("JobId"), "i"}, /* 3 */ - { N_("Client"), "s"}, /* 4 */ - { N_("JobName"), "s"}, /* 5 */ - { N_("JobStatus"), "s"}, /* 6 */ + { NT_("FDName"), "s"}, /* 0 */ + { NT_("Level"), "s"}, /* 1 */ + { NT_("Type"), "s"}, /* 2 */ + { NT_("JobId"), "i"}, /* 3 */ + { NT_("Client"), "s"}, /* 4 */ + { NT_("JobName"), "s"}, /* 5 */ + { NT_("JobStatus"), "s"}, /* 6 */ { NULL, NULL} }; /* Writable variables */ static struct s_vars setvars[] = { - { N_("JobReport"), "s"}, + { NT_("JobReport"), "s"}, { NULL, NULL} }; diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 5d1fda2925..baa4743a10 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -10,7 +10,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -38,13 +38,7 @@ int32_t path_max; /* path name max length */ static int our_callback(FF_PKT *ff, void *hpkt, bool top_level); static bool accept_file(FF_PKT *ff); -/* Fold case in fnmatch() on Win32 */ -#ifdef WIN32 -static const int fnmode = FNM_CASEFOLD; -#else static const int fnmode = 0; -#endif - /* * Initialize the find files "global" variables diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index d5487aa539..b7d25f8df1 100755 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -4,7 +4,7 @@ * Kern Sibbald MMI */ /* - Copyright (C) 2001-2005 Kern Sibbald + Copyright (C) 2001-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -170,7 +170,7 @@ struct HFSPLUS_INFO { * first argument to the find_files callback subroutine. */ struct FF_PKT { - char *fname; /* filename */ + char *fname; /* full filename */ char *link; /* link if file linked */ POOLMEM *sys_fname; /* system filename */ struct stat statp; /* stat packet */ diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 59577d8b06..fd9338b9ad 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -2522,34 +2522,34 @@ static void bfill_cmd() struct cmdstruct { const char *key; void (*func)(); const char *help; }; static struct cmdstruct commands[] = { - {N_("autochanger"),autochangercmd, _("test autochanger")}, - {N_("bsf"), bsfcmd, _("backspace file")}, - {N_("bsr"), bsrcmd, _("backspace record")}, - {N_("bfill"), bfill_cmd, _("fill tape using Bacula writes")}, - {N_("cap"), capcmd, _("list device capabilities")}, - {N_("clear"), clearcmd, _("clear tape errors")}, - {N_("eod"), eodcmd, _("go to end of Bacula data for append")}, - {N_("eom"), eomcmd, _("go to the physical end of medium")}, - {N_("fill"), fillcmd, _("fill tape, write onto second volume")}, - {N_("unfill"), unfillcmd, _("read filled tape")}, - {N_("fsf"), fsfcmd, _("forward space a file")}, - {N_("fsr"), fsrcmd, _("forward space a record")}, - {N_("help"), helpcmd, _("print this command")}, - {N_("label"), labelcmd, _("write a Bacula label to the tape")}, - {N_("load"), loadcmd, _("load a tape")}, - {N_("quit"), quitcmd, _("quit btape")}, - {N_("rawfill"), rawfill_cmd, _("use write() to fill tape")}, - {N_("readlabel"), readlabelcmd, _("read and print the Bacula tape label")}, - {N_("rectest"), rectestcmd, _("test record handling functions")}, - {N_("rewind"), rewindcmd, _("rewind the tape")}, - {N_("scan"), scancmd, _("read() tape block by block to EOT and report")}, - {N_("scanblocks"),scan_blocks, _("Bacula read block by block to EOT and report")}, - {N_("status"), statcmd, _("print tape status")}, - {N_("test"), testcmd, _("General test Bacula tape functions")}, - {N_("weof"), weofcmd, _("write an EOF on the tape")}, - {N_("wr"), wrcmd, _("write a single Bacula block")}, - {N_("rr"), rrcmd, _("read a single record")}, - {N_("qfill"), qfillcmd, _("quick fill command")} + {NT_("autochanger"),autochangercmd, _("test autochanger")}, + {NT_("bsf"), bsfcmd, _("backspace file")}, + {NT_("bsr"), bsrcmd, _("backspace record")}, + {NT_("bfill"), bfill_cmd, _("fill tape using Bacula writes")}, + {NT_("cap"), capcmd, _("list device capabilities")}, + {NT_("clear"), clearcmd, _("clear tape errors")}, + {NT_("eod"), eodcmd, _("go to end of Bacula data for append")}, + {NT_("eom"), eomcmd, _("go to the physical end of medium")}, + {NT_("fill"), fillcmd, _("fill tape, write onto second volume")}, + {NT_("unfill"), unfillcmd, _("read filled tape")}, + {NT_("fsf"), fsfcmd, _("forward space a file")}, + {NT_("fsr"), fsrcmd, _("forward space a record")}, + {NT_("help"), helpcmd, _("print this command")}, + {NT_("label"), labelcmd, _("write a Bacula label to the tape")}, + {NT_("load"), loadcmd, _("load a tape")}, + {NT_("quit"), quitcmd, _("quit btape")}, + {NT_("rawfill"), rawfill_cmd, _("use write() to fill tape")}, + {NT_("readlabel"), readlabelcmd, _("read and print the Bacula tape label")}, + {NT_("rectest"), rectestcmd, _("test record handling functions")}, + {NT_("rewind"), rewindcmd, _("rewind the tape")}, + {NT_("scan"), scancmd, _("read() tape block by block to EOT and report")}, + {NT_("scanblocks"),scan_blocks, _("Bacula read block by block to EOT and report")}, + {NT_("status"), statcmd, _("print tape status")}, + {NT_("test"), testcmd, _("General test Bacula tape functions")}, + {NT_("weof"), weofcmd, _("write an EOF on the tape")}, + {NT_("wr"), wrcmd, _("write a single Bacula block")}, + {NT_("rr"), rrcmd, _("read a single record")}, + {NT_("qfill"), qfillcmd, _("quick fill command")} }; #define comsize (sizeof(commands)/sizeof(struct cmdstruct)) diff --git a/bacula/src/stored/pythonsd.c b/bacula/src/stored/pythonsd.c index 7b1cffdb4c..b728de9402 100644 --- a/bacula/src/stored/pythonsd.c +++ b/bacula/src/stored/pythonsd.c @@ -55,18 +55,18 @@ struct s_vars { }; static struct s_vars getvars[] = { - { N_("Job"), "s"}, /* 0 */ - { N_("SDName"), "s"}, /* 1 */ - { N_("Level"), "s"}, /* 2 */ - { N_("Type"), "s"}, /* 3 */ - { N_("JobId"), "i"}, /* 4 */ - { N_("Client"), "s"}, /* 5 */ - { N_("Pool"), "s"}, /* 6 */ - { N_("MediaType"), "s"}, /* 7 */ - { N_("JobName"), "s"}, /* 8 */ - { N_("JobStatus"), "s"}, /* 9 */ - { N_("VolumeName"), "s"}, /* 10 */ - { N_("Device"), "s"}, /* 11 */ + { NT_("Job"), "s"}, /* 0 */ + { NT_("SDName"), "s"}, /* 1 */ + { NT_("Level"), "s"}, /* 2 */ + { NT_("Type"), "s"}, /* 3 */ + { NT_("JobId"), "i"}, /* 4 */ + { NT_("Client"), "s"}, /* 5 */ + { NT_("Pool"), "s"}, /* 6 */ + { NT_("MediaType"), "s"}, /* 7 */ + { NT_("JobName"), "s"}, /* 8 */ + { NT_("JobStatus"), "s"}, /* 9 */ + { NT_("VolumeName"), "s"}, /* 10 */ + { NT_("Device"), "s"}, /* 11 */ { NULL, NULL} }; @@ -74,7 +74,7 @@ static struct s_vars getvars[] = { /* Writable variables */ static struct s_vars setvars[] = { - { N_("JobReport"), "s"}, + { NT_("JobReport"), "s"}, { NULL, NULL} }; diff --git a/bacula/src/tools/Makefile.in b/bacula/src/tools/Makefile.in index d961440392..a4b342a175 100644 --- a/bacula/src/tools/Makefile.in +++ b/bacula/src/tools/Makefile.in @@ -38,7 +38,7 @@ EXTRAOBJS = @OBJLIST@ DIRCONFOBJS = ../dird/dird_conf.o ../dird/run_conf.o ../dird/inc_conf.o NODIRTOOLS = bsmtp -DIRTOOLS = bsmtp dbcheck fstype testfind testls regex +DIRTOOLS = bsmtp dbcheck fstype testfind testls regex wild TOOLS = $(@DIR_TOOLS@) INSNODIRTOOLS = bsmtp @@ -79,6 +79,11 @@ regex: ../findlib/libfind.a ../lib/libbac.a regex.o $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ regex.o \ $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) +wild: ../findlib/libfind.a ../lib/libbac.a wild.o + $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ wild.o \ + $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) + + Makefile: $(srcdir)/Makefile.in $(topdir)/config.status cd $(topdir) \ diff --git a/bacula/src/tools/wild.c b/bacula/src/tools/wild.c new file mode 100644 index 0000000000..9aa9deb73a --- /dev/null +++ b/bacula/src/tools/wild.c @@ -0,0 +1,131 @@ +/* + * Test program for testing wild card expressions + */ +/* + Copyright (C) 2006 Kern Sibbald + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. + + */ + +#include "bacula.h" +#include "lib/fnmatch.h" + + +static void usage() +{ + fprintf(stderr, +"\n" +"Usage: wild [-d debug_level] -f \n" +" -f specify file of data to be matched\n" +" -i use case insenitive match\n" +" -l suppress line numbers\n" +" -n print lines that do not match\n" +" -? print this message.\n" +"\n\n"); + + exit(1); +} + +/* Fold case in fnmatch() on Win32 */ +#ifdef WIN32 +static const int fnmode = FNM_CASEFOLD; +#else +static const int fnmode = 0; +#endif + +int main(int argc, char *const *argv) +{ + char *fname = NULL; + int rc, ch; + char data[1000]; + char pat[500]; + FILE *fd; + bool match_only = true; + int lineno; + bool no_linenos = false; + int ic = 0; + + + setlocale(LC_ALL, ""); + bindtextdomain("bacula", LOCALEDIR); + textdomain("bacula"); + + while ((ch = getopt(argc, argv, "d:f:in?")) != -1) { + switch (ch) { + case 'd': /* set debug level */ + debug_level = atoi(optarg); + if (debug_level <= 0) { + debug_level = 1; + } + break; + + case 'f': /* data */ + fname = optarg; + break; + + case 'i': /* ignore case */ + ic = FNM_CASEFOLD; + break; + + case 'l': + no_linenos = true; + break; + + case 'n': + match_only = false; + break; + + case '?': + default: + usage(); + + } + } + argc -= optind; + argv += optind; + + if (!fname) { + printf("A data file must be specified.\n"); + usage(); + } + + for ( ;; ) { + printf("Enter a wild-card: "); + if (fgets(pat, sizeof(pat)-1, stdin) == NULL) { + break; + } + strip_trailing_newline(pat); + if (pat[0] == 0) { + exit(0); + } + fd = fopen(fname, "r"); + if (!fd) { + printf(_("Could not open data file: %s\n"), fname); + exit(1); + } + lineno = 0; + while (fgets(data, sizeof(data)-1, fd)) { + strip_trailing_newline(data); + lineno++; + rc = fnmatch(pat, data, fnmode | ic); + if ((match_only && rc == 0) || (!match_only && rc != 0)) { + if (no_linenos) { + printf("%s\n", data); + } else { + printf("%5d: %s\n", lineno, data); + } + } + } + fclose(fd); + } + exit(0); +} diff --git a/bacula/src/version.h b/bacula/src/version.h index 8ba38bde0c..2ce2bf52ee 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.7" -#define BDATE "08 April 2006" -#define LSMDATE "08Apr06" +#define BDATE "11 April 2006" +#define LSMDATE "11Apr06" /* Debug flags */ #undef DEBUG -- 2.39.5