[gfs2-utils] 06/08: Remove GFS2_HAS_RG_RI_FIELDS conditionals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 364c05246309005810a958c6f8476e854a88400e
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 17:49:02 2021 +0100
Remove GFS2_HAS_RG_RI_FIELDS conditionals
Our own gfs2_ondisk.h has the new rgrp fields so there's no need for
these conditionals.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 2 --
gfs2/libgfs2/meta.c | 2 --
gfs2/libgfs2/ondisk.c | 8 --------
gfs2/libgfs2/rgrp.c | 6 ------
4 files changed, 18 deletions(-)
diff --git a/configure.ac b/configure.ac
index 31cb3e49..e356199c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,8 +126,6 @@ AC_SUBST([udevdir], [$with_udevdir])
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_MEMBER([struct gfs2_rgrp.rg_data0],[AC_DEFINE([GFS2_HAS_RG_RI_FIELDS],[],[Resource group fields duplicated from the rindex])],
- [], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_log_header.lh_crc],[AC_DEFINE([GFS2_HAS_LH_V2],[],[v2 log header format])],
[], [[#include <linux/gfs2_ondisk.h>]])
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index c209c70a..771b1f13 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -227,12 +227,10 @@ F(rg_free, .flags = LGFS2_MFF_FSBLOCKS)
F(rg_dinodes, .flags = LGFS2_MFF_FSBLOCKS)
FP(rg_skip, .points_to = (1 << LGFS2_MT_GFS2_RGRP))
F(rg_igeneration)
-#ifdef GFS2_HAS_RG_RI_FIELDS
FP(rg_data0, .points_to = ANY_GFS2_BLOCK|(1 << LGFS2_MT_FREE))
F(rg_data, .flags = LGFS2_MFF_FSBLOCKS)
F(rg_bitbytes, .flags = LGFS2_MFF_BYTES)
F(rg_crc, .flags = LGFS2_MFF_CHECK)
-#endif
RF(rg_reserved)
};
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index cf81005e..157f3358 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -210,12 +210,10 @@ void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf)
CPIN_32(rg, str, rg_dinodes);
CPIN_32(rg, str, rg_skip);
CPIN_64(rg, str, rg_igeneration);
-#ifdef GFS2_HAS_RG_RI_FIELDS
CPIN_64(rg, str, rg_data0);
CPIN_32(rg, str, rg_data);
CPIN_32(rg, str, rg_bitbytes);
CPIN_32(rg, str, rg_crc);
-#endif
CPIN_08(rg, str, rg_reserved, sizeof(rg->rg_reserved));
}
@@ -229,15 +227,11 @@ void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf)
CPOUT_32(rg, str, rg_dinodes);
CPOUT_32(rg, str, rg_skip);
CPOUT_64(rg, str, rg_igeneration);
-#ifdef GFS2_HAS_RG_RI_FIELDS
CPOUT_64(rg, str, rg_data0);
CPOUT_32(rg, str, rg_data);
CPOUT_32(rg, str, rg_bitbytes);
CPOUT_08(rg, str, rg_reserved, sizeof(rg->rg_reserved));
lgfs2_rgrp_crc_set(buf);
-#else
- CPOUT_08(rg, str, rg_reserved, sizeof(rg->rg_reserved));
-#endif
}
void gfs2_rgrp_print(const struct gfs2_rgrp *rg)
@@ -248,12 +242,10 @@ void gfs2_rgrp_print(const struct gfs2_rgrp *rg)
pv(rg, rg_dinodes, "%u", "0x%x");
pv(rg, rg_skip, "%u", "0x%x");
pv(rg, rg_igeneration, "%llu", "0x%llx");
-#ifdef GFS2_HAS_RG_RI_FIELDS
pv(rg, rg_data0, "%llu", "0x%llx");
pv(rg, rg_data, "%u", "0x%x");
pv(rg, rg_bitbytes, "%u", "0x%x");
pv(rg, rg_crc, "%u", "0x%x");
-#endif
}
void gfs2_quota_in(struct gfs2_quota *qu, char *buf)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index f5eb88c9..aa5eadf2 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -156,7 +156,6 @@ void lgfs2_rgrp_bitbuf_free(lgfs2_rgrp_t rg)
int lgfs2_rgrp_crc_check(char *buf)
{
int ret = 0;
-#ifdef GFS2_HAS_RG_RI_FIELDS
struct gfs2_rgrp *rg = (struct gfs2_rgrp *)buf;
uint32_t crc = rg->rg_crc;
@@ -167,7 +166,6 @@ int lgfs2_rgrp_crc_check(char *buf)
if (be32_to_cpu(crc) != gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp)))
ret = 1;
rg->rg_crc = crc;
-#endif
return ret;
}
@@ -176,14 +174,12 @@ int lgfs2_rgrp_crc_check(char *buf)
*/
void lgfs2_rgrp_crc_set(char *buf)
{
-#ifdef GFS2_HAS_RG_RI_FIELDS
struct gfs2_rgrp *rg = (struct gfs2_rgrp *)buf;
uint32_t crc;
rg->rg_crc = 0;
crc = gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp));
rg->rg_crc = cpu_to_be32(crc);
-#endif
}
/**
@@ -674,12 +670,10 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry, ui
rg->rg.rg_header.mh_format = GFS2_FORMAT_RG;
rg->rg.rg_free = rg->ri.ri_data;
rg->rg.rg_skip = rg_skip;
-#ifdef GFS2_HAS_RG_RI_FIELDS
rg->rg.rg_data0 = rg->ri.ri_data0;
rg->rg.rg_data = rg->ri.ri_data;
rg->rg.rg_bitbytes = rg->ri.ri_bitbytes;
rg->rg.rg_crc = 0;
-#endif
compute_bitmaps(rg, rgs->sdp->bsize);
rg->rgrps = rgs;
return rg;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 05/08: Remove GFS2_HAS_RG_SKIP conditionals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 74c6c38f197265a3de285052dcf78640740b1a8d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 17:44:39 2021 +0100
Remove GFS2_HAS_RG_SKIP conditionals
Our own gfs2_ondisk.h has rg_skip so there's no need for these
conditionals.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 2 --
gfs2/libgfs2/meta.c | 4 ----
gfs2/libgfs2/ondisk.c | 12 ------------
gfs2/libgfs2/rgrp.c | 2 --
4 files changed, 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index a512f9dd..31cb3e49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,8 +126,6 @@ AC_SUBST([udevdir], [$with_udevdir])
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_MEMBER([struct gfs2_rgrp.rg_skip],[AC_DEFINE([GFS2_HAS_RG_SKIP],[],[Next resource group pointer])],
- [], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_rgrp.rg_data0],[AC_DEFINE([GFS2_HAS_RG_RI_FIELDS],[],[Resource group fields duplicated from the rindex])],
[], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_log_header.lh_crc],[AC_DEFINE([GFS2_HAS_LH_V2],[],[v2 log header format])],
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index d642424a..c209c70a 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -225,11 +225,7 @@ MH(rg_header)
F(rg_flags)
F(rg_free, .flags = LGFS2_MFF_FSBLOCKS)
F(rg_dinodes, .flags = LGFS2_MFF_FSBLOCKS)
-#ifdef GFS2_HAS_RG_SKIP
FP(rg_skip, .points_to = (1 << LGFS2_MT_GFS2_RGRP))
-#else
-RF(__pad)
-#endif
F(rg_igeneration)
#ifdef GFS2_HAS_RG_RI_FIELDS
FP(rg_data0, .points_to = ANY_GFS2_BLOCK|(1 << LGFS2_MT_FREE))
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 6e969143..cf81005e 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -208,11 +208,7 @@ void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf)
CPIN_32(rg, str, rg_flags);
CPIN_32(rg, str, rg_free);
CPIN_32(rg, str, rg_dinodes);
-#ifdef GFS2_HAS_RG_SKIP
CPIN_32(rg, str, rg_skip);
-#else
- CPIN_32(rg, str, __pad);
-#endif
CPIN_64(rg, str, rg_igeneration);
#ifdef GFS2_HAS_RG_RI_FIELDS
CPIN_64(rg, str, rg_data0);
@@ -231,11 +227,7 @@ void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf)
CPOUT_32(rg, str, rg_flags);
CPOUT_32(rg, str, rg_free);
CPOUT_32(rg, str, rg_dinodes);
-#ifdef GFS2_HAS_RG_SKIP
CPOUT_32(rg, str, rg_skip);
-#else
- CPOUT_32(rg, str, __pad);
-#endif
CPOUT_64(rg, str, rg_igeneration);
#ifdef GFS2_HAS_RG_RI_FIELDS
CPOUT_64(rg, str, rg_data0);
@@ -254,11 +246,7 @@ void gfs2_rgrp_print(const struct gfs2_rgrp *rg)
pv(rg, rg_flags, "%u", "0x%x");
pv(rg, rg_free, "%u", "0x%x");
pv(rg, rg_dinodes, "%u", "0x%x");
-#ifdef GFS2_HAS_RG_SKIP
pv(rg, rg_skip, "%u", "0x%x");
-#else
- pv(rg, __pad, "%u", "0x%x");
-#endif
pv(rg, rg_igeneration, "%llu", "0x%llx");
#ifdef GFS2_HAS_RG_RI_FIELDS
pv(rg, rg_data0, "%llu", "0x%llx");
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 75fd0ba3..f5eb88c9 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -673,9 +673,7 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry, ui
rg->rg.rg_header.mh_type = GFS2_METATYPE_RG;
rg->rg.rg_header.mh_format = GFS2_FORMAT_RG;
rg->rg.rg_free = rg->ri.ri_data;
-#ifdef GFS2_HAS_RG_SKIP
rg->rg.rg_skip = rg_skip;
-#endif
#ifdef GFS2_HAS_RG_RI_FIELDS
rg->rg.rg_data0 = rg->ri.ri_data0;
rg->rg.rg_data = rg->ri.ri_data;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 04/08: Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 40d3c4c50d62f34a1f9be091721d4e8d837c5092
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 17:40:58 2021 +0100
Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals
Our own gfs2_ondisk.h has de_rahead and de_cookie so there's no need for
these conditionals.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 4 ----
gfs2/edit/extended.c | 8 ++------
gfs2/libgfs2/meta.c | 8 --------
gfs2/libgfs2/ondisk.c | 16 ----------------
4 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5cb0770f..a512f9dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,10 +126,6 @@ AC_SUBST([udevdir], [$with_udevdir])
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_MEMBER([struct gfs2_dirent.de_rahead],[AC_DEFINE([GFS2_HAS_DE_RAHEAD],[],[Dirent readahead field])],
- [], [[#include <linux/gfs2_ondisk.h>]])
-AC_CHECK_MEMBER([struct gfs2_dirent.de_cookie],[AC_DEFINE([GFS2_HAS_DE_COOKIE],[],[Dirent cookie field])],
- [], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_rgrp.rg_skip],[AC_DEFINE([GFS2_HAS_RG_SKIP],[],[Next resource group pointer])],
[], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_rgrp.rg_data0],[AC_DEFINE([GFS2_HAS_RG_RI_FIELDS],[],[Resource group fields duplicated from the rindex])],
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index b8c61ee1..91609bd2 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -335,18 +335,14 @@ static int display_leaf(struct iinfo *ind)
strcpy(edit_fmt, "%llx");
}
}
- print_gfs2("%d/%d [%08x] %lld/%"PRId64" (0x%llx/0x%"PRIx64") +%u: ",
+ print_gfs2("%d/%d [%08x] %lld/%"PRId64" (0x%llx/0x%"PRIx64") +%"PRIu16": ",
total_dirents, d + 1,
ind->ii[0].dirent[d].dirent.de_hash,
ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
ind->ii[0].dirent[d].block,
ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
ind->ii[0].dirent[d].block,
-#ifdef GFS2_HAS_DE_RAHEAD
- (unsigned int)ind->ii[0].dirent[d].dirent.de_rahead
-#else
- 0
-#endif
+ ind->ii[0].dirent[d].dirent.de_rahead
);
}
print_inode_type(ind->ii[0].dirent[d].dirent.de_type);
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 2be87045..d642424a 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -481,17 +481,9 @@ F(de_hash, .flags = LGFS2_MFF_CHECK)
F(de_rec_len, .flags = LGFS2_MFF_BYTES)
F(de_name_len, .flags = LGFS2_MFF_BYTES)
F(de_type)
-#ifdef GFS2_HAS_DE_RAHEAD
F(de_rahead)
-#ifdef GFS2_HAS_DE_COOKIE
F(de_cookie)
RF(pad3)
-#else
-RF(pad2)
-#endif /* GFS2_HAS_DE_COOKIE */
-#else
-RF(__pad)
-#endif /* GFS2_HAS_DE_RAHEAD */
};
#undef STRUCT
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index dffd2221..6e969143 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -404,17 +404,9 @@ void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
CPIN_16(de, str, de_rec_len);
CPIN_16(de, str, de_name_len);
CPIN_16(de, str, de_type);
-#ifdef GFS2_HAS_DE_RAHEAD
CPIN_16(de, str, de_rahead);
-#ifdef GFS2_HAS_DE_COOKIE
CPIN_32(de, str, de_cookie);
CPIN_08(de, str, pad3, 8);
-#else
- CPIN_08(de, str, pad2, 12);
-#endif /* GFS2_HAS_DE_COOKIE */
-#else
- CPIN_08(de, str, __pad, 14);
-#endif /* GFS2_HAS_DE_RAHEAD */
}
void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
@@ -426,17 +418,9 @@ void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
CPOUT_16(de, str, de_rec_len);
CPOUT_16(de, str, de_name_len);
CPOUT_16(de, str, de_type);
-#ifdef GFS2_HAS_DE_RAHEAD
CPOUT_16(de, str, de_rahead);
-#ifdef GFS2_HAS_DE_COOKIE
CPOUT_32(de, str, de_cookie);
CPOUT_08(de, str, pad3, 8);
-#else
- CPOUT_08(de, str, pad2, 12);
-#endif /* GFS2_HAS_DE_COOKIE */
-#else
- CPOUT_08(de, str, __pad, 14);
-#endif /* GFS2_HAS_DE_RAHEAD */
}
void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 03/08: Remove GFS2_HAS_LEAF_HINTS conditionals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 5d86cc21404736704451322cbb64377c81814f62
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 17:31:31 2021 +0100
Remove GFS2_HAS_LEAF_HINTS conditionals
Our own gfs2_ondisk.h has leaf hints so there's no need for these
conditionals.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 2 --
gfs2/edit/extended.c | 9 ++-------
gfs2/libgfs2/fs_ops.c | 6 ------
gfs2/libgfs2/ondisk.c | 10 ----------
4 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8c60741d..5cb0770f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,8 +126,6 @@ AC_SUBST([udevdir], [$with_udevdir])
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_MEMBER([struct gfs2_leaf.lf_inode],[AC_DEFINE([GFS2_HAS_LEAF_HINTS],[],[Leaf block hints])],
- [], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_dirent.de_rahead],[AC_DEFINE([GFS2_HAS_DE_RAHEAD],[],[Dirent readahead field])],
[], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_dirent.de_cookie],[AC_DEFINE([GFS2_HAS_DE_COOKIE],[],[Dirent cookie field])],
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 64e4d31f..b8c61ee1 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -294,14 +294,9 @@ static void print_inode_type(__be16 de_type)
}
}
-#ifdef GFS2_HAS_LEAF_HINTS
-#define LEAF_HINT_FMTS "lf_inode: 0x%llx, lf_dist: %u, " \
- "lf_nsec: %u, lf_sec: %llu, "
+#define LEAF_HINT_FMTS "lf_inode: 0x%"PRIx64", lf_dist: %"PRIu32", " \
+ "lf_nsec: %"PRIu32", lf_sec: %"PRIu64", "
#define LEAF_HINT_FIELDS(lp) lp->lf_inode, lp->lf_dist, lp->lf_nsec, lp->lf_sec,
-#else
-#define LEAF_HINT_FMTS
-#define LEAF_HINT_FIELDS(lp)
-#endif
static int display_leaf(struct iinfo *ind)
{
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 1c580081..27fb43cb 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1001,9 +1001,7 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_no,
oleaf->lf_depth = cpu_to_be16(oleaf->lf_depth);
nleaf->lf_depth = oleaf->lf_depth;
-#ifdef GFS2_HAS_LEAF_HINTS
nleaf->lf_inode = cpu_to_be64(dip->i_di.di_num.no_addr);
-#endif
dip->i_di.di_blocks++;
bmodified(dip->i_bh);
@@ -1203,9 +1201,7 @@ restart:
nleaf = (struct gfs2_leaf *)nbh->b_data;
nleaf->lf_depth = leaf->lf_depth;
nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
-#ifdef GFS2_HAS_LEAF_HINTS
nleaf->lf_inode = cpu_to_be64(dip->i_di.di_num.no_addr);
-#endif
err = dirent_alloc(dip, nbh, len, &dent);
if (err)
return err;
@@ -1257,9 +1253,7 @@ static void dir_make_exhash(struct gfs2_inode *dip)
leaf = (struct gfs2_leaf *)bh->b_data;
leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
leaf->lf_entries = cpu_to_be16(dip->i_di.di_entries);
-#ifdef GFS2_HAS_LEAF_HINTS
leaf->lf_inode = cpu_to_be64(dip->i_di.di_num.no_addr);
-#endif
buffer_copy_tail(sdp, bh, sizeof(struct gfs2_leaf),
dip->i_bh, sizeof(struct gfs2_dinode));
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 2185fd38..dffd2221 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -448,15 +448,11 @@ void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf)
CPIN_16(lf, str, lf_entries);
CPIN_32(lf, str, lf_dirent_format);
CPIN_64(lf, str, lf_next);
-#ifdef GFS2_HAS_LEAF_HINTS
CPIN_64(lf, str, lf_inode);
CPIN_32(lf, str, lf_dist);
CPIN_32(lf, str, lf_nsec);
CPIN_64(lf, str, lf_sec);
CPIN_08(lf, str, lf_reserved2, 40);
-#else
- CPIN_08(lf, str, lf_reserved, 32);
-#endif
}
void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf)
@@ -468,15 +464,11 @@ void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf)
CPOUT_16(lf, str, lf_entries);
CPOUT_32(lf, str, lf_dirent_format);
CPOUT_64(lf, str, lf_next);
-#ifdef GFS2_HAS_LEAF_HINTS
CPOUT_64(lf, str, lf_inode);
CPOUT_32(lf, str, lf_dist);
CPOUT_32(lf, str, lf_nsec);
CPOUT_64(lf, str, lf_sec);
CPOUT_08(lf, str, lf_reserved2, 40);
-#else
- CPOUT_08(lf, str, lf_reserved, 64);
-#endif
}
void gfs2_leaf_print(const struct gfs2_leaf *lf)
@@ -486,12 +478,10 @@ void gfs2_leaf_print(const struct gfs2_leaf *lf)
pv(lf, lf_entries, "%u", "0x%x");
pv(lf, lf_dirent_format, "%u", "0x%x");
pv(lf, lf_next, "%llu", "0x%llx");
-#ifdef GFS2_HAS_LEAF_HINTS
pv(lf, lf_inode, "%llu", "0x%llx");
pv(lf, lf_dist, "%u", "0x%x");
pv(lf, lf_nsec, "%u", "0x%x");
pv(lf, lf_sec, "%llu", "0x%llx");
-#endif
}
void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 02/08: Remove HAS_UUID conditionals
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 4a2c962f5b129b7b7b66fa7e30c6394442849fc8
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 17:16:33 2021 +0100
Remove HAS_UUID conditionals
Now that we own our own gfs2_ondisk.h we know that it has sb_uuid so we
can use it unconditionally (and require libuuid unconditionally).
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 11 +----------
gfs2/edit/gfs2hex.c | 12 +++---------
gfs2/libgfs2/lang.c | 11 +----------
gfs2/libgfs2/meta.c | 9 +--------
gfs2/libgfs2/ondisk.c | 16 +++-------------
gfs2/libgfs2/structures.c | 7 +------
gfs2/mkfs/main_mkfs.c | 16 +++++-----------
gfs2/tune/super.c | 16 ++--------------
8 files changed, 17 insertions(+), 81 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9a7e50ab..8c60741d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,9 +106,7 @@ AM_CONDITIONAL([HAVE_CHECK], [test "x$have_check" = "xyes"])
PKG_CHECK_MODULES([zlib],[zlib])
PKG_CHECK_MODULES([bzip2],[bzip2])
PKG_CHECK_MODULES([blkid],[blkid])
-PKG_CHECK_MODULES([uuid],[uuid],
- [have_uuid=yes],
- [have_uuid=no])
+PKG_CHECK_MODULES([uuid],[uuid])
# old versions of ncurses don't ship pkg-config files
PKG_CHECK_MODULES([ncurses],[ncurses],,
@@ -128,8 +126,6 @@ AC_SUBST([udevdir], [$with_udevdir])
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_MEMBER([struct gfs2_sb.sb_uuid], [sb_has_uuid=yes], [sb_has_uuid=no],
- [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_leaf.lf_inode],[AC_DEFINE([GFS2_HAS_LEAF_HINTS],[],[Leaf block hints])],
[], [[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_dirent.de_rahead],[AC_DEFINE([GFS2_HAS_DE_RAHEAD],[],[Dirent readahead field])],
@@ -143,11 +139,6 @@ AC_CHECK_MEMBER([struct gfs2_rgrp.rg_data0],[AC_DEFINE([GFS2_HAS_RG_RI_FIELDS],[
AC_CHECK_MEMBER([struct gfs2_log_header.lh_crc],[AC_DEFINE([GFS2_HAS_LH_V2],[],[v2 log header format])],
[], [[#include <linux/gfs2_ondisk.h>]])
-# libuuid is only required if struct gfs2_sb.sb_uuid exists
-if test "$sb_has_uuid" = "yes" -a "$have_uuid" = "no"; then
- AC_MSG_ERROR([libuuid is required for this version of gfs2])
-fi
-
# *FLAGS handling
ENV_CFLAGS="$CFLAGS"
ENV_CPPFLAGS="$CPPFLAGS"
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 133a508e..5e6760f2 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -10,14 +10,12 @@
#include <unistd.h>
#include <errno.h>
#include <curses.h>
+#include <uuid.h>
#include "hexedit.h"
#include "extended.h"
#include "gfs2hex.h"
#include "libgfs2.h"
-#ifdef GFS2_HAS_UUID
-#include <uuid.h>
-#endif
#define pv(struct, member, fmt, fmt2) do { \
print_it(" "#member, fmt, fmt2, struct->member); \
@@ -386,6 +384,8 @@ static void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
*/
static void gfs2_sb_print2(struct gfs2_sb *sbp2)
{
+ char readable_uuid[36+1];
+
gfs2_meta_header_print(&sbp2->sb_header);
pv(sbp2, sb_fs_format, "%u", "0x%x");
@@ -410,14 +410,8 @@ static void gfs2_sb_print2(struct gfs2_sb *sbp2)
gfs2_inum_print2("quota ino ", &gfs1_quota_di);
gfs2_inum_print2("license ", &gfs1_license_di);
}
-#ifdef GFS2_HAS_UUID
- {
- char readable_uuid[36+1];
-
uuid_unparse(sbp2->sb_uuid, readable_uuid);
print_it(" sb_uuid", "%s", NULL, readable_uuid);
- }
-#endif
}
/**
diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
index d48b123f..3faa5abd 100644
--- a/gfs2/libgfs2/lang.c
+++ b/gfs2/libgfs2/lang.c
@@ -7,12 +7,10 @@
#include <errno.h>
#include <limits.h>
#include <ctype.h>
+#include <uuid.h>
#include "lang.h"
#include "parser.h"
-#ifdef GFS2_HAS_UUID
-#include <uuid.h>
-#endif
const char* ast_type_string[] = {
[AST_NONE] = "NONE",
@@ -315,14 +313,12 @@ static int field_print(char *buf, uint64_t addr, const struct lgfs2_metadata *mt
printf("%s\t%"PRIu64"\t%u\t%u\t%s\t", mtype->name, addr, field->offset, field->length, field->name);
if (field->flags & LGFS2_MFF_UUID) {
-#ifdef GFS2_HAS_UUID
char readable_uuid[36+1];
uuid_t uuid;
memcpy(uuid, fieldp, sizeof(uuid_t));
uuid_unparse(uuid, readable_uuid);
printf("'%s'\n", readable_uuid);
-#endif
} else if (field->flags & LGFS2_MFF_STRING) {
printf("'%s'\n", fieldp);
} else {
@@ -471,7 +467,6 @@ static int ast_field_set(char *buf, const struct lgfs2_metafield *field,
int err = 0;
if (field->flags & LGFS2_MFF_UUID) {
-#ifdef GFS2_HAS_UUID
uuid_t uuid;
if (uuid_parse(val->ast_str, uuid) != 0) {
@@ -479,10 +474,6 @@ static int ast_field_set(char *buf, const struct lgfs2_metafield *field,
return AST_INTERP_INVAL;
}
err = lgfs2_field_assign(buf, field, uuid);
-#else
- fprintf(stderr, "No UUID support\n");
- err = 1;
-#endif
} else if (field->flags & LGFS2_MFF_STRING) {
err = lgfs2_field_assign(buf, field, val->ast_str);
} else {
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 6e338d27..2be87045 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -1,12 +1,9 @@
#include <stdint.h>
#include <string.h>
+#include <uuid.h>
#include "libgfs2.h"
#include "clusterautoconfig.h"
-#ifdef GFS2_HAS_UUID
-#include <uuid.h>
-#endif
-
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define SYM(x) { x, #x, 0 },
#define PREFIX_SYM(p,x) { p##x, #p #x, sizeof #p - 1 },
@@ -183,9 +180,7 @@ F(sb_lockproto, .flags = LGFS2_MFF_STRING)
F(sb_locktable, .flags = LGFS2_MFF_STRING)
INR(__pad3, .points_to = (1 << LGFS2_MT_GFS2_DINODE))
INR(__pad4, .points_to = (1 << LGFS2_MT_GFS2_DINODE))
-#ifdef GFS2_HAS_UUID
F(sb_uuid, .flags = LGFS2_MFF_UUID)
-#endif
};
#undef STRUCT
@@ -880,14 +875,12 @@ int lgfs2_field_str(char *str, const size_t size, const char *blk, const struct
return 1;
if (field->flags & LGFS2_MFF_UUID) {
-#ifdef GFS2_HAS_UUID
char readable_uuid[36+1];
uuid_t uuid;
memcpy(uuid, fieldp, sizeof(uuid_t));
uuid_unparse(uuid, readable_uuid);
snprintf(str, size, "%s", readable_uuid);
-#endif
} else if (field->flags & LGFS2_MFF_STRING) {
snprintf(str, size, "%s", fieldp);
} else {
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 4515e7ac..2185fd38 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -6,10 +6,8 @@
#include <stdint.h>
#include <inttypes.h>
#include <ctype.h>
-#include "libgfs2.h"
-#ifdef GFS2_HAS_UUID
#include <uuid.h>
-#endif
+#include "libgfs2.h"
#define pv(struct, member, fmt, fmt2) do { \
print_it(" "#member, fmt, fmt2, struct->member); \
@@ -112,9 +110,7 @@ void gfs2_sb_in(struct gfs2_sb *sb, char *buf)
gfs2_inum_in(&sb->__pad2, (char *)&str->__pad2); /* gfs rindex */
gfs2_inum_in(&sb->__pad3, (char *)&str->__pad3); /* gfs quota */
gfs2_inum_in(&sb->__pad4, (char *)&str->__pad4); /* gfs license */
-#ifdef GFS2_HAS_UUID
CPIN_08(sb, str, sb_uuid, sizeof(sb->sb_uuid));
-#endif
}
void gfs2_sb_out(const struct gfs2_sb *sb, char *buf)
@@ -139,13 +135,13 @@ void gfs2_sb_out(const struct gfs2_sb *sb, char *buf)
gfs2_inum_out(&sb->__pad2, (char *)&str->__pad2); /* gfs rindex */
gfs2_inum_out(&sb->__pad3, (char *)&str->__pad3); /* gfs quota */
gfs2_inum_out(&sb->__pad4, (char *)&str->__pad4); /* gfs license */
-#ifdef GFS2_HAS_UUID
memcpy(str->sb_uuid, sb->sb_uuid, 16);
-#endif
}
void gfs2_sb_print(const struct gfs2_sb *sb)
{
+ char readable_uuid[36+1];
+
gfs2_meta_header_print(&sb->sb_header);
pv(sb, sb_fs_format, "%u", "0x%x");
@@ -160,14 +156,8 @@ void gfs2_sb_print(const struct gfs2_sb *sb)
pv(sb, sb_lockproto, "%s", NULL);
pv(sb, sb_locktable, "%s", NULL);
-#ifdef GFS2_HAS_UUID
- {
- char readable_uuid[36+1];
-
uuid_unparse(sb->sb_uuid, readable_uuid);
print_it(" uuid", "%36s", NULL, readable_uuid);
- }
-#endif
}
void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf)
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 10933683..789b9a63 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -11,15 +11,12 @@
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
+#include <uuid.h>
#include "libgfs2.h"
#include "config.h"
#include "crc32c.h"
-#ifdef GFS2_HAS_UUID
-#include <uuid.h>
-#endif
-
int build_master(struct gfs2_sbd *sdp)
{
struct gfs2_inum inum;
@@ -62,9 +59,7 @@ void lgfs2_sb_init(struct gfs2_sb *sb, unsigned bsize, unsigned format)
sb->sb_multihost_format = GFS2_FORMAT_MULTI;
sb->sb_bsize = bsize;
sb->sb_bsize_shift = ffs(bsize) - 1;
-#ifdef GFS2_HAS_UUID
uuid_generate(sb->sb_uuid);
-#endif
}
int lgfs2_sb_write(const struct gfs2_sb *sb, int fd, const unsigned bsize)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 9ed1d0c1..2400cc8e 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -22,6 +22,7 @@
#include <limits.h>
#include <blkid.h>
#include <locale.h>
+#include <uuid.h>
#define _(String) gettext(String)
@@ -29,10 +30,6 @@
#include "gfs2_mkfs.h"
#include "progress.h"
-#ifdef GFS2_HAS_UUID
-#include <uuid.h>
-#endif
-
static void print_usage(const char *prog_name)
{
int i;
@@ -640,6 +637,10 @@ static int opts_check(struct mkfs_opts *opts)
static void print_results(struct gfs2_sb *sb, struct mkfs_opts *opts, uint64_t rgrps, uint64_t fssize)
{
+ char readable_uuid[36+1];
+
+ uuid_unparse(sb->sb_uuid, readable_uuid);
+
printf("%-27s%s\n", _("Device:"), opts->dev.path);
printf("%-27s%u\n", _("Block size:"), sb->sb_bsize);
printf("%-27s%.2f %s (%"PRIu64" %s)\n", _("Device size:"),
@@ -653,15 +654,8 @@ static void print_results(struct gfs2_sb *sb, struct mkfs_opts *opts, uint64_t r
printf("%-27s%"PRIu64"\n", _("Resource groups:"), rgrps);
printf("%-27s\"%s\"\n", _("Locking protocol:"), opts->lockproto);
printf("%-27s\"%s\"\n", _("Lock table:"), opts->locktable);
-#ifdef GFS2_HAS_UUID
- {
- char readable_uuid[36+1];
-
- uuid_unparse(sb->sb_uuid, readable_uuid);
/* Translators: "UUID" = universally unique identifier. */
printf("%-27s%s\n", _("UUID:"), readable_uuid);
- }
-#endif
}
static int warn_of_destruction(const char *path)
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
index 74e4a457..9e6578fb 100644
--- a/gfs2/tune/super.c
+++ b/gfs2/tune/super.c
@@ -12,11 +12,8 @@
#define _(String) gettext(String)
#include <linux_endian.h>
#include <libgfs2.h>
-#include "tunegfs2.h"
-
-#ifdef GFS2_HAS_UUID
#include <uuid.h>
-#endif
+#include "tunegfs2.h"
int read_super(struct tunegfs2 *tfs)
{
@@ -54,15 +51,11 @@ static int is_gfs2(const struct tunegfs2 *tfs)
int print_super(const struct tunegfs2 *tfs)
{
- printf(_("File system volume name: %s\n"), tfs->sb->sb_locktable);
-#ifdef GFS2_HAS_UUID
- {
char readable_uuid[36+1];
uuid_unparse(tfs->sb->sb_uuid, readable_uuid);
+ printf(_("File system volume name: %s\n"), tfs->sb->sb_locktable);
printf(_("File system UUID: %s\n"), readable_uuid);
- }
-#endif
printf( _("File system magic number: 0x%X\n"), be32_to_cpu(tfs->sb->sb_header.mh_magic));
printf(_("File system format version: %"PRIu32"\n"), be32_to_cpu(tfs->sb->sb_fs_format));
printf(_("Block size: %d\n"), be32_to_cpu(tfs->sb->sb_bsize));
@@ -89,7 +82,6 @@ int write_super(const struct tunegfs2 *tfs)
int change_uuid(struct tunegfs2 *tfs, const char *str)
{
-#ifdef GFS2_HAS_UUID
uuid_t uuid;
int status;
@@ -97,10 +89,6 @@ int change_uuid(struct tunegfs2 *tfs, const char *str)
if (status == 0)
uuid_copy(tfs->sb->sb_uuid, uuid);
return status;
-#else
- fprintf(stderr, _("UUID support unavailable in this build\n"));
- return 1;
-#endif
}
int change_lockproto(struct tunegfs2 *tfs, const char *lockproto)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 01/08: Import linux/gfs2_ondisk.h
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 97dda9153bdcd4643083836a6de351b7001ac4a0
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 16:49:50 2021 +0100
Import linux/gfs2_ondisk.h
Give gfs2-utils its own copy of gfs2_ondisk.h. This allows us to always
support the latest ondisk structures and obsoletes a lot of #ifdef
GFS2_HAS_<FEATURE> blocks and configure.ac checks.
Provide the kernel int typedefs that gfs2_ondisk.h uses with our own
linux/types.h, which uses standard userspace types but keeps the bitwise
attribute tags that sparse uses.
Remove a bunch of unnecessary #include statements in the utils so that
linux/gfs2_ondisk.h is never included and (our) linux/types.h is only
ever included in libgfs2.h.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 2 -
gfs2/convert/gfs2_convert.c | 2 -
gfs2/edit/extended.c | 2 -
gfs2/edit/gfs2hex.c | 5 -
gfs2/edit/hexedit.c | 2 -
gfs2/edit/hexedit.h | 1 -
gfs2/edit/journal.c | 2 -
gfs2/edit/savemeta.c | 2 -
gfs2/include/Makefile.am | 2 +
gfs2/include/linux/gfs2_ondisk.h | 542 +++++++++++++++++++++++++++++++++++++++
gfs2/include/linux/types.h | 32 +++
gfs2/libgfs2/buf.c | 1 -
gfs2/libgfs2/device_geometry.c | 1 -
gfs2/libgfs2/fs_ops.c | 1 -
gfs2/libgfs2/gfs1.c | 2 -
gfs2/libgfs2/libgfs2.h | 1 -
gfs2/libgfs2/ondisk.c | 1 -
gfs2/libgfs2/structures.c | 1 -
gfs2/mkfs/gfs2_mkfs.h | 1 -
gfs2/mkfs/main_grow.c | 1 -
gfs2/mkfs/main_jadd.c | 1 -
gfs2/mkfs/main_mkfs.c | 1 -
gfs2/tune/super.c | 1 -
23 files changed, 576 insertions(+), 31 deletions(-)
diff --git a/configure.ac b/configure.ac
index 690049f2..9a7e50ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,9 +127,7 @@ AC_SUBST([udevdir], [$with_udevdir])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
AC_CHECK_HEADER([linux/fs.h], [], [AC_MSG_ERROR([Unable to find linux/fs.h])])
-AC_CHECK_HEADER([linux/types.h], [], [AC_MSG_ERROR([Unable to find linux/types.h])])
AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
-AC_CHECK_HEADER([linux/gfs2_ondisk.h], [], [AC_MSG_ERROR([Unable to find linux/gfs2_ondisk.h])])
AC_CHECK_MEMBER([struct gfs2_sb.sb_uuid], [sb_has_uuid=yes], [sb_has_uuid=no],
[[#include <linux/gfs2_ondisk.h>]])
AC_CHECK_MEMBER([struct gfs2_leaf.lf_inode],[AC_DEFINE([GFS2_HAS_LEAF_HINTS],[],[Leaf block hints])],
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 142c7d4e..5656b39d 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -28,8 +28,6 @@
#include <locale.h>
#define _(String) gettext(String)
-#include <linux/types.h>
-#include <linux/gfs2_ondisk.h>
#include <logging.h>
#include "osi_list.h"
#include "copyright.cf"
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 0e5ecda4..64e4d31f 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -6,7 +6,6 @@
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -19,7 +18,6 @@
#include <sys/mount.h>
#include <dirent.h>
-#include <linux/gfs2_ondisk.h>
#include "copyright.cf"
#include "hexedit.h"
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 3204577a..133a508e 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -5,7 +5,6 @@
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -13,10 +12,6 @@
#include <curses.h>
#include "hexedit.h"
-
-#define WANT_GFS_CONVERSION_FUNCTIONS
-#include <linux/gfs2_ondisk.h>
-
#include "extended.h"
#include "gfs2hex.h"
#include "libgfs2.h"
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index d07437bb..e38d0b7b 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -6,7 +6,6 @@
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -19,7 +18,6 @@
#include <sys/mount.h>
#include <dirent.h>
-#include <linux/gfs2_ondisk.h>
#include "copyright.cf"
#include "hexedit.h"
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 1c94c901..35573415 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -4,7 +4,6 @@
#include <sys/types.h>
#include <inttypes.h>
#include <limits.h>
-#include <linux/gfs2_ondisk.h>
#include <string.h>
#include "libgfs2.h"
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 1adbc4b1..313f18f2 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -6,7 +6,6 @@
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -19,7 +18,6 @@
#include <sys/mount.h>
#include <dirent.h>
-#include <linux/gfs2_ondisk.h>
#include "copyright.cf"
#include "hexedit.h"
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index a13e6a5f..e256fa26 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -7,7 +7,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
-#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -17,7 +16,6 @@
#include <sys/ioctl.h>
#include <limits.h>
#include <sys/time.h>
-#include <linux/gfs2_ondisk.h>
#include <zlib.h>
#include <bzlib.h>
#include <time.h>
diff --git a/gfs2/include/Makefile.am b/gfs2/include/Makefile.am
index fca6f6aa..f9486288 100644
--- a/gfs2/include/Makefile.am
+++ b/gfs2/include/Makefile.am
@@ -4,4 +4,6 @@ noinst_HEADERS = \
osi_list.h \
osi_tree.h \
linux_endian.h \
+ linux/gfs2_ondisk.h \
+ linux/types.h \
logging.h
diff --git a/gfs2/include/linux/gfs2_ondisk.h b/gfs2/include/linux/gfs2_ondisk.h
new file mode 100644
index 00000000..fc948f89
--- /dev/null
+++ b/gfs2/include/linux/gfs2_ondisk.h
@@ -0,0 +1,542 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
+
+#ifndef __GFS2_ONDISK_DOT_H__
+#define __GFS2_ONDISK_DOT_H__
+
+#include <linux/types.h>
+
+#define GFS2_MAGIC 0x01161970
+#define GFS2_BASIC_BLOCK 512
+#define GFS2_BASIC_BLOCK_SHIFT 9
+
+/* Lock numbers of the LM_TYPE_NONDISK type */
+
+#define GFS2_MOUNT_LOCK 0
+#define GFS2_LIVE_LOCK 1
+#define GFS2_FREEZE_LOCK 2
+#define GFS2_RENAME_LOCK 3
+#define GFS2_CONTROL_LOCK 4
+#define GFS2_MOUNTED_LOCK 5
+
+/* Format numbers for various metadata types */
+
+#define GFS2_FORMAT_NONE 0
+#define GFS2_FORMAT_SB 100
+#define GFS2_FORMAT_RG 200
+#define GFS2_FORMAT_RB 300
+#define GFS2_FORMAT_DI 400
+#define GFS2_FORMAT_IN 500
+#define GFS2_FORMAT_LF 600
+#define GFS2_FORMAT_JD 700
+#define GFS2_FORMAT_LH 800
+#define GFS2_FORMAT_LD 900
+#define GFS2_FORMAT_LB 1000
+#define GFS2_FORMAT_EA 1600
+#define GFS2_FORMAT_ED 1700
+#define GFS2_FORMAT_QC 1400
+/* These are format numbers for entities contained in files */
+#define GFS2_FORMAT_RI 1100
+#define GFS2_FORMAT_DE 1200
+#define GFS2_FORMAT_QU 1500
+/* These are part of the superblock */
+#define GFS2_FORMAT_FS 1802
+#define GFS2_FORMAT_MULTI 1900
+
+/*
+ * An on-disk inode number
+ */
+
+struct gfs2_inum {
+ __be64 no_formal_ino;
+ __be64 no_addr;
+};
+
+/*
+ * Generic metadata head structure
+ * Every inplace buffer logged in the journal must start with this.
+ */
+
+#define GFS2_METATYPE_NONE 0
+#define GFS2_METATYPE_SB 1
+#define GFS2_METATYPE_RG 2
+#define GFS2_METATYPE_RB 3
+#define GFS2_METATYPE_DI 4
+#define GFS2_METATYPE_IN 5
+#define GFS2_METATYPE_LF 6
+#define GFS2_METATYPE_JD 7
+#define GFS2_METATYPE_LH 8
+#define GFS2_METATYPE_LD 9
+#define GFS2_METATYPE_LB 12
+#define GFS2_METATYPE_EA 10
+#define GFS2_METATYPE_ED 11
+#define GFS2_METATYPE_QC 14
+
+struct gfs2_meta_header {
+ __be32 mh_magic;
+ __be32 mh_type;
+ __be64 __pad0; /* Was generation number in gfs1 */
+ __be32 mh_format;
+ /* This union is to keep userspace happy */
+ union {
+ __be32 mh_jid; /* Was incarnation number in gfs1 */
+ __be32 __pad1;
+ };
+};
+
+/*
+ * super-block structure
+ *
+ * It's probably good if SIZEOF_SB <= GFS2_BASIC_BLOCK (512 bytes)
+ *
+ * Order is important, need to be able to read old superblocks to do on-disk
+ * version upgrades.
+ */
+
+/* Address of superblock in GFS2 basic blocks */
+#define GFS2_SB_ADDR 128
+
+/* The lock number for the superblock (must be zero) */
+#define GFS2_SB_LOCK 0
+
+/* Requirement: GFS2_LOCKNAME_LEN % 8 == 0
+ Includes: the fencing zero at the end */
+#define GFS2_LOCKNAME_LEN 64
+
+struct gfs2_sb {
+ struct gfs2_meta_header sb_header;
+
+ __be32 sb_fs_format;
+ __be32 sb_multihost_format;
+ __u32 __pad0; /* Was superblock flags in gfs1 */
+
+ __be32 sb_bsize;
+ __be32 sb_bsize_shift;
+ __u32 __pad1; /* Was journal segment size in gfs1 */
+
+ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
+ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
+ struct gfs2_inum sb_root_dir;
+
+ char sb_lockproto[GFS2_LOCKNAME_LEN];
+ char sb_locktable[GFS2_LOCKNAME_LEN];
+
+ struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
+ struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
+#define GFS2_HAS_UUID 1
+ __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */
+};
+
+/*
+ * resource index structure
+ */
+
+struct gfs2_rindex {
+ __be64 ri_addr; /* grp block disk address */
+ __be32 ri_length; /* length of rgrp header in fs blocks */
+ __u32 __pad;
+
+ __be64 ri_data0; /* first data location */
+ __be32 ri_data; /* num of data blocks in rgrp */
+
+ __be32 ri_bitbytes; /* number of bytes in data bitmaps */
+
+ __u8 ri_reserved[64];
+};
+
+/*
+ * resource group header structure
+ */
+
+/* Number of blocks per byte in rgrp */
+#define GFS2_NBBY 4
+#define GFS2_BIT_SIZE 2
+#define GFS2_BIT_MASK 0x00000003
+
+#define GFS2_BLKST_FREE 0
+#define GFS2_BLKST_USED 1
+#define GFS2_BLKST_UNLINKED 2
+#define GFS2_BLKST_DINODE 3
+
+#define GFS2_RGF_JOURNAL 0x00000001
+#define GFS2_RGF_METAONLY 0x00000002
+#define GFS2_RGF_DATAONLY 0x00000004
+#define GFS2_RGF_NOALLOC 0x00000008
+#define GFS2_RGF_TRIMMED 0x00000010
+
+struct gfs2_inode_lvb {
+ __be32 ri_magic;
+ __be32 __pad;
+ __be64 ri_generation_deleted;
+};
+
+struct gfs2_rgrp_lvb {
+ __be32 rl_magic;
+ __be32 rl_flags;
+ __be32 rl_free;
+ __be32 rl_dinodes;
+ __be64 rl_igeneration;
+ __be32 rl_unlinked;
+ __be32 __pad;
+};
+
+struct gfs2_rgrp {
+ struct gfs2_meta_header rg_header;
+
+ __be32 rg_flags;
+ __be32 rg_free;
+ __be32 rg_dinodes;
+ union {
+ __be32 __pad;
+ __be32 rg_skip; /* Distance to the next rgrp in fs blocks */
+ };
+ __be64 rg_igeneration;
+ /* The following 3 fields are duplicated from gfs2_rindex to reduce
+ reliance on the rindex */
+ __be64 rg_data0; /* First data location */
+ __be32 rg_data; /* Number of data blocks in rgrp */
+ __be32 rg_bitbytes; /* Number of bytes in data bitmaps */
+ __be32 rg_crc; /* crc32 of the structure with this field 0 */
+
+ __u8 rg_reserved[60]; /* Several fields from gfs1 now reserved */
+};
+
+/*
+ * quota structure
+ */
+
+struct gfs2_quota {
+ __be64 qu_limit;
+ __be64 qu_warn;
+ __be64 qu_value;
+ __u8 qu_reserved[64];
+};
+
+/*
+ * dinode structure
+ */
+
+#define GFS2_MAX_META_HEIGHT 10
+#define GFS2_DIR_MAX_DEPTH 17
+
+#define DT2IF(dt) (((dt) << 12) & S_IFMT)
+#define IF2DT(sif) (((sif) & S_IFMT) >> 12)
+
+enum {
+ gfs2fl_Jdata = 0,
+ gfs2fl_ExHash = 1,
+ gfs2fl_Unused = 2,
+ gfs2fl_EaIndirect = 3,
+ gfs2fl_Directio = 4,
+ gfs2fl_Immutable = 5,
+ gfs2fl_AppendOnly = 6,
+ gfs2fl_NoAtime = 7,
+ gfs2fl_Sync = 8,
+ gfs2fl_System = 9,
+ gfs2fl_TopLevel = 10,
+ gfs2fl_TruncInProg = 29,
+ gfs2fl_InheritDirectio = 30,
+ gfs2fl_InheritJdata = 31,
+};
+
+/* Dinode flags */
+#define GFS2_DIF_JDATA 0x00000001
+#define GFS2_DIF_EXHASH 0x00000002
+#define GFS2_DIF_UNUSED 0x00000004 /* only in gfs1 */
+#define GFS2_DIF_EA_INDIRECT 0x00000008
+#define GFS2_DIF_DIRECTIO 0x00000010
+#define GFS2_DIF_IMMUTABLE 0x00000020
+#define GFS2_DIF_APPENDONLY 0x00000040
+#define GFS2_DIF_NOATIME 0x00000080
+#define GFS2_DIF_SYNC 0x00000100
+#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
+#define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */
+#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
+#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */
+#define GFS2_DIF_INHERIT_JDATA 0x80000000
+
+struct gfs2_dinode {
+ struct gfs2_meta_header di_header;
+
+ struct gfs2_inum di_num;
+
+ __be32 di_mode; /* mode of file */
+ __be32 di_uid; /* owner's user id */
+ __be32 di_gid; /* owner's group id */
+ __be32 di_nlink; /* number of links to this file */
+ __be64 di_size; /* number of bytes in file */
+ __be64 di_blocks; /* number of blocks in file */
+ __be64 di_atime; /* time last accessed */
+ __be64 di_mtime; /* time last modified */
+ __be64 di_ctime; /* time last changed */
+ __be32 di_major; /* device major number */
+ __be32 di_minor; /* device minor number */
+
+ /* This section varies from gfs1. Padding added to align with
+ * remainder of dinode
+ */
+ __be64 di_goal_meta; /* rgrp to alloc from next */
+ __be64 di_goal_data; /* data block goal */
+ __be64 di_generation; /* generation number for NFS */
+
+ __be32 di_flags; /* GFS2_DIF_... */
+ __be32 di_payload_format; /* GFS2_FORMAT_... */
+ __u16 __pad1; /* Was ditype in gfs1 */
+ __be16 di_height; /* height of metadata */
+ __u32 __pad2; /* Unused incarnation number from gfs1 */
+
+ /* These only apply to directories */
+ __u16 __pad3; /* Padding */
+ __be16 di_depth; /* Number of bits in the table */
+ __be32 di_entries; /* The number of entries in the directory */
+
+ struct gfs2_inum __pad4; /* Unused even in current gfs1 */
+
+ __be64 di_eattr; /* extended attribute block number */
+ __be32 di_atime_nsec; /* nsec portion of atime */
+ __be32 di_mtime_nsec; /* nsec portion of mtime */
+ __be32 di_ctime_nsec; /* nsec portion of ctime */
+
+ __u8 di_reserved[44];
+};
+
+/*
+ * directory structure - many of these per directory file
+ */
+
+#define GFS2_FNAMESIZE 255
+#define GFS2_DIRENT_SIZE(name_len) ((sizeof(struct gfs2_dirent) + (name_len) + 7) & ~7)
+#define GFS2_MIN_DIRENT_SIZE (GFS2_DIRENT_SIZE(1))
+
+
+struct gfs2_dirent {
+ struct gfs2_inum de_inum;
+ __be32 de_hash;
+ __be16 de_rec_len;
+ __be16 de_name_len;
+ __be16 de_type;
+ __be16 de_rahead;
+ union {
+ __u8 __pad[12];
+ struct {
+ __u32 de_cookie; /* ondisk value not used */
+ __u8 pad3[8];
+ };
+ };
+};
+
+/*
+ * Header of leaf directory nodes
+ */
+
+struct gfs2_leaf {
+ struct gfs2_meta_header lf_header;
+
+ __be16 lf_depth; /* Depth of leaf */
+ __be16 lf_entries; /* Number of dirents in leaf */
+ __be32 lf_dirent_format; /* Format of the dirents */
+ __be64 lf_next; /* Next leaf, if overflow */
+
+ union {
+ __u8 lf_reserved[64];
+ struct {
+ __be64 lf_inode; /* Dir inode number */
+ __be32 lf_dist; /* Dist from inode on chain */
+ __be32 lf_nsec; /* Last ins/del usecs */
+ __be64 lf_sec; /* Last ins/del in secs */
+ __u8 lf_reserved2[40];
+ };
+ };
+};
+
+/*
+ * Extended attribute header format
+ *
+ * This works in a similar way to dirents. There is a fixed size header
+ * followed by a variable length section made up of the name and the
+ * associated data. In the case of a "stuffed" entry, the value is
+ * __inline__ directly after the name, the ea_num_ptrs entry will be
+ * zero in that case. For non-"stuffed" entries, there will be
+ * a set of pointers (aligned to 8 byte boundary) to the block(s)
+ * containing the value.
+ *
+ * The blocks containing the values and the blocks containing the
+ * extended attribute headers themselves all start with the common
+ * metadata header. Each inode, if it has extended attributes, will
+ * have either a single block containing the extended attribute headers
+ * or a single indirect block pointing to blocks containing the
+ * extended attribute headers.
+ *
+ * The maximum size of the data part of an extended attribute is 64k
+ * so the number of blocks required depends upon block size. Since the
+ * block size also determines the number of pointers in an indirect
+ * block, its a fairly complicated calculation to work out the maximum
+ * number of blocks that an inode may have relating to extended attributes.
+ *
+ */
+
+#define GFS2_EA_MAX_NAME_LEN 255
+#define GFS2_EA_MAX_DATA_LEN 65536
+
+#define GFS2_EATYPE_UNUSED 0
+#define GFS2_EATYPE_USR 1
+#define GFS2_EATYPE_SYS 2
+#define GFS2_EATYPE_SECURITY 3
+#define GFS2_EATYPE_TRUSTED 4
+
+#define GFS2_EATYPE_LAST 4
+#define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST)
+
+#define GFS2_EAFLAG_LAST 0x01 /* last ea in block */
+
+struct gfs2_ea_header {
+ __be32 ea_rec_len;
+ __be32 ea_data_len;
+ __u8 ea_name_len; /* no NULL pointer after the string */
+ __u8 ea_type; /* GFS2_EATYPE_... */
+ __u8 ea_flags; /* GFS2_EAFLAG_... */
+ __u8 ea_num_ptrs;
+ __u32 __pad;
+};
+
+/*
+ * Log header structure
+ */
+
+#define GFS2_LOG_HEAD_UNMOUNT 0x00000001 /* log is clean */
+#define GFS2_LOG_HEAD_FLUSH_NORMAL 0x00000002 /* normal log flush */
+#define GFS2_LOG_HEAD_FLUSH_SYNC 0x00000004 /* Sync log flush */
+#define GFS2_LOG_HEAD_FLUSH_SHUTDOWN 0x00000008 /* Shutdown log flush */
+#define GFS2_LOG_HEAD_FLUSH_FREEZE 0x00000010 /* Freeze flush */
+#define GFS2_LOG_HEAD_RECOVERY 0x00000020 /* Journal recovery */
+#define GFS2_LOG_HEAD_USERSPACE 0x80000000 /* Written by gfs2-utils */
+
+/* Log flush callers */
+#define GFS2_LFC_SHUTDOWN 0x00000100
+#define GFS2_LFC_JDATA_WPAGES 0x00000200
+#define GFS2_LFC_SET_FLAGS 0x00000400
+#define GFS2_LFC_AIL_EMPTY_GL 0x00000800
+#define GFS2_LFC_AIL_FLUSH 0x00001000
+#define GFS2_LFC_RGRP_GO_SYNC 0x00002000
+#define GFS2_LFC_INODE_GO_SYNC 0x00004000
+#define GFS2_LFC_INODE_GO_INVAL 0x00008000
+#define GFS2_LFC_FREEZE_GO_SYNC 0x00010000
+#define GFS2_LFC_KILL_SB 0x00020000
+#define GFS2_LFC_DO_SYNC 0x00040000
+#define GFS2_LFC_INPLACE_RESERVE 0x00080000
+#define GFS2_LFC_WRITE_INODE 0x00100000
+#define GFS2_LFC_MAKE_FS_RO 0x00200000
+#define GFS2_LFC_SYNC_FS 0x00400000
+#define GFS2_LFC_EVICT_INODE 0x00800000
+#define GFS2_LFC_TRANS_END 0x01000000
+#define GFS2_LFC_LOGD_JFLUSH_REQD 0x02000000
+#define GFS2_LFC_LOGD_AIL_FLUSH_REQD 0x04000000
+
+#define LH_V1_SIZE (offsetofend(struct gfs2_log_header, lh_hash))
+
+struct gfs2_log_header {
+ struct gfs2_meta_header lh_header;
+
+ __be64 lh_sequence; /* Sequence number of this transaction */
+ __be32 lh_flags; /* GFS2_LOG_HEAD_... */
+ __be32 lh_tail; /* Block number of log tail */
+ __be32 lh_blkno;
+ __be32 lh_hash; /* crc up to here with this field 0 */
+
+ /* Version 2 additional fields start here */
+ __be32 lh_crc; /* crc32c from lh_nsec to end of block */
+ __be32 lh_nsec; /* Nanoseconds of timestamp */
+ __be64 lh_sec; /* Seconds of timestamp */
+ __be64 lh_addr; /* Block addr of this log header (absolute) */
+ __be64 lh_jinode; /* Journal inode number */
+ __be64 lh_statfs_addr; /* Local statfs inode number */
+ __be64 lh_quota_addr; /* Local quota change inode number */
+
+ /* Statfs local changes (i.e. diff from global statfs) */
+ __be64 lh_local_total;
+ __be64 lh_local_free;
+ __be64 lh_local_dinodes;
+};
+
+/*
+ * Log type descriptor
+ */
+
+#define GFS2_LOG_DESC_METADATA 300
+/* ld_data1 is the number of metadata blocks in the descriptor.
+ ld_data2 is unused. */
+
+#define GFS2_LOG_DESC_REVOKE 301
+/* ld_data1 is the number of revoke blocks in the descriptor.
+ ld_data2 is unused. */
+
+#define GFS2_LOG_DESC_JDATA 302
+/* ld_data1 is the number of data blocks in the descriptor.
+ ld_data2 is unused. */
+
+struct gfs2_log_descriptor {
+ struct gfs2_meta_header ld_header;
+
+ __be32 ld_type; /* GFS2_LOG_DESC_... */
+ __be32 ld_length; /* Number of buffers in this chunk */
+ __be32 ld_data1; /* descriptor-specific field */
+ __be32 ld_data2; /* descriptor-specific field */
+
+ __u8 ld_reserved[32];
+};
+
+/*
+ * Inum Range
+ * Describe a range of formal inode numbers allocated to
+ * one machine to assign to inodes.
+ */
+
+#define GFS2_INUM_QUANTUM 1048576
+
+struct gfs2_inum_range {
+ __be64 ir_start;
+ __be64 ir_length;
+};
+
+/*
+ * Statfs change
+ * Describes an change to the pool of free and allocated
+ * blocks.
+ */
+
+struct gfs2_statfs_change {
+ __be64 sc_total;
+ __be64 sc_free;
+ __be64 sc_dinodes;
+};
+
+/*
+ * Quota change
+ * Describes an allocation change for a particular
+ * user or group.
+ */
+
+#define GFS2_QCF_USER 0x00000001
+
+struct gfs2_quota_change {
+ __be64 qc_change;
+ __be32 qc_flags; /* GFS2_QCF_... */
+ __be32 qc_id;
+};
+
+struct gfs2_quota_lvb {
+ __be32 qb_magic;
+ __u32 __pad;
+ __be64 qb_limit; /* Hard limit of # blocks to alloc */
+ __be64 qb_warn; /* Warn user when alloc is above this # */
+ __be64 qb_value; /* Current # blocks allocated */
+};
+
+#endif /* __GFS2_ONDISK_DOT_H__ */
diff --git a/gfs2/include/linux/types.h b/gfs2/include/linux/types.h
new file mode 100644
index 00000000..7f4d4b98
--- /dev/null
+++ b/gfs2/include/linux/types.h
@@ -0,0 +1,32 @@
+#ifndef LINUX_TYPES_H
+#define LINUX_TYPES_H
+
+/* Satisfy gfs2_ondisk.h with userspace definitions of kernel types */
+
+#include <stdint.h>
+
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#define __bitwise __bitwise__
+
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+typedef uint64_t __u64;
+
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+typedef int64_t __s64;
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+
+#endif /* LINUX_TYPES_H */
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
index eb7a94cf..22144d68 100644
--- a/gfs2/libgfs2/buf.c
+++ b/gfs2/libgfs2/buf.c
@@ -11,7 +11,6 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#include <linux/types.h>
#include "libgfs2.h"
diff --git a/gfs2/libgfs2/device_geometry.c b/gfs2/libgfs2/device_geometry.c
index 1303f11b..72f9c7e4 100644
--- a/gfs2/libgfs2/device_geometry.c
+++ b/gfs2/libgfs2/device_geometry.c
@@ -11,7 +11,6 @@
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
-#include <linux/types.h>
#include <linux/fs.h>
#include "libgfs2.h"
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 9e54010f..1c580081 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -11,7 +11,6 @@
#include <unistd.h>
#include <errno.h>
-#include <linux/types.h>
#include "libgfs2.h"
#include "rgrp.h"
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index 15fa5809..b2294a8b 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -10,8 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <linux/types.h>
-#include <linux/gfs2_ondisk.h>
#include "osi_list.h"
#include "libgfs2.h"
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 8b70a56e..bbeade04 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
-#include <linux/types.h>
#include <linux/limits.h>
#include <endian.h>
#include <byteswap.h>
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 6918d82d..4515e7ac 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -6,7 +6,6 @@
#include <stdint.h>
#include <inttypes.h>
#include <ctype.h>
-#include <linux/types.h>
#include "libgfs2.h"
#ifdef GFS2_HAS_UUID
#include <uuid.h>
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 79095efc..10933683 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -10,7 +10,6 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#include <linux/types.h>
#include <sys/time.h>
#include "libgfs2.h"
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index af0fcd50..d584a9cd 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -2,7 +2,6 @@
#define __GFS2_MKFS_DOT_H__
#include <stdarg.h>
-#include <linux/gfs2_ondisk.h>
#include "osi_list.h"
#include "copyright.cf"
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index e1a6d70b..2fadd06a 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -15,7 +15,6 @@
#include <time.h>
#include <errno.h>
#include <stdarg.h>
-#include <linux/types.h>
#include <blkid.h>
#include <libintl.h>
#include <locale.h>
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index 2bd0f7b0..33bd5127 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -20,7 +20,6 @@
#include <locale.h>
#define _(String) gettext(String)
-#include <linux/types.h>
#include <linux/fiemap.h>
#include <linux/fs.h>
#include "libgfs2.h"
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 7d7e3730..9ed1d0c1 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -25,7 +25,6 @@
#define _(String) gettext(String)
-#include <linux/types.h>
#include "libgfs2.h"
#include "gfs2_mkfs.h"
#include "progress.h"
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
index c3029fd1..74e4a457 100644
--- a/gfs2/tune/super.c
+++ b/gfs2/tune/super.c
@@ -11,7 +11,6 @@
#include <libintl.h>
#define _(String) gettext(String)
#include <linux_endian.h>
-#include <linux/gfs2_ondisk.h>
#include <libgfs2.h>
#include "tunegfs2.h"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] branch master updated (e84636d3 -> a380f778)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a change to branch master
in repository gfs2-utils.
from e84636d3 configure: Don't define _FORTIFY_SOURCE for gcov builds
new 97dda915 Import linux/gfs2_ondisk.h
new 4a2c962f Remove HAS_UUID conditionals
new 5d86cc21 Remove GFS2_HAS_LEAF_HINTS conditionals
new 40d3c4c5 Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals
new 74c6c38f Remove GFS2_HAS_RG_SKIP conditionals
new 364c0524 Remove GFS2_HAS_RG_RI_FIELDS conditionals
new de650ba2 Remove GFS2_HAS_LH_V2 conditionals
new a380f778 Use PRI* when printing gfs2 structures
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
configure.ac | 25 +-
gfs2/convert/gfs2_convert.c | 2 -
gfs2/edit/extended.c | 54 ++--
gfs2/edit/gfs2hex.c | 45 ++--
gfs2/edit/hexedit.c | 2 -
gfs2/edit/hexedit.h | 1 -
gfs2/edit/journal.c | 15 +-
gfs2/edit/savemeta.c | 2 -
gfs2/fsck/fs_recovery.c | 10 +-
gfs2/fsck/initialize.c | 47 ++--
gfs2/fsck/lost_n_found.c | 10 +-
gfs2/fsck/pass1.c | 5 +-
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/rgrepair.c | 37 +--
gfs2/include/Makefile.am | 2 +
gfs2/include/linux/gfs2_ondisk.h | 542 +++++++++++++++++++++++++++++++++++++++
gfs2/include/linux/types.h | 32 +++
gfs2/libgfs2/buf.c | 1 -
gfs2/libgfs2/device_geometry.c | 1 -
gfs2/libgfs2/fs_ops.c | 7 -
gfs2/libgfs2/gfs1.c | 2 -
gfs2/libgfs2/lang.c | 11 +-
gfs2/libgfs2/libgfs2.h | 4 -
gfs2/libgfs2/meta.c | 27 +-
gfs2/libgfs2/ondisk.c | 266 +++++++------------
gfs2/libgfs2/recovery.c | 2 -
gfs2/libgfs2/rgrp.c | 8 -
gfs2/libgfs2/structures.c | 24 +-
gfs2/mkfs/gfs2_mkfs.h | 1 -
gfs2/mkfs/main_grow.c | 1 -
gfs2/mkfs/main_jadd.c | 10 +-
gfs2/mkfs/main_mkfs.c | 17 +-
gfs2/tune/super.c | 17 +-
33 files changed, 772 insertions(+), 460 deletions(-)
create mode 100644 gfs2/include/linux/gfs2_ondisk.h
create mode 100644 gfs2/include/linux/types.h
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] branch master updated: configure: Don't define
_FORTIFY_SOURCE for gcov builds
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new e84636d3 configure: Don't define _FORTIFY_SOURCE for gcov builds
e84636d3 is described below
commit e84636d3b53325a9a949f1690919088ed5c2444f
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Apr 16 14:21:43 2021 +0100
configure: Don't define _FORTIFY_SOURCE for gcov builds
Coverage instrumentation requires optimisation to be disabled and
_FORTIFY_SOURCE requires optimisation to be enabled, so they are
incompatible.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 5c2d45cd..690049f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,7 @@ if test "x${enable_gcov}" = xyes; then
enable_debug="no (gcov enabled)"
fi
OPT_CFLAGS="-O0 $GCOV_CFLAGS"
+ OPT_CPPFLAGS=""
fi
if test "x${enable_gprof}" = xyes; then
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 05/05: fsck.gfs2: Improve rindex consistency check
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit f52f1ba4f6c8dc1804f74b6c9a33f6293dafbc8a
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Apr 8 11:52:44 2021 +0100
fsck.gfs2: Improve rindex consistency check
Before we were ignoring the flag set by rindex_read to tell whether
there are bad entries and the rindex was (sometimes) fixed by subsequent
checks failing. Check that flag and enable an rindex repair test that
previously failed.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/initialize.c | 2 +-
tests/fsck.at | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 4c266d9a..58dd23d3 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -751,7 +751,7 @@ static int fetch_rgrps_level(struct gfs2_sbd *sdp, enum rgindex_trust_level lvl,
if (rg_repair(sdp, lvl, ok) != 0)
goto fail;
- if (rindex_read(sdp, count, ok) != 0)
+ if (rindex_read(sdp, count, ok) != 0 || !*ok)
goto fail;
ret = read_rgrps(sdp, *count);
diff --git a/tests/fsck.at b/tests/fsck.at
index 3b1c5af3..538d41ad 100644
--- a/tests/fsck.at
+++ b/tests/fsck.at
@@ -36,10 +36,10 @@ AT_KEYWORDS(fsck.gfs2 fsck)
GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-r 1])
AT_CLEANUP
-#AT_SETUP([Fix bad rindex entry #0])
-#AT_KEYWORDS(fsck.gfs2 fsck)
-#GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-i 0])
-#AT_CLEANUP
+AT_SETUP([Fix bad rindex entry #0])
+AT_KEYWORDS(fsck.gfs2 fsck)
+GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-i 0])
+AT_CLEANUP
AT_SETUP([Fix bad rindex entry #1])
AT_KEYWORDS(fsck.gfs2 fsck)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years
[gfs2-utils] 04/05: fsck.gfs2: Fix bounds check in
find_next_rgrp_dist()
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit ace15ae18d0390fcdfecfd8d24d2adce5bd1d9cb
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 13 11:59:02 2021 +0100
fsck.gfs2: Fix bounds check in find_next_rgrp_dist()
We're reading block address (next_block + b) so the bounds check should
make sure that address is valid.
Add some tests that now pass (and some commented-out ones that don't).
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/rgrepair.c | 2 +-
tests/fsck.at | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 2bddd91f..637e5271 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -392,7 +392,7 @@ static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t blk,
next_block = prevrgd->ri.ri_addr + rgrp_dist;
/* Now we account for block rounding done by mkfs.gfs2 */
for (b = 0; b <= length + GFS2_NBBY; b++) {
- if (next_block >= sdp->device.length)
+ if (next_block + b >= sdp->device.length)
break;
bh = bread(sdp, next_block + b);
gfs2_meta_header_in(&mh, bh->b_data);
diff --git a/tests/fsck.at b/tests/fsck.at
index 727108f4..3b1c5af3 100644
--- a/tests/fsck.at
+++ b/tests/fsck.at
@@ -46,6 +46,26 @@ AT_KEYWORDS(fsck.gfs2 fsck)
GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-i 1])
AT_CLEANUP
+AT_SETUP([2G RGs: Fix bad resource group #0])
+AT_KEYWORDS(fsck.gfs2 fsck)
+GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock -r 2048 $GFS_TGT], [-r 0])
+AT_CLEANUP
+
+AT_SETUP([2G RGs: Fix bad resource group #1])
+AT_KEYWORDS(fsck.gfs2 fsck)
+GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock -r 2048 $GFS_TGT], [-r 1])
+AT_CLEANUP
+
+#AT_SETUP([2G RGs: Fix bad rindex entry #0])
+#AT_KEYWORDS(fsck.gfs2 fsck)
+#GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock -r 2048 $GFS_TGT], [-i 0])
+#AT_CLEANUP
+
+#AT_SETUP([2G RGs: Fix bad rindex entry #1])
+#AT_KEYWORDS(fsck.gfs2 fsck)
+#GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock -r 2048 $GFS_TGT], [-i 1])
+#AT_CLEANUP
+
AT_SETUP([Rebuild bad journal])
AT_KEYWORDS(fsck.gfs2 fsck)
GFS_TGT_REGEN
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
3 years