From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 3/3] rbd: snap names are pointer to constant data
Date: Tue, 30 Apr 2013 07:23:42 -0500 [thread overview]
Message-ID: <517FB7CE.9050809@inktank.com> (raw)
In-Reply-To: <517FB770.1070500@inktank.com>
Make explicit that snapshot names don't change by making functions
return and take parameters that that point to const qualified data.
This resolves:
http://tracker.ceph.com/issues/4857
Signed-off-by: Alex Elder <elder@inktank.com>
---
drivers/block/rbd.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index dbc61e3..ab5c901 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3435,10 +3435,10 @@ static struct rbd_snap *rbd_snap_create(struct
rbd_device *rbd_dev,
* Returns a dynamically-allocated snapshot name if successful, or a
* pointer-coded error otherwise.
*/
-static char *rbd_dev_v1_snap_info(struct rbd_device *rbd_dev, u32 which,
+static const char *rbd_dev_v1_snap_info(struct rbd_device *rbd_dev, u32
which,
u64 *snap_size, u64 *snap_features)
{
- char *snap_name;
+ const char *snap_name;
int i;
rbd_assert(which < rbd_dev->header.snapc->num_snaps);
@@ -3907,7 +3907,7 @@ out:
return ret;
}
-static char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev, u32 which)
+static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev, u32
which)
{
size_t size;
void *reply_buf;
@@ -3948,13 +3948,13 @@ out:
return snap_name;
}
-static char *rbd_dev_v2_snap_info(struct rbd_device *rbd_dev, u32 which,
+static const char *rbd_dev_v2_snap_info(struct rbd_device *rbd_dev, u32
which,
u64 *snap_size, u64 *snap_features)
{
u64 snap_id;
u64 size;
u64 features;
- char *snap_name;
+ const char *snap_name;
int ret;
rbd_assert(which < rbd_dev->header.snapc->num_snaps);
@@ -3978,7 +3978,7 @@ out_err:
return ERR_PTR(ret);
}
-static char *rbd_dev_snap_info(struct rbd_device *rbd_dev, u32 which,
+static const char *rbd_dev_snap_info(struct rbd_device *rbd_dev, u32 which,
u64 *snap_size, u64 *snap_features)
{
if (rbd_dev->image_format == 1)
@@ -4045,7 +4045,7 @@ static int rbd_dev_snaps_update(struct rbd_device
*rbd_dev)
while (index < snap_count || links != head) {
u64 snap_id;
struct rbd_snap *snap;
- char *snap_name;
+ const char *snap_name;
u64 snap_size = 0;
u64 snap_features = 0;
--
1.7.9.5
next prev parent reply other threads:[~2013-04-30 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 12:22 [PATCH 0/3] rbd: a few small issues Alex Elder
2013-04-30 12:23 ` [PATCH 1/3] rbd: fix up the layering warning message Alex Elder
2013-04-30 12:23 ` [PATCH 2/3] rbd: don't revalidate so much Alex Elder
2013-04-30 12:23 ` Alex Elder [this message]
2013-04-30 18:32 ` [PATCH 0/3] rbd: a few small issues Josh Durgin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517FB7CE.9050809@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.