1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

segtype: drop cmdcontex pointer

Users of context provide their cmd pointer,
so don't keep it inside segtype.
This commit is contained in:
Zdenek Kabelac 2014-10-27 10:50:52 +01:00
parent 87fc3b710c
commit 97cccfbf1c
12 changed files with 1 additions and 22 deletions

View File

@ -388,12 +388,10 @@ int init_cache_segtypes(struct cmd_context *cmd,
log_error("Failed to allocate memory for cache_pool segtype"); log_error("Failed to allocate memory for cache_pool segtype");
return 0; return 0;
} }
segtype->cmd = cmd;
segtype->name = "cache-pool"; segtype->name = "cache-pool";
segtype->flags = SEG_CACHE_POOL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_CACHE_POOL | SEG_CANNOT_BE_ZEROED;
segtype->ops = &_cache_pool_ops; segtype->ops = &_cache_pool_ops;
segtype->private = NULL;
if (!lvm_register_segtype(seglib, segtype)) if (!lvm_register_segtype(seglib, segtype))
return_0; return_0;
@ -404,12 +402,10 @@ int init_cache_segtypes(struct cmd_context *cmd,
log_error("Failed to allocate memory for cache segtype"); log_error("Failed to allocate memory for cache segtype");
return 0; return 0;
} }
segtype->cmd = cmd;
segtype->name = "cache"; segtype->name = "cache";
segtype->flags = SEG_CACHE; segtype->flags = SEG_CACHE;
segtype->ops = &_cache_ops; segtype->ops = &_cache_ops;
segtype->private = NULL;
if (!lvm_register_segtype(seglib, segtype)) if (!lvm_register_segtype(seglib, segtype))
return_0; return_0;

View File

@ -1174,7 +1174,6 @@ int lvm_register_segtype(struct segtype_library *seglib,
struct segment_type *segtype2; struct segment_type *segtype2;
segtype->library = seglib->lib; segtype->library = seglib->lib;
segtype->cmd = seglib->cmd;
dm_list_iterate_items(segtype2, &seglib->cmd->segtypes) { dm_list_iterate_items(segtype2, &seglib->cmd->segtypes) {
if (strcmp(segtype2->name, segtype->name)) if (strcmp(segtype2->name, segtype->name))

View File

@ -94,10 +94,8 @@ struct segment_type *init_error_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_error_ops; segtype->ops = &_error_ops;
segtype->name = "error"; segtype->name = "error";
segtype->private = NULL;
segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);

View File

@ -32,10 +32,8 @@ struct segment_type *init_free_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_freeseg_ops; segtype->ops = &_freeseg_ops;
segtype->name = "free"; segtype->name = "free";
segtype->private = NULL;
segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);

View File

@ -81,7 +81,6 @@ struct dev_manager;
struct segment_type { struct segment_type {
struct dm_list list; /* Internal */ struct dm_list list; /* Internal */
struct cmd_context *cmd; /* lvm_register_segtype() sets this. */
uint32_t flags; uint32_t flags;
uint32_t parity_devs; /* Parity drives required by segtype */ uint32_t parity_devs; /* Parity drives required by segtype */

View File

@ -618,10 +618,8 @@ struct segment_type *init_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_mirrored_ops; segtype->ops = &_mirrored_ops;
segtype->name = "mirror"; segtype->name = "mirror";
segtype->private = NULL;
segtype->flags = SEG_MIRROR | SEG_AREAS_MIRRORED; segtype->flags = SEG_MIRROR | SEG_AREAS_MIRRORED;
#ifdef DEVMAPPER_SUPPORT #ifdef DEVMAPPER_SUPPORT

View File

@ -462,7 +462,7 @@ static struct segment_type *_init_raid_segtype(struct cmd_context *cmd,
rt->name); rt->name);
return NULL; return NULL;
} }
segtype->cmd = cmd;
segtype->ops = &_raid_ops; segtype->ops = &_raid_ops;
segtype->name = rt->name; segtype->name = rt->name;
segtype->flags = SEG_RAID | rt->extra_flags | monitored; segtype->flags = SEG_RAID | rt->extra_flags | monitored;

View File

@ -258,10 +258,8 @@ struct segment_type *init_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_snapshot_ops; segtype->ops = &_snapshot_ops;
segtype->name = "snapshot"; segtype->name = "snapshot";
segtype->private = NULL;
segtype->flags = SEG_SNAPSHOT | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_SNAPSHOT | SEG_CANNOT_BE_ZEROED;
#ifdef DEVMAPPER_SUPPORT #ifdef DEVMAPPER_SUPPORT

View File

@ -228,10 +228,8 @@ struct segment_type *init_striped_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_striped_ops; segtype->ops = &_striped_ops;
segtype->name = "striped"; segtype->name = "striped";
segtype->private = NULL;
segtype->flags = segtype->flags =
SEG_CAN_SPLIT | SEG_AREAS_STRIPED | SEG_FORMAT1_SUPPORT; SEG_CAN_SPLIT | SEG_AREAS_STRIPED | SEG_FORMAT1_SUPPORT;

View File

@ -67,10 +67,8 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd, const char *n
return NULL; return NULL;
} }
segtype->cmd = cmd;
segtype->ops = &_unknown_ops; segtype->ops = &_unknown_ops;
segtype->name = dm_pool_strdup(cmd->libmem, name); segtype->name = dm_pool_strdup(cmd->libmem, name);
segtype->private = NULL;
segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);

View File

@ -90,10 +90,8 @@ struct segment_type *init_zero_segtype(struct cmd_context *cmd)
if (!segtype) if (!segtype)
return_NULL; return_NULL;
segtype->cmd = cmd;
segtype->ops = &_zero_ops; segtype->ops = &_zero_ops;
segtype->name = "zero"; segtype->name = "zero";
segtype->private = NULL;
segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name); log_very_verbose("Initialised segtype: %s", segtype->name);

View File

@ -100,7 +100,6 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
struct lvinfo lvinfo = { .exists = 0 }; struct lvinfo lvinfo = { .exists = 0 };
struct segment_type _freeseg_type = { struct segment_type _freeseg_type = {
.cmd = cmd,
.name = "free", .name = "free",
.flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED, .flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED,
}; };