Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rogge <andreas.rogge@bareos.com>2022-11-02 11:49:11 +0300
committerAndreas Rogge <andreas.rogge@bareos.com>2022-11-07 19:40:28 +0300
commit8208f2ad40a3f34317fda7bdedfd998fa89d6752 (patch)
treec8391f5d3132ede14c8e695b37ae481c15a4374f
parent28d4311e3d795ae2f14750d5197dd947a50c6c2e (diff)
stored: rename dev_type to device_type
-rw-r--r--core/src/stored/dev.cc13
-rw-r--r--core/src/stored/dev.h6
-rw-r--r--core/src/stored/device_resource.cc8
-rw-r--r--core/src/stored/device_resource.h20
-rw-r--r--core/src/stored/sd_backends.h2
-rw-r--r--core/src/stored/sd_backends_dynamic.cc10
-rw-r--r--core/src/stored/stored_conf.cc30
7 files changed, 45 insertions, 44 deletions
diff --git a/core/src/stored/dev.cc b/core/src/stored/dev.cc
index 2a1205e14..a5d0e25a3 100644
--- a/core/src/stored/dev.cc
+++ b/core/src/stored/dev.cc
@@ -122,15 +122,16 @@ Device* FactoryCreateDevice(JobControlRecord* jcr,
Dmsg1(400, "max_block_size in device_resource res is %u\n",
device_resource->max_block_size);
- if (!ImplementationFactory<Device>::IsRegistered(device_resource->dev_type)) {
+ if (!ImplementationFactory<Device>::IsRegistered(
+ device_resource->device_type)) {
Jmsg2(jcr, M_ERROR, 0, _("%s has an unknown device type %s\n"),
device_resource->archive_device_string,
- device_resource->dev_type.c_str());
+ device_resource->device_type.c_str());
return nullptr;
}
Device* dev
- = ImplementationFactory<Device>::Create(device_resource->dev_type);
+ = ImplementationFactory<Device>::Create(device_resource->device_type);
dev->device_resource = device_resource;
device_resource->dev = dev;
@@ -179,7 +180,7 @@ static void InitiateDevice(JobControlRecord* jcr, Device* dev)
dev->drive_index = dev->device_resource->drive_index;
dev->autoselect = dev->device_resource->autoselect;
dev->norewindonclose = dev->device_resource->norewindonclose;
- dev->dev_type = dev->device_resource->dev_type;
+ dev->device_type = dev->device_resource->device_type;
if (dev->vol_poll_interval && dev->vol_poll_interval < 60) {
dev->vol_poll_interval = 60;
@@ -505,7 +506,7 @@ bool Device::open(DeviceControlRecord* dcr, DeviceMode omode)
}
Dmsg4(100, "open dev: type=%d archive_device_string=%s vol=%s mode=%s\n",
- dev_type.c_str(), print_name(), getVolCatName(), mode_to_str(omode));
+ device_type.c_str(), print_name(), getVolCatName(), mode_to_str(omode));
ClearBit(ST_LABEL, state);
ClearBit(ST_APPENDREADY, state);
@@ -899,7 +900,7 @@ bool Device::close(DeviceControlRecord* dcr)
if (!norewindonclose) { OfflineOrRewind(); }
- if (dev_type == DeviceType::B_TAPE_DEV) { UnlockDoor(); }
+ if (device_type == DeviceType::B_TAPE_DEV) { UnlockDoor(); }
status = d_close(fd);
if (status < 0) {
BErrNo be;
diff --git a/core/src/stored/dev.h b/core/src/stored/dev.h
index 823761872..ad27ae7b1 100644
--- a/core/src/stored/dev.h
+++ b/core/src/stored/dev.h
@@ -229,7 +229,7 @@ class Device {
int dev_errno{}; /**< Our own errno */
int oflags{}; /**< Read/write flags */
DeviceMode open_mode{DeviceMode::kUndefined};
- std::string dev_type{};
+ std::string device_type{};
bool autoselect{}; /**< Autoselect in autochanger */
bool norewindonclose{}; /**< Don't rewind tape drive on close */
bool initiated{}; /**< Set when FactoryCreateDevice() called */
@@ -298,7 +298,7 @@ class Device {
bool AttachedToAutochanger() const { return BitIsSet(CAP_ATTACHED_TO_AUTOCHANGER, capabilities); }
bool RequiresMount() const { return BitIsSet(CAP_REQMOUNT, capabilities); }
bool IsRemovable() const { return BitIsSet(CAP_REM, capabilities); }
- bool IsTape() const { return (dev_type == DeviceType::B_TAPE_DEV); }
+ bool IsTape() const { return (device_type == DeviceType::B_TAPE_DEV); }
bool IsOpen() const { return fd >= 0; }
bool IsOffline() const { return BitIsSet(ST_OFFLINE, state); }
bool IsLabeled() const { return BitIsSet(ST_LABEL, state); }
@@ -335,7 +335,7 @@ class Device {
const char* strerror() const;
const char* archive_name() const;
const char* name() const;
- const std::string& type() const { return dev_type; }
+ const std::string& type() const { return device_type; }
const char* print_name() const; /**< Name for display purposes */
void SetEot() { SetBit(ST_EOT, state); }
void SetEof() { SetBit(ST_EOF, state); }
diff --git a/core/src/stored/device_resource.cc b/core/src/stored/device_resource.cc
index 6cdd29c48..7fb59d7de 100644
--- a/core/src/stored/device_resource.cc
+++ b/core/src/stored/device_resource.cc
@@ -38,7 +38,7 @@ DeviceResource::DeviceResource()
, changer_command(nullptr)
, alert_command(nullptr)
, spool_directory(nullptr)
- , dev_type(DeviceType::B_UNKNOWN_DEV)
+ , device_type(DeviceType::B_UNKNOWN_DEV)
, label_type(B_BAREOS_LABEL)
, autoselect(true)
, norewindonclose(true)
@@ -115,7 +115,7 @@ DeviceResource::DeviceResource(const DeviceResource& other)
if (other.spool_directory) {
spool_directory = strdup(other.spool_directory);
}
- dev_type = other.dev_type;
+ device_type = other.device_type;
label_type = other.label_type;
autoselect = other.autoselect;
norewindonclose = other.norewindonclose;
@@ -170,7 +170,7 @@ DeviceResource& DeviceResource::operator=(const DeviceResource& rhs)
changer_command = rhs.changer_command;
alert_command = rhs.alert_command;
spool_directory = rhs.spool_directory;
- dev_type = rhs.dev_type;
+ device_type = rhs.device_type;
label_type = rhs.label_type;
autoselect = rhs.autoselect;
norewindonclose = rhs.norewindonclose;
@@ -274,7 +274,7 @@ void DeviceResource::CreateAndAssignSerialNumber(uint16_t number)
bool DeviceResource::Validate()
{
- if (max_block_size > 0 && dev_type != DeviceType::B_TAPE_DEV) {
+ if (max_block_size > 0 && device_type != DeviceType::B_TAPE_DEV) {
my_config->AddWarning(
"Setting 'Maximum Block Size' on a non-tape device is unsupported");
}
diff --git a/core/src/stored/device_resource.h b/core/src/stored/device_resource.h
index 40a1c927d..1a115ef0b 100644
--- a/core/src/stored/device_resource.h
+++ b/core/src/stored/device_resource.h
@@ -35,16 +35,16 @@ class AutochangerResource;
class DeviceResource : public BareosResource {
public:
- char* media_type; /**< User assigned media type */
- char* archive_device_string; /**< Archive device name */
- char* device_options; /**< Device specific option string */
- char* diag_device_name; /**< Diagnostic device name */
- char* changer_name; /**< Changer device name */
- char* changer_command; /**< Changer command -- external program */
- char* alert_command; /**< Alert command -- external program */
- char* spool_directory; /**< Spool file directory */
- std::string dev_type; /**< device type */
- uint32_t label_type; /**< label type */
+ char* media_type; /**< User assigned media type */
+ char* archive_device_string; /**< Archive device name */
+ char* device_options; /**< Device specific option string */
+ char* diag_device_name; /**< Diagnostic device name */
+ char* changer_name; /**< Changer device name */
+ char* changer_command; /**< Changer command -- external program */
+ char* alert_command; /**< Alert command -- external program */
+ char* spool_directory; /**< Spool file directory */
+ std::string device_type;
+ uint32_t label_type;
bool autoselect; /**< Automatically select from AutoChanger */
bool norewindonclose; /**< Don't rewind tape drive on close */
bool drive_tapealert_enabled; /**< Enable Tape Alert monitoring */
diff --git a/core/src/stored/sd_backends.h b/core/src/stored/sd_backends.h
index 722b82136..cb8b834d0 100644
--- a/core/src/stored/sd_backends.h
+++ b/core/src/stored/sd_backends.h
@@ -30,7 +30,7 @@ class Device;
template <typename T> Device* DeviceFactory(void) { return new T(); }
#if defined(HAVE_DYNAMIC_SD_BACKENDS)
-bool LoadStorageBackend(const std::string& dev_type,
+bool LoadStorageBackend(const std::string& device_type,
const std::vector<std::string>& backend_directories);
#endif
diff --git a/core/src/stored/sd_backends_dynamic.cc b/core/src/stored/sd_backends_dynamic.cc
index 9ff449828..2d4fcf9e6 100644
--- a/core/src/stored/sd_backends_dynamic.cc
+++ b/core/src/stored/sd_backends_dynamic.cc
@@ -53,23 +53,23 @@ static bool LoadDynamicLibrary(
return false;
}
-bool LoadStorageBackend(const std::string& dev_type,
+bool LoadStorageBackend(const std::string& device_type,
const std::vector<std::string>& backend_directories)
{
using namespace std::string_literals;
- if (dev_type.empty() || backend_directories.empty()) { return false; }
+ if (device_type.empty() || backend_directories.empty()) { return false; }
- if (!LoadDynamicLibrary("libbareossd-"s + dev_type + kDynLibExtension,
+ if (!LoadDynamicLibrary("libbareossd-"s + device_type + kDynLibExtension,
backend_directories)) {
return false;
}
- if (!ImplementationFactory<Device>::IsRegistered(dev_type)) {
+ if (!ImplementationFactory<Device>::IsRegistered(device_type)) {
Jmsg(nullptr, M_ERROR_TERM, 0,
"Loaded backend library for %s did not register its backend. This is "
"probably a bug in the backend library.\n",
- dev_type.c_str());
+ device_type.c_str());
}
return true;
diff --git a/core/src/stored/stored_conf.cc b/core/src/stored/stored_conf.cc
index 4ad7eb0a7..ed9bc7ce5 100644
--- a/core/src/stored/stored_conf.cc
+++ b/core/src/stored/stored_conf.cc
@@ -148,7 +148,7 @@ static ResourceItem dev_items[] = {
{"Description", CFG_TYPE_STR, ITEM(res_dev, description_), 0, 0, NULL, NULL,
"The Description directive provides easier human recognition, but is not used by Bareos directly."},
{"MediaType", CFG_TYPE_STRNAME, ITEM(res_dev, media_type), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL},
- {"DeviceType", CFG_TYPE_STDSTR, ITEM(res_dev, dev_type), 0, CFG_ITEM_DEFAULT, "", NULL, NULL},
+ {"DeviceType", CFG_TYPE_STDSTR, ITEM(res_dev, device_type), 0, CFG_ITEM_DEFAULT, "", NULL, NULL},
{"ArchiveDevice", CFG_TYPE_STRNAME, ITEM(res_dev, archive_device_string), 0, CFG_ITEM_REQUIRED, NULL, NULL, NULL},
{"DeviceOptions", CFG_TYPE_STR, ITEM(res_dev, device_options), 0, 0, NULL, "15.2.0-", NULL},
{"DiagnosticDevice", CFG_TYPE_STRNAME, ITEM(res_dev, diag_device_name), 0, 0, NULL, NULL, NULL},
@@ -489,11 +489,11 @@ static void CheckDropletDevices(ConfigurationParser& my_config)
while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
DeviceResource* d = dynamic_cast<DeviceResource*>(p);
- if (d && d->dev_type == DeviceType::B_DROPLET_DEV) {
+ if (d && d->device_type == DeviceType::B_DROPLET_DEV) {
if (d->max_concurrent_jobs == 0) {
/*
- * 0 is the general default. However, for this dev_type, only 1 works.
- * So we set it to this value.
+ * 0 is the general default. However, for this device_type, only 1
+ * works. So we set it to this value.
*/
Jmsg1(nullptr, M_WARNING, 0,
_("device %s is set to the default 'Maximum Concurrent Jobs' = "
@@ -516,7 +516,7 @@ static void GuessMissingDeviceTypes(ConfigurationParser& my_config)
while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
DeviceResource* d = dynamic_cast<DeviceResource*>(p);
- if (d && d->dev_type == DeviceType::B_UNKNOWN_DEV) {
+ if (d && d->device_type == DeviceType::B_UNKNOWN_DEV) {
struct stat statp;
// Check that device is available
if (stat(d->archive_device_string, &statp) < 0) {
@@ -529,11 +529,11 @@ static void GuessMissingDeviceTypes(ConfigurationParser& my_config)
return;
}
if (S_ISDIR(statp.st_mode)) {
- d->dev_type = DeviceType::B_FILE_DEV;
+ d->device_type = DeviceType::B_FILE_DEV;
} else if (S_ISCHR(statp.st_mode)) {
- d->dev_type = DeviceType::B_TAPE_DEV;
+ d->device_type = DeviceType::B_TAPE_DEV;
} else if (S_ISFIFO(statp.st_mode)) {
- d->dev_type = DeviceType::B_FIFO_DEV;
+ d->device_type = DeviceType::B_FIFO_DEV;
} else if (!BitIsSet(CAP_REQMOUNT, d->cap_bits)) {
Jmsg2(nullptr, M_ERROR_TERM, 0,
_("%s is an unknown device type. Must be tape or directory, "
@@ -556,24 +556,24 @@ static void CheckAndLoadDeviceBackends(ConfigurationParser& my_config)
while ((p = my_config.GetNextRes(R_DEVICE, p)) != nullptr) {
DeviceResource* d = dynamic_cast<DeviceResource*>(p);
if (d) {
- to_lower(d->dev_type);
- if (!ImplementationFactory<Device>::IsRegistered(d->dev_type)) {
+ to_lower(d->device_type);
+ if (!ImplementationFactory<Device>::IsRegistered(d->device_type)) {
#if defined(HAVE_DYNAMIC_SD_BACKENDS)
if (!storage_res || storage_res->backend_directories.empty()) {
Jmsg2(nullptr, M_ERROR_TERM, 0,
"Backend Directory not set. Cannot load dynamic backend %s\n",
- d->dev_type.c_str());
+ d->device_type.c_str());
}
- if (!LoadStorageBackend(d->dev_type,
+ if (!LoadStorageBackend(d->device_type,
storage_res->backend_directories)) {
Jmsg2(nullptr, M_ERROR_TERM, 0,
"Could not load storage backend %s for device %s.\n",
- d->dev_type.c_str(), d->resource_name_);
+ d->device_type.c_str(), d->resource_name_);
}
#else
Jmsg2(nullptr, M_ERROR_TERM, 0,
- "Backend %s for device %s not available.\n", d->dev_type.c_str(),
- d->resource_name_);
+ "Backend %s for device %s not available.\n",
+ d->device_type.c_str(), d->resource_name_);
#endif
}
}