]> sourceware.org Git - lvm2.git/commitdiff
segtype: drop cmdcontex pointer
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 27 Oct 2014 09:50:52 +0000 (10:50 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 30 Oct 2014 22:58:49 +0000 (23:58 +0100)
Users of context provide their cmd pointer,
so don't keep it inside segtype.

12 files changed:
lib/cache_segtype/cache.c
lib/commands/toolcontext.c
lib/error/errseg.c
lib/freeseg/freeseg.c
lib/metadata/segtype.h
lib/mirror/mirrored.c
lib/raid/raid.c
lib/snapshot/snapshot.c
lib/striped/striped.c
lib/unknown/unknown.c
lib/zero/zero.c
tools/reporter.c

index 8c2ff780873c272101f4a5442652c47cc1b4ca6a..93027d727e719e32582ed21de51504bd52e259f3 100644 (file)
@@ -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;
index 72525f51ead77b9ee5b014014ca2a483923f0e67..3900179c50b565822f891e2958172cc1b993caca 100644 (file)
@@ -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))
index af19e7d3df09b91b115335afaa956c4b9f1b35a4..fa0b9c06ee54ae71cce71fb90cd8b703ba8c1783 100644 (file)
@@ -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);
index b4eba943ad08906f66b18a5d46e1647c1fa7faa5..71d7f8c94abe204f373bbb6b2b9183643f06ea0f 100644 (file)
@@ -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);
index 749b1881549d8448e1db76add89cae7b3e58a345..4635681cd01d021988e41ae5cf6d6bbc7449fcc6 100644 (file)
@@ -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 */
index 46dfe02fb487a2d4fbb3fec071d7d7f260437d5d..7ab11c2165aec0ffb9cbedc469368428de484fcd 100644 (file)
@@ -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
index 7cc4301a85860a646f8d639308fe6ed0f93031e3..6f4fe27de0aaf5f927e866c1c8abe163862c2ac6 100644 (file)
@@ -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;
index aefab3ac95b2f1a0cdfa06c3cd7b441dfbd91542..b64e533fccb24afbee660d5581fb4c40955998d6 100644 (file)
@@ -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
index dfd45181fb5ac531e8748fff36ffa095ff47b1db..18030772554976a57ef378db4215e9af5a36c1af 100644 (file)
@@ -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;
 
index 760f1c2e59c67e381a64e24401c3bb793a26d53f..3712c661fb850d3c4d4f57bddcfe1d9050060f20 100644 (file)
@@ -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);
index 9f9d06c06d0f1bd6cb3a995aae113e046d618199..f07f28850d072f46c63430d03aca51ed18a0753c 100644 (file)
@@ -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);
index 96881510e22e265921e74975b78533a6772ba27b..02f606428d8e239482686ae3bd57fbc6463c9366 100644 (file)
@@ -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,
        };
This page took 0.045179 seconds and 5 git commands to generate.