mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
config_file: remove unused code
config_file_read() is only used for regular files, not devices.
This commit is contained in:
parent
76bd678ce3
commit
57e9083c90
@ -265,7 +265,7 @@ struct dm_config_tree *config_file_open_and_read(const char *config_file,
|
||||
}
|
||||
|
||||
log_very_verbose("Loading config file: %s", config_file);
|
||||
if (!config_file_read(cft)) {
|
||||
if (!config_file_read_from_file(cft)) {
|
||||
log_error("Failed to load config file %s", config_file);
|
||||
goto bad;
|
||||
}
|
||||
@ -589,7 +589,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_r
|
||||
return r;
|
||||
}
|
||||
|
||||
int config_file_read(struct dm_config_tree *cft)
|
||||
int config_file_read_from_file(struct dm_config_tree *cft)
|
||||
{
|
||||
const char *filename = NULL;
|
||||
struct config_source *cs = dm_config_get_custom(cft);
|
||||
@ -597,7 +597,6 @@ int config_file_read(struct dm_config_tree *cft)
|
||||
struct stat info;
|
||||
struct device fake_dev = { 0 };
|
||||
struct dm_str_list *alias;
|
||||
int free_fake = 0;
|
||||
int fd;
|
||||
int r;
|
||||
|
||||
@ -610,10 +609,12 @@ int config_file_read(struct dm_config_tree *cft)
|
||||
|
||||
cf = cs->source.file;
|
||||
|
||||
if (cf->dev)
|
||||
return_0;
|
||||
|
||||
/* fixme: get rid of fake dev and just
|
||||
add separate code paths for files */
|
||||
|
||||
if (!cf->dev) {
|
||||
if (!(alias = zalloc(sizeof(*alias))))
|
||||
return_0;
|
||||
if (!(alias->str = strdup(filename))) {
|
||||
@ -631,21 +632,15 @@ int config_file_read(struct dm_config_tree *cft)
|
||||
return_0;
|
||||
}
|
||||
fake_dev.fd = fd;
|
||||
free_fake = 1;
|
||||
cf->dev = &fake_dev;
|
||||
}
|
||||
|
||||
r = config_file_read_fd(cft, cf->dev, DEV_IO_MDA_CONTENT, 0, (size_t) info.st_size, 0, 0,
|
||||
(checksum_fn_t) NULL, 0, 0, 0);
|
||||
|
||||
if (free_fake) {
|
||||
free((void*)alias->str);
|
||||
free((void*)alias);
|
||||
close(fd);
|
||||
} else {
|
||||
if (!dev_close(cf->dev))
|
||||
stack;
|
||||
}
|
||||
|
||||
cf->dev = NULL;
|
||||
|
||||
return r;
|
||||
|
@ -244,7 +244,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_r
|
||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||
checksum_fn_t checksum_fn, uint32_t checksum,
|
||||
int skip_parse, int no_dup_node_check);
|
||||
int config_file_read(struct dm_config_tree *cft);
|
||||
int config_file_read_from_file(struct dm_config_tree *cft);
|
||||
struct dm_config_tree *config_file_open_and_read(const char *config_file, config_source_t source,
|
||||
struct cmd_context *cmd);
|
||||
int config_write(struct dm_config_tree *cft, struct config_def_tree_spec *tree_spec,
|
||||
|
@ -67,7 +67,7 @@ int text_read_metadata_summary(const struct format_type *fmt,
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (!config_file_read(cft)) {
|
||||
if (!config_file_read_from_file(cft)) {
|
||||
log_warn("WARNING: invalid metadata text from file.");
|
||||
goto out;
|
||||
}
|
||||
@ -161,7 +161,7 @@ struct volume_group *text_read_metadata(struct format_instance *fid,
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (!config_file_read(cft)) {
|
||||
if (!config_file_read_from_file(cft)) {
|
||||
log_warn("WARNING: couldn't read volume group metadata from file.");
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user