Skip to content

Commit

Permalink
renamed get_index_by_element_address and get_element_address_by_index
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Nov 22, 2018
1 parent 8c7c8a8 commit 723f1bb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/dird/ndmp_dma_backup_NDMP_NATIVE.c
Expand Up @@ -134,7 +134,7 @@ int ndmp_load_next(struct ndm_session *sess) {
goto bail_out;
}

slot_number_t slotnumber = get_element_address_by_index(store, slot_type_storage, mr.Slot);
slot_number_t slotnumber = get_element_address_by_slotnumber(store, slot_type_storage, mr.Slot);
/*
* check if lookup_storage_mapping was successful
*/
Expand Down Expand Up @@ -546,7 +546,7 @@ static inline bool extract_post_backup_stats_ndmp_native(JCR *jcr,
* translate Physical to Logical Slot before storing into database
*/

media->slot_addr = get_index_by_element_address (jcr->res.wstore, slot_type_storage, media->slot_addr);
media->slot_addr = get_slotnumber_by_element_address (jcr->res.wstore, slot_type_storage, media->slot_addr);
#if 0
Jmsg(jcr, M_INFO, 0, _("Physical Slot is %d\n"), media->slot_addr);
Jmsg(jcr, M_INFO, 0, _("Logical slot is : %d\n"), media->slot_addr);
Expand Down
2 changes: 1 addition & 1 deletion src/dird/ndmp_dma_restore_NDMP_NATIVE.c
Expand Up @@ -303,7 +303,7 @@ static bool do_ndmp_native_restore(JCR *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_address_by_index(store, slot_type_storage, media->slot_addr);
ndmp_slot = get_element_address_by_slotnumber(store, 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);
Expand Down
16 changes: 8 additions & 8 deletions src/dird/ndmp_dma_storage.c
Expand Up @@ -571,7 +571,7 @@ dlist *ndmp_get_vol_list(UAContext *ua, STORERES *store, bool listall, bool scan
slot_number_t slot_mapping;

vl->SlotStatus = slot_status_full;
slot_mapping = get_index_by_element_address(store, slot_type_storage, edp->src_se_addr);
slot_mapping = get_slotnumber_by_element_address(store, slot_type_storage, edp->src_se_addr);
vl->CurrentlyLoadedSlot = slot_mapping;
fill_volume_name(vl, edp);
} else {
Expand All @@ -588,7 +588,7 @@ dlist *ndmp_get_vol_list(UAContext *ua, STORERES *store, bool listall, bool scan
/*
* Map physical storage address to logical one using the storage mappings.
*/
vl->SlotOrDriveNumber = get_index_by_element_address(store, slot_type_storage, edp->element_address);
vl->SlotOrDriveNumber = get_slotnumber_by_element_address(store, slot_type_storage, edp->element_address);

if (vl->VolName) {
Dmsg6(100, "Add index = %hd slot=%hd loaded=%hd type=%hd content=%hd Vol=%s to SD list.\n",
Expand Down Expand Up @@ -718,15 +718,15 @@ bool ndmp_transfer_volume(UAContext *ua, STORERES *store,
* to physical slot numbers for the actual NDMP operation.
*/
/* slot_mapping = lookup_storage_mapping(store, slot_type_storage, LOGICAL_TO_PHYSICAL, src_slot); */
slot_mapping = get_element_address_by_index(store, slot_type_storage, src_slot);
slot_mapping = get_element_address_by_slotnumber(store, slot_type_storage, src_slot);
if (slot_mapping == -1) {
ua->error_msg("No slot mapping for slot %hd\n", src_slot);
return retval;
}
ndmp_job.from_addr = slot_mapping;
ndmp_job.from_addr_given = 1;

slot_mapping = get_element_address_by_index(store, slot_type_storage, dst_slot);
slot_mapping = get_element_address_by_slotnumber(store, slot_type_storage, dst_slot);
if (slot_mapping == -1) {
ua->error_msg("No slot mapping for slot %hd\n", dst_slot);
return retval;
Expand Down Expand Up @@ -922,7 +922,7 @@ bool ndmp_autochanger_volume_operation(UAContext *ua, STORERES *store, const cha
/*
* Map the logical address to a physical one.
*/
slot_mapping = get_element_address_by_index(store, slot_type_storage, slot);
slot_mapping = get_element_address_by_slotnumber(store, slot_type_storage, slot);
if (slot_mapping == -1) {
ua->error_msg("No slot mapping for slot %hd\n", slot);
return retval;
Expand All @@ -934,7 +934,7 @@ bool ndmp_autochanger_volume_operation(UAContext *ua, STORERES *store, const cha
/*
* Map the logical address to a physical one.
*/
drive_mapping = get_element_address_by_index(store, slot_type_drive, slot);
drive_mapping = get_element_address_by_slotnumber(store, slot_type_drive, slot);
if (drive_mapping == -1) {
ua->error_msg("No slot mapping for drive %hd\n", drive);
return retval;
Expand Down Expand Up @@ -1031,7 +1031,7 @@ bool ndmp_send_label_request(UAContext *ua, STORERES *store, MEDIA_DBR *mr,
if (slot > 0) {
slot_number_t slot_mapping;

slot_mapping = get_element_address_by_index(store, slot_type_storage, slot);
slot_mapping = get_element_address_by_slotnumber(store, slot_type_storage, slot);
if (slot_mapping == -1) {
ua->error_msg("No slot mapping for slot %hd\n", slot);
return retval;
Expand Down Expand Up @@ -1112,7 +1112,7 @@ bool ndmp_native_setup_robot_and_tape_for_native_backup_job(JCR* jcr, STORERES*
return retval;
}

driveaddress = get_element_address_by_index(store, slot_type_drive, driveindex);
driveaddress = get_element_address_by_slotnumber(store, slot_type_drive, driveindex);
if (driveaddress == -1) {
Jmsg(jcr, M_ERROR, 0, _("Could not lookup driveaddress for driveindex %d\n"),
driveaddress);
Expand Down
4 changes: 2 additions & 2 deletions src/dird/protos.h
Expand Up @@ -361,8 +361,8 @@ int compare_storage_mapping(void *e1, void *e2);
/* slot_number_t lookup_storage_mapping(STORERES *store, slot_type slot_type, */
/* s_mapping_type map_type, slot_number_t slot); */

slot_number_t get_index_by_element_address(STORERES *store, slot_type slot_type, slot_number_t element_addr);
slot_number_t get_element_address_by_index(STORERES *store, slot_type slot_type, slot_number_t index);
slot_number_t get_slotnumber_by_element_address(STORERES *store, slot_type slot_type, slot_number_t element_addr);
slot_number_t get_element_address_by_slotnumber(STORERES *store, slot_type slot_type, slot_number_t index);

/* ua_cmds.c */
bool do_a_command(UAContext *ua);
Expand Down
4 changes: 2 additions & 2 deletions src/dird/storage.c
Expand Up @@ -872,7 +872,7 @@ void invalidate_vol_list(STORERES *store)
/**
* calculate the element address for given index and slot_type
*/
slot_number_t get_element_address_by_index(STORERES *store, slot_type slot_type, slot_number_t index)
slot_number_t get_element_address_by_slotnumber(STORERES *store, slot_type slot_type, slot_number_t index)
{
if (slot_type == slot_type_storage) {
return (store->rss->storage_mapping.se_addr + index
Expand All @@ -899,7 +899,7 @@ slot_number_t get_element_address_by_index(STORERES *store, slot_type slot_type,
/**
* calculate the index for element address and slot_type
*/
slot_number_t get_index_by_element_address(STORERES *store, slot_type slot_type, slot_number_t element_addr)
slot_number_t get_slotnumber_by_element_address(STORERES *store, slot_type slot_type, slot_number_t element_addr)
{
if (slot_type == slot_type_storage) {
return (element_addr - store->rss->storage_mapping.se_addr
Expand Down

0 comments on commit 723f1bb

Please sign in to comment.