JCR *jcr = ua->jcr;
char dev_name[MAX_NAME_LENGTH];
int drive;
+ int slot = -1;
if (!open_db(ua)) {
return;
}
set_wstorage(jcr, store);
drive = get_storage_drive(ua, store);
+ if (strcmp(command, "mount") == 0) {
+ slot = get_storage_slot(ua, store);
+ }
Dmsg3(120, "Found storage, MediaType=%s DevName=%s drive=%d\n",
store->media_type, store->dev_name(), drive);
sd = jcr->store_bsock;
bstrncpy(dev_name, store->dev_name(), sizeof(dev_name));
bash_spaces(dev_name);
- bnet_fsend(sd, "%s %s drive=%d", command, dev_name, drive);
+ if (slot > 0) {
+ bnet_fsend(sd, "%s %s drive=%d slot=%d", command, dev_name, drive, slot);
+ } else {
+ bnet_fsend(sd, "%s %s drive=%d", command, dev_name, drive);
+ }
while (bnet_recv(sd) >= 0) {
bsendmsg(ua, "%s", sd->msg);
}
}
/*
- * mount [storage=<name>] [drive=nn]
+ * mount [storage=<name>] [drive=nn] [slot=mm]
*/
static int mount_cmd(UAContext *ua, const char *cmd)
{
}
-/* A bit brain damaged in that if the user has not done
- * a "use catalog xxx" command, we simply find the first
- * catalog resource and open it.
+/*
+ * Open the catalog database.
*/
bool open_db(UAContext *ua)
{
return true;
}
if (!ua->catalog) {
- LockRes();
- ua->catalog = (CAT *)GetNextRes(R_CATALOG, NULL);
- UnlockRes();
+ ua->catalog = get_catalog_resource(ua);
if (!ua->catalog) {
bsendmsg(ua, _("Could not find a Catalog resource\n"));
return false;
- } else if (!acl_access_ok(ua, Catalog_ACL, ua->catalog->hdr.name)) {
- bsendmsg(ua, _("You must specify a \"use <catalog-name>\" command before continuing.\n"));
- ua->catalog = NULL;
- return false;
- } else {
- bsendmsg(ua, _("Using default Catalog name=%s DB=%s\n"),
- ua->catalog->hdr.name, ua->catalog->db_name);
}
}