[gfs2-utils] 12/40: gfs2_edit: Convert superblock printing to expect
big-endian
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 7b7515f7fea5ea3e04dd85ece6e4ef33f28ef68e
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 15:03:20 2021 +0100
gfs2_edit: Convert superblock printing to expect big-endian
Split the gfs2_sb printing code from the gfs1 and use the libgfs2
version. Update gfs2_edit's gfs1 sb printing code to print values from
the big-endian structures.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 77 ++++++++++++++++++-----------------------------------
gfs2/edit/hexedit.h | 1 -
2 files changed, 26 insertions(+), 52 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 5a2199de..021c7308 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -23,8 +23,10 @@
#define pv2(struct, member, fmt, fmt2) do { \
print_it(" ", fmt, fmt2, struct->member); \
} while (FALSE);
+#define printbe32(struct, member) do { \
+ print_it(" "#member, "%"PRIu32, "0x%"PRIx32, be32_to_cpu(struct->member)); \
+ } while(0)
-struct gfs2_sb sb;
struct gfs2_dinode di;
int line, termlines, modelines[DMODES];
char edit_fmt[80];
@@ -364,56 +366,28 @@ static void do_eattr_extended(char *buf)
}
}
-static void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
-{
- if (termlines) {
- check_highlight(TRUE);
- move(line,2);
- printw(title);
- check_highlight(FALSE);
- }
- else
- printf(" %s:",title);
- pv2(no, no_formal_ino, "%"PRIu64, "0x%"PRIx64);
- if (!termlines)
- printf(" addr:");
- pv2(no, no_addr, "%"PRIu64, "0x%"PRIx64);
-}
-
/**
- * gfs2_sb_print2 - Print out a superblock
- * @sb: the cpu-order buffer
+ * gfs_sb_print - Print out a gfs1 superblock
+ * @sbp: the big-endian buffer
*/
-static void gfs2_sb_print2(struct gfs2_sb *sbp2)
+static void gfs_sb_print(void *sbp)
{
- char readable_uuid[36+1];
-
- gfs2_meta_header_print(&sbp2->sb_header);
-
- pv(sbp2, sb_fs_format, "%"PRIu32, "0x%"PRIx32);
- pv(sbp2, sb_multihost_format, "%"PRIu32, "0x%"PRIx32);
-
- if (sbd.gfs1)
- pv(sbd1, sb_flags, "%"PRIu32, "0x%"PRIx32);
- pv(sbp2, sb_bsize, "%"PRIu32, "0x%"PRIx32);
- pv(sbp2, sb_bsize_shift, "%"PRIu32, "0x%"PRIx32);
- if (sbd.gfs1) {
- pv(sbd1, sb_seg_size, "%"PRIu32, "0x%"PRIx32);
- gfs2_inum_print2("jindex ino", &sbd1->sb_jindex_di);
- gfs2_inum_print2("rindex ino", &sbd1->sb_rindex_di);
- }
- else
- gfs2_inum_print2("master dir", &sbp2->sb_master_dir);
- gfs2_inum_print2("root dir ", &sbp2->sb_root_dir);
-
- pv(sbp2, sb_lockproto, "%s", NULL);
- pv(sbp2, sb_locktable, "%s", NULL);
- if (sbd.gfs1) {
- gfs2_inum_print2("quota ino ", &gfs1_quota_di);
- gfs2_inum_print2("license ", &gfs1_license_di);
- }
- uuid_unparse(sbp2->sb_uuid, readable_uuid);
- print_it(" sb_uuid", "%s", NULL, readable_uuid);
+ struct gfs_sb *sb = sbp;
+
+ lgfs2_meta_header_print(&sb->sb_header);
+ printbe32(sb, sb_fs_format);
+ printbe32(sb, sb_multihost_format);
+ printbe32(sb, sb_flags);
+ printbe32(sb, sb_bsize);
+ printbe32(sb, sb_bsize_shift);
+ printbe32(sb, sb_seg_size);
+ lgfs2_inum_print(&sb->sb_jindex_di);
+ lgfs2_inum_print(&sb->sb_rindex_di);
+ lgfs2_inum_print(&sb->sb_root_di);
+ pv(sb, sb_lockproto, "%.64s", NULL);
+ pv(sb, sb_locktable, "%.64s", NULL);
+ lgfs2_inum_print(&sb->sb_quota_di);
+ lgfs2_inum_print(&sb->sb_license_di);
}
int display_gfs2(char *buf)
@@ -439,10 +413,11 @@ int display_gfs2(char *buf)
switch (mh.mh_type)
{
case GFS2_METATYPE_SB:
- gfs2_sb_in(&sbd.sd_sb, buf);
- gfs2_sb_print2(&sbd.sd_sb);
+ if (sbd.gfs1)
+ gfs_sb_print(buf);
+ else
+ lgfs2_sb_print(buf);
break;
-
case GFS2_METATYPE_RG:
if (sbd.gfs1)
gfs_rgrp_print(buf);
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 51b466ee..f44ea3b1 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -27,7 +27,6 @@ enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2, INIT_MODE = 3 };
#define JOURNALS_DUMMY_BLOCK -3
extern const char *mtypes[];
-extern struct gfs2_sb sb;
extern int blockhist;
extern int edit_mode;
extern int line;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 11/40: libgfs2: Convert gfs2_sb_print to expect
big-endian data
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 6de94a062ba78b1e0c32956a4c3b6a3bf0872b82
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 14:39:23 2021 +0100
libgfs2: Convert gfs2_sb_print to expect big-endian data
There are no current users of this function but convert it anyway as
it's likely there will be.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 2 +-
gfs2/libgfs2/ondisk.c | 26 +++++++++++---------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ec013647..19d060f5 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -718,13 +718,13 @@ extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
extern void gfs2_inum_print(const struct gfs2_inum *no);
extern void gfs2_meta_header_print(const struct gfs2_meta_header *mh);
-extern void gfs2_sb_print(const struct gfs2_sb *sb);
extern void gfs2_rindex_print(const struct gfs2_rindex *ri);
extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_inum_print(void *nop);
extern void lgfs2_meta_header_print(void *mhp);
+extern void lgfs2_sb_print(void *sbp);
extern void lgfs2_log_descriptor_print(void *ldp);
extern void lgfs2_quota_print(void *qp);
extern void lgfs2_quota_change_print(void *qcp);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index c349a4b4..5e69ee98 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -167,24 +167,20 @@ void gfs2_sb_out(const struct gfs2_sb *sb, char *buf)
memcpy(str->sb_uuid, sb->sb_uuid, 16);
}
-void gfs2_sb_print(const struct gfs2_sb *sb)
+void lgfs2_sb_print(void *sbp)
{
+ struct gfs2_sb *sb = sbp;
char readable_uuid[36+1];
- gfs2_meta_header_print(&sb->sb_header);
-
- pv(sb, sb_fs_format, "%"PRIu32, "0x%"PRIx32);
- pv(sb, sb_multihost_format, "%"PRIu32, "0x%"PRIx32);
-
- pv(sb, sb_bsize, "%"PRIu32, "0x%"PRIx32);
- pv(sb, sb_bsize_shift, "%"PRIu32, "0x%"PRIx32);
-
- gfs2_inum_print(&sb->sb_master_dir);
- gfs2_inum_print(&sb->sb_root_dir);
-
- pv(sb, sb_lockproto, "%s", NULL);
- pv(sb, sb_locktable, "%s", NULL);
-
+ lgfs2_meta_header_print(&sb->sb_header);
+ printbe32(sb, sb_fs_format);
+ printbe32(sb, sb_multihost_format);
+ printbe32(sb, sb_bsize);
+ printbe32(sb, sb_bsize_shift);
+ lgfs2_inum_print(&sb->sb_master_dir);
+ lgfs2_inum_print(&sb->sb_root_dir);
+ print_it(" sb_lockproto", "%.64s", NULL, sb->sb_lockproto);
+ print_it(" sb_locktable", "%.64s", NULL, sb->sb_locktable);
uuid_unparse(sb->sb_uuid, readable_uuid);
print_it(" uuid", "%36s", NULL, readable_uuid);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 10/40: Convert rgrp printing functions to expect
big-endian data
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 231938c4a15133798ac9260d8f4370d6f8cf9132
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 13:04:34 2021 +0100
Convert rgrp printing functions to expect big-endian data
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 8 ++-----
gfs2/edit/gfs2hex.c | 48 ++++------------------------------------
gfs2/edit/hexedit.c | 60 +++++++++++++++++++++++---------------------------
gfs2/edit/hexedit.h | 2 +-
gfs2/libgfs2/libgfs2.h | 3 ++-
gfs2/libgfs2/ondisk.c | 32 ++++++++++++++++++---------
6 files changed, 58 insertions(+), 95 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index b0a75465..7050a36a 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -547,13 +547,9 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
if (ret != sizeof(buf)) {
perror("Failed to read resource group");
} else if (sbd.gfs1) {
- struct gfs_rgrp rg1;
- gfs_rgrp_in(&rg1, buf);
- gfs_rgrp_print(&rg1);
+ gfs_rgrp_print(buf);
} else {
- struct gfs2_rgrp rg;
- gfs2_rgrp_in(&rg, buf);
- gfs2_rgrp_print(&rg);
+ lgfs2_rgrp_print(buf);
}
}
last_entry_onscreen[dmode] = print_entry_ndx;
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index b8faf33a..5a2199de 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -416,44 +416,9 @@ static void gfs2_sb_print2(struct gfs2_sb *sbp2)
print_it(" sb_uuid", "%s", NULL, readable_uuid);
}
-/**
- * gfs1_rgrp_in - read in a gfs1 rgrp
- */
-static void gfs1_rgrp_in(struct gfs_rgrp *rgrp, const char *buf)
-{
- struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
- gfs2_meta_header_in(&rgrp->rg_header, buf);
- rgrp->rg_flags = be32_to_cpu(str->rg_flags);
- rgrp->rg_free = be32_to_cpu(str->rg_free);
- rgrp->rg_useddi = be32_to_cpu(str->rg_useddi);
- rgrp->rg_freedi = be32_to_cpu(str->rg_freedi);
- gfs2_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
- rgrp->rg_usedmeta = be32_to_cpu(str->rg_usedmeta);
- rgrp->rg_freemeta = be32_to_cpu(str->rg_freemeta);
- memcpy(rgrp->rg_reserved, str->rg_reserved, 64);
-}
-
-/**
- * gfs_rgrp_print - Print out a resource group header
- */
-static void gfs1_rgrp_print(struct gfs_rgrp *rg)
-{
- gfs2_meta_header_print(&rg->rg_header);
- pv(rg, rg_flags, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_free, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_useddi, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_freedi, "%"PRIu32, "0x%"PRIx32);
- gfs2_inum_print(&rg->rg_freedi_list);
-
- pv(rg, rg_usedmeta, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_freemeta, "%"PRIu32, "0x%"PRIx32);
-}
-
int display_gfs2(char *buf)
{
struct gfs2_meta_header mh;
- struct gfs2_rgrp rg;
struct gfs_log_header lh1;
struct gfs2_log_header lh;
@@ -479,15 +444,10 @@ int display_gfs2(char *buf)
break;
case GFS2_METATYPE_RG:
- if (sbd.gfs1) {
- struct gfs_rgrp rg1;
-
- gfs1_rgrp_in(&rg1, buf);
- gfs1_rgrp_print(&rg1);
- } else {
- gfs2_rgrp_in(&rg, buf);
- gfs2_rgrp_print(&rg);
- }
+ if (sbd.gfs1)
+ gfs_rgrp_print(buf);
+ else
+ lgfs2_rgrp_print(buf);
break;
case GFS2_METATYPE_RB:
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index e38d0b7b..c497c748 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -26,6 +26,10 @@
#include "extended.h"
#include "journal.h"
+#define printbe32(struct, member) do { \
+ print_it(" "#member, "%"PRIu32, "0x%"PRIx32, be32_to_cpu(struct->member)); \
+ } while(0)
+
const char *mtypes[] = {"none", "sb", "rg", "rb", "di", "in", "lf", "jd",
"lh", "ld", "ea", "ed", "lb", "13", "qc"};
const char *allocdesc[2][5] = {
@@ -728,16 +732,18 @@ static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
/* ------------------------------------------------------------------------ */
/* gfs_rgrp_print - print a gfs1 resource group */
/* ------------------------------------------------------------------------ */
-void gfs_rgrp_print(struct gfs_rgrp *rg)
+void gfs_rgrp_print(void *rgp)
{
- gfs2_meta_header_print(&rg->rg_header);
- pv(rg, rg_flags, "%u", "0x%x");
- pv(rg, rg_free, "%u", "0x%x");
- pv(rg, rg_useddi, "%u", "0x%x");
- pv(rg, rg_freedi, "%u", "0x%x");
- gfs2_inum_print(&rg->rg_freedi_list);
- pv(rg, rg_usedmeta, "%u", "0x%x");
- pv(rg, rg_freemeta, "%u", "0x%x");
+ struct gfs_rgrp *rg = rgp;
+
+ lgfs2_meta_header_print(&rg->rg_header);
+ printbe32(rg, rg_flags);
+ printbe32(rg, rg_free);
+ printbe32(rg, rg_useddi);
+ printbe32(rg, rg_freedi);
+ lgfs2_inum_print(&rg->rg_freedi_list);
+ printbe32(rg, rg_usedmeta);
+ printbe32(rg, rg_freemeta);
}
/* ------------------------------------------------------------------------ */
@@ -774,46 +780,36 @@ static uint64_t get_rg_addr(int rgnum)
/* ------------------------------------------------------------------------ */
static void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
{
- union {
- struct gfs2_rgrp rg2;
- struct gfs_rgrp rg1;
- } rg;
struct gfs2_buffer_head *rbh;
+ struct gfs2_rgrp *rg;
uint64_t rgblk;
rgblk = get_rg_addr(rgnum);
rbh = bread(&sbd, rgblk);
- if (sbd.gfs1)
- gfs_rgrp_in(&rg.rg1, rbh->b_data);
- else
- gfs2_rgrp_in(&rg.rg2, rbh->b_data);
+ rg = (void *)rbh->b_data;
+
if (modify) {
- printf("RG #%d (block %llu / 0x%llx) rg_flags changed from 0x%08x to 0x%08x\n",
- rgnum, (unsigned long long)rgblk,
- (unsigned long long)rgblk, rg.rg2.rg_flags, new_flags);
- rg.rg2.rg_flags = new_flags;
- if (sbd.gfs1)
- gfs_rgrp_out(&rg.rg1, rbh->b_data);
- else
- gfs2_rgrp_out(&rg.rg2, rbh->b_data);
+ uint32_t flags = be32_to_cpu(rg->rg_flags);
+
+ printf("RG #%d (block %"PRIu64" / 0x%"PRIx64") rg_flags changed from 0x%08x to 0x%08x\n",
+ rgnum, rgblk, rgblk, flags, new_flags);
+ rg->rg_flags = cpu_to_be32(new_flags);
bmodified(rbh);
- brelse(rbh);
} else {
if (full) {
print_gfs2("RG #%d", rgnum);
print_gfs2(" located at: %"PRIu64" (0x%"PRIx64")", rgblk, rgblk);
eol(0);
if (sbd.gfs1)
- gfs_rgrp_print(&rg.rg1);
+ gfs_rgrp_print(rg);
else
- gfs2_rgrp_print(&rg.rg2);
+ lgfs2_rgrp_print(rg);
}
else
- printf("RG #%d (block %llu / 0x%llx) rg_flags = 0x%08x\n",
- rgnum, (unsigned long long)rgblk,
- (unsigned long long)rgblk, rg.rg2.rg_flags);
- brelse(rbh);
+ printf("RG #%d (block %"PRIu64" / 0x%"PRIx64") rg_flags = 0x%08x\n",
+ rgnum, rgblk, rgblk, be32_to_cpu(rg->rg_flags));
}
+ brelse(rbh);
if (modify)
fsync(sbd.device_fd);
}
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 35573415..51b466ee 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -232,7 +232,7 @@ extern int display(int identify_only, int trunc_zeros, uint64_t flagref,
uint64_t ref_blk);
extern uint64_t check_keywords(const char *kword);
extern uint64_t masterblock(const char *fn);
-extern void gfs_rgrp_print(struct gfs_rgrp *rg);
+extern void gfs_rgrp_print(void *rgp);
extern int has_indirect_blocks(void);
extern const struct lgfs2_metadata *get_block_type(char *buf);
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index ab4c7320..ec013647 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -720,10 +720,10 @@ extern void gfs2_inum_print(const struct gfs2_inum *no);
extern void gfs2_meta_header_print(const struct gfs2_meta_header *mh);
extern void gfs2_sb_print(const struct gfs2_sb *sb);
extern void gfs2_rindex_print(const struct gfs2_rindex *ri);
-extern void gfs2_rgrp_print(const struct gfs2_rgrp *rg);
extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
/* These expect on-disk data instead of native-endian structs */
+extern void lgfs2_inum_print(void *nop);
extern void lgfs2_meta_header_print(void *mhp);
extern void lgfs2_log_descriptor_print(void *ldp);
extern void lgfs2_quota_print(void *qp);
@@ -731,6 +731,7 @@ extern void lgfs2_quota_change_print(void *qcp);
extern void lgfs2_statfs_change_print(void *scp);
extern void lgfs2_ea_header_print(void *eap);
extern void lgfs2_leaf_print(void *lfp);
+extern void lgfs2_rgrp_print(void *rgp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 0e51a582..c349a4b4 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -73,6 +73,14 @@ void gfs2_inum_print(const struct gfs2_inum *no)
pv(no, no_addr, "%"PRIu64, "0x%"PRIx64);
}
+void lgfs2_inum_print(void *nop)
+{
+ struct gfs2_inum *no = nop;
+
+ printbe64(no, no_formal_ino);
+ printbe64(no, no_addr);
+}
+
void gfs2_meta_header_in(struct gfs2_meta_header *mh, const char *buf)
{
const struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
@@ -255,18 +263,20 @@ void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf)
lgfs2_rgrp_crc_set(buf);
}
-void gfs2_rgrp_print(const struct gfs2_rgrp *rg)
+void lgfs2_rgrp_print(void *rgp)
{
- gfs2_meta_header_print(&rg->rg_header);
- pv(rg, rg_flags, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_free, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_dinodes, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_skip, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_igeneration, "%"PRIu64, "0x%"PRIx64);
- pv(rg, rg_data0, "%"PRIu64, "0x%"PRIx64);
- pv(rg, rg_data, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_bitbytes, "%"PRIu32, "0x%"PRIx32);
- pv(rg, rg_crc, "%"PRIu32, "0x%"PRIx32);
+ struct gfs2_rgrp *rg = rgp;
+
+ lgfs2_meta_header_print(&rg->rg_header);
+ printbe32(rg, rg_flags);
+ printbe32(rg, rg_free);
+ printbe32(rg, rg_dinodes);
+ printbe32(rg, rg_skip);
+ printbe64(rg, rg_igeneration);
+ printbe64(rg, rg_data0);
+ printbe32(rg, rg_data);
+ printbe32(rg, rg_bitbytes);
+ printbe32(rg, rg_crc);
}
void lgfs2_quota_print(void *qp)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 09/40: libgfs2: Remove gfs2_quota_{in,out}
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit c841138f81925674bd309197c3f84940cade5710
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 10:41:03 2021 +0100
libgfs2: Remove gfs2_quota_{in,out}
Update users to avoid storing cpu-endian data in an on-disk struct and
remove the functions. Replace the gfs2_quota_print() function with one
that expects big-endian data.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 11 +++++------
gfs2/libgfs2/libgfs2.h | 4 +---
gfs2/libgfs2/ondisk.c | 28 +++++-----------------------
gfs2/libgfs2/structures.c | 10 ++++------
4 files changed, 15 insertions(+), 38 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 79a5ec86..b0a75465 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -610,26 +610,25 @@ static int print_statfs(struct gfs2_inode *dis)
static int print_quota(struct gfs2_inode *diq)
{
- struct gfs2_quota qbuf, q;
+ struct gfs2_quota q;
int i, error;
-
+
print_gfs2("quota file contents:");
eol(0);
print_gfs2("quota entries found: %"PRIu64".", diq->i_di.di_size / sizeof(q));
eol(0);
for (i=0; ; i++) {
- error = gfs2_readi(diq, (void *)&qbuf, i * sizeof(q), sizeof(qbuf));
+ error = gfs2_readi(diq, &q, i * sizeof(q), sizeof(q));
if (!error)
break;
- if (error != sizeof(qbuf)) {
+ if (error != sizeof(q)) {
print_gfs2("Error reading quota file.");
eol(0);
return -1;
}
- gfs2_quota_in(&q, (char *)&qbuf);
print_gfs2("Entry #%d", i + 1);
eol(0);
- gfs2_quota_print(&q);
+ lgfs2_quota_print(&q);
}
return 0;
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index e861a8b9..ab4c7320 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -705,8 +705,6 @@ extern void gfs2_rindex_in(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, char *buf);
extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf);
-extern void gfs2_quota_in(struct gfs2_quota *qu, char *buf);
-extern void gfs2_quota_out(struct gfs2_quota *qu, char *buf);
extern void gfs2_dinode_in(struct gfs2_dinode *di, char *buf);
extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf);
extern void gfs2_dirent_in(struct gfs2_dirent *de, char *buf);
@@ -723,12 +721,12 @@ extern void gfs2_meta_header_print(const struct gfs2_meta_header *mh);
extern void gfs2_sb_print(const struct gfs2_sb *sb);
extern void gfs2_rindex_print(const struct gfs2_rindex *ri);
extern void gfs2_rgrp_print(const struct gfs2_rgrp *rg);
-extern void gfs2_quota_print(const struct gfs2_quota *qu);
extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
extern void lgfs2_log_descriptor_print(void *ldp);
+extern void lgfs2_quota_print(void *qp);
extern void lgfs2_quota_change_print(void *qcp);
extern void lgfs2_statfs_change_print(void *scp);
extern void lgfs2_ea_header_print(void *eap);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 1450d973..0e51a582 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -269,31 +269,13 @@ void gfs2_rgrp_print(const struct gfs2_rgrp *rg)
pv(rg, rg_crc, "%"PRIu32, "0x%"PRIx32);
}
-void gfs2_quota_in(struct gfs2_quota *qu, char *buf)
+void lgfs2_quota_print(void *qp)
{
- struct gfs2_quota *str = (struct gfs2_quota *)buf;
+ struct gfs2_quota *q = qp;
- CPIN_64(qu, str, qu_limit);
- CPIN_64(qu, str, qu_warn);
- CPIN_64(qu, str, qu_value);
- CPIN_08(qu, str, qu_reserved, sizeof(qu->qu_reserved));
-}
-
-void gfs2_quota_out(struct gfs2_quota *qu, char *buf)
-{
- struct gfs2_quota *str = (struct gfs2_quota *)buf;
-
- CPOUT_64(qu, str, qu_limit);
- CPOUT_64(qu, str, qu_warn);
- CPOUT_64(qu, str, qu_value);
- memset(qu->qu_reserved, 0, sizeof(qu->qu_reserved));
-}
-
-void gfs2_quota_print(const struct gfs2_quota *qu)
-{
- pv(qu, qu_limit, "%"PRIu64, "0x%"PRIx64);
- pv(qu, qu_warn, "%"PRIu64, "0x%"PRIx64);
- pv(qu, qu_value, "%"PRIu64, "0x%"PRIx64);
+ printbe64(q, qu_limit);
+ printbe64(q, qu_warn);
+ printbe64(q, qu_value);
}
void gfs2_dinode_in(struct gfs2_dinode *di, char *buf)
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 4b25f05a..79d99ba1 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -554,7 +554,6 @@ int build_quota(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip;
struct gfs2_quota qu;
- char buf[sizeof(struct gfs2_quota)];
int count;
ip = createi(sdp->master_dir, "quota", S_IFREG | 0600,
@@ -566,19 +565,18 @@ int build_quota(struct gfs2_sbd *sdp)
bmodified(ip->i_bh);
memset(&qu, 0, sizeof(struct gfs2_quota));
- qu.qu_value = 1;
- gfs2_quota_out(&qu, buf);
+ qu.qu_value = cpu_to_be64(1);
- count = gfs2_writei(ip, buf, ip->i_di.di_size, sizeof(struct gfs2_quota));
+ count = gfs2_writei(ip, &qu, ip->i_di.di_size, sizeof(struct gfs2_quota));
if (count != sizeof(struct gfs2_quota))
return -1;
- count = gfs2_writei(ip, buf, ip->i_di.di_size, sizeof(struct gfs2_quota));
+ count = gfs2_writei(ip, &qu, ip->i_di.di_size, sizeof(struct gfs2_quota));
if (count != sizeof(struct gfs2_quota))
return -1;
if (cfg_debug) {
printf("\nRoot quota:\n");
- gfs2_quota_print(&qu);
+ lgfs2_quota_print(&qu);
}
inode_put(&ip);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 08/40: libgfs2: Convert gfs2_leaf_print to accept
big-endian data
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 411aa2e8f94596b93c1690dfd5e9ae0602a9ce33
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 10:20:02 2021 +0100
libgfs2: Convert gfs2_leaf_print to accept big-endian data
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 4 +---
gfs2/libgfs2/libgfs2.h | 2 +-
gfs2/libgfs2/ondisk.c | 24 +++++++++++++-----------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 8fdc68a0..b8faf33a 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -454,7 +454,6 @@ int display_gfs2(char *buf)
{
struct gfs2_meta_header mh;
struct gfs2_rgrp rg;
- struct gfs2_leaf lf;
struct gfs_log_header lh1;
struct gfs2_log_header lh;
@@ -504,8 +503,7 @@ int display_gfs2(char *buf)
break;
case GFS2_METATYPE_LF:
- gfs2_leaf_in(&lf, buf);
- gfs2_leaf_print(&lf);
+ lgfs2_leaf_print(buf);
break;
case GFS2_METATYPE_JD:
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index acd98d23..e861a8b9 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -725,7 +725,6 @@ extern void gfs2_rindex_print(const struct gfs2_rindex *ri);
extern void gfs2_rgrp_print(const struct gfs2_rgrp *rg);
extern void gfs2_quota_print(const struct gfs2_quota *qu);
extern void gfs2_dinode_print(const struct gfs2_dinode *di);
-extern void gfs2_leaf_print(const struct gfs2_leaf *lf);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
@@ -733,6 +732,7 @@ extern void lgfs2_log_descriptor_print(void *ldp);
extern void lgfs2_quota_change_print(void *qcp);
extern void lgfs2_statfs_change_print(void *scp);
extern void lgfs2_ea_header_print(void *eap);
+extern void lgfs2_leaf_print(void *lfp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index a1ba73c3..1450d973 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -456,17 +456,19 @@ void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf)
CPOUT_08(lf, str, lf_reserved2, 40);
}
-void gfs2_leaf_print(const struct gfs2_leaf *lf)
-{
- gfs2_meta_header_print(&lf->lf_header);
- pv(lf, lf_depth, "%"PRIu16, "0x%"PRIx16);
- pv(lf, lf_entries, "%"PRIu16, "0x%"PRIx16);
- pv(lf, lf_dirent_format, "%"PRIu32, "0x%"PRIx32);
- pv(lf, lf_next, "%"PRIu64, "0x%"PRIx64);
- pv(lf, lf_inode, "%"PRIu64, "0x%"PRIx64);
- pv(lf, lf_dist, "%"PRIu32, "0x%"PRIx32);
- pv(lf, lf_nsec, "%"PRIu32, "0x%"PRIx32);
- pv(lf, lf_sec, "%"PRIu64, "0x%"PRIx64);
+void lgfs2_leaf_print(void *lfp)
+{
+ struct gfs2_leaf *lf = lfp;
+
+ lgfs2_meta_header_print(&lf->lf_header);
+ printbe16(lf, lf_depth);
+ printbe16(lf, lf_entries);
+ printbe32(lf, lf_dirent_format);
+ printbe64(lf, lf_next);
+ printbe64(lf, lf_inode);
+ printbe32(lf, lf_dist);
+ printbe32(lf, lf_nsec);
+ printbe64(lf, lf_sec);
}
void lgfs2_ea_header_print(void *eap)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 07/40: libgfs2: Remove gfs2_ea_header_in
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 018c2b6a81d5c17a50fcb7d338c2248824fdd676
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 20:12:37 2021 +0100
libgfs2: Remove gfs2_ea_header_in
Update users to avoid storing cpu-endian data in an on-disk struct and
remove gfs2_ea_header_in(). Replace the gfs2_ea_header_print() function
with one that expects big-endian data and make it safer against buffer
overruns.
(There is no gfs2_ea_header_out() to remove.)
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 12 +++++++-----
gfs2/edit/savemeta.c | 15 +++++++++------
gfs2/libgfs2/libgfs2.h | 3 +--
gfs2/libgfs2/ondisk.c | 41 ++++++++++++++++++-----------------------
4 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index b1fc1433..8fdc68a0 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -346,19 +346,21 @@ uint64_t do_leaf_extended(char *dlebuf, struct iinfo *indir)
static void do_eattr_extended(char *buf)
{
- struct gfs2_ea_header ea;
+ struct gfs2_ea_header *ea;
+ uint32_t rec_len = 0;
unsigned int x;
eol(0);
print_gfs2("Eattr Entries:");
eol(0);
- for (x = sizeof(struct gfs2_meta_header); x < sbd.bsize;
- x += ea.ea_rec_len)
+ for (x = sizeof(struct gfs2_meta_header); x < sbd.bsize; x += rec_len)
{
eol(0);
- gfs2_ea_header_in(&ea, buf + x);
- gfs2_ea_header_print(&ea, buf + x + sizeof(struct gfs2_ea_header));
+ buf += x;
+ ea = (struct gfs2_ea_header *)buf;
+ lgfs2_ea_header_print(ea);
+ rec_len = be32_to_cpu(ea->ea_rec_len);
}
}
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index e256fa26..e9401e4a 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -694,18 +694,20 @@ static char *check_read_block(int fd, uint64_t blk, uint64_t owner, int *blktype
*/
static void save_ea_block(struct metafd *mfd, char *buf, uint64_t owner)
{
+ struct gfs2_ea_header *ea;
+ uint32_t rec_len = 0;
int e;
- struct gfs2_ea_header ea;
- for (e = sizeof(struct gfs2_meta_header); e < sbd.bsize; e += ea.ea_rec_len) {
+ for (e = sizeof(struct gfs2_meta_header); e < sbd.bsize; e += rec_len) {
uint64_t blk, *b;
int charoff, i;
- gfs2_ea_header_in(&ea, buf + e);
- for (i = 0; i < ea.ea_num_ptrs; i++) {
+ ea = (void *)(buf + e);
+ /* ea_num_ptrs and ea_name_len are u8 so no endianness worries */
+ for (i = 0; i < ea->ea_num_ptrs; i++) {
char *_buf;
- charoff = e + ea.ea_name_len +
+ charoff = e + ea->ea_name_len +
sizeof(struct gfs2_ea_header) +
sizeof(uint64_t) - 1;
charoff /= sizeof(uint64_t);
@@ -718,7 +720,8 @@ static void save_ea_block(struct metafd *mfd, char *buf, uint64_t owner)
free(_buf);
}
}
- if (!ea.ea_rec_len)
+ rec_len = be32_to_cpu(ea->ea_rec_len);
+ if (rec_len == 0)
break;
}
}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 20cb11bf..acd98d23 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -713,7 +713,6 @@ extern void gfs2_dirent_in(struct gfs2_dirent *de, char *buf);
extern void gfs2_dirent_out(struct gfs2_dirent *de, char *buf);
extern void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf);
extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
-extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
@@ -727,13 +726,13 @@ extern void gfs2_rgrp_print(const struct gfs2_rgrp *rg);
extern void gfs2_quota_print(const struct gfs2_quota *qu);
extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_leaf_print(const struct gfs2_leaf *lf);
-extern void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
extern void lgfs2_log_descriptor_print(void *ldp);
extern void lgfs2_quota_change_print(void *qcp);
extern void lgfs2_statfs_change_print(void *scp);
+extern void lgfs2_ea_header_print(void *eap);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 8f28ca6e..a1ba73c3 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -25,6 +25,9 @@
#define printbe64(struct, member) do { \
print_it(" "#member, "%"PRIu64, "0x%"PRIx64, be64_to_cpu(struct->member)); \
} while(0)
+#define print8(struct, member) do { \
+ print_it(" "#member, "%"PRIu8, "0x%"PRIx8, struct->member); \
+ } while(0)
#define CPIN_08(s1, s2, member, count) {memcpy((s1->member), (s2->member), (count));}
#define CPOUT_08(s1, s2, member, count) {memcpy((s2->member), (s1->member), (count));}
@@ -466,31 +469,23 @@ void gfs2_leaf_print(const struct gfs2_leaf *lf)
pv(lf, lf_sec, "%"PRIu64, "0x%"PRIx64);
}
-void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf)
-{
- struct gfs2_ea_header *str = (struct gfs2_ea_header *)buf;
-
- CPIN_32(ea, str, ea_rec_len);
- CPIN_32(ea, str, ea_data_len);
- ea->ea_name_len = str->ea_name_len;
- ea->ea_type = str->ea_type;
- ea->ea_flags = str->ea_flags;
- ea->ea_num_ptrs = str->ea_num_ptrs;
-}
-
-void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name)
+void lgfs2_ea_header_print(void *eap)
{
char buf[GFS2_EA_MAX_NAME_LEN + 1];
-
- pv(ea, ea_rec_len, "%"PRIu32, "0x%"PRIx32);
- pv(ea, ea_data_len, "%"PRIu32, "0x%"PRIx32);
- pv(ea, ea_name_len, "%"PRIu8, "0x%"PRIx8);
- pv(ea, ea_type, "%"PRIu8, "0x%"PRIx8);
- pv(ea, ea_flags, "%"PRIu8, "0x%"PRIx8);
- pv(ea, ea_num_ptrs, "%"PRIu8, "0x%"PRIx8);
-
- memset(buf, 0, GFS2_EA_MAX_NAME_LEN + 1);
- memcpy(buf, name, ea->ea_name_len);
+ struct gfs2_ea_header *ea = eap;
+ unsigned len = ea->ea_name_len;
+
+ printbe32(ea, ea_rec_len);
+ printbe32(ea, ea_data_len);
+ print8(ea, ea_name_len);
+ print8(ea, ea_type);
+ print8(ea, ea_flags);
+ print8(ea, ea_num_ptrs);
+
+ if (len > GFS2_EA_MAX_NAME_LEN)
+ len = GFS2_EA_MAX_NAME_LEN;
+ memcpy(buf, ea + 1, len);
+ buf[len] = '\0';
print_it(" name", "%s", NULL, buf);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 06/40: libgfs2: Remove gfs2_statfs_change_{in,out}
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit ac0aa85c98c66deec9f021b69bf4bcf50f123c05
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 18:44:56 2021 +0100
libgfs2: Remove gfs2_statfs_change_{in,out}
Update users to avoid storing cpu-endian data in an on-disk struct and
remove the functions. Replace the gfs2_statfs_change_print() function
with one that expects big-endian data.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 22 ++++++++++------------
gfs2/edit/extended.c | 11 +++++------
gfs2/fsck/initialize.c | 3 ---
gfs2/fsck/main.c | 32 +++++++++++++++-----------------
gfs2/libgfs2/libgfs2.h | 4 +---
gfs2/libgfs2/ondisk.c | 26 +++++---------------------
gfs2/libgfs2/structures.c | 14 ++++++--------
7 files changed, 42 insertions(+), 70 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index ded2589e..cca60598 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1958,27 +1958,25 @@ static void update_inode_file(struct gfs2_sbd *sdp)
log_debug(_("\nNext Inum: %llu\n"), (unsigned long long)sdp->md.next_inum);
}/* update_inode_file */
-/* ------------------------------------------------------------------------- */
-/* write_statfs_file - write the statfs file */
-/* ------------------------------------------------------------------------- */
+/**
+ * write_statfs_file - write the statfs file
+ */
static void write_statfs_file(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip = sdp->md.statfs;
struct gfs2_statfs_change sc;
- char buf[sizeof(struct gfs2_statfs_change)];
int count;
- sc.sc_total = sdp->blks_total;
- sc.sc_free = sdp->blks_total - sdp->blks_alloced;
- sc.sc_dinodes = sdp->dinodes_alloced;
+ sc.sc_total = cpu_to_be64(sdp->blks_total);
+ sc.sc_free = cpu_to_be64(sdp->blks_total - sdp->blks_alloced);
+ sc.sc_dinodes = cpu_to_be64(sdp->dinodes_alloced);
- gfs2_statfs_change_out(&sc, buf);
- count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
- if (count != sizeof(struct gfs2_statfs_change)) {
- fprintf(stderr, "do_init (2)\n");
+ count = gfs2_writei(ip, &sc, 0, sizeof(sc));
+ if (count != sizeof(sc)) {
+ fprintf(stderr, "Failed to write statfs file\n");
exit(1);
}
-}/* write_statfs_file */
+}
/* ------------------------------------------------------------------------- */
/* remove_obsolete_gfs1 - remove obsolete gfs1 inodes. */
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 30e227d1..79a5ec86 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -588,24 +588,23 @@ static int print_inum(struct gfs2_inode *dii)
static int print_statfs(struct gfs2_inode *dis)
{
- struct gfs2_statfs_change sfb, sfc;
+ struct gfs2_statfs_change sc;
int rc;
-
- rc = gfs2_readi(dis, (void *)&sfb, 0, sizeof(sfb));
+
+ rc = gfs2_readi(dis, (void *)&sc, 0, sizeof(sc));
if (!rc) {
print_gfs2("The statfs file is empty.");
eol(0);
return 0;
}
- if (rc != sizeof(sfb)) {
+ if (rc != sizeof(sc)) {
print_gfs2("Error reading statfs file.");
eol(0);
return -1;
}
- gfs2_statfs_change_in(&sfc, (char *)&sfb);
print_gfs2("statfs file contents:");
eol(0);
- gfs2_statfs_change_print(&sfc);
+ lgfs2_statfs_change_print(&sc);
return 0;
}
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index e35cf0a9..1a6db6ec 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -808,7 +808,6 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
{
uint64_t inumbuf = 0;
char *buf;
- struct gfs2_statfs_change sc;
int err;
/*******************************************************************
@@ -914,8 +913,6 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
free(buf);
goto fail;
}
- /* call gfs2_inum_range_in() to retrieve range */
- gfs2_statfs_change_in(&sc, buf);
free(buf);
}
}
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index a860f6eb..d424e075 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -168,8 +168,10 @@ static int check_statfs(struct gfs2_sbd *sdp)
struct osi_node *n, *next = NULL;
struct rgrp_tree *rgd;
struct gfs2_rindex *ri;
- struct gfs2_statfs_change sc = {0,};
- char buf[sizeof(struct gfs2_statfs_change)];
+ struct gfs2_statfs_change sc;
+ uint64_t sc_total;
+ uint64_t sc_free;
+ uint64_t sc_dinodes;
int count;
if (sdp->gfs1 && !sdp->md.statfs->i_di.di_size) {
@@ -177,14 +179,17 @@ static int check_statfs(struct gfs2_sbd *sdp)
return 0;
}
/* Read the current statfs values */
- count = gfs2_readi(sdp->md.statfs, buf, 0,
+ count = gfs2_readi(sdp->md.statfs, &sc, 0,
sdp->md.statfs->i_di.di_size);
if (count != sizeof(struct gfs2_statfs_change)) {
log_err(_("Failed to read statfs values (%d of %"PRIu64" read)\n"),
count, (uint64_t)sdp->md.statfs->i_di.di_size);
return FSCK_ERROR;
}
- gfs2_statfs_change_in(&sc, buf);
+ sc_total = be64_to_cpu(sc.sc_total);
+ sc_free = be64_to_cpu(sc.sc_free);
+ sc_dinodes = be64_to_cpu(sc.sc_dinodes);
+
/* Calculate the real values from the rgrp information */
sdp->blks_total = 0;
sdp->blks_alloced = 0;
@@ -200,24 +205,17 @@ static int check_statfs(struct gfs2_sbd *sdp)
}
/* See if they match */
- if (sc.sc_total == sdp->blks_total &&
- sc.sc_free == (sdp->blks_total - sdp->blks_alloced) &&
- sc.sc_dinodes == sdp->dinodes_alloced) {
+ if (sc_total == sdp->blks_total &&
+ sc_free == (sdp->blks_total - sdp->blks_alloced) &&
+ sc_dinodes == sdp->dinodes_alloced) {
log_info( _("The statfs file is accurate.\n"));
return 0;
}
log_err( _("The statfs file is wrong:\n\n"));
log_err( _("Current statfs values:\n"));
- log_err( _("blocks: %lld (0x%llx)\n"),
- (unsigned long long)sc.sc_total,
- (unsigned long long)sc.sc_total);
- log_err( _("free: %lld (0x%llx)\n"),
- (unsigned long long)sc.sc_free,
- (unsigned long long)sc.sc_free);
- log_err( _("dinodes: %lld (0x%llx)\n\n"),
- (unsigned long long)sc.sc_dinodes,
- (unsigned long long)sc.sc_dinodes);
-
+ log_err( _("blocks: %"PRId64" (0x%"PRIx64")\n"), sc_total, sc_total);
+ log_err( _("free: %"PRId64" (0x%"PRIx64")\n"), sc_free, sc_free);
+ log_err( _("dinodes: %"PRId64" (0x%"PRIx64")\n\n"), sc_dinodes, sc_dinodes);
log_err( _("Calculated statfs values:\n"));
log_err( _("blocks: %lld (0x%llx)\n"),
(unsigned long long)sdp->blks_total,
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d479ade2..20cb11bf 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -716,8 +716,6 @@ extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
-extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf);
/* Printing functions */
@@ -731,11 +729,11 @@ extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_leaf_print(const struct gfs2_leaf *lf);
extern void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
-extern void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
extern void lgfs2_log_descriptor_print(void *ldp);
extern void lgfs2_quota_change_print(void *qcp);
+extern void lgfs2_statfs_change_print(void *scp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 3b72051a..8f28ca6e 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -569,29 +569,13 @@ void lgfs2_log_descriptor_print(void *ldp)
printbe32(ld, ld_data2);
}
-void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf)
+void lgfs2_statfs_change_print(void *scp)
{
- struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf;
+ struct gfs2_statfs_change *sc = scp;
- CPIN_64(sc, str, sc_total);
- CPIN_64(sc, str, sc_free);
- CPIN_64(sc, str, sc_dinodes);
-}
-
-void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf)
-{
- struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf;
-
- CPOUT_64(sc, str, sc_total);
- CPOUT_64(sc, str, sc_free);
- CPOUT_64(sc, str, sc_dinodes);
-}
-
-void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc)
-{
- pv(sc, sc_total, "%"PRId64, "0x%"PRIx64);
- pv(sc, sc_free, "%"PRId64, "0x%"PRIx64);
- pv(sc, sc_dinodes, "%"PRId64, "0x%"PRIx64);
+ print_it(" sc_total", "%"PRId64, "0x%"PRIx64, be64_to_cpu(sc->sc_total));
+ print_it(" sc_free", "%"PRId64, "0x%"PRIx64, be64_to_cpu(sc->sc_free));
+ print_it(" sc_dinodes", "%"PRId64, "0x%"PRIx64, be64_to_cpu(sc->sc_dinodes));
}
void lgfs2_quota_change_print(void *qcp)
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index d5d12ef1..4b25f05a 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -635,21 +635,19 @@ int do_init_statfs(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip = sdp->md.statfs;
struct gfs2_statfs_change sc;
- char buf[sizeof(struct gfs2_statfs_change)];
int count;
- sc.sc_total = sdp->blks_total;
- sc.sc_free = sdp->blks_total - sdp->blks_alloced;
- sc.sc_dinodes = sdp->dinodes_alloced;
+ sc.sc_total = cpu_to_be64(sdp->blks_total);
+ sc.sc_free = cpu_to_be64(sdp->blks_total - sdp->blks_alloced);
+ sc.sc_dinodes = cpu_to_be64(sdp->dinodes_alloced);
- gfs2_statfs_change_out(&sc, buf);
- count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
- if (count != sizeof(struct gfs2_statfs_change))
+ count = gfs2_writei(ip, &sc, 0, sizeof(sc));
+ if (count != sizeof(sc))
return -1;
if (cfg_debug) {
printf("\nStatfs:\n");
- gfs2_statfs_change_print(&sc);
+ lgfs2_statfs_change_print(&sc);
}
return 0;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 05/40: libgfs2: Remove gfs2_quota_change_{in,out}
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 5fe42ca0139ecde28bee22db9382485b2a0fd23d
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 18:08:45 2021 +0100
libgfs2: Remove gfs2_quota_change_{in,out}
Just one remaining user of these functions so update it to avoid storing
cpu-endian data in an on-disk struct and remove the functions. Replace
the gfs2_quota_change_print() function as before.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 4 +---
gfs2/libgfs2/libgfs2.h | 4 +---
gfs2/libgfs2/ondisk.c | 28 +++++-----------------------
3 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index dc748c52..b1fc1433 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -455,7 +455,6 @@ int display_gfs2(char *buf)
struct gfs2_leaf lf;
struct gfs_log_header lh1;
struct gfs2_log_header lh;
- struct gfs2_quota_change qc;
uint32_t magic;
@@ -538,8 +537,7 @@ int display_gfs2(char *buf)
break;
case GFS2_METATYPE_QC:
- gfs2_quota_change_in(&qc, buf);
- gfs2_quota_change_print(&qc);
+ lgfs2_quota_change_print(buf);
break;
default:
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 7ef9fcc7..d479ade2 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -718,8 +718,6 @@ extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf);
extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf);
-extern void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf);
/* Printing functions */
@@ -734,10 +732,10 @@ extern void gfs2_leaf_print(const struct gfs2_leaf *lf);
extern void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
extern void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc);
-extern void gfs2_quota_change_print(const struct gfs2_quota_change *qc);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
extern void lgfs2_log_descriptor_print(void *ldp);
+extern void lgfs2_quota_change_print(void *qcp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index c1602766..3b72051a 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -594,30 +594,12 @@ void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc)
pv(sc, sc_dinodes, "%"PRId64, "0x%"PRIx64);
}
-void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf)
+void lgfs2_quota_change_print(void *qcp)
{
- struct gfs2_quota_change *str = (struct gfs2_quota_change *)(buf +
- sizeof(struct gfs2_meta_header));
+ struct gfs2_quota_change *qc = qcp;
- CPIN_64(qc, str, qc_change);
- CPIN_32(qc, str, qc_flags);
- CPIN_32(qc, str, qc_id);
-}
-
-void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf)
-{
- struct gfs2_quota_change *str = (struct gfs2_quota_change *)(buf +
- sizeof(struct gfs2_meta_header));
-
- CPOUT_64(qc, str, qc_change);
- CPOUT_32(qc, str, qc_flags);
- CPOUT_32(qc, str, qc_id);
-}
-
-void gfs2_quota_change_print(const struct gfs2_quota_change *qc)
-{
- pv(qc, qc_change, "%"PRId64, "0x%"PRIx64);
- pv(qc, qc_flags, "0x%.8"PRIX32, NULL);
- pv(qc, qc_id, "%"PRIu32, "0x%"PRIx32);
+ print_it(" qc_change", "%"PRId64, "0x%"PRIx64, be64_to_cpu(qc->qc_change));
+ print_it(" qc_flags", "0x%.8"PRIX32, NULL, be32_to_cpu(qc->qc_flags));
+ printbe32(qc, qc_id);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 04/40: libgfs2: Remove gfs2_log_descriptor_{in,out}
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit 2b6ca657e58c7df31069fd32f9257bdbee83abcf
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 17:57:07 2021 +0100
libgfs2: Remove gfs2_log_descriptor_{in,out}
Just one remaining user of these functions so update it to avoid storing
cpu-endian data in an on-disk struct and remove the functions.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/journal.c | 18 ++++++++++--------
gfs2/libgfs2/libgfs2.h | 2 --
gfs2/libgfs2/ondisk.c | 26 --------------------------
3 files changed, 10 insertions(+), 36 deletions(-)
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index 859919aa..e8b71dc5 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -367,9 +367,12 @@ static int process_ld(uint64_t abs_block, uint64_t wrappt, uint64_t j_size,
struct rgrp_tree *rgd, int *prnt, uint64_t *bblk_off)
{
uint64_t *b;
- struct gfs2_log_descriptor ld;
+ struct gfs2_log_descriptor *ld = (void *)buf;
int ltndx, is_meta_ld = 0;
int ld_blocks = 0;
+ uint32_t ld_type = be32_to_cpu(ld->ld_type);
+ uint32_t ld_length = be32_to_cpu(ld->ld_length);
+ uint32_t ld_data1 = be32_to_cpu(ld->ld_data1);
uint32_t logtypes[2][6] = {
{GFS2_LOG_DESC_METADATA, GFS2_LOG_DESC_REVOKE,
GFS2_LOG_DESC_JDATA, 0, 0, 0},
@@ -381,7 +384,6 @@ static int process_ld(uint64_t abs_block, uint64_t wrappt, uint64_t j_size,
{"Metadata", "Unlinked inode", "Dealloc inode",
"Quota", "Final Entry", "Unknown"}};
- gfs2_log_descriptor_in(&ld, buf);
if (sbd.gfs1)
b = (uint64_t *)(buf + sizeof(struct gfs_log_descriptor));
else
@@ -391,21 +393,21 @@ static int process_ld(uint64_t abs_block, uint64_t wrappt, uint64_t j_size,
if (*prnt) {
print_gfs2("0x%"PRIx64" (j+%4"PRIx64"): Log descriptor, ",
abs_block, ((jb + wrappt) % j_size) / sbd.bsize);
- print_gfs2("type %d ", ld.ld_type);
+ print_gfs2("type %"PRIu32" ", ld_type);
for (ltndx = 0;; ltndx++) {
- if (ld.ld_type == logtypes[sbd.gfs1][ltndx] ||
+ if (ld_type == logtypes[sbd.gfs1][ltndx] ||
logtypes[sbd.gfs1][ltndx] == 0)
break;
}
print_gfs2("(%s) ", logtypestr[sbd.gfs1][ltndx]);
- print_gfs2("len:%u, data1: %u", ld.ld_length, ld.ld_data1);
+ print_gfs2("len:%"PRIu32", data1: %"PRIu32, ld_length, ld_data1);
eol(0);
print_gfs2(" ");
}
- ld_blocks = ld.ld_data1;
- if (ld.ld_type == GFS2_LOG_DESC_METADATA ||
- ld.ld_type == GFS_LOG_DESC_METADATA)
+ ld_blocks = ld_data1;
+ if (ld_type == GFS2_LOG_DESC_METADATA ||
+ ld_type == GFS_LOG_DESC_METADATA)
is_meta_ld = 1;
ld_blocks -= print_ld_blks(b, (buf + sbd.bsize), line, tblk, tblk_off,
bitblk, rgd, abs_block, *prnt, bblk_off,
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 744c63c8..7ef9fcc7 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -716,8 +716,6 @@ extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
-extern void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf);
-extern void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf);
extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf);
extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf);
extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf);
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index ab393715..c1602766 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -558,32 +558,6 @@ void gfs2_log_header_print(const struct gfs2_log_header *lh)
pv(lh, lh_local_dinodes, "%"PRId64, "0x%"PRIx64);
}
-void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf)
-{
- struct gfs2_log_descriptor *str = (struct gfs2_log_descriptor *)buf;
-
- gfs2_meta_header_in(&ld->ld_header, buf);
- CPIN_32(ld, str, ld_type);
- CPIN_32(ld, str, ld_length);
- CPIN_32(ld, str, ld_data1);
- CPIN_32(ld, str, ld_data2);
-
- CPIN_08(ld, str, ld_reserved, 32);
-}
-
-void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf)
-{
- struct gfs2_log_descriptor *str = (struct gfs2_log_descriptor *)buf;
-
- gfs2_meta_header_out(&ld->ld_header, buf);
- CPOUT_32(ld, str, ld_type);
- CPOUT_32(ld, str, ld_length);
- CPOUT_32(ld, str, ld_data1);
- CPOUT_32(ld, str, ld_data2);
-
- CPOUT_08(ld, str, ld_reserved, 32);
-}
-
void lgfs2_log_descriptor_print(void *ldp)
{
struct gfs2_log_descriptor *ld = ldp;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months
[gfs2-utils] 03/40: libgfs2: Expect big-endian data when printing log
descriptors
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-sparse
in repository gfs2-utils.
commit f42aeb72838d24e14685c8edc41db5afa9f20464
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 17:39:11 2021 +0100
libgfs2: Expect big-endian data when printing log descriptors
Replace gfs2_log_descriptor_print() with a function that accepts
big-endian data instead of a struct that has been pre-converted.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 4 +---
gfs2/libgfs2/libgfs2.h | 2 +-
gfs2/libgfs2/ondisk.c | 14 ++++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 5e79009a..dc748c52 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -455,7 +455,6 @@ int display_gfs2(char *buf)
struct gfs2_leaf lf;
struct gfs_log_header lh1;
struct gfs2_log_header lh;
- struct gfs2_log_descriptor ld;
struct gfs2_quota_change qc;
uint32_t magic;
@@ -523,8 +522,7 @@ int display_gfs2(char *buf)
break;
case GFS2_METATYPE_LD:
- gfs2_log_descriptor_in(&ld, buf);
- gfs2_log_descriptor_print(&ld);
+ lgfs2_log_descriptor_print(buf);
break;
case GFS2_METATYPE_EA:
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 8c49d150..744c63c8 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -735,11 +735,11 @@ extern void gfs2_dinode_print(const struct gfs2_dinode *di);
extern void gfs2_leaf_print(const struct gfs2_leaf *lf);
extern void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name);
extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
-extern void gfs2_log_descriptor_print(const struct gfs2_log_descriptor *ld);
extern void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc);
extern void gfs2_quota_change_print(const struct gfs2_quota_change *qc);
/* These expect on-disk data instead of native-endian structs */
extern void lgfs2_meta_header_print(void *mhp);
+extern void lgfs2_log_descriptor_print(void *ldp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index c4ce16b1..ab393715 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -584,13 +584,15 @@ void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf)
CPOUT_08(ld, str, ld_reserved, 32);
}
-void gfs2_log_descriptor_print(const struct gfs2_log_descriptor *ld)
+void lgfs2_log_descriptor_print(void *ldp)
{
- gfs2_meta_header_print(&ld->ld_header);
- pv(ld, ld_type, "%"PRIu32, "0x%"PRIx32);
- pv(ld, ld_length, "%"PRIu32, "0x%"PRIx32);
- pv(ld, ld_data1, "%"PRIu32, "0x%"PRIx32);
- pv(ld, ld_data2, "%"PRIu32, "0x%"PRIx32);
+ struct gfs2_log_descriptor *ld = ldp;
+
+ lgfs2_meta_header_print(&ld->ld_header);
+ printbe32(ld, ld_type);
+ printbe32(ld, ld_length);
+ printbe32(ld, ld_data1);
+ printbe32(ld, ld_data2);
}
void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 10 months