aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-04-26 10:43:47 -0400
committerSage Weil <sage@inktank.com>2013-05-02 00:19:37 -0400
commitecb4dc225612e1c0b28d2c1b168422dde4f442a6 (patch)
tree30ba46a6b18030788751dee3084a6e7e4a12bf84 /drivers/block/rbd.c
parente1d4213f090644b06aab6ea70e307ecf16182148 (diff)
rbd: make rbd spec names pointer to const
Make the names and image id in an rbd_spec be pointers to constant data. This required the use of a local variable to hold the snapshot name in rbd_add_parse_args() to avoid a warning. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index c34f8716d1d2..e728e11096b4 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -138,13 +138,13 @@ struct rbd_image_header {
138 */ 138 */
139struct rbd_spec { 139struct rbd_spec {
140 u64 pool_id; 140 u64 pool_id;
141 char *pool_name; 141 const char *pool_name;
142 142
143 char *image_id; 143 const char *image_id;
144 char *image_name; 144 const char *image_name;
145 145
146 u64 snap_id; 146 u64 snap_id;
147 char *snap_name; 147 const char *snap_name;
148 148
149 struct kref kref; 149 struct kref kref;
150}; 150};
@@ -4375,6 +4375,7 @@ static int rbd_add_parse_args(const char *buf,
4375 size_t len; 4375 size_t len;
4376 char *options; 4376 char *options;
4377 const char *mon_addrs; 4377 const char *mon_addrs;
4378 char *snap_name;
4378 size_t mon_addrs_size; 4379 size_t mon_addrs_size;
4379 struct rbd_spec *spec = NULL; 4380 struct rbd_spec *spec = NULL;
4380 struct rbd_options *rbd_opts = NULL; 4381 struct rbd_options *rbd_opts = NULL;
@@ -4433,10 +4434,11 @@ static int rbd_add_parse_args(const char *buf,
4433 ret = -ENAMETOOLONG; 4434 ret = -ENAMETOOLONG;
4434 goto out_err; 4435 goto out_err;
4435 } 4436 }
4436 spec->snap_name = kmemdup(buf, len + 1, GFP_KERNEL); 4437 snap_name = kmemdup(buf, len + 1, GFP_KERNEL);
4437 if (!spec->snap_name) 4438 if (!snap_name)
4438 goto out_mem; 4439 goto out_mem;
4439 *(spec->snap_name + len) = '\0'; 4440 *(snap_name + len) = '\0';
4441 spec->snap_name = snap_name;
4440 4442
4441 /* Initialize all rbd options to the defaults */ 4443 /* Initialize all rbd options to the defaults */
4442 4444