Skip to content

Commit

Permalink
compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Jan 4, 2019
1 parent 8a5df72 commit 7591436
Show file tree
Hide file tree
Showing 13 changed files with 438 additions and 368 deletions.
1 change: 1 addition & 0 deletions core/src/dird/CMakeLists.txt
Expand Up @@ -30,6 +30,7 @@ set(DIRD_OBJECTS_SRCS admin.cc archive.cc authenticate.cc authenticate_console.c
ndmp_dma_generic.cc
ndmp_dma_restore_common.cc ndmp_dma_restore_NDMP_BAREOS.cc ndmp_dma_restore_NDMP_NATIVE.cc
ndmp_fhdb_common.cc ndmp_fhdb_helpers.cc
ndmp_slot2elemaddr.cc
ndmp_fhdb_mem.cc ndmp_fhdb_lmdb.cc ndmp_ndmmedia_db_helpers.cc
newvol.cc next_vol.cc quota.cc socket_server.cc recycle.cc restore.cc
run_conf.cc sd_cmds.cc scheduler.cc stats.cc storage.cc ua.cc ua_acl.cc ua_audit.cc
Expand Down
5 changes: 3 additions & 2 deletions core/src/dird/ndmp_dma_generic.cc
Expand Up @@ -617,7 +617,7 @@ extern "C" void ndmp_log_delivery_cb_to_ua(struct ndmlog *log, char *tag, int le
* operation. Callback is the above NdmpClientStatusHandler which prints
* the data to the user context.
*/
void NdmpDoQuery(UaContext *ua, ndm_job_param *ndmp_job, int NdmpLoglevel)
void NdmpDoQuery(UaContext *ua, ndm_job_param *ndmp_job, int NdmpLoglevel, ndmca_query_callbacks* query_cbs)
{
NIS *nis;
struct ndm_session ndmp_sess;
Expand Down Expand Up @@ -703,6 +703,7 @@ void NdmpDoQuery(UaContext *ua, ndm_job_param *ndmp_job, int NdmpLoglevel)

bail_out:

ndmca_query_unregister_callbacks(&ndmp_sess);
/*
* Free the param block.
*/
Expand Down Expand Up @@ -734,7 +735,7 @@ void DoNdmpClientStatus(UaContext *ua, ClientResource *client, char *cmd)
return;
}


ndmca_query_callbacks *query_cbs = nullptr;
NdmpDoQuery(ua, &ndmp_job,
(client->ndmp_loglevel > me->ndmp_loglevel) ? client->ndmp_loglevel :
me->ndmp_loglevel, query_cbs);
Expand Down
13 changes: 6 additions & 7 deletions core/src/dird/ndmp_dma_restore_NDMP_NATIVE.cc
Expand Up @@ -34,11 +34,11 @@
#include "lib/edit.h"

#if HAVE_NDMP
#include "dird/ndmp_dma_storage.h"

#define NDMP_NEED_ENV_KEYWORDS 1

#include "ndmp/ndmagents.h"
#include "dird/ndmp_dma_storage.h"
#include "ndmp_dma_priv.h"
#include "dird/ndmp_dma_restore_common.h"
#include "dird/ndmp_dma_generic.h"
Expand Down Expand Up @@ -265,7 +265,7 @@ static bool DoNdmpNativeRestore(JobControlRecord *jcr)
char mediabuf[100];
ndmmedia *media;
slot_number_t ndmp_slot;
STORERES *store = NULL;
StorageResource *store = NULL;

store = jcr->res.rstore;

Expand All @@ -276,7 +276,7 @@ static bool DoNdmpNativeRestore(JobControlRecord *jcr)

NdmpLoglevel = std::max(jcr->res.client->ndmp_loglevel, me->ndmp_loglevel);

if (!ndmp_build_client_and_storage_job(jcr, store, jcr->res.client,
if (!NdmpBuildClientAndStorageJob(jcr, store, jcr->res.client,
true, /* init_tape */
true, /* init_robot */
NDM_JOB_OP_EXTRACT, &ndmp_job)) {
Expand All @@ -295,7 +295,7 @@ static bool DoNdmpNativeRestore(JobControlRecord *jcr)
* Get media from database and put into ndmmmedia table
*/

get_ndmmedia_info_from_database(&ndmp_job.media_tab, jcr);
GetNdmmediaInfoFromDatabase(&ndmp_job.media_tab, jcr);

for (ndmmedia *media = ndmp_job.media_tab.head; media; media = media->next) {
ndmmedia_to_str(media, mediabuf);
Expand All @@ -304,14 +304,14 @@ static bool DoNdmpNativeRestore(JobControlRecord *jcr)

for (ndmmedia *media = ndmp_job.media_tab.head; media; media = media->next) {
Jmsg(jcr, M_INFO, 0, _("Logical slot for volume %s is %d\n"), media->label, media->slot_addr);
ndmp_slot = get_element_addr_by_slotnumber(&store->rss->storage_mapping, slot_type_storage, media->slot_addr);
ndmp_slot = GetElementAddressByBareosSlotNumber(&store->rss->storage_mapping, slot_type_storage, media->slot_addr);
media->slot_addr = ndmp_slot;
Jmsg(jcr, M_INFO, 0, _("Physical(NDMP) slot for volume %s is %d\n"), media->label, media->slot_addr);
Jmsg(jcr, M_INFO, 0, _("Media Index of volume %s is %d\n"), media->label, media->index);
}


if (!ndmp_validate_job(jcr, &ndmp_job)) {
if (!NdmpValidateJob(jcr, &ndmp_job)) {
Jmsg(jcr, M_ERROR, 0, _("ERROR in ndmp_validate_job\n"));
goto cleanup_ndmp;
}
Expand Down Expand Up @@ -461,7 +461,6 @@ static bool DoNdmpNativeRestore(JobControlRecord *jcr)
cleanup:
free(nis);

bail_out:
FreeTree(jcr->restore_tree_root);
jcr->restore_tree_root = NULL;
return retval;
Expand Down
58 changes: 29 additions & 29 deletions core/src/dird/sd_cmds.cc
Expand Up @@ -383,21 +383,21 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,
/*
* Scanning -- require only valid slot
*/
vl->Slot = atoi(field1);
if (vl->Slot <= 0) {
vl->bareos_slot_number = atoi(field1);
if (vl->bareos_slot_number <= 0) {
ua->ErrorMsg(_("Invalid Slot number: %s\n"), sd->msg);
free(vl);
continue;
}

vl->Type = slot_type_storage;
vl->slot_type = slot_type_storage;
if (strlen(field2) > 0) {
vl->Content = slot_content_full;
vl->slot_status = slot_status_full;
vl->VolName = bstrdup(field2);
} else {
vl->Content = slot_content_empty;
vl->slot_status = slot_status_empty;
}
vl->Index = INDEX_SLOT_OFFSET + vl->Slot;
vl->element_address = INDEX_SLOT_OFFSET + vl->bareos_slot_number;
} else if (!listall) {
/*
* Not scanning and not listall.
Expand All @@ -407,7 +407,7 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,
continue;
}

if (!IsAnInteger(field1) || (vl->Slot = atoi(field1)) <= 0) {
if (!IsAnInteger(field1) || (vl->bareos_slot_number = atoi(field1)) <= 0) {
ua->ErrorMsg(_("Invalid Slot number: %s\n"), field1);
free(vl);
continue;
Expand All @@ -419,10 +419,10 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,
continue;
}

vl->Type = slot_type_storage;
vl->Content = slot_content_full;
vl->slot_type = slot_type_storage;
vl->slot_status = slot_status_full;
vl->VolName = bstrdup(field2);
vl->Index = INDEX_SLOT_OFFSET + vl->Slot;
vl->element_address = INDEX_SLOT_OFFSET + vl->bareos_slot_number;
} else {
/*
* Listall.
Expand All @@ -433,56 +433,56 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,

switch (*field1) {
case 'D':
vl->Type = slot_type_drive;
vl->slot_type = slot_type_drive;
break;
case 'S':
vl->Type = slot_type_storage;
vl->slot_type = slot_type_storage;
break;
case 'I':
vl->Type = slot_type_import;
vl->Flags |= (can_import | can_export | by_oper);
vl->slot_type = slot_type_import;
vl->flags |= (can_import | can_export | by_oper);
break;
default:
vl->Type = slot_type_unknown;
vl->slot_type = slot_type_unknown;
break;
}

/*
* For drives the Slot is the actual drive number.
* For any other type its the actual slot number.
*/
switch (vl->Type) {
switch (vl->slot_type) {
case slot_type_drive:
if (!IsAnInteger(field2) || (vl->Slot = atoi(field2)) < 0) {
if (!IsAnInteger(field2) || (vl->bareos_slot_number = atoi(field2)) < 0) {
ua->ErrorMsg(_("Invalid Drive number: %s\n"), field2);
free(vl);
continue;
}
vl->Index = INDEX_DRIVE_OFFSET + vl->Slot;
if (vl->Index >= INDEX_MAX_DRIVES) {
vl->element_address = INDEX_DRIVE_OFFSET + vl->bareos_slot_number;
if (vl->element_address >= INDEX_MAX_DRIVES) {
ua->ErrorMsg(_("Drive number %hd greater then INDEX_MAX_DRIVES(%hd) please increase define\n"),
vl->Slot, INDEX_MAX_DRIVES);
vl->bareos_slot_number, INDEX_MAX_DRIVES);
free(vl);
continue;
}
break;
default:
if (!IsAnInteger(field2) || (vl->Slot = atoi(field2)) <= 0) {
if (!IsAnInteger(field2) || (vl->bareos_slot_number = atoi(field2)) <= 0) {
ua->ErrorMsg(_("Invalid Slot number: %s\n"), field2);
free(vl);
continue;
}
vl->Index = INDEX_SLOT_OFFSET + vl->Slot;
vl->element_address = INDEX_SLOT_OFFSET + vl->bareos_slot_number;
break;
}

switch (*field3) {
case 'E':
vl->Content = slot_content_empty;
vl->slot_status = slot_status_empty;
break;
case 'F':
vl->Content = slot_content_full;
switch (vl->Type) {
vl->slot_status = slot_status_full;
switch (vl->slot_status) {
case slot_type_storage:
case slot_type_import:
if (field4) {
Expand All @@ -491,7 +491,7 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,
break;
case slot_type_drive:
if (field4) {
vl->Loaded = atoi(field4);
vl->currently_loaded_slot_number = atoi(field4);
}
if (field5) {
vl->VolName = bstrdup(field5);
Expand All @@ -502,17 +502,17 @@ dlist *native_get_vol_list(UaContext *ua, StorageResource *store, bool listall,
}
break;
default:
vl->Content = slot_content_unknown;
vl->slot_status = slot_status_unknown;
break;
}
}

if (vl->VolName) {
Dmsg6(100, "Add index = %hd slot=%hd loaded=%hd type=%hd content=%hd Vol=%s to SD list.\n",
vl->Index, vl->Slot, vl->Loaded, vl->Type, vl->Content, NPRT(vl->VolName));
vl->element_address, vl->bareos_slot_number, vl->currently_loaded_slot_number, vl->slot_type, vl->slot_type, NPRT(vl->VolName));
} else {
Dmsg5(100, "Add index = %hd slot=%hd loaded=%hd type=%hd content=%hd Vol=NULL to SD list.\n",
vl->Index, vl->Slot, vl->Loaded, vl->Type, vl->Content);
vl->element_address, vl->bareos_slot_number, vl->currently_loaded_slot_number, vl->slot_type, vl->slot_type);
}

vol_list->binary_insert(vl, StorageCompareVolListEntry);
Expand Down

0 comments on commit 7591436

Please sign in to comment.