From: Kern Sibbald Date: Wed, 26 Sep 2007 23:54:02 +0000 (+0000) Subject: Convert bnet_xxx to bsock class calls X-Git-Tag: Release-3.0.0~2439 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=762fe32f53360132ab6ec934322dcafcf50729d0;p=bacula%2Fbacula Convert bnet_xxx to bsock class calls git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5667 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 73252c0869..99f9c2d47b 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -98,7 +98,7 @@ bool dir_update_device(JCR *jcr, DEVICE *dev) } else { pm_strcpy(ChangerName, "*"); } - ok =bnet_fsend(dir, Device_update, + ok =dir->fsend(Device_update, jcr->Job, dev_name.c_str(), dev->can_append()!=0, @@ -125,7 +125,7 @@ bool dir_update_changer(JCR *jcr, AUTOCHANGER *changer) pm_strcpy(MediaType, device->media_type); bash_spaces(MediaType); /* This is mostly to indicate that we are here */ - ok = bnet_fsend(dir, Device_update, + ok = dir->fsend(Device_update, jcr->Job, dev_name.c_str(), /* Changer name */ 0, 0, 0, /* append, read, num_writers */ @@ -347,7 +347,7 @@ bool dir_update_volume_info(DCR *dcr, bool label) pm_strcpy(VolumeName, vol->VolCatName); bash_spaces(VolumeName); InChanger = vol->InChanger; - bnet_fsend(dir, Update_media, jcr->Job, + dir->fsend(Update_media, jcr->Job, VolumeName.c_str(), vol->VolCatJobs, vol->VolCatFiles, vol->VolCatBlocks, edit_uint64(vol->VolCatBytes, ed1), vol->VolCatMounts, vol->VolCatErrors, @@ -396,7 +396,7 @@ bool dir_create_jobmedia_record(DCR *dcr) } dcr->WroteVol = false; - bnet_fsend(dir, Create_job_media, jcr->Job, + dir->fsend(Create_job_media, jcr->Job, dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartFile, dcr->EndFile, dcr->StartBlock, dcr->EndBlock, diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 3776f92e2e..1d9cad0eba 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -493,9 +493,9 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) if (!dev->is_autochanger() || !dcr->device->changer_name || !dcr->device->changer_command) { if (strcmp(cmd, "drives") == 0) { - bnet_fsend(dir, "drives=1\n"); + dir->fsend("drives=1\n"); } - bnet_fsend(dir, _("3993 Device %s not an autochanger device.\n"), + dir->fsend(_("3993 Device %s not an autochanger device.\n"), dev->print_name()); return false; } @@ -506,7 +506,7 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) if (changer_res) { drives = changer_res->device->size(); } - bnet_fsend(dir, "drives=%d\n", drives); + dir->fsend("drives=%d\n", drives); Dmsg1(100, "drives=%d\n", drives); return true; } @@ -516,10 +516,10 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) /* Now issue the command */ changer = edit_device_codes(dcr, changer, dcr->device->changer_command, cmd); - bnet_fsend(dir, _("3306 Issuing autochanger \"%s\" command.\n"), cmd); + dir->fsend(_("3306 Issuing autochanger \"%s\" command.\n"), cmd); bpipe = open_bpipe(changer, timeout, "r"); if (!bpipe) { - bnet_fsend(dir, _("3996 Open bpipe failed.\n")); + dir->fsend(_("3996 Open bpipe failed.\n")); goto bail_out; } if (strcmp(cmd, "list") == 0) { @@ -538,7 +538,7 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) /* Strip any leading space in front of # of slots */ for (p=buf; B_ISSPACE(*p); p++) { } - bnet_fsend(dir, "slots=%s", p); + dir->fsend("slots=%s", p); Dmsg1(100, "msg); } @@ -546,7 +546,7 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd) if (stat != 0) { berrno be; be.set_errno(stat); - bnet_fsend(dir, _("Autochanger error: ERR=%s\n"), be.bstrerror()); + dir->fsend(_("Autochanger error: ERR=%s\n"), be.bstrerror()); } bnet_sig(dir, BNET_EOD); ok = true; diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index cd0153e8f5..f54994bb97 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -275,12 +275,12 @@ static bool setdebug_cmd(JCR *jcr) Dmsg1(10, "setdebug_cmd: %s", dir->msg); if (sscanf(dir->msg, "setdebug=%d trace=%d", &level, &trace_flag) != 2 || level < 0) { - bnet_fsend(dir, _("3991 Bad setdebug command: %s\n"), dir->msg); + dir->fsend(_("3991 Bad setdebug command: %s\n"), dir->msg); return 0; } debug_level = level; set_trace(trace_flag); - return bnet_fsend(dir, OKsetdebug, level); + return dir->fsend(OKsetdebug, level); } @@ -296,7 +296,7 @@ static bool cancel_cmd(JCR *cjcr) if (sscanf(dir->msg, "cancel Job=%127s", Job) == 1) { if (!(jcr=get_jcr_by_full_name(Job))) { - bnet_fsend(dir, _("3904 Job %s not found.\n"), Job); + dir->fsend(_("3904 Job %s not found.\n"), Job); } else { oldStatus = jcr->JobStatus; set_jcr_job_status(jcr, JS_Canceled); @@ -321,13 +321,13 @@ static bool cancel_cmd(JCR *cjcr) pthread_cond_broadcast(&wait_device_release); } Jmsg(jcr, M_INFO, 0, _("Job %s marked to be canceled.\n"), jcr->Job); - bnet_fsend(dir, _("3000 Job %s marked to be canceled.\n"), jcr->Job); + dir->fsend(_("3000 Job %s marked to be canceled.\n"), jcr->Job); free_jcr(jcr); } } else { - bnet_fsend(dir, _("3903 Error scanning cancel command.\n")); + dir->fsend(_("3903 Error scanning cancel command.\n")); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return 1; } @@ -401,18 +401,18 @@ static bool do_label(JCR *jcr, int relabel) dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), dev_name.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), dev_name.c_str()); } } else { /* NB dir->msg gets clobbered in bnet_fsend, so save command */ pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3903 Error scanning label command: %s\n"), jcr->errmsg); + dir->fsend(_("3903 Error scanning label command: %s\n"), jcr->errmsg); } free_memory(oldname); free_memory(newname); free_memory(poolname); free_memory(mtype); - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return true; } @@ -456,7 +456,7 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, /* Set old volume name for open if relabeling */ bstrncpy(dcr->VolCatInfo.VolCatName, volname, sizeof(dcr->VolCatInfo.VolCatName)); if (dev->open(dcr, mode) < 0) { - bnet_fsend(dir, _("3910 Unable to open device %s: ERR=%s\n"), + dir->fsend(_("3910 Unable to open device %s: ERR=%s\n"), dev->print_name(), dev->strerror()); goto bail_out; } @@ -472,7 +472,7 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, case VOL_LABEL_ERROR: case VOL_OK: if (!relabel) { - bnet_fsend(dir, _( + dir->fsend(_( "3920 Cannot label Volume because it is already labeled: \"%s\"\n"), dev->VolHdr.VolumeName); break; @@ -480,11 +480,11 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, /* Relabel request. If oldname matches, continue */ if (strcmp(oldname, dev->VolHdr.VolumeName) != 0) { - bnet_fsend(dir, _("3921 Wrong volume mounted.\n")); + dir->fsend(_("3921 Wrong volume mounted.\n")); break; } if (dev->label_type != B_BACULA_LABEL) { - bnet_fsend(dir, _("3922 Cannot relabel an ANSI/IBM labeled Volume.\n")); + dir->fsend(_("3922 Cannot relabel an ANSI/IBM labeled Volume.\n")); break; } /* Fall through wanted! */ @@ -492,20 +492,20 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, case VOL_NO_LABEL: if (!write_new_volume_label_to_dev(dcr, newname, poolname, relabel, true /* write dvd now */)) { - bnet_fsend(dir, _("3912 Failed to label Volume: ERR=%s\n"), dev->bstrerror()); + dir->fsend(_("3912 Failed to label Volume: ERR=%s\n"), dev->bstrerror()); break; } bstrncpy(dcr->VolumeName, newname, sizeof(dcr->VolumeName)); /* The following 3000 OK label. string is scanned in ua_label.c */ - bnet_fsend(dir, "3000 OK label. VolBytes=%s DVD=%d Volume=\"%s\" Device=%s\n", + dir->fsend("3000 OK label. VolBytes=%s DVD=%d Volume=\"%s\" Device=%s\n", edit_uint64(dev->VolCatInfo.VolCatBytes, ed1), dev->is_dvd()?1:0, newname, dev->print_name()); break; case VOL_NO_MEDIA: - bnet_fsend(dir, _("3914 Failed to label Volume (no media): ERR=%s\n"), dev->bstrerror()); + dir->fsend(_("3914 Failed to label Volume (no media): ERR=%s\n"), dev->bstrerror()); break; default: - bnet_fsend(dir, _("3913 Cannot label Volume. " + dir->fsend(_("3913 Cannot label Volume. " "Unknown status %d from read_volume_label()\n"), label_status); break; } @@ -538,11 +538,11 @@ static bool read_label(DCR *dcr) dev->clear_labeled(); /* force read of label */ switch (read_dev_volume_label(dcr)) { case VOL_OK: - bnet_fsend(dir, _("3001 Mounted Volume: %s\n"), dev->VolHdr.VolumeName); + dir->fsend(_("3001 Mounted Volume: %s\n"), dev->VolHdr.VolumeName); ok = true; break; default: - bnet_fsend(dir, _("3902 Cannot mount Volume on Storage Device %s because:\n%s"), + dir->fsend(_("3902 Cannot mount Volume on Storage Device %s because:\n%s"), dev->print_name(), jcr->errmsg); ok = false; break; @@ -652,7 +652,7 @@ static bool mount_cmd(JCR *jcr) /* Someone is waiting, wake him */ Dmsg0(100, "Waiting for mount. Attempting to wake thread\n"); dev->set_blocked(BST_MOUNT); - bnet_fsend(dir, "3001 OK mount. Device=%s\n", + dir->fsend("3001 OK mount. Device=%s\n", dev->print_name()); pthread_cond_broadcast(&dev->wait_next_vol); Dmsg1(100, "JobId=%u broadcast wait_device_release\n", (uint32_t)dcr->jcr->JobId); @@ -667,7 +667,7 @@ static bool mount_cmd(JCR *jcr) } /* We freed the device, so reopen it and wake any waiting threads */ if (dev->open(dcr, OPEN_READ_ONLY) < 0) { - bnet_fsend(dir, _("3901 open device failed: ERR=%s\n"), + dir->fsend(_("3901 open device failed: ERR=%s\n"), dev->bstrerror()); if (dev->blocked() == BST_UNMOUNTED) { /* We blocked the device, so unblock it */ @@ -687,10 +687,10 @@ static bool mount_cmd(JCR *jcr) dev->set_blocked(BST_MOUNT); } if (dev->is_labeled()) { - bnet_fsend(dir, _("3001 Device %s is mounted with Volume \"%s\"\n"), + dir->fsend(_("3001 Device %s is mounted with Volume \"%s\"\n"), dev->print_name(), dev->VolHdr.VolumeName); } else { - bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n" + dir->fsend(_("3905 Device %s open but no Bacula volume is mounted.\n" "If this is not a blank tape, try unmounting and remounting the Volume.\n"), dev->print_name()); } @@ -700,12 +700,12 @@ static bool mount_cmd(JCR *jcr) break; case BST_DOING_ACQUIRE: - bnet_fsend(dir, _("3001 Device %s is doing acquire.\n"), + dir->fsend(_("3001 Device %s is doing acquire.\n"), dev->print_name()); break; case BST_WRITING_LABEL: - bnet_fsend(dir, _("3903 Device %s is being labeled.\n"), + dir->fsend(_("3903 Device %s is being labeled.\n"), dev->print_name()); break; @@ -715,55 +715,55 @@ static bool mount_cmd(JCR *jcr) } if (dev->is_open()) { if (dev->is_labeled()) { - bnet_fsend(dir, _("3001 Device %s is mounted with Volume \"%s\"\n"), + dir->fsend(_("3001 Device %s is mounted with Volume \"%s\"\n"), dev->print_name(), dev->VolHdr.VolumeName); } else { - bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n" + dir->fsend(_("3905 Device %s open but no Bacula volume is mounted.\n" "If this is not a blank tape, try unmounting and remounting the Volume.\n"), dev->print_name()); } } else if (dev->is_tape()) { if (dev->open(dcr, OPEN_READ_ONLY) < 0) { - bnet_fsend(dir, _("3901 open device failed: ERR=%s\n"), + dir->fsend(_("3901 open device failed: ERR=%s\n"), dev->bstrerror()); break; } read_label(dcr); if (dev->is_labeled()) { - bnet_fsend(dir, _("3001 Device %s is already mounted with Volume \"%s\"\n"), + dir->fsend(_("3001 Device %s is already mounted with Volume \"%s\"\n"), dev->print_name(), dev->VolHdr.VolumeName); } else { - bnet_fsend(dir, _("3905 Device %s open but no Bacula volume is mounted.\n" + dir->fsend(_("3905 Device %s open but no Bacula volume is mounted.\n" "If this is not a blank tape, try unmounting and remounting the Volume.\n"), dev->print_name()); } } else if (dev->is_unmountable()) { if (dev->mount(1)) { - bnet_fsend(dir, _("3002 Device %s is mounted.\n"), + dir->fsend(_("3002 Device %s is mounted.\n"), dev->print_name()); } else { - bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); + dir->fsend(_("3907 %s"), dev->bstrerror()); } } else { /* must be file */ - bnet_fsend(dir, _("3906 File device %s is always mounted.\n"), + dir->fsend(_("3906 File device %s is always mounted.\n"), dev->print_name()); } break; default: - bnet_fsend(dir, _("3905 Bizarre wait state %d\n"), dev->blocked()); + dir->fsend(_("3905 Bizarre wait state %d\n"), dev->blocked()); break; } dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); } } else { pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3909 Error scanning mount command: %s\n"), jcr->errmsg); + dir->fsend(_("3909 Error scanning mount command: %s\n"), jcr->errmsg); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return true; } @@ -789,14 +789,14 @@ static bool unmount_cmd(JCR *jcr) } if (dev->is_unmountable()) { if (dev->unmount(0)) { - bnet_fsend(dir, _("3002 Device %s unmounted.\n"), + dir->fsend(_("3002 Device %s unmounted.\n"), dev->print_name()); } else { - bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); + dir->fsend(_("3907 %s"), dev->bstrerror()); } } else { Dmsg0(90, "Device already unmounted\n"); - bnet_fsend(dir, _("3901 Device %s is already unmounted.\n"), + dir->fsend(_("3901 Device %s is already unmounted.\n"), dev->print_name()); } } else if (dev->blocked() == BST_WAITING_FOR_SYSOP) { @@ -807,19 +807,19 @@ static bool unmount_cmd(JCR *jcr) dev->close(); } if (dev->is_unmountable() && !dev->unmount(0)) { - bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); + dir->fsend(_("3907 %s"), dev->bstrerror()); } else { dev->set_blocked(BST_UNMOUNTED_WAITING_FOR_SYSOP); - bnet_fsend(dir, _("3001 Device %s unmounted.\n"), + dir->fsend(_("3001 Device %s unmounted.\n"), dev->print_name()); } } else if (dev->blocked() == BST_DOING_ACQUIRE) { - bnet_fsend(dir, _("3902 Device %s is busy in acquire.\n"), + dir->fsend(_("3902 Device %s is busy in acquire.\n"), dev->print_name()); } else if (dev->blocked() == BST_WRITING_LABEL) { - bnet_fsend(dir, _("3903 Device %s is being labeled.\n"), + dir->fsend(_("3903 Device %s is being labeled.\n"), dev->print_name()); } else if (dev->is_busy()) { @@ -838,23 +838,23 @@ static bool unmount_cmd(JCR *jcr) dev->close(); } if (dev->is_unmountable() && !dev->unmount(0)) { - bnet_fsend(dir, _("3907 %s"), dev->bstrerror()); + dir->fsend(_("3907 %s"), dev->bstrerror()); } else { - bnet_fsend(dir, _("3002 Device %s unmounted.\n"), + dir->fsend(_("3002 Device %s unmounted.\n"), dev->print_name()); } } dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); } } else { /* NB dir->msg gets clobbered in bnet_fsend, so save command */ pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3907 Error scanning unmount command: %s\n"), jcr->errmsg); + dir->fsend(_("3907 Error scanning unmount command: %s\n"), jcr->errmsg); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return true; } @@ -883,28 +883,28 @@ static bool release_cmd(JCR *jcr) unload_autochanger(dcr, -1); } Dmsg0(90, "Device already released\n"); - bnet_fsend(dir, _("3921 Device %s already released.\n"), + dir->fsend(_("3921 Device %s already released.\n"), dev->print_name()); } else if (dev->blocked() == BST_WAITING_FOR_SYSOP) { Dmsg2(90, "%d waiter dev_block=%d.\n", dev->num_waiting, dev->blocked()); unload_autochanger(dcr, -1); - bnet_fsend(dir, _("3922 Device %s waiting for sysop.\n"), + dir->fsend(_("3922 Device %s waiting for sysop.\n"), dev->print_name()); } else if (dev->blocked() == BST_UNMOUNTED_WAITING_FOR_SYSOP) { Dmsg2(90, "%d waiter dev_block=%d. doing unmount\n", dev->num_waiting, dev->blocked()); - bnet_fsend(dir, _("3922 Device %s waiting for mount.\n"), + dir->fsend(_("3922 Device %s waiting for mount.\n"), dev->print_name()); } else if (dev->blocked() == BST_DOING_ACQUIRE) { - bnet_fsend(dir, _("3923 Device %s is busy in acquire.\n"), + dir->fsend(_("3923 Device %s is busy in acquire.\n"), dev->print_name()); } else if (dev->blocked() == BST_WRITING_LABEL) { - bnet_fsend(dir, _("3914 Device %s is being labeled.\n"), + dir->fsend(_("3914 Device %s is being labeled.\n"), dev->print_name()); } else if (dev->is_busy()) { @@ -913,20 +913,20 @@ static bool release_cmd(JCR *jcr) Dmsg0(90, "Device not in use, releaseing\n"); unload_autochanger(dcr, -1); release_volume(dcr); - bnet_fsend(dir, _("3022 Device %s released.\n"), + dir->fsend(_("3022 Device %s released.\n"), dev->print_name()); } dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); } } else { /* NB dir->msg gets clobbered in bnet_fsend, so save command */ pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3927 Error scanning release command: %s\n"), jcr->errmsg); + dir->fsend(_("3927 Error scanning release command: %s\n"), jcr->errmsg); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return true; } @@ -969,7 +969,7 @@ static bool changer_cmd(JCR *jcr) dev = dcr->dev; dev->dlock(); /* Use P to avoid indefinite block */ if (!dev->device->changer_res) { - bnet_fsend(dir, _("3995 Device %s is not an autochanger.\n"), + dir->fsend(_("3995 Device %s is not an autochanger.\n"), dev->print_name()); /* Under certain "safe" conditions, we can steal the lock */ } else if (safe_cmd || !dev->is_open() || dev->can_steal_lock()) { @@ -982,11 +982,11 @@ static bool changer_cmd(JCR *jcr) dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); } } else { /* error on scanf */ pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3908 Error scanning autocharger drives/list/slots command: %s\n"), + dir->fsend(_("3908 Error scanning autocharger drives/list/slots command: %s\n"), jcr->errmsg); } dir->signal(BNET_EOD); @@ -1025,11 +1025,11 @@ static bool readlabel_cmd(JCR *jcr) dev->dunlock(); free_dcr(dcr); } else { - bnet_fsend(dir, _("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); + dir->fsend(_("3999 Device \"%s\" not found or could not be opened.\n"), devname.c_str()); } } else { pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("3909 Error scanning readlabel command: %s\n"), jcr->errmsg); + dir->fsend(_("3909 Error scanning readlabel command: %s\n"), jcr->errmsg); } dir->signal(BNET_EOD); return true; @@ -1057,11 +1057,11 @@ static void read_volume_label(JCR *jcr, DCR *dcr, DEVICE *dev, int Slot) switch (read_dev_volume_label(dcr)) { case VOL_OK: /* DO NOT add quotes around the Volume name. It is scanned in the DIR */ - bnet_fsend(dir, _("3001 Volume=%s Slot=%d\n"), dev->VolHdr.VolumeName, Slot); + dir->fsend(_("3001 Volume=%s Slot=%d\n"), dev->VolHdr.VolumeName, Slot); Dmsg1(100, "Volume: %s\n", dev->VolHdr.VolumeName); break; default: - bnet_fsend(dir, _("3902 Cannot mount Volume on Storage Device %s because:\n%s"), + dir->fsend(_("3902 Cannot mount Volume on Storage Device %s because:\n%s"), dev->print_name(), jcr->errmsg); break; } @@ -1089,35 +1089,35 @@ static void send_dir_busy_message(BSOCK *dir, DEVICE *dev) if (dev->is_blocked()) { switch (dev->blocked()) { case BST_UNMOUNTED: - bnet_fsend(dir, _("3931 Device %s is BLOCKED. user unmounted.\n"), + dir->fsend(_("3931 Device %s is BLOCKED. user unmounted.\n"), dev->print_name()); break; case BST_UNMOUNTED_WAITING_FOR_SYSOP: - bnet_fsend(dir, _("3932 Device %s is BLOCKED. user unmounted during wait for media/mount.\n"), + dir->fsend(_("3932 Device %s is BLOCKED. user unmounted during wait for media/mount.\n"), dev->print_name()); break; case BST_WAITING_FOR_SYSOP: - bnet_fsend(dir, _("3933 Device %s is BLOCKED waiting for media.\n"), + dir->fsend(_("3933 Device %s is BLOCKED waiting for media.\n"), dev->print_name()); break; case BST_DOING_ACQUIRE: - bnet_fsend(dir, _("3934 Device %s is being initialized.\n"), + dir->fsend(_("3934 Device %s is being initialized.\n"), dev->print_name()); break; case BST_WRITING_LABEL: - bnet_fsend(dir, _("3935 Device %s is blocked labeling a Volume.\n"), + dir->fsend(_("3935 Device %s is blocked labeling a Volume.\n"), dev->print_name()); break; default: - bnet_fsend(dir, _("3935 Device %s is blocked for unknown reason.\n"), + dir->fsend(_("3935 Device %s is blocked for unknown reason.\n"), dev->print_name()); break; } } else if (dev->can_read()) { - bnet_fsend(dir, _("3936 Device %s is busy reading.\n"), + dir->fsend(_("3936 Device %s is busy reading.\n"), dev->print_name());; } else { - bnet_fsend(dir, _("3937 Device %s is busy with %d writer(s).\n"), + dir->fsend(_("3937 Device %s is busy with %d writer(s).\n"), dev->print_name(), dev->num_writers); } } diff --git a/bacula/src/stored/mac.c b/bacula/src/stored/mac.c index 16640f4e92..11528ad84c 100644 --- a/bacula/src/stored/mac.c +++ b/bacula/src/stored/mac.c @@ -167,7 +167,7 @@ ok_out: set_jcr_job_status(jcr, JS_Terminated); } generate_daemon_event(jcr, "JobEnd"); - bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, + dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, edit_uint64(jcr->JobBytes, ec1)); Dmsg4(200, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, ec1); @@ -239,17 +239,18 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) if (stream == STREAM_UNIX_ATTRIBUTES || stream == STREAM_UNIX_ATTRIBUTES_EX || crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) { if (!jcr->no_attributes) { + BSOCK *dir = jcr->dir_bsock; if (are_attributes_spooled(jcr)) { - jcr->dir_bsock->set_spooling(); + dir->set_spooling(); } Dmsg0(850, "Send attributes to dir.\n"); if (!dir_update_file_attributes(jcr->dcr, rec)) { - jcr->dir_bsock->clear_spooling(); + dir->clear_spooling(); Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"), - bnet_strerror(jcr->dir_bsock)); + dir->bstrerror()); return false; } - jcr->dir_bsock->clear_spooling(); + dir->clear_spooling(); } }