X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fbutil.c;h=43a8088a8f909425cd9c8dacddb39afc687db04c;hb=70fe74e091b2426c2209110ada86566ee2f89c97;hp=746ff744a98017f5968b9679e77fd7a04012c3aa;hpb=16415680c8b2c30cddd68400f906d410b4d344f0;p=bacula%2Fbacula diff --git a/bacula/src/stored/butil.c b/bacula/src/stored/butil.c index 746ff744a9..43a8088a8f 100644 --- a/bacula/src/stored/butil.c +++ b/bacula/src/stored/butil.c @@ -12,7 +12,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 @@ -43,19 +43,19 @@ char *rec_state_to_str(DEV_RECORD *rec) static char buf[200]; buf[0] = 0; if (rec->state & REC_NO_HEADER) { - strcat(buf, "Nohdr,"); + strcat(buf, _("Nohdr,")); } if (is_partial_record(rec)) { - strcat(buf, "partial,"); + strcat(buf, _("partial,")); } if (rec->state & REC_BLOCK_EMPTY) { - strcat(buf, "empty,"); + strcat(buf, _("empty,")); } if (rec->state & REC_NO_MATCH) { - strcat(buf, "Nomatch,"); + strcat(buf, _("Nomatch,")); } if (rec->state & REC_CONTINUATION) { - strcat(buf, "cont,"); + strcat(buf, _("cont,")); } if (buf[0]) { buf[strlen(buf)-1] = 0; @@ -92,6 +92,9 @@ JCR *setup_jcr(const char *name, char *dev_name, BSR *bsr, jcr->fileset_md5 = get_pool_memory(PM_FNAME); pm_strcpy(jcr->fileset_md5, "Dummy.fileset.md5"); + init_autochangers(); + create_volume_list(); + dcr = setup_to_access_device(jcr, dev_name, VolumeName, mode); if (!dcr) { return NULL; @@ -118,6 +121,8 @@ static DCR *setup_to_access_device(JCR *jcr, char *dev_name, DCR *dcr; char VolName[MAX_NAME_LENGTH]; + init_reservations_lock(); + /* * If no volume name already given and no bsr, and it is a file, * try getting name from Filename @@ -157,6 +162,7 @@ static DCR *setup_to_access_device(JCR *jcr, char *dev_name, } device->dev = dev; dcr = new_dcr(jcr, dev); + jcr->dcr = dcr; if (VolName[0]) { bstrncpy(dcr->VolumeName, VolName, sizeof(dcr->VolumeName)); } @@ -169,11 +175,13 @@ static DCR *setup_to_access_device(JCR *jcr, char *dev_name, if (!acquire_device_for_read(dcr)) { return NULL; } + jcr->read_dcr = dcr; } else { if (!first_open_device(dcr)) { Jmsg1(jcr, M_FATAL, 0, _("Cannot open %s\n"), dev->print_name()); return NULL; } + jcr->dcr = dcr; /* write dcr */ } return dcr; } @@ -224,8 +232,10 @@ static DEVRES *find_device_res(char *device_name, int read_access) bool found = false; DEVRES *device; + Dmsg0(900, "Enter find_device_res\n"); LockRes(); foreach_res(device, R_DEVICE) { + Dmsg2(900, "Compare %s and %s\n", device->device_name, device_name); if (strcmp(device->device_name, device_name) == 0) { found = true; break; @@ -242,6 +252,7 @@ static DEVRES *find_device_res(char *device_name, int read_access) } } foreach_res(device, R_DEVICE) { + Dmsg2(900, "Compare %s and %s\n", device->hdr.name, device_name); if (strcmp(device->hdr.name, device_name) == 0) { found = true; break; @@ -254,8 +265,12 @@ static DEVRES *find_device_res(char *device_name, int read_access) configfile); return NULL; } - Pmsg2(0, _("Using device: \"%s\" for %s.\n"), device_name, - read_access?"reading":"writing"); + if (read_access) { + Pmsg1(0, _("Using device: \"%s\" for reading.\n"), device_name); + } + else { + Pmsg1(0, _("Using device: \"%s\" for writing.\n"), device_name); + } return device; }