[Cluster-devel] [PATCH 10/14] libgfs2: Const-ify the 'ri' argument to gfs2_rindex_out

Andrew Price anprice at redhat.com
Thu Apr 3 15:12:43 UTC 2014


This function shouldn't modify its ri argument and the const helps when we want
to pass it the return value of one of the newly-const lgfs2_rgrp_{index,rgrp}
functions (the rgrp arg to gfs2_rgrp_out is already const so no change needed).

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/libgfs2.h | 2 +-
 gfs2/libgfs2/ondisk.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 455f01d..3353f5f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -802,7 +802,7 @@ extern void gfs2_meta_header_out_bh(const struct gfs2_meta_header *mh,
 extern void gfs2_sb_in(struct gfs2_sb *sb, struct gfs2_buffer_head *bh);
 extern void gfs2_sb_out(const struct gfs2_sb *sb, char *buf);
 extern void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf);
-extern void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf);
+extern void gfs2_rindex_out(const struct gfs2_rindex *ri, char *buf);
 extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, struct gfs2_buffer_head *bh);
 extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf);
 extern void gfs2_rgrp_out_bh(const struct gfs2_rgrp *rg, struct gfs2_buffer_head *bh);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 3fbc63f..1f81b5f 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -213,13 +213,13 @@ void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf)
 	CPIN_08(ri, str, ri_reserved, 64);
 }
 
-void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf)
+void gfs2_rindex_out(const struct gfs2_rindex *ri, char *buf)
 {
 	struct gfs2_rindex *str = (struct gfs2_rindex *)buf;
 
 	CPOUT_64(ri, str, ri_addr);
 	CPOUT_32(ri, str, ri_length);
-	ri->__pad = 0;
+	str->__pad = 0;
 
 	CPOUT_64(ri, str, ri_data0);
 	CPOUT_32(ri, str, ri_data);
-- 
1.8.5.3




More information about the Cluster-devel mailing list