new_vol_name, slot, drive);
dcr->VolCatInfo.Slot = slot; /* slot to be loaded */
- changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "load");
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, "load");
dev->close(dcr);
Dmsg1(dbglvl, "Run program=%s\n", changer);
status = run_program_full_output(changer, timeout, results.addr());
Jmsg(jcr, M_INFO, 0, _("3301 Issuing autochanger \"loaded? drive %d\" command.\n"),
drive);
}
- changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "loaded");
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, "loaded");
Dmsg1(dbglvl, "Run program=%s\n", changer);
status = run_program_full_output(changer, timeout, results.addr());
Dmsg3(dbglvl, "run_prog: %s stat=%d result=%s", changer, status, results.c_str());
old_vol_name, loaded, dev->drive_index);
slot = dcr->VolCatInfo.Slot;
dcr->VolCatInfo.Slot = loaded;
- changer = edit_device_codes(dcr, changer,
+ edit_device_codes(dcr, &changer,
dcr->device->changer_command, "unload");
dev->close(dcr);
Dmsg1(dbglvl, "Run program=%s\n", changer);
Dmsg3(0/*dbglvl*/, "Issuing autochanger \"unload Volume %s, Slot %d, Drive %d\" command.\n",
old_vol_name, dev->get_slot(), dev->drive_index);
- changer_cmd = edit_device_codes(dcr, changer_cmd,
- dcr->device->changer_command, "unload");
+ edit_device_codes(dcr, &changer_cmd, dcr->device->changer_command, "unload");
dev->close(dcr);
Dmsg2(dbglvl, "close dev=%s reserve=%d\n", dev->print_name(),
dev->num_reserved());
changer = get_pool_memory(PM_FNAME);
lock_changer(dcr);
/* Now issue the command */
- changer = edit_device_codes(dcr, changer,
- dcr->device->changer_command, cmd);
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, cmd);
dir->fsend(_("3306 Issuing autochanger \"%s\" command.\n"), cmd);
bpipe = open_bpipe(changer, timeout, "r");
if (!bpipe) {
* cmd = command string (load, unload, ...)
*
*/
-char *edit_device_codes(DCR *dcr, char *omsg, const char *imsg, const char *cmd)
+void edit_device_codes(DCR *dcr, POOLMEM **omsg, const char *imsg, const char *cmd)
{
const char *p;
const char *str;
str = add;
}
Dmsg1(1900, "add_str %s\n", str);
- pm_strcat(&omsg, (char *)str);
+ pm_strcat(omsg, (char *)str);
Dmsg1(1800, "omsg=%s\n", omsg);
}
Dmsg1(800, "omsg=%s\n", omsg);
- return omsg;
}
dcr->VolCatInfo.Slot = slot;
/* Find out what is loaded, zero means device is unloaded */
Pmsg0(-1, _("3301 Issuing autochanger \"loaded\" command.\n"));
- changer = edit_device_codes(dcr, changer,
- dcr->device->changer_command, "loaded");
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, "loaded");
status = run_program(changer, timeout, results);
Dmsg3(100, "run_prog: %s stat=%d result=\"%s\"\n", changer, status, results);
if (status == 0) {
dev->close(dcr);
Pmsg2(-1, _("3302 Issuing autochanger \"unload %d %d\" command.\n"),
loaded, dev->drive_index);
- changer = edit_device_codes(dcr, changer,
- dcr->device->changer_command, "unload");
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, "unload");
status = run_program(changer, timeout, results);
Pmsg2(-1, _("unload status=%s %d\n"), status==0?_("OK"):_("Bad"), status);
if (status != 0) {
dcr->VolCatInfo.Slot = slot;
Pmsg2(-1, _("3303 Issuing autochanger \"load %d %d\" command.\n"),
slot, dev->drive_index);
- changer = edit_device_codes(dcr, changer,
- dcr->device->changer_command, "load");
+ edit_device_codes(dcr, &changer, dcr->device->changer_command, "load");
Dmsg1(100, "Changer=%s\n", changer);
dev->close(dcr);
status = run_program(changer, timeout, results);
bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd);
bool unload_autochanger(DCR *dcr, int loaded);
bool unload_dev(DCR *dcr, DEVICE *dev);
-char *edit_device_codes(DCR *dcr, char *omsg, const char *imsg, const char *cmd);
+void edit_device_codes(DCR *dcr, POOLMEM **omsg, const char *imsg, const char *cmd);
int get_autochanger_loaded_slot(DCR *dcr);
/* From block.c */
int type, utime_t mtime, const char *fmt, ...);
static bRC baculaDebugMsg(bpContext *ctx, const char *file, int line,
int level, const char *fmt, ...);
-static char *baculaEditDeviceCodes(DCR *dcr, char *omsg,
+static void baculaEditDeviceCodes(DCR *dcr, POOLMEM **omsg,
const char *imsg, const char *cmd);
static bool is_plugin_compatible(Plugin *plugin);
return bRC_OK;
}
-static char *baculaEditDeviceCodes(DCR *dcr, char *omsg,
+static void baculaEditDeviceCodes(DCR *dcr, POOLMEM **omsg,
const char *imsg, const char *cmd)
{
- return edit_device_codes(dcr, omsg, imsg, cmd);
+ edit_device_codes(dcr, omsg, imsg, cmd);
}
#ifdef TEST_PROGRAM
int type, utime_t mtime, const char *fmt, ...);
bRC (*DebugMessage)(bpContext *ctx, const char *file, int line,
int level, const char *fmt, ...);
- char *(*EditDeviceCodes)(DCR *dcr, char *omsg,
+ void (*EditDeviceCodes)(DCR *dcr, POOLMEM **omsg,
const char *imsg, const char *cmd);
bRC (*getBaculaGlobal)(bsdrGlobalVariable var, void *value); /* ***BEEF*** */
} bsdFuncs;
alert_list = New(alist(10));
}
alertcmd = get_pool_memory(PM_FNAME);
- alertcmd = edit_device_codes(dcr, alertcmd, dcr->device->alert_command, "");
+ edit_device_codes(dcr, &alertcmd, dcr->device->alert_command, "");
/* Wait maximum 5 minutes */
bpipe = open_bpipe(alertcmd, 60 * 5, "r");
if (bpipe) {
const char *fmt = " %d";
wormcmd = get_pool_memory(PM_FNAME);
- wormcmd = edit_device_codes(dcr, wormcmd, dcr->device->worm_command, "");
+ edit_device_codes(dcr, &wormcmd, dcr->device->worm_command, "");
/* Wait maximum 5 minutes */
bpipe = open_bpipe(wormcmd, 60 * 5, "r");
if (bpipe) {