Other parts of libgfs2 will need to know the struct behind lgfs2_rgrps_t
in future patches so move it into rgrp.h. Also make its sdp field
non-const as the struct it points to will be modified.

Signed-off-by: Andrew Price <anpr...@redhat.com>
---
 gfs2/libgfs2/libgfs2.h |  2 +-
 gfs2/libgfs2/rgrp.c    | 20 +-------------------
 gfs2/libgfs2/rgrp.h    | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 71da81e..b996be9 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -191,7 +191,7 @@ struct rgrp_tree {
 typedef struct rgrp_tree *lgfs2_rgrp_t;
 typedef struct _lgfs2_rgrps *lgfs2_rgrps_t;
 
-extern lgfs2_rgrps_t lgfs2_rgrps_init(const struct gfs2_sbd *sdp, uint64_t 
align, uint64_t offset);
+extern lgfs2_rgrps_t lgfs2_rgrps_init(struct gfs2_sbd *sdp, uint64_t align, 
uint64_t offset);
 extern void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs);
 extern uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex 
*entry, uint64_t addr, uint32_t len);
 extern unsigned lgfs2_rindex_read_fd(int fd, lgfs2_rgrps_t rgs);
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index dd8811b..0f36b86 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -219,24 +219,6 @@ void gfs2_rgrp_free(struct osi_root *rgrp_tree)
        }
 }
 
-struct rgplan {
-       uint32_t num;
-       uint32_t len;
-};
-
-/**
- * This structure is defined in libgfs2.h as an opaque type. It stores the
- * constants and context required for creating resource groups from any point
- * in an application.
- */
-struct _lgfs2_rgrps {
-       struct osi_root root;
-       struct rgplan plan[2];
-       const struct gfs2_sbd *sdp;
-       unsigned long align;
-       unsigned long align_off;
-};
-
 static uint64_t align_block(const uint64_t base, const uint64_t align)
 {
        if ((align > 0) && ((base % align) > 0))
@@ -344,7 +326,7 @@ uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, uint64_t 
space, uint32_t tgts
  * offset: The required stripe offset of the resource groups
  * Returns an initialised lgfs2_rgrps_t or NULL if unsuccessful with errno set
  */
-lgfs2_rgrps_t lgfs2_rgrps_init(const struct gfs2_sbd *sdp, uint64_t align, 
uint64_t offset)
+lgfs2_rgrps_t lgfs2_rgrps_init(struct gfs2_sbd *sdp, uint64_t align, uint64_t 
offset)
 {
        lgfs2_rgrps_t rgs;
 
diff --git a/gfs2/libgfs2/rgrp.h b/gfs2/libgfs2/rgrp.h
index 99c52d3..384231e 100644
--- a/gfs2/libgfs2/rgrp.h
+++ b/gfs2/libgfs2/rgrp.h
@@ -3,6 +3,24 @@
 
 #include "libgfs2.h"
 
+struct rgplan {
+       uint32_t num;
+       uint32_t len;
+};
+
+/**
+ * This structure is defined in libgfs2.h as an opaque type. It stores the
+ * constants and context required for creating resource groups from any point
+ * in an application.
+ */
+struct _lgfs2_rgrps {
+       struct osi_root root;
+       struct rgplan plan[2];
+       struct gfs2_sbd *sdp;
+       unsigned long align;
+       unsigned long align_off;
+};
+
 struct lgfs2_rbm {
        lgfs2_rgrp_t rgd;
        uint32_t offset;    /* The offset is bitmap relative */
-- 
1.9.3

Reply via email to