From: Zdenek Kabelac Date: Mon, 27 Oct 2014 09:50:52 +0000 (+0100) Subject: segtype: drop cmdcontex pointer X-Git-Tag: v2_02_112~95 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=97cccfbf1c000e597cf751e26284614a15f77cb5;p=lvm2.git segtype: drop cmdcontex pointer Users of context provide their cmd pointer, so don't keep it inside segtype. --- diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c index 8c2ff7808..93027d727 100644 --- a/lib/cache_segtype/cache.c +++ b/lib/cache_segtype/cache.c @@ -388,12 +388,10 @@ int init_cache_segtypes(struct cmd_context *cmd, log_error("Failed to allocate memory for cache_pool segtype"); return 0; } - segtype->cmd = cmd; segtype->name = "cache-pool"; segtype->flags = SEG_CACHE_POOL | SEG_CANNOT_BE_ZEROED; segtype->ops = &_cache_pool_ops; - segtype->private = NULL; if (!lvm_register_segtype(seglib, segtype)) return_0; @@ -404,12 +402,10 @@ int init_cache_segtypes(struct cmd_context *cmd, log_error("Failed to allocate memory for cache segtype"); return 0; } - segtype->cmd = cmd; segtype->name = "cache"; segtype->flags = SEG_CACHE; segtype->ops = &_cache_ops; - segtype->private = NULL; if (!lvm_register_segtype(seglib, segtype)) return_0; diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 72525f51e..3900179c5 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1174,7 +1174,6 @@ int lvm_register_segtype(struct segtype_library *seglib, struct segment_type *segtype2; segtype->library = seglib->lib; - segtype->cmd = seglib->cmd; dm_list_iterate_items(segtype2, &seglib->cmd->segtypes) { if (strcmp(segtype2->name, segtype->name)) diff --git a/lib/error/errseg.c b/lib/error/errseg.c index af19e7d3d..fa0b9c06e 100644 --- a/lib/error/errseg.c +++ b/lib/error/errseg.c @@ -94,10 +94,8 @@ struct segment_type *init_error_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_error_ops; segtype->name = "error"; - segtype->private = NULL; segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; log_very_verbose("Initialised segtype: %s", segtype->name); diff --git a/lib/freeseg/freeseg.c b/lib/freeseg/freeseg.c index b4eba943a..71d7f8c94 100644 --- a/lib/freeseg/freeseg.c +++ b/lib/freeseg/freeseg.c @@ -32,10 +32,8 @@ struct segment_type *init_free_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_freeseg_ops; segtype->name = "free"; - segtype->private = NULL; segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; log_very_verbose("Initialised segtype: %s", segtype->name); diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h index 749b18815..4635681cd 100644 --- a/lib/metadata/segtype.h +++ b/lib/metadata/segtype.h @@ -81,7 +81,6 @@ struct dev_manager; struct segment_type { struct dm_list list; /* Internal */ - struct cmd_context *cmd; /* lvm_register_segtype() sets this. */ uint32_t flags; uint32_t parity_devs; /* Parity drives required by segtype */ diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c index 46dfe02fb..7ab11c216 100644 --- a/lib/mirror/mirrored.c +++ b/lib/mirror/mirrored.c @@ -618,10 +618,8 @@ struct segment_type *init_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_mirrored_ops; segtype->name = "mirror"; - segtype->private = NULL; segtype->flags = SEG_MIRROR | SEG_AREAS_MIRRORED; #ifdef DEVMAPPER_SUPPORT diff --git a/lib/raid/raid.c b/lib/raid/raid.c index 7cc4301a8..6f4fe27de 100644 --- a/lib/raid/raid.c +++ b/lib/raid/raid.c @@ -462,7 +462,7 @@ static struct segment_type *_init_raid_segtype(struct cmd_context *cmd, rt->name); return NULL; } - segtype->cmd = cmd; + segtype->ops = &_raid_ops; segtype->name = rt->name; segtype->flags = SEG_RAID | rt->extra_flags | monitored; diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c index aefab3ac9..b64e533fc 100644 --- a/lib/snapshot/snapshot.c +++ b/lib/snapshot/snapshot.c @@ -258,10 +258,8 @@ struct segment_type *init_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_snapshot_ops; segtype->name = "snapshot"; - segtype->private = NULL; segtype->flags = SEG_SNAPSHOT | SEG_CANNOT_BE_ZEROED; #ifdef DEVMAPPER_SUPPORT diff --git a/lib/striped/striped.c b/lib/striped/striped.c index dfd45181f..180307725 100644 --- a/lib/striped/striped.c +++ b/lib/striped/striped.c @@ -228,10 +228,8 @@ struct segment_type *init_striped_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_striped_ops; segtype->name = "striped"; - segtype->private = NULL; segtype->flags = SEG_CAN_SPLIT | SEG_AREAS_STRIPED | SEG_FORMAT1_SUPPORT; diff --git a/lib/unknown/unknown.c b/lib/unknown/unknown.c index 760f1c2e5..3712c661f 100644 --- a/lib/unknown/unknown.c +++ b/lib/unknown/unknown.c @@ -67,10 +67,8 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd, const char *n return NULL; } - segtype->cmd = cmd; segtype->ops = &_unknown_ops; segtype->name = dm_pool_strdup(cmd->libmem, name); - segtype->private = NULL; segtype->flags = SEG_UNKNOWN | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; log_very_verbose("Initialised segtype: %s", segtype->name); diff --git a/lib/zero/zero.c b/lib/zero/zero.c index 9f9d06c06..f07f28850 100644 --- a/lib/zero/zero.c +++ b/lib/zero/zero.c @@ -90,10 +90,8 @@ struct segment_type *init_zero_segtype(struct cmd_context *cmd) if (!segtype) return_NULL; - segtype->cmd = cmd; segtype->ops = &_zero_ops; segtype->name = "zero"; - segtype->private = NULL; segtype->flags = SEG_CAN_SPLIT | SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED; log_very_verbose("Initialised segtype: %s", segtype->name); diff --git a/tools/reporter.c b/tools/reporter.c index 96881510e..02f606428 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -100,7 +100,6 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd, struct lvinfo lvinfo = { .exists = 0 }; struct segment_type _freeseg_type = { - .cmd = cmd, .name = "free", .flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED, };