Skip to content

Commit

Permalink
boogie merge: dird.cc, dird.h
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Jan 3, 2019
1 parent 9124e7a commit 65963c0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 15 deletions.
65 changes: 50 additions & 15 deletions core/src/dird/dird.h
Expand Up @@ -109,16 +109,16 @@ typedef enum {
typedef enum {
slot_type_unknown, /**< Unknown slot type */
slot_type_drive, /**< Drive slot */
slot_type_storage, /**< Normal slot */
slot_type_storage, /**< Storage slot */
slot_type_import, /**< Import/export slot */
slot_type_picker /**< Robotics */
} slot_type;

typedef enum {
slot_content_unknown, /**< Slot content is unknown */
slot_content_empty, /**< Slot is empty */
slot_content_full /**< Slot is full */
} slot_content;
slot_status_unknown, /**< Slot content is unknown */
slot_status_empty, /**< Slot is empty */
slot_status_full /**< Slot is full */
} slot_status_t;

enum s_mapping_type {
LOGICAL_TO_PHYSICAL,
Expand All @@ -130,12 +130,12 @@ enum s_mapping_type {
*/
struct vol_list_t {
dlink link; /**< Link for list */
slot_number_t Index; /**< Unique index */
slot_flags_t Flags; /**< Slot specific flags see e_slot_flag enum */
slot_type Type; /**< See slot_type_* */
slot_content Content; /**< See slot_content_* */
slot_number_t Slot; /**< Drive number when slot_type_drive or actual slot number */
slot_number_t Loaded; /**< Volume loaded in drive when slot_type_drive */
slot_number_t element_address ; /**< scsi element address */
slot_flags_t flags; /**< Slot specific flags see e_slot_flag enum */
slot_type type; /**< See slot_type_* */
slot_status_t slot_status; /**< See slot_status_* */
slot_number_t bareos_slot_number; /**< Drive number when slot_type_drive or actual slot number */
slot_number_t currently_loaded_slot_number; /**< Volume loaded in drive when slot_type_drive */
char *VolName; /**< Actual Volume Name */
};

Expand All @@ -151,19 +151,54 @@ struct changer_vol_list_t {
*/
struct storage_mapping_t {
dlink link; /**< Link for list */
slot_type Type; /**< See slot_type_* */
slot_number_t Index; /**< Unique index */
slot_type type; /**< See slot_type_* */
slot_number_t element_address;/**< scsi element address */
slot_number_t Slot; /**< Drive number when slot_type_drive or actual slot number */
};



#if HAVE_NDMP
/**
* same as smc_element_address_assignment
* from ndmp/smc.h
* TODO: check if original definition can be used
*/
struct smc_element_aa {

unsigned mte_addr; /* media transport element */
unsigned mte_count;

unsigned se_addr; /* storage element */
unsigned se_count;

unsigned iee_addr; /* import/export element */
unsigned iee_count;

unsigned dte_addr; /* data transfer element */
unsigned dte_count;

};

struct ndmp_deviceinfo_t {
std::string device;
std::string model;
JobId_t JobIdUsingDevice;
};
#endif


struct runtime_storage_status_t {
int32_t NumConcurrentJobs; /**< Number of concurrent jobs running */
int32_t NumConcurrentReadJobs; /**< Number of jobs reading */
drive_number_t drives; /**< Number of drives in autochanger */
slot_number_t slots; /**< Number of slots in autochanger */
dlist *storage_mappings; /**< Mappings from logical to physical storage address */
changer_vol_list_t *vol_list; /**< Cached content of autochanger */
pthread_mutex_t changer_lock; /**< Any access to the autochanger is controlled by this lock */
unsigned char smc_ident[32]; /**< smc ident info = changer name */
smc_element_aa storage_mapping;/**< smc element assignment */
changer_vol_list_t *vol_list; /**< Cached content of autochanger */
std::list<ndmp_deviceinfo_t> *ndmp_deviceinfo; /**< NDMP device info for devices in this Storage */
pthread_mutex_t ndmp_deviceinfo_lock; /**< Any access to the list devices is controlled by this lock */
};

struct runtime_client_status_t {
Expand Down
7 changes: 7 additions & 0 deletions core/src/dird/dird_conf.cc
Expand Up @@ -2486,6 +2486,12 @@ static bool UpdateResourcePointer(int type, ResourceItem *items)

Emsg1(M_ERROR_TERM, 0, _("pthread_mutex_init: ERR=%s\n"), be.bstrerror(status));
}
if ((status = pthread_mutex_init(&res->res_store.rss->ndmp_deviceinfo_lock, NULL)) != 0) {
BErrNo be;

Emsg1(M_ERROR_TERM, 0, _("pthread_mutex_init: ERR=%s\n"), be.bstrerror(status));
}

}
break;
case R_JOBDEFS:
Expand Down Expand Up @@ -4108,6 +4114,7 @@ static void FreeResource(CommonResourceHeader *sres, int type)
free(res->res_store.rss->vol_list);
}
pthread_mutex_destroy(&res->res_store.rss->changer_lock);
pthread_mutex_destroy(&res->res_store.rss->ndmp_device_info_lock);
free(res->res_store.rss);
}
if (res->res_store.tls_cert_.allowed_certificate_common_names_) {
Expand Down

0 comments on commit 65963c0

Please sign in to comment.