dummy:
fd_subdirs = src scripts doc src/lib src/findlib src/filed \
- rescue rescue/linux
+ @READLINE_SRC@ src/console rescue rescue/linux
-subdirs = src/cats @READLINE_SRC@ src/console src/dird \
- src/stored @GNOME_DIR@ src/tools
+subdirs = src/cats src/dird src/stored @GNOME_DIR@ src/tools
all_subdirs = ${fd_subdirs} ${@ALL_DIRS@}
$(MKDIR) $(DESTDIR)/etc/security/console.apps
$(MKDIR) $(DESTDIR)/etc/pam.d
-install-menu: installdirs gnomedirs
+install-menu: gnomedirs
${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png
${INSTALL_DATA} scripts/bacula.desktop.gnome1 $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop
${INSTALL_DATA} scripts/bacula.desktop.gnome2 $(DESTDIR)/usr/share/applications/bacula.desktop
-install-menu-xsu: installdirs gnomedirs
+install-menu-xsu: gnomedirs
${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png
${INSTALL_DATA} scripts/bacula.desktop.gnome1.xsu $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop
${INSTALL_DATA} scripts/bacula.desktop.gnome2.xsu $(DESTDIR)/usr/share/applications/bacula.desktop
-install-menu-consolehelper: installdirs gnomedirs
+install-menu-consolehelper: gnomedirs
${INSTALL_DATA} scripts/bacula.png $(DESTDIR)/usr/share/pixmaps/bacula.png
${INSTALL_DATA} scripts/bacula.desktop.gnome1.consolehelper $(DESTDIR)/usr/share/gnome/apps/System/bacula.desktop
${INSTALL_DATA} scripts/bacula.desktop.gnome2.consolehelper $(DESTDIR)/usr/share/applications/bacula.desktop
Kern's ToDo List
- 28 March 2004
+ 31 March 2004
Documentation to do: (any release a little bit at a time)
- DB upgrade to version 5 in bacula-1.27b, DB upgrade to
For 1.33 Testing/Documentation:
- Add counter variable test.
-- Document ln -sf /usr/lib/libncurses.so /usr/lib/libtermcap.so
- and install the esound-devĀ package for compiling Console on SuSE.
- This should read 'Document LDFLAGS="-L/usr/lib/termcap" ... '
- Add an example of using a FIFO in dirdconf.wml
- Add an item to the FAQ about running jobs in different timezones.
- Add some examples of job editing codes.
a consequence, Bacula will completely stall untilthe machine exporting
the NSF mounts comes back up. If someone knows a wayaround this, please
let me know."I haven't tried using NFS in years, but I think that the
- "soft" and "intr"remount options may well help you. The only way of
- being sure would be totry it.See, for example,
+ "soft" and "intr" remount options may well help you. The only way of
+ being sure would be to try it.See, for example,
http://howtos.linux.com/guides/nag2/x-087-2-nfs.mountd.shtml
For 1.33
-- Null dlist head and tail pointers if all items are removed.
- Complete Win32 installer
- Finish work on Gnome restore GUI.
-- On unknown client in restore "client=xxx"
- Could not find Client "Matou": ERR=Query failed: DROP TABLE temp1:
- ERR=no such table: temp1
- Fix "llist jobid=xx" where no fileset or client exists.
-- Build console in client-only build.
- Test work on conio.c -- particularly linking.
-- Phil says that Windows file sizes mismatch in Verify when they should,
- and that either the file size or the catalog size was zero.
-- Check time/dates printed during restore when using Win32 API.
--- Maybe in 1.33
From Chris Hull:
For version 1.35:
+- Make sure list of Volumes needed is in correct order for restore.
+ See havana.
- Remove paths (and files that reference them) that have no trailing slash
in dbcheck -- or add a trailing slash.
- Remove Filenames (and files that reference them) that have a trailing
- Test Qmsg() code to be used in bnet.c to prevent recursion. Queue the
message. If dequeueing toss the messages. Lock while dequeuing so that
it cannot be called recursively and set dequeuing flag.
+- On unknown client in restore "client=xxx"
+ Could not find Client "Matou": ERR=Query failed: DROP TABLE temp1:
+ ERR=no such table: temp1
+- Null dlist head and tail pointers if all items are removed.
+- Build console in client-only build.
+- Phil says that Windows file sizes mismatch in Verify when they should,
+ and that either the file size or the catalog size was zero.
+- Check time/dates printed during restore when using Win32 API.
{
uint32_t *val = (uint32_t *)ctx;
- Dmsg1(200, "int_handler starts with row pointing at %x\n", row);
+ Dmsg1(800, "int_handler starts with row pointing at %x\n", row);
if (row[0]) {
- Dmsg1(200, "int_handler finds '%s'\n", row[0]);
+ Dmsg1(800, "int_handler finds '%s'\n", row[0]);
*val = atoi(row[0]);
} else {
- Dmsg0(200, "int_handler finds zero\n");
+ Dmsg0(800, "int_handler finds zero\n");
*val = 0;
}
- Dmsg0(200, "int_handler finishes\n");
+ Dmsg0(800, "int_handler finishes\n");
return 0;
}
int i, col_len, max_len = 0;
char buf[2000], ewc[30];
- Dmsg0(200, "list_result starts\n");
+ Dmsg0(800, "list_result starts\n");
if (mdb->result == NULL || sql_num_rows(mdb) == 0) {
send(ctx, _("No results to list.\n"));
return;
}
- Dmsg1(200, "list_result starts looking at %d fields\n", sql_num_fields(mdb));
+ Dmsg1(800, "list_result starts looking at %d fields\n", sql_num_fields(mdb));
/* determine column display widths */
sql_field_seek(mdb, 0);
for (i = 0; i < sql_num_fields(mdb); i++) {
- Dmsg1(200, "list_result processing field %d\n", i);
+ Dmsg1(800, "list_result processing field %d\n", i);
field = sql_fetch_field(mdb);
col_len = strlen(field->name);
if (type == VERT_LIST) {
}
}
- Dmsg0(200, "list_result finished first loop\n");
+ Dmsg0(800, "list_result finished first loop\n");
if (type == VERT_LIST) {
goto vertical_list;
}
- Dmsg1(200, "list_result starts second loop looking at %d fields\n", sql_num_fields(mdb));
+ Dmsg1(800, "list_result starts second loop looking at %d fields\n", sql_num_fields(mdb));
list_dashes(mdb, send, ctx);
send(ctx, "|");
sql_field_seek(mdb, 0);
for (i = 0; i < sql_num_fields(mdb); i++) {
- Dmsg1(200, "list_result looking at field %d\n", i);
+ Dmsg1(800, "list_result looking at field %d\n", i);
field = sql_fetch_field(mdb);
bsnprintf(buf, sizeof(buf), " %-*s |", (int)field->max_length, field->name);
send(ctx, buf);
send(ctx, "\n");
list_dashes(mdb, send, ctx);
- Dmsg1(200, "list_result starts third loop looking at %d fields\n", sql_num_fields(mdb));
+ Dmsg1(800, "list_result starts third loop looking at %d fields\n", sql_num_fields(mdb));
while ((row = sql_fetch_row(mdb)) != NULL) {
sql_field_seek(mdb, 0);
send(ctx, "|");
vertical_list:
- Dmsg1(200, "list_result starts vertical list at %d fields\n", sql_num_fields(mdb));
+ Dmsg1(800, "list_result starts vertical list at %d fields\n", sql_num_fields(mdb));
while ((row = sql_fetch_row(mdb)) != NULL) {
sql_field_seek(mdb, 0);
for (i = 0; i < sql_num_fields(mdb); i++) {
int db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
+ db_lock(mdb);
Dmsg1(300, "Fname=%s\n", ar->fname);
Dmsg0(500, "put_file_into_catalog\n");
/*
ar->Stream == STREAM_UNIX_ATTRIBUTES_EX)) {
Mmsg0(&mdb->errmsg, _("Attempt to put non-attributes into catalog\n"));
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
- return 0;
+ goto bail_out;
}
- db_lock(mdb);
split_path_and_file(jcr, mdb, ar->fname);
if (!db_create_filename_record(jcr, mdb, ar)) {
- db_unlock(mdb);
- return 0;
+ goto bail_out;
}
Dmsg1(500, "db_create_filename_record: %s\n", mdb->esc_name);
if (!db_create_path_record(jcr, mdb, ar)) {
- db_unlock(mdb);
- return 0;
+ goto bail_out;
}
Dmsg1(500, "db_create_path_record: %s\n", mdb->esc_name);
/* Now create master File record */
if (!db_create_file_record(jcr, mdb, ar)) {
- db_unlock(mdb);
- return 0;
+ goto bail_out;
}
Dmsg0(500, "db_create_file_record OK\n");
Dmsg3(300, "CreateAttributes Path=%s File=%s FilenameId=%d\n", mdb->path, mdb->fname, ar->FilenameId);
db_unlock(mdb);
return 1;
+
+bail_out:
+ db_unlock(mdb);
+ return 0;
}
/*
fdbr->PathId, fdbr->FilenameId);
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("File record not found in Catalog.\n"));
}
return stat;
Mmsg1(&mdb->errmsg, _("Filename record: %s not found.\n"), mdb->fname);
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("Filename record: %s not found in Catalog.\n"), mdb->fname);
}
return FilenameId;
}
Mmsg1(&mdb->errmsg, _("Path record: %s not found.\n"), mdb->path);
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("Path record: %s not found in Catalog.\n"), mdb->path);
}
return PathId;
}
}
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("No Volume for JobId %d found in Catalog.\n"), JobId);
}
db_unlock(mdb);
return stat;
bstrncpy(pdbr->LabelFormat, row[14]!=NULL?row[15]:"", sizeof(pdbr->LabelFormat));
stat = pdbr->PoolId;
}
+ } else {
+ Mmsg(&mdb->errmsg, _("Pool record not found in Catalog.\n"));
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("Pool record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
cdbr->JobRetention = str_to_int64(row[5]);
stat = 1;
}
+ } else {
+ Mmsg(&mdb->errmsg, _("Client record not found in Catalog.\n"));
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("Client record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
return 1;
}
sql_free_result(mdb);
- }
+ } else {
+ Mmsg(&mdb->errmsg, _("Counter record: %s not found in Catalog.\n"), cr->Counter);
+ }
db_unlock(mdb);
return 0;
}
stat = fsr->FileSetId;
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("FileSet record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
}
}
sql_free_result(mdb);
+ } else {
+ Mmsg(&mdb->errmsg, _("Media record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
(char)(jr->Level), dt, jr->ClientId, edit_uint64(JobTDate, ed1), jr->JobId);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
- db_unlock(mdb);
mdb->changes = 0;
+ db_unlock(mdb);
return stat;
}
term_msg(); /* terminate message handler */
stop_watchdog();
close_memory_pool(); /* release free memory in pool */
- sm_dump(False);
+ sm_dump(false);
exit(sig);
}
wd->interval = 60;
wd->data = new_control_jcr("*JobMonitor*", JT_SYSTEM);
register_watchdog(wd);
-
- return;
}
/*
int stat, errstat;
P(jcr->mutex);
- sm_check(__FILE__, __LINE__, True);
+ sm_check(__FILE__, __LINE__, true);
init_msg(jcr, jcr->messages);
create_unique_job_name(jcr, jcr->job->hdr.name);
set_jcr_job_status(jcr, JS_Created);
{
JCR *jcr = (JCR *)arg;
- pthread_detach(pthread_self());
- sm_check(__FILE__, __LINE__, True);
+ jcr->my_thread_id = pthread_self();
+ pthread_detach(jcr->my_thread_id);
+ sm_check(__FILE__, __LINE__, true);
for ( ;; ) {
}
Dmsg0(50, "======== End Job ==========\n");
- sm_check(__FILE__, __LINE__, True);
+ sm_check(__FILE__, __LINE__, true);
return NULL;
}
return;
}
njobs = 0;
- bsendmsg(ua, _("\nRunning Jobs:\n"));
bsendmsg(ua, _(" JobId Level Name Status\n"));
bsendmsg(ua, _("======================================================================\n"));
foreach_jcr(jcr) {
term_msg();
stop_watchdog();
close_memory_pool(); /* release free memory in pool */
- sm_dump(False); /* dump orphaned buffers */
+ sm_dump(false); /* dump orphaned buffers */
exit(sig);
}
struct s_last_job *job;
bacstat = 0;
+ if (!last_jobs) {
+ return _("Bacula Terminated");
+ }
if (last_jobs->size() > 0) {
job = (struct s_last_job *)last_jobs->first();
switch (job->JobStatus) {
delete mlist;
- sm_dump(False);
+ sm_dump(false);
}
#endif
* buffer is at least one byte longer than the message length.
*/
mp_chr(bsock->msg)[nbytes] = 0; /* terminate in case it is a string */
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
return nbytes; /* return actual length of message */
}
((dlink *)(((char *)xitem)+loffset))->next = ilink->next;
}
num_items--;
+ if (num_items == 0) {
+ head = tail = NULL;
+ }
}
void * dlist::next(void *item)
delete jcr_chain;
- sm_dump(False);
+ sm_dump(false);
}
#endif
if (lookup(key)) {
return false; /* already exists */
}
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
ASSERT(index < buckets);
Dmsg2(100, "Insert: hash=0x%x index=%d\n", (unsigned)hash, index);
hp = (hlink *)(((char *)item)+loffset);
Dmsg2(100, "num_items=%d max_items=%d\n", num_items, max_items);
grow_table();
}
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
Dmsg3(100, "Leave insert index=%d num_items=%d key=%s\n", index, num_items, key);
return true;
}
free(jcrtbl);
printf("Freed jcrtbl\n");
- sm_dump(False);
+ sm_dump(false);
}
#endif
int errstat;
struct s_last_job *job_entry = NULL;
if (!last_jobs) {
- last_jobs = new dlist(job_entry, &job_entry->link);
+ last_jobs = new dlist(job_entry, &job_entry->link);
if ((errstat=rwl_init(&lock)) != 0) {
Emsg1(M_ABORT, 0, _("Unable to initialize jcr_chain lock. ERR=%s\n"),
strerror(errstat));
void term_last_jobs_list()
{
- struct s_last_job *je;
if (last_jobs) {
- foreach_dlist(je, last_jobs) {
- free(je);
- }
delete last_jobs;
last_jobs = NULL;
rwl_destroy(&lock);
memset(jcr, 0, size);
jcr->msg_queue = new dlist(item, &item->link);
jcr->job_end_push.init(1, false);
- jcr->my_thread_id = pthread_self();
jcr->sched_time = time(NULL);
jcr->daemon_free_jcr = daemon_free_jcr; /* plug daemon free routine */
jcr->use_count = 1;
{
struct abufhead *buf, *next;
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
P(mutex);
for (int i=1; i<=PM_MAX; i++) {
buf = pool_ctl[i].free_buf;
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#undef calloc
#undef malloc
#undef free
+
+/* We normally turn off debugging here.
+ * If you want it, simply #ifdef all the
+ * following off.
+ */
+#undef Dmsg1
+#undef Dmsg2
+#undef Dmsg3
+#undef Dmsg4
+#define Dmsg1(l,f,a1)
+#define Dmsg2(l,f,a1,a2)
+#define Dmsg3(l,f,a1,a2,a3)
+#define Dmsg4(l,f,a1,a2,a3,a4)
&abqueue, &abqueue
};
-static Boolean bufimode = False; /* Buffers not tracked when True */
+static bool bufimode = false; /* Buffers not tracked when True */
#define HEAD_SIZE BALIGN(sizeof(struct abufhead))
* N.B. DO NOT USE any Bacula print routines (Dmsg, Jmsg, Emsg, ...)
* as they have all been shut down at this point.
*/
-void sm_dump(Boolean bufdump)
+void sm_dump(bool bufdump)
{
struct abufhead *ap;
if (ap->abfname != NULL) {
unsigned memsize = ap->ablen - (HEAD_SIZE + 1);
- char errmsg[80];
+ char errmsg[500];
- sprintf(errmsg,
+ bsnprintf(errmsg, sizeof(errmsg),
"Orphaned buffer: %6u bytes allocated at line %d of %s %s\n",
memsize, ap->ablineno, my_name, ap->abfname
);
fprintf(stderr, "%s", errmsg);
if (bufdump) {
+ char buf[20];
unsigned llen = 0;
char *cp = ((char *) ap) + HEAD_SIZE;
errmsg[0] = EOS;
while (memsize) {
if (llen >= 16) {
- strcat(errmsg, "\n");
+ bstrncat(errmsg, "\n", sizeof(errmsg));
llen = 0;
fprintf(stderr, "%s", errmsg);
errmsg[0] = EOS;
}
- sprintf(errmsg + strlen(errmsg), " %02X",
+ bsnprintf(buf, sizeof(buf), " %02X",
(*cp++) & 0xFF);
+ bstrncat(errmsg, buf, sizeof(errmsg));
llen++;
memsize--;
}
#undef sm_check
/* SM_CHECK -- Check the buffers and dump if any damage exists. */
-void sm_check(const char *fname, int lineno, Boolean bufdump)
+void sm_check(const char *fname, int lineno, bool bufdump)
{
if (!sm_check_rtn(fname, lineno, bufdump)) {
Emsg2(M_ABORT, 0, "Damaged buffer found. Called from %s:%d\n",
#undef sm_check_rtn
/* SM_CHECK_RTN -- Check the buffers and return 1 if OK otherwise 0 */
-int sm_check_rtn(const char *fname, int lineno, Boolean bufdump)
+int sm_check_rtn(const char *fname, int lineno, bool bufdump)
{
struct abufhead *ap;
int bad, badbuf = 0;
void sm_static(int mode)
{
- bufimode = (Boolean) (mode != 0);
+ bufimode = (bool) (mode != 0);
}
/*
/*
- Definitions for the smart memory allocator
+ Definitions for the smart memory allocator
Version $Id$
#ifdef SMARTALLOC
-typedef enum {False = 0, True = 1} Boolean;
-
extern void *sm_malloc(const char *fname, int lineno, unsigned int nbytes),
- *sm_calloc(const char *fname, int lineno,
- unsigned int nelem, unsigned int elsize),
- *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size),
- *actuallymalloc(unsigned int size),
- *actuallycalloc(unsigned int nelem, unsigned int elsize),
- *actuallyrealloc(void *ptr, unsigned int size);
+ *sm_calloc(const char *fname, int lineno,
+ unsigned int nelem, unsigned int elsize),
+ *sm_realloc(const char *fname, int lineno, void *ptr, unsigned int size),
+ *actuallymalloc(unsigned int size),
+ *actuallycalloc(unsigned int nelem, unsigned int elsize),
+ *actuallyrealloc(void *ptr, unsigned int size);
extern void sm_free(const char *fname, int lineno, void *fp);
extern void actuallyfree(void *cp),
- sm_dump(Boolean bufdump), sm_static(int mode);
+ sm_dump(bool bufdump), sm_static(int mode);
extern void sm_new_owner(const char *fname, int lineno, char *buf);
#ifdef SMCHECK
-extern void sm_check(const char *fname, int lineno, Boolean bufdump);
-extern int sm_check_rtn(const char *fname, int lineno, Boolean bufdump);
+extern void sm_check(const char *fname, int lineno, bool bufdump);
+extern int sm_check_rtn(const char *fname, int lineno, bool bufdump);
#else
#define sm_check(f, l, fl)
#define sm_check_rtn(f, l, fl) 1
#define sm_check_rtn(f, l, fl) 1
extern void *b_malloc();
-#define malloc(x) b_malloc(__FILE__, __LINE__, (x))
+#define malloc(x) b_malloc(__FILE__, __LINE__, (x))
#endif
stat = pthread_join(wd_tid, NULL);
- foreach_dlist(p, wd_queue) {
+ while (!wd_queue->empty()) {
+ void *item = wd_queue->first();
+ wd_queue->remove(item);
+ p = (watchdog_t *)item;
if (p->destructor != NULL) {
p->destructor(p);
}
delete wd_queue;
wd_queue = NULL;
- foreach_dlist(p, wd_inactive) {
+ while (!wd_inactive->empty()) {
+ void *item = wd_inactive->first();
+ wd_inactive->remove(item);
+ p = (watchdog_t *)item;
if (p->destructor != NULL) {
p->destructor(p);
}
free(p);
}
-
delete wd_inactive;
wd_inactive = NULL;
rwl_destroy(&lock);
Dmsg0(400, "NicB-reworked watchdog thread entered\n");
while (!quit) {
- watchdog_t *p;
+ watchdog_t *p, *q;
/*
* We lock the jcr chain here because a good number of the
* callback routines lock the jcr chain. We need to lock
* it here *before* the watchdog lock because the SD message
* thread first locks the jcr chain, then when closing the
- * job locks the watchdog chain. If the two thread do not
+ * job locks the watchdog chain. If the two threads do not
* lock in the same order, we get a deadlock -- each holds
* the other's needed lock.
*/
/* Reschedule (or move to inactive list if it's a one-shot timer) */
if (p->one_shot) {
+ /*
+ * Note, when removing an item while walking the list
+ * we must get the previous pointer (q) and set the
+ * current pointer (p) to this previous pointer after
+ * removing the current pointer, otherwise, we won't
+ * walk the rest of the list.
+ */
+ q = (watchdog_t *)wd_queue->prev(p);
wd_queue->remove(p);
wd_inactive->append(p);
+ p = q;
} else {
p->next_fire = watchdog_time + p->interval;
}
break;
case 's':
- signals = FALSE;
+ signals = false;
break;
case 'v':
static void terminate_btape(int stat)
{
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
if (configfile) {
free(configfile);
}
term_msg();
close_memory_pool(); /* free memory in pool */
- sm_dump(False);
+ sm_dump(false);
exit(stat);
}
return;
}
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
block = new_block(dev);
rec = new_record();
rec->data = check_pool_memory_size(rec->data, i);
memset(rec->data, i & 0xFF, i);
rec->data_len = i;
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
if (write_record_to_block(block, rec)) {
empty_block(block);
blkno++;
} else {
break;
}
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
}
free_record(rec);
free_block(block);
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
}
/*
DEV_RECORD *rec;
int i;
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
block = new_block(dev);
rec = new_record();
dump_block(block, "test");
rec->data = check_pool_memory_size(rec->data, i);
memset(rec->data, i & 0xFF, i);
rec->data_len = i;
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
goto bail_out;
Pmsg0(0, _("Wrote block to device.\n"));
bail_out:
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
free_record(rec);
free_block(block);
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
}
/*
}
if (!write_session_label(jcr, block, EOS_LABEL)) {
Pmsg1(000, _("Error writting end session label. ERR=%s\n"), strerror_dev(dev));
- ok = FALSE;
+ ok = false;
}
/* Write out final block of this session */
if (!write_block_to_device(jcr->dcr, block)) {
- Pmsg0(-1, _("Set ok=FALSE after write_block_to_device.\n"));
- ok = FALSE;
+ Pmsg0(-1, _("Set ok=false after write_block_to_device.\n"));
+ ok = false;
}
Pmsg0(-1, _("Wrote End Of Session label.\n"));
/* Release the device */
if (!release_device(jcr)) {
Pmsg0(-1, _("Error in release_device\n"));
- ok = FALSE;
+ ok = false;
}
/* Full test in progress */
if (!fixup_device_block_write_error(jcr, dev, block)) {
Pmsg1(000, _("Cannot fixup device error. %s\n"), strerror_dev(dev));
- ok = FALSE;
+ ok = false;
unlock_device(dev);
return 0;
}
count = 1000;
}
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
block = new_block(dev);
rec = new_record();
scan_blocks();
bail_out:
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
free_record(rec);
free_block(block);
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
}
bool found;
while (get_cmd("*")) {
- sm_check(__FILE__, __LINE__, False);
+ sm_check(__FILE__, __LINE__, false);
found = false;
parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS);
for (i=0; i<comsize; i++) /* search for command */
stop_watchdog();
close_memory_pool();
- sm_dump(False); /* dump orphaned buffers */
+ sm_dump(false); /* dump orphaned buffers */
exit(sig);
}
/* Get all the Ids of each name */
db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
sprintf(buf, "SELECT FilenameId FROM Filename WHERE Name='%s'", esc_name);
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
if (!make_id_list(buf, &id_list)) {
exit(1);
}
for (int j=1; j<id_list.num_ids; j++) {
sprintf(buf, "UPDATE File SET FilenameId=%u WHERE FilenameId=%u",
id_list.Id[0], id_list.Id[j]);
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
sprintf(buf, "DELETE FROM Filename WHERE FilenameId=%u",
id_list.Id[j]);
+ if (verbose > 2) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
}
}
/* Get all the Ids of each name */
db_escape_string(esc_name, name_list.name[i], strlen(name_list.name[i]));
sprintf(buf, "SELECT PathId FROM Path WHERE Path='%s'", esc_name);
- id_list.num_ids = 0;
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
if (!make_id_list(buf, &id_list)) {
exit(1);
}
for (int j=1; j<id_list.num_ids; j++) {
sprintf(buf, "UPDATE File SET PathId=%u WHERE PathId=%u",
id_list.Id[0], id_list.Id[j]);
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
sprintf(buf, "DELETE FROM Path WHERE PathId=%u",
id_list.Id[j]);
+ if (verbose > 2) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
}
}
query = "SELECT File.FileId,Job.JobId FROM File "
"LEFT OUTER JOIN Job ON (File.JobId=Job.JobId) "
"WHERE Job.JobId IS NULL";
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
query = "SELECT Path.PathId,File.PathId FROM Path "
"LEFT OUTER JOIN File ON (Path.PathId=File.PathId) "
"GROUP BY Path.PathId HAVING File.PathId IS NULL";
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
query = "SELECT Filename.FilenameId,File.FilenameId FROM Filename "
"LEFT OUTER JOIN File ON (Filename.FilenameId=File.FilenameId) "
"WHERE File.FilenameId IS NULL";
-
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
query = "SELECT FileSet.FileSetId,Job.FileSetId FROM FileSet "
"LEFT OUTER JOIN Job ON (FileSet.FileSetId=Job.FileSetId) "
"WHERE Job.FileSetId IS NULL";
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
printf("Checking for Filenames with a trailing slash\n");
query = "SELECT FilenameId,Name from Filename "
"WHERE Name LIKE '%/'";
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
bsnprintf(buf, sizeof(buf),
"UPDATE Filename SET Name='%s' WHERE FilenameId=%u",
esc_name, id_list.Id[i]);
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
}
}
printf("Checking for Paths without a trailing slash\n");
query = "SELECT PathId,Path from Path "
"WHERE Path NOT LIKE '%/'";
+ if (verbose > 1) {
+ printf("%s\n", query);
+ }
if (!make_id_list(query, &id_list)) {
exit(1);
}
db_escape_string(esc_name, name, len);
bsnprintf(buf, sizeof(buf), "UPDATE Path SET Path='%s' WHERE PathId=%u",
esc_name, id_list.Id[i]);
+ if (verbose > 1) {
+ printf("%s\n", buf);
+ }
db_sql_query(db, buf, NULL, NULL);
}
}
free_jcr(jcr);
close_memory_pool();
- sm_dump(False);
+ sm_dump(false);
exit(0);
}
free_jcr(jcr);
close_memory_pool();
- sm_dump(False);
+ sm_dump(false);
exit(0);
}
#undef VERSION
#define VERSION "1.33.6"
#define VSTRING "1"
-#define BDATE "30 Mar 2004"
-#define LSMDATE "30Mar04"
+#define BDATE "01 Apr 2004"
+#define LSMDATE "01Apr04"
/* Debug flags */
#undef DEBUG