1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2018-2018 Bareos GmbH & Co. KG
5 
6    This program is Free Software; you can redistribute it and/or
7    modify it under the terms of version three of the GNU Affero General Public
8    License as published by the Free Software Foundation and included
9    in the file LICENSE.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14    Affero General Public License for more details.
15 
16    You should have received a copy of the GNU Affero General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA.
20 */
21 
22 #ifndef BAREOS_DIRD_STORAGE_H_
23 #define BAREOS_DIRD_STORAGE_H_
24 
25 #include "ndmp/smc.h"
26 
27 class alist;
28 
29 namespace directordaemon {
30 
31 void CopyRwstorage(JobControlRecord* jcr, alist* storage, const char* where);
32 void SetRwstorage(JobControlRecord* jcr, UnifiedStorageResource* store);
33 void FreeRwstorage(JobControlRecord* jcr);
34 void CopyWstorage(JobControlRecord* jcr, alist* storage, const char* where);
35 void SetWstorage(JobControlRecord* jcr, UnifiedStorageResource* store);
36 void FreeWstorage(JobControlRecord* jcr);
37 void CopyRstorage(JobControlRecord* jcr, alist* storage, const char* where);
38 void SetRstorage(JobControlRecord* jcr, UnifiedStorageResource* store);
39 void FreeRstorage(JobControlRecord* jcr);
40 void SetPairedStorage(JobControlRecord* jcr);
41 void FreePairedStorage(JobControlRecord* jcr);
42 bool HasPairedStorage(JobControlRecord* jcr);
43 bool SelectNextRstore(JobControlRecord* jcr, bootstrap_info& info);
44 void StorageStatus(UaContext* ua, StorageResource* store, char* cmd);
45 int StorageCompareVolListEntry(void* e1, void* e2);
46 changer_vol_list_t* get_vol_list_from_storage(UaContext* ua,
47                                               StorageResource* store,
48                                               bool listall,
49                                               bool scan,
50                                               bool cached = true);
51 slot_number_t GetNumSlots(UaContext* ua, StorageResource* store);
52 drive_number_t GetNumDrives(UaContext* ua, StorageResource* store);
53 bool transfer_volume(UaContext* ua,
54                      StorageResource* store,
55                      slot_number_t src_slot,
56                      slot_number_t dst_slot);
57 bool DoAutochangerVolumeOperation(UaContext* ua,
58                                   StorageResource* store,
59                                   const char* operation,
60                                   drive_number_t drive,
61                                   slot_number_t slot);
62 vol_list_t* vol_is_loaded_in_drive(StorageResource* store,
63                                    changer_vol_list_t* vol_list,
64                                    slot_number_t slot);
65 void StorageReleaseVolList(StorageResource* store,
66                            changer_vol_list_t* vol_list);
67 void StorageFreeVolList(StorageResource* store, changer_vol_list_t* vol_list);
68 void InvalidateVolList(StorageResource* store);
69 int CompareStorageMapping(void* e1, void* e2);
70 
71 slot_number_t GetElementAddressByBareosSlotNumber(
72     smc_element_address_assignment* smc_elem_aa,
73     slot_type_t slot_type,
74     slot_number_t slotnumber);
75 slot_number_t GetBareosSlotNumberByElementAddress(
76     smc_element_address_assignment* smc_elem_aa,
77     slot_type_t slot_type,
78     slot_number_t element_addr);
79 
80 } /* namespace directordaemon */
81 #endif  // BAREOS_DIRD_STORAGE_H_
82