[gfs2-utils] branch main updated: Add configure~ to .gitignore
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch main
in repository gfs2-utils.
The following commit(s) were added to refs/heads/main by this push:
new 1a3b09de Add configure~ to .gitignore
1a3b09de is described below
commit 1a3b09de08286554c7787a71ea857b6357d0c845
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Oct 21 11:29:07 2022 +0100
Add configure~ to .gitignore
It's a backup of the configure script generated by autoconf.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 3c56ad09..fc97cf04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ autom4te.cache
automake
compile
configure
+configure~
config.guess
config.log
config.sub
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
1 year, 6 months
[gfs2-utils] 01/01: Add support for ri_crc
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-ri-crc
in repository gfs2-utils.
commit 4c68fef25a78ac881558359f1df337df38fc96e6
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Oct 24 19:17:56 2022 +0100
Add support for ri_crc
Experimental support for rindex integrity checking.
Kernel bits: https://gitlab.com/andyprice/linux/-/commits/experiment.ri_crc
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/struct_print.c | 1 +
gfs2/include/linux/gfs2_ondisk.h | 2 +-
gfs2/libgfs2/libgfs2.h | 2 ++
gfs2/libgfs2/meta.c | 2 +-
gfs2/libgfs2/ondisk.c | 1 +
gfs2/libgfs2/rgrp.c | 35 ++++++++++++++++++++++++++++++++++-
6 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/gfs2/edit/struct_print.c b/gfs2/edit/struct_print.c
index 896f648b..9e06902b 100644
--- a/gfs2/edit/struct_print.c
+++ b/gfs2/edit/struct_print.c
@@ -185,6 +185,7 @@ void rindex_print(void *rip)
printbe64(ri, ri_addr);
printbe32(ri, ri_length);
+ printbe32(ri, ri_crc);
printbe64(ri, ri_data0);
printbe32(ri, ri_data);
printbe32(ri, ri_bitbytes);
diff --git a/gfs2/include/linux/gfs2_ondisk.h b/gfs2/include/linux/gfs2_ondisk.h
index fc948f89..95f9a690 100644
--- a/gfs2/include/linux/gfs2_ondisk.h
+++ b/gfs2/include/linux/gfs2_ondisk.h
@@ -141,7 +141,7 @@ struct gfs2_sb {
struct gfs2_rindex {
__be64 ri_addr; /* grp block disk address */
__be32 ri_length; /* length of rgrp header in fs blocks */
- __u32 __pad;
+ __be32 ri_crc; /* crc32c of the struct with this field zeroed */
__be64 ri_data0; /* first data location */
__be32 ri_data; /* num of data blocks in rgrp */
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 34c9dfa1..12bcf5eb 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -743,6 +743,8 @@ extern int lgfs2_compute_bitstructs(const uint32_t bsize, struct lgfs2_rgrp_tree
extern struct lgfs2_rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk);
extern int lgfs2_rgrp_crc_check(char *buf);
extern void lgfs2_rgrp_crc_set(char *buf);
+extern int lgfs2_rindex_crc_check(char *buf);
+extern void lgfs2_rindex_crc_set(char *buf);
extern uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd);
extern void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd);
extern struct lgfs2_rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree,
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index 5d8811a6..27ef1fc1 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -208,7 +208,7 @@ RF(sb_reserved)
static const struct lgfs2_metafield gfs2_rindex_fields[] = {
FP(ri_addr, .points_to = (1 << LGFS2_MT_GFS2_RGRP))
F(ri_length, .flags = LGFS2_MFF_FSBLOCKS)
-RF(__pad)
+F(ri_crc, .flags = LGFS2_MFF_CHECK)
FP(ri_data0, .points_to = ANY_GFS2_BLOCK|(1 << LGFS2_MT_FREE))
F(ri_data, .flags = LGFS2_MFF_FSBLOCKS)
F(ri_bitbytes, .flags = LGFS2_MFF_BYTES)
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index b6e6a867..b18663d4 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -90,6 +90,7 @@ void lgfs2_rindex_out(const lgfs2_rgrp_t rg, void *buf)
ri->ri_data0 = cpu_to_be64(rg->rt_data0);
ri->ri_data = cpu_to_be32(rg->rt_data);
ri->ri_bitbytes = cpu_to_be32(rg->rt_bitbytes);
+ lgfs2_rindex_crc_set(buf);
}
void lgfs2_rgrp_in(lgfs2_rgrp_t rg, void *buf)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 56ee571a..7a56bf33 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -182,6 +182,39 @@ void lgfs2_rgrp_crc_set(char *buf)
rg->rg_crc = cpu_to_be32(crc);
}
+/**
+ * Check an rindex entry's crc
+ * Returns 0 on success, non-zero if crc is bad
+ */
+int lgfs2_rindex_crc_check(char *buf)
+{
+ int ret = 0;
+ struct gfs2_rindex *ri = (struct gfs2_rindex *)buf;
+ __be32 crc = ri->ri_crc;
+
+ if (crc == 0)
+ return 0;
+
+ ri->ri_crc = 0;
+ if (be32_to_cpu(crc) != lgfs2_disk_hash(buf, sizeof(struct gfs2_rindex)))
+ ret = 1;
+ ri->ri_crc = crc;
+ return ret;
+}
+
+/**
+ * Set the crc of an rindex entry
+ */
+void lgfs2_rindex_crc_set(char *buf)
+{
+ struct gfs2_rindex *ri = (struct gfs2_rindex *)buf;
+ uint32_t crc;
+
+ ri->ri_crc = 0;
+ crc = lgfs2_disk_hash(buf, sizeof(struct gfs2_rindex));
+ ri->ri_crc = cpu_to_be32(crc);
+}
+
/**
* lgfs2_rgrp_read - read in the resource group information from disk.
* @rgd - resource group structure
@@ -583,10 +616,10 @@ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint6
ri->ri_addr = cpu_to_be64(addr);
ri->ri_length = cpu_to_be32(ri_length);
ri->ri_data = cpu_to_be32(ri_data);
- ri->__pad = 0;
ri->ri_data0 = cpu_to_be64(addr + ri_length);
ri->ri_bitbytes = cpu_to_be32(ri_data / GFS2_NBBY);
memset(&ri->ri_reserved, 0, sizeof(ri->ri_reserved));
+ lgfs2_rindex_crc_set((char *)ri);
return addr + len;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
1 year, 6 months