* [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h
@ 2021-04-19 19:11 Andrew Price
2021-04-19 19:11 ` [Cluster-devel] [PATCH 1/8] " Andrew Price
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw)
To: cluster-devel.redhat.com
v1: https://listman.redhat.com/archives/cluster-devel/2019-April/msg00021.html
My previous attempt at this did a search+replace to satisfy the field types in gfs2_ondisk.h, which was a little OTT. This attempt adds a linux/types.h that gfs2_ondisk.h will pick up instead of the kernel one.
Having our own gfs2_ondisk.h means that we can support new gfs2 features unconditionally and more easily experiment with on-disk changes; we can use the PRI* macros from inttypes.h for consistent string formatting (appease -Wformat) across architectures, and it gets us closer to being able to compile gfs2-utils on non-linux systems.
Andy
Andrew Price (8):
Import linux/gfs2_ondisk.h
Remove HAS_UUID conditionals
Remove GFS2_HAS_LEAF_HINTS conditionals
Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals
Remove GFS2_HAS_RG_SKIP conditionals
Remove GFS2_HAS_RG_RI_FIELDS conditionals
Remove GFS2_HAS_LH_V2 conditionals
Use PRI* when printing gfs2 structures
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/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 | 6 +-
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, 773 insertions(+), 461 deletions(-)
create mode 100644 gfs2/include/gfs2_ondisk.h
create mode 100644 gfs2/include/linux/types.h
--
2.30.2
^ permalink raw reply [flat|nested] 16+ messages in thread* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:35 ` Andreas Gruenbacher 2021-04-19 19:11 ` [Cluster-devel] [PATCH 2/8] Remove HAS_UUID conditionals Andrew Price ` (7 subsequent siblings) 8 siblings, 1 reply; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com 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@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/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 | 3 +- 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, 577 insertions(+), 32 deletions(-) create mode 100644 gfs2/include/gfs2_ondisk.h create mode 100644 gfs2/include/linux/types.h 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..4b92abe7 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 \ + gfs2_ondisk.h \ + linux/types.h \ logging.h diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h new file mode 100644 index 00000000..fc948f89 --- /dev/null +++ b/gfs2/include/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@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..6346b74a 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -8,13 +8,12 @@ #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> #include <mntent.h> -#include <linux/gfs2_ondisk.h> +#include <gfs2_ondisk.h> #include "osi_list.h" #include "osi_tree.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" -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-19 19:11 ` [Cluster-devel] [PATCH 1/8] " Andrew Price @ 2021-04-19 19:35 ` Andreas Gruenbacher 2021-04-19 20:47 ` Andrew Price 0 siblings, 1 reply; 16+ messages in thread From: Andreas Gruenbacher @ 2021-04-19 19:35 UTC (permalink / raw) To: cluster-devel.redhat.com Andy, On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: > diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h > new file mode 100644 > index 00000000..fc948f89 > --- /dev/null > +++ b/gfs2/include/gfs2_ondisk.h any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? Thanks, Andreas ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-19 19:35 ` Andreas Gruenbacher @ 2021-04-19 20:47 ` Andrew Price 2021-04-20 6:00 ` Andreas Gruenbacher 0 siblings, 1 reply; 16+ messages in thread From: Andrew Price @ 2021-04-19 20:47 UTC (permalink / raw) To: cluster-devel.redhat.com On 19/04/2021 20:35, Andreas Gruenbacher wrote: > Andy, > > On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: >> diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h >> new file mode 100644 >> index 00000000..fc948f89 >> --- /dev/null >> +++ b/gfs2/include/gfs2_ondisk.h > > any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? I didn't feel it was needed, but it does have the benefit of making sure we're not picking up the system linux/gfs2_ondisk.h when we #include <gfs2_ondisk.h> and it shows clearly that we're not trying to. Andy ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-19 20:47 ` Andrew Price @ 2021-04-20 6:00 ` Andreas Gruenbacher 2021-04-20 8:34 ` Andrew Price 0 siblings, 1 reply; 16+ messages in thread From: Andreas Gruenbacher @ 2021-04-20 6:00 UTC (permalink / raw) To: cluster-devel.redhat.com On Mon, Apr 19, 2021 at 10:47 PM Andrew Price <anprice@redhat.com> wrote: > On 19/04/2021 20:35, Andreas Gruenbacher wrote: > > Andy, > > > > On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: > >> diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h > >> new file mode 100644 > >> index 00000000..fc948f89 > >> --- /dev/null > >> +++ b/gfs2/include/gfs2_ondisk.h > > > > any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? > > I didn't feel it was needed, but it does have the benefit of making sure > we're not picking up the system linux/gfs2_ondisk.h when we #include > <gfs2_ondisk.h> and it shows clearly that we're not trying to. Well, we have "-I$(top_srcdir)/gfs2/include" in CPPFLAGS so gfs2/include/linux/types.h is picked up by <linux/types.h>. We already rely on that working. So gfs2/include/linux/gfs2_ondisk.h would be picked up by <linux/gfs2_ondisk.h> already anyway. Andreas ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-20 6:00 ` Andreas Gruenbacher @ 2021-04-20 8:34 ` Andrew Price 2021-04-20 9:07 ` Andreas Gruenbacher 0 siblings, 1 reply; 16+ messages in thread From: Andrew Price @ 2021-04-20 8:34 UTC (permalink / raw) To: cluster-devel.redhat.com On 20/04/2021 07:00, Andreas Gruenbacher wrote: > On Mon, Apr 19, 2021 at 10:47 PM Andrew Price <anprice@redhat.com> wrote: >> On 19/04/2021 20:35, Andreas Gruenbacher wrote: >>> Andy, >>> >>> On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: >>>> diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h >>>> new file mode 100644 >>>> index 00000000..fc948f89 >>>> --- /dev/null >>>> +++ b/gfs2/include/gfs2_ondisk.h >>> >>> any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? >> >> I didn't feel it was needed, but it does have the benefit of making sure >> we're not picking up the system linux/gfs2_ondisk.h when we #include >> <gfs2_ondisk.h> and it shows clearly that we're not trying to. > > Well, we have "-I$(top_srcdir)/gfs2/include" in CPPFLAGS so > gfs2/include/linux/types.h is picked up by <linux/types.h>. We already > rely on that working. So gfs2/include/linux/gfs2_ondisk.h would be > picked up by <linux/gfs2_ondisk.h> already anyway. So, what would be the advantage of having gfs2_ondisk.h in gfs2/include/linux/? I put types.h in that directory because I didn't want to change the #include statement, but I didn't see a reason to put gfs2_ondisk.h in there. Andy ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-20 8:34 ` Andrew Price @ 2021-04-20 9:07 ` Andreas Gruenbacher 2021-04-20 9:47 ` Andrew Price 0 siblings, 1 reply; 16+ messages in thread From: Andreas Gruenbacher @ 2021-04-20 9:07 UTC (permalink / raw) To: cluster-devel.redhat.com On Tue, Apr 20, 2021 at 10:34 AM Andrew Price <anprice@redhat.com> wrote: > On 20/04/2021 07:00, Andreas Gruenbacher wrote: > > On Mon, Apr 19, 2021 at 10:47 PM Andrew Price <anprice@redhat.com> wrote: > >> On 19/04/2021 20:35, Andreas Gruenbacher wrote: > >>> Andy, > >>> > >>> On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: > >>>> diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h > >>>> new file mode 100644 > >>>> index 00000000..fc948f89 > >>>> --- /dev/null > >>>> +++ b/gfs2/include/gfs2_ondisk.h > >>> > >>> any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? > >> > >> I didn't feel it was needed, but it does have the benefit of making sure > >> we're not picking up the system linux/gfs2_ondisk.h when we #include > >> <gfs2_ondisk.h> and it shows clearly that we're not trying to. > > > > Well, we have "-I$(top_srcdir)/gfs2/include" in CPPFLAGS so > > gfs2/include/linux/types.h is picked up by <linux/types.h>. We already > > rely on that working. So gfs2/include/linux/gfs2_ondisk.h would be > > picked up by <linux/gfs2_ondisk.h> already anyway. > > So, what would be the advantage of having gfs2_ondisk.h in > gfs2/include/linux/? I put types.h in that directory because I didn't > want to change the #include statement, but I didn't see a reason to put > gfs2_ondisk.h in there. It's more consistent if the definitions are always included as <linux/gfs2_ondisk.h> by the kernel and by all user-space programs. Andreas ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 1/8] Import linux/gfs2_ondisk.h 2021-04-20 9:07 ` Andreas Gruenbacher @ 2021-04-20 9:47 ` Andrew Price 0 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-20 9:47 UTC (permalink / raw) To: cluster-devel.redhat.com On 20/04/2021 10:07, Andreas Gruenbacher wrote: > On Tue, Apr 20, 2021 at 10:34 AM Andrew Price <anprice@redhat.com> wrote: >> On 20/04/2021 07:00, Andreas Gruenbacher wrote: >>> On Mon, Apr 19, 2021 at 10:47 PM Andrew Price <anprice@redhat.com> wrote: >>>> On 19/04/2021 20:35, Andreas Gruenbacher wrote: >>>>> Andy, >>>>> >>>>> On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: >>>>>> diff --git a/gfs2/include/gfs2_ondisk.h b/gfs2/include/gfs2_ondisk.h >>>>>> new file mode 100644 >>>>>> index 00000000..fc948f89 >>>>>> --- /dev/null >>>>>> +++ b/gfs2/include/gfs2_ondisk.h >>>>> >>>>> any reason why this file shouldn't be at gfs2/include/linux/gfs2_ondisk.h? >>>> >>>> I didn't feel it was needed, but it does have the benefit of making sure >>>> we're not picking up the system linux/gfs2_ondisk.h when we #include >>>> <gfs2_ondisk.h> and it shows clearly that we're not trying to. >>> >>> Well, we have "-I$(top_srcdir)/gfs2/include" in CPPFLAGS so >>> gfs2/include/linux/types.h is picked up by <linux/types.h>. We already >>> rely on that working. So gfs2/include/linux/gfs2_ondisk.h would be >>> picked up by <linux/gfs2_ondisk.h> already anyway. >> >> So, what would be the advantage of having gfs2_ondisk.h in >> gfs2/include/linux/? I put types.h in that directory because I didn't >> want to change the #include statement, but I didn't see a reason to put >> gfs2_ondisk.h in there. > > It's more consistent if the definitions are always included as > <linux/gfs2_ondisk.h> by the kernel and by all user-space programs. Hmm, I guess. I've moved it into gfs2/include/linux/ in my local branch and I'll push it with that change later, barring objections. Andy ^ permalink raw reply [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 2/8] Remove HAS_UUID conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 1/8] " Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 3/8] Remove GFS2_HAS_LEAF_HINTS conditionals Andrew Price ` (6 subsequent siblings) 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com 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@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) -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 3/8] Remove GFS2_HAS_LEAF_HINTS conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 1/8] " Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 2/8] Remove HAS_UUID conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 4/8] Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals Andrew Price ` (5 subsequent siblings) 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com Our own gfs2_ondisk.h has leaf hints so there's no need for these conditionals. Signed-off-by: Andrew Price <anprice@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) -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 4/8] Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (2 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 3/8] Remove GFS2_HAS_LEAF_HINTS conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 5/8] Remove GFS2_HAS_RG_SKIP conditionals Andrew Price ` (4 subsequent siblings) 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com 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@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) -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 5/8] Remove GFS2_HAS_RG_SKIP conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (3 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 4/8] Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 6/8] Remove GFS2_HAS_RG_RI_FIELDS conditionals Andrew Price ` (3 subsequent siblings) 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com Our own gfs2_ondisk.h has rg_skip so there's no need for these conditionals. Signed-off-by: Andrew Price <anprice@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; -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 6/8] Remove GFS2_HAS_RG_RI_FIELDS conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (4 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 5/8] Remove GFS2_HAS_RG_SKIP conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 7/8] Remove GFS2_HAS_LH_V2 conditionals Andrew Price ` (2 subsequent siblings) 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com Our own gfs2_ondisk.h has the new rgrp fields so there's no need for these conditionals. Signed-off-by: Andrew Price <anprice@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; -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 7/8] Remove GFS2_HAS_LH_V2 conditionals 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (5 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 6/8] Remove GFS2_HAS_RG_RI_FIELDS conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 8/8] Use PRI* when printing gfs2 structures Andrew Price 2021-04-19 19:31 ` [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andreas Gruenbacher 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com Our own gfs2_ondisk.h has v2 log headers so there's no need for these conditionals. There aren't any users of gfs2_log_header_v1_*() functions so fold those into gfs2_log_header*(). Signed-off-by: Andrew Price <anprice@redhat.com> --- configure.ac | 2 -- gfs2/libgfs2/libgfs2.h | 3 --- gfs2/libgfs2/meta.c | 4 ---- gfs2/libgfs2/ondisk.c | 35 +++-------------------------------- gfs2/libgfs2/recovery.c | 2 -- gfs2/libgfs2/structures.c | 16 ++-------------- gfs2/mkfs/main_jadd.c | 9 +-------- 7 files changed, 6 insertions(+), 65 deletions(-) diff --git a/configure.ac b/configure.ac index e356199c..bb85d65c 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_log_header.lh_crc],[AC_DEFINE([GFS2_HAS_LH_V2],[],[v2 log header format])], - [], [[#include <linux/gfs2_ondisk.h>]]) # *FLAGS handling ENV_CFLAGS="$CFLAGS" diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 6346b74a..b59b72b7 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -715,9 +715,7 @@ 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_v1_in(struct gfs2_log_header *lh, char *buf); extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf); -extern void gfs2_log_header_v1_out(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); @@ -737,7 +735,6 @@ 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_v1_print(const struct gfs2_log_header *lh); 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); diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c index 771b1f13..db5f37b1 100644 --- a/gfs2/libgfs2/meta.c +++ b/gfs2/libgfs2/meta.c @@ -69,7 +69,6 @@ const unsigned lgfs2_di_flag_size = ARRAY_SIZE(lgfs2_di_flags); const struct lgfs2_symbolic lgfs2_lh_flags[] = { PREFIX_SYM(GFS2_LOG_HEAD_, UNMOUNT) -#ifdef GFS2_HAS_LH_V2 PREFIX_SYM(GFS2_LOG_HEAD_FLUSH_, NORMAL) PREFIX_SYM(GFS2_LOG_HEAD_FLUSH_, SYNC) PREFIX_SYM(GFS2_LOG_HEAD_FLUSH_, SHUTDOWN) @@ -97,7 +96,6 @@ PREFIX_SYM(GFS2_LFC_, EVICT_INODE) PREFIX_SYM(GFS2_LFC_, TRANS_END) PREFIX_SYM(GFS2_LFC_, LOGD_JFLUSH_REQD) PREFIX_SYM(GFS2_LFC_, LOGD_AIL_FLUSH_REQD) -#endif }; const unsigned int lgfs2_lh_flag_size = ARRAY_SIZE(lgfs2_lh_flags); @@ -381,7 +379,6 @@ F(lh_flags, .flags = LGFS2_MFF_MASK, .symtab = lgfs2_lh_flags, .nsyms = ARRAY_SI F(lh_tail) F(lh_blkno) F(lh_hash, .flags = LGFS2_MFF_CHECK) -#ifdef GFS2_HAS_LH_V2 F(lh_crc, .flags = LGFS2_MFF_CHECK) F(lh_nsec, .flags = LGFS2_MFF_NSECS) F(lh_sec, .flags = LGFS2_MFF_SECS) @@ -392,7 +389,6 @@ FP(lh_quota_addr, .points_to = (1 << LGFS2_MT_GFS2_DINODE)) F(lh_local_total, .flags = LGFS2_MFF_FSBLOCKS) F(lh_local_free, .flags = LGFS2_MFF_FSBLOCKS) F(lh_local_dinodes, .flags = LGFS2_MFF_FSBLOCKS) -#endif }; #undef STRUCT diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c index 157f3358..0d68de8f 100644 --- a/gfs2/libgfs2/ondisk.c +++ b/gfs2/libgfs2/ondisk.c @@ -476,7 +476,7 @@ void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name) print_it(" name", "%s", NULL, buf); } -void gfs2_log_header_v1_in(struct gfs2_log_header *lh, char *buf) +void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) { struct gfs2_log_header *str = (struct gfs2_log_header *)buf; @@ -486,15 +486,6 @@ void gfs2_log_header_v1_in(struct gfs2_log_header *lh, char *buf) CPIN_32(lh, str, lh_tail); CPIN_32(lh, str, lh_blkno); CPIN_32(lh, str, lh_hash); -} - -void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) -{ - gfs2_log_header_v1_in(lh, buf); -#ifdef GFS2_HAS_LH_V2 - { - struct gfs2_log_header *str = (struct gfs2_log_header *)buf; - CPIN_32(lh, str, lh_crc); CPIN_32(lh, str, lh_nsec); CPIN_64(lh, str, lh_sec); @@ -505,11 +496,9 @@ void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) CPIN_64(lh, str, lh_local_total); CPIN_64(lh, str, lh_local_free); CPIN_64(lh, str, lh_local_dinodes); - } -#endif } -void gfs2_log_header_v1_out(struct gfs2_log_header *lh, char *buf) +void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf) { struct gfs2_log_header *str = (struct gfs2_log_header *)buf; @@ -519,15 +508,6 @@ void gfs2_log_header_v1_out(struct gfs2_log_header *lh, char *buf) CPOUT_32(lh, str, lh_tail); CPOUT_32(lh, str, lh_blkno); CPOUT_32(lh, str, lh_hash); -} - -void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf) -{ - gfs2_log_header_v1_out(lh, buf); -#ifdef GFS2_HAS_LH_V2 - { - struct gfs2_log_header *str = (struct gfs2_log_header *)buf; - CPOUT_32(lh, str, lh_crc); CPOUT_32(lh, str, lh_nsec); CPOUT_64(lh, str, lh_sec); @@ -538,11 +518,9 @@ void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf) CPOUT_64(lh, str, lh_local_total); CPOUT_64(lh, str, lh_local_free); CPOUT_64(lh, str, lh_local_dinodes); - } -#endif } -void gfs2_log_header_v1_print(const struct gfs2_log_header *lh) +void gfs2_log_header_print(const struct gfs2_log_header *lh) { gfs2_meta_header_print(&lh->lh_header); pv(lh, lh_sequence, "%llu", "0x%llx"); @@ -550,12 +528,6 @@ void gfs2_log_header_v1_print(const struct gfs2_log_header *lh) pv(lh, lh_tail, "%u", "0x%x"); pv(lh, lh_blkno, "%u", "0x%x"); pv(lh, lh_hash, "0x%.8X", NULL); -} - -void gfs2_log_header_print(const struct gfs2_log_header *lh) -{ - gfs2_log_header_v1_print(lh); -#ifdef GFS2_HAS_LH_V2 pv(lh, lh_crc, "0x%.8X", NULL); pv(lh, lh_nsec, "%u", "0x%x"); pv(lh, lh_sec, "%llu", "0x%llx"); @@ -566,7 +538,6 @@ void gfs2_log_header_print(const struct gfs2_log_header *lh) pv(lh, lh_local_total, "%lld", "0x%llx"); pv(lh, lh_local_free, "%lld", "0x%llx"); pv(lh, lh_local_dinodes, "%lld", "0x%llx"); -#endif } void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf) diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c index b711cdfa..78136ac2 100644 --- a/gfs2/libgfs2/recovery.c +++ b/gfs2/libgfs2/recovery.c @@ -72,9 +72,7 @@ int get_log_header(struct gfs2_inode *ip, unsigned int blk, crc = lgfs2_log_header_crc(bh->b_data, ip->i_sbd->bsize); gfs2_log_header_in(&lh, bh->b_data); brelse(bh); -#ifdef GFS2_HAS_LH_V2 lh_crc = lh.lh_crc; -#endif if (error || lh.lh_blkno != blk || lh.lh_hash != hash) return 1; /* Don't check the crc if it's zero, as it is in pre-v2 log headers */ diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c index 789b9a63..d5d12ef1 100644 --- a/gfs2/libgfs2/structures.c +++ b/gfs2/libgfs2/structures.c @@ -107,15 +107,11 @@ uint32_t lgfs2_log_header_hash(char *buf) uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize) { -#ifdef GFS2_HAS_LH_V2 /* lh_crc CRCs the rest of the block starting after lh_crc */ const off_t v1_end = offsetof(struct gfs2_log_header, lh_hash) + 4; const unsigned char *lb = (const unsigned char *)buf; return crc32c(~0, lb + v1_end + 4, bsize - v1_end - 4); -#else - return 0; -#endif } /** @@ -135,7 +131,6 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip) .lh_tail = 0, .lh_blkno = 0, .lh_hash = 0, -#ifdef GFS2_HAS_LH_V2 .lh_flags = GFS2_LOG_HEAD_UNMOUNT | GFS2_LOG_HEAD_USERSPACE, .lh_crc = 0, .lh_nsec = 0, @@ -146,9 +141,6 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip) .lh_local_total = 0, .lh_local_free = 0, .lh_local_dinodes = 0, -#else - .lh_flags = GFS2_LOG_HEAD_UNMOUNT, -#endif }; struct gfs2_sbd *sdp = ip->i_sbd; unsigned blocks = (ip->i_di.di_size + sdp->bsize - 1) / sdp->bsize; @@ -170,10 +162,9 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip) gfs2_log_header_out(&lh, buf); buflh->lh_hash = cpu_to_be32(lgfs2_log_header_hash(buf)); -#ifdef GFS2_HAS_LH_V2 buflh->lh_addr = cpu_to_be64(jblk); buflh->lh_crc = cpu_to_be32(lgfs2_log_header_crc(buf, sdp->bsize)); -#endif + if (pwrite(sdp->device_fd, buf, sdp->bsize, jblk * sdp->bsize) != sdp->bsize) { free(buf); return -1; @@ -230,10 +221,9 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks) lh.lh_header.mh_type = GFS2_METATYPE_LH; lh.lh_header.mh_format = GFS2_FORMAT_LH; lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT; -#ifdef GFS2_HAS_LH_V2 lh.lh_flags |= GFS2_LOG_HEAD_USERSPACE; lh.lh_jinode = jnl->i_di.di_num.no_addr; -#endif + for (x = 0; x < blocks; x++) { struct gfs2_buffer_head *bh = get_file_buf(jnl, x, 1); if (!bh) @@ -253,11 +243,9 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks) gfs2_log_header_out(&lh, bh->b_data); hash = lgfs2_log_header_hash(bh->b_data); ((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash); -#ifdef GFS2_HAS_LH_V2 ((struct gfs2_log_header *)bh->b_data)->lh_addr = cpu_to_be64(bh->b_blocknr); hash = lgfs2_log_header_crc(bh->b_data, bsize); ((struct gfs2_log_header *)bh->b_data)->lh_crc = cpu_to_be32(hash); -#endif bmodified(bh); brelse(bh); diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c index 33bd5127..bad7db25 100644 --- a/gfs2/mkfs/main_jadd.c +++ b/gfs2/mkfs/main_jadd.c @@ -456,7 +456,6 @@ out: return ret; } -#ifdef GFS2_HAS_LH_V2 static uint64_t find_block_address(int fd, off_t offset, unsigned bsize) { struct { @@ -477,7 +476,6 @@ static uint64_t find_block_address(int fd, off_t offset, unsigned bsize) } return fme.fe.fe_physical / bsize; } -#endif static int alloc_new_journal(int fd, unsigned bytes) { @@ -551,21 +549,17 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts) lh.lh_header.mh_type = GFS2_METATYPE_LH; lh.lh_header.mh_format = GFS2_FORMAT_LH; lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT; -#ifdef GFS2_HAS_LH_V2 lh.lh_flags |= GFS2_LOG_HEAD_USERSPACE; lh.lh_jinode = addr; -#endif + for (x=0; x<blocks; x++) { uint32_t hash; -#ifdef GFS2_HAS_LH_V2 uint64_t blk_addr = 0; -#endif lh.lh_sequence = seq; lh.lh_blkno = x; gfs2_log_header_out(&lh, buf); hash = lgfs2_log_header_hash(buf); ((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash); -#ifdef GFS2_HAS_LH_V2 if (!(blk_addr = find_block_address(fd, off, sdp->bsize))) { error = -1; goto close_fd; @@ -573,7 +567,6 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts) ((struct gfs2_log_header *)buf)->lh_addr = cpu_to_be64(blk_addr); hash = lgfs2_log_header_crc(buf, sdp->bsize); ((struct gfs2_log_header *)buf)->lh_crc = cpu_to_be32(hash); -#endif if (write(fd, buf, sdp->bsize) != sdp->bsize) { perror("add_j write"); error = -1; -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH 8/8] Use PRI* when printing gfs2 structures 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (6 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 7/8] Remove GFS2_HAS_LH_V2 conditionals Andrew Price @ 2021-04-19 19:11 ` Andrew Price 2021-04-19 19:31 ` [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andreas Gruenbacher 8 siblings, 0 replies; 16+ messages in thread From: Andrew Price @ 2021-04-19 19:11 UTC (permalink / raw) To: cluster-devel.redhat.com Now that we have gfs2 structs defined in terms of standard userspace types instead of kernel types we can use these defines from inttypes.h to print their fields in a consistent way across architectures. Fixes a number of -Wformat warnings on x86_64. Signed-off-by: Andrew Price <anprice@redhat.com> --- gfs2/edit/extended.c | 37 ++++----- gfs2/edit/gfs2hex.c | 28 +++---- gfs2/edit/journal.c | 13 ++- 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/libgfs2/ondisk.c | 168 +++++++++++++++++++-------------------- 10 files changed, 170 insertions(+), 187 deletions(-) diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c index 91609bd2..30e227d1 100644 --- a/gfs2/edit/extended.c +++ b/gfs2/edit/extended.c @@ -308,9 +308,9 @@ static int display_leaf(struct iinfo *ind) if (gfs2_struct_type == GFS2_METATYPE_SB) print_gfs2("The superblock has 2 directories"); else - print_gfs2("Directory block: lf_depth:%d, lf_entries:%d, " + print_gfs2("Directory block: lf_depth:%"PRIu16", lf_entries:%"PRIu16", " LEAF_HINT_FMTS - "fmt:%d next=0x%llx (%d dirents).", + "fmt:%"PRIu32" next=0x%"PRIx64" (%d dirents).", leaf->lf_depth, leaf->lf_entries, LEAF_HINT_FIELDS(leaf) leaf->lf_dirent_format, @@ -330,12 +330,11 @@ static int display_leaf(struct iinfo *ind) line - start_line - 1 == edit_row[dmode] - start_row[dmode]) { COLORS_HIGHLIGHT; - sprintf(estring, "%llx", - (unsigned long long)ind->ii[0].dirent[d].block); + sprintf(estring, "%"PRIx64, ind->ii[0].dirent[d].block); strcpy(edit_fmt, "%llx"); } } - print_gfs2("%d/%d [%08x] %lld/%"PRId64" (0x%llx/0x%"PRIx64") +%"PRIu16": ", + print_gfs2("%d/%d [%08"PRIX32"] %"PRIu64"/%"PRIu64" (0x%"PRIx64"/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, @@ -388,11 +387,9 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height, while (thisblk) { /* read in the desired block */ if (pread(sbd.device_fd, tmpbuf, sbd.bsize, thisblk * sbd.bsize) != sbd.bsize) { - fprintf(stderr, "bad read: %s from %s:%d: block %lld " - "(0x%llx)\n", strerror(errno), __FUNCTION__, - __LINE__, - (unsigned long long)ind->ii[pndx].block, - (unsigned long long)ind->ii[pndx].block); + fprintf(stderr, "bad read: %s from %s:%d: block %"PRIu64 + " (0x%"PRIx64")\n", strerror(errno), __FUNCTION__, + __LINE__, ind->ii[pndx].block, ind->ii[pndx].block); exit(-1); } thisblk = 0; @@ -428,9 +425,9 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height, static void gfs_jindex_print(struct gfs_jindex *ji) { - pv((unsigned long long)ji, ji_addr, "%llu", "0x%llx"); - pv(ji, ji_nsegment, "%u", "0x%x"); - pv(ji, ji_pad, "%u", "0x%x"); + pv(ji, ji_addr, "%"PRIu64, "0x%"PRIx64); + pv(ji, ji_nsegment, "%"PRIu32, "0x%"PRIx32); + pv(ji, ji_pad, "%"PRIu32, "0x%"PRIx32); } static int print_gfs_jindex(struct gfs2_inode *dij) @@ -440,7 +437,7 @@ static int print_gfs_jindex(struct gfs2_inode *dij) char jbuf[sizeof(struct gfs_jindex)]; start_line = line; - print_gfs2("Journal index entries found: %lld.", + print_gfs2("Journal index entries found: %"PRIu64".", dij->i_di.di_size / sizeof(struct gfs_jindex)); eol(0); lines_per_row[dmode] = 4; @@ -458,7 +455,7 @@ static int print_gfs_jindex(struct gfs2_inode *dij) if (edit_row[dmode] == print_entry_ndx) { COLORS_HIGHLIGHT; strcpy(efield, "ji_addr"); - sprintf(estring, "%llx", (unsigned long long)ji.ji_addr); + sprintf(estring, "%"PRIx64, ji.ji_addr); } print_gfs2("Journal #%d", print_entry_ndx); eol(0); @@ -482,7 +479,7 @@ static int print_gfs2_jindex(void) if (strncmp(indirect->ii[0].dirent[d].filename, "journal", 7)) continue; ip = lgfs2_inode_read(&sbd, indirect->ii[0].dirent[d].block); - print_gfs2("%s: 0x%-5"PRIx64" %lldMB ", + print_gfs2("%s: 0x%-5"PRIx64" %"PRIu64"MB ", indirect->ii[0].dirent[d].filename, indirect->ii[0].dirent[d].block, ip->i_di.di_size / 1048576); @@ -509,7 +506,7 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex) char highlighted_addr[32]; start_line = line; - print_gfs2("RG index entries found: %lld.", dip->i_di.di_size / + print_gfs2("RG index entries found: %"PRIu64".", dip->i_di.di_size / sizeof(struct gfs2_rindex)); eol(0); lines_per_row[dmode] = 6; @@ -531,11 +528,11 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex) termlines - start_line - 2)) { if (edit_row[dmode] == print_entry_ndx) { COLORS_HIGHLIGHT; - sprintf(highlighted_addr, "%llx", (unsigned long long)ri.ri_addr); + sprintf(highlighted_addr, "%"PRIx64, ri.ri_addr); } print_gfs2("RG #%d", print_entry_ndx); if (!print_rindex) - print_gfs2(" located at: %llu (0x%llx)", + print_gfs2(" located at: %"PRIu64" (0x%"PRIx64")", ri.ri_addr, ri.ri_addr); eol(0); if (edit_row[dmode] == print_entry_ndx) @@ -619,7 +616,7 @@ static int print_quota(struct gfs2_inode *diq) print_gfs2("quota file contents:"); eol(0); - print_gfs2("quota entries found: %lld.", diq->i_di.di_size / sizeof(q)); + 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)); diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c index 5e6760f2..5e79009a 100644 --- a/gfs2/edit/gfs2hex.c +++ b/gfs2/edit/gfs2hex.c @@ -372,10 +372,10 @@ static void gfs2_inum_print2(const char *title,struct gfs2_inum *no) } else printf(" %s:",title); - pv2(no, no_formal_ino, "%llu", "0x%llx"); + pv2(no, no_formal_ino, "%"PRIu64, "0x%"PRIx64); if (!termlines) printf(" addr:"); - pv2(no, no_addr, "%llu", "0x%llx"); + pv2(no, no_addr, "%"PRIu64, "0x%"PRIx64); } /** @@ -388,15 +388,15 @@ static void gfs2_sb_print2(struct gfs2_sb *sbp2) gfs2_meta_header_print(&sbp2->sb_header); - pv(sbp2, sb_fs_format, "%u", "0x%x"); - pv(sbp2, sb_multihost_format, "%u", "0x%x"); + pv(sbp2, sb_fs_format, "%"PRIu32, "0x%"PRIx32); + pv(sbp2, sb_multihost_format, "%"PRIu32, "0x%"PRIx32); if (sbd.gfs1) - pv(sbd1, sb_flags, "%u", "0x%x"); - pv(sbp2, sb_bsize, "%u", "0x%x"); - pv(sbp2, sb_bsize_shift, "%u", "0x%x"); + 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, "%u", "0x%x"); + 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); } @@ -438,14 +438,14 @@ static void gfs1_rgrp_in(struct gfs_rgrp *rgrp, const char *buf) static void gfs1_rgrp_print(struct gfs_rgrp *rg) { 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"); + 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, "%u", "0x%x"); - pv(rg, rg_freemeta, "%u", "0x%x"); + pv(rg, rg_usedmeta, "%"PRIu32, "0x%"PRIx32); + pv(rg, rg_freemeta, "%"PRIu32, "0x%"PRIx32); } int display_gfs2(char *buf) diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c index 313f18f2..859919aa 100644 --- a/gfs2/edit/journal.c +++ b/gfs2/edit/journal.c @@ -534,7 +534,7 @@ void dump_journal(const char *journal, int tblk) uint64_t o; int bmap = 0; - print_gfs2("rgd: 0x%llx for 0x%x, ", rgd->ri.ri_addr, + print_gfs2("rgd: 0x%"PRIx64" for 0x%"PRIx32", ", rgd->ri.ri_addr, rgd->ri.ri_length); o = tblk - rgd->ri.ri_data0; if (o >= (rgd->bits->bi_start + @@ -544,8 +544,7 @@ void dump_journal(const char *journal, int tblk) * GFS2_NBBY; bmap = o / sbd.sd_blocks_per_bitmap; bitblk = rgd->ri.ri_addr + bmap; - print_gfs2("bitmap: %d, bitblk: 0x%llx", bmap, - (unsigned long long)bitblk); + print_gfs2("bitmap: %d, bitblk: 0x%"PRIx64, bmap, bitblk); eol(0); } @@ -597,8 +596,8 @@ void dump_journal(const char *journal, int tblk) check_journal_wrap(lh1.lh_sequence, &highest_seq); print_gfs2("0x%"PRIx64" (j+%4"PRIx64"): Log header: " - "Flags:%x, Seq: 0x%llx, 1st: 0x%llx, " - "tail: 0x%llx, last: 0x%llx", + "Flags:%"PRIx32", Seq: 0x%"PRIx64", 1st: 0x%"PRIx64", " + "tail: 0x%"PRIx64", last: 0x%"PRIx64, abs_block, jb + wrappt, lh1.lh_flags, lh1.lh_sequence, lh1.lh_first, lh1.lh_tail, @@ -612,8 +611,8 @@ void dump_journal(const char *journal, int tblk) lgfs2_field_str(flags_str, sizeof(flags_str), buf, lh_flags_field, (dmode == HEX_MODE)); - print_gfs2("0x%"PRIx64" (j+%4"PRIx64"): Log header: Seq" - ": 0x%llx, tail: 0x%x, blk: 0x%x [%s]", + print_gfs2("0x%"PRIx64" (j+%4"PRIx64"): Log header: Seq: " + "0x%"PRIx64", tail: 0x%"PRIx32", blk: 0x%"PRIx32" [%s]", abs_block, ((jb + wrappt) % j_size) / sbd.bsize, lh.lh_sequence, lh.lh_tail, lh.lh_blkno, diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index ac6e0cee..820df1d0 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -428,19 +428,17 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix) prev_seq = lh.lh_sequence; continue; } - log_err( _("Journal block %u (0x%x): sequence no. 0x%llx " + log_err(_("Journal block %"PRIu32" (0x%"PRIx32"): sequence no. 0x%"PRIx64" " "out of order.\n"), blk, blk, lh.lh_sequence); - log_info( _("Low: 0x%llx, High: 0x%llx, Prev: 0x%llx\n"), - (unsigned long long)lowest_seq, - (unsigned long long)highest_seq, - (unsigned long long)prev_seq); + log_info(_("Low: 0x%"PRIx64", High: 0x%"PRIx64", Prev: 0x%"PRIx64"\n"), + lowest_seq, highest_seq, prev_seq); seq_errors++; if (!fix) continue; highest_seq++; lh.lh_sequence = highest_seq; prev_seq = lh.lh_sequence; - log_warn( _("Renumbering it as 0x%llx\n"), lh.lh_sequence); + log_warn(_("Renumbering it as 0x%"PRIx64"\n"), lh.lh_sequence); block_map(ip, blk, &new, &dblock, NULL, 0); bh = bread(ip->i_sbd, dblock); gfs2_log_header_out(&lh, bh->b_data); diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index 58dd23d3..17f2d6cd 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -1014,7 +1014,7 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, if (di->di_num.no_formal_ino == 2) { if (sdp->sd_sb.sb_master_dir.no_addr) return; - log_warn(_("Found system master directory at: 0x%llx.\n"), + log_warn(_("Found system master directory at: 0x%"PRIx64".\n"), di->di_num.no_addr); sdp->sd_sb.sb_master_dir.no_addr = di->di_num.no_addr; return; @@ -1029,7 +1029,7 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, (di->di_size % sizeof(struct gfs_jindex) == 0))) { if (fix_md.jiinode || is_journal_copy(ip, bh)) goto out_discard_ip; - log_warn(_("Found system jindex file at: 0x%llx\n"), + log_warn(_("Found system jindex file at: 0x%"PRIx64"\n"), di->di_num.no_addr); fix_md.jiinode = ip; } else if (!sdp->gfs1 && is_dir(di, sdp->gfs1)) { @@ -1043,8 +1043,8 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, } fix_md.jiinode = child_ip; sdp->sd_sb.sb_master_dir.no_addr = di->di_num.no_addr; - log_warn(_("Found system master directory at: " - "0x%llx\n"), di->di_num.no_addr); + log_warn(_("Found system master directory at: 0x%"PRIx64"\n"), + di->di_num.no_addr); return; } @@ -1055,39 +1055,38 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, inode_put(&child_ip); if (fix_md.pinode || is_journal_copy(ip, bh)) goto out_discard_ip; - log_warn(_("Found system per_node directory at: " - "0x%llx\n"), ip->i_di.di_num.no_addr); + log_warn(_("Found system per_node directory at: 0x%"PRIx64"\n"), + ip->i_di.di_num.no_addr); fix_md.pinode = ip; error = dir_search(ip, "..", 2, NULL, &inum); if (!error && inum.no_addr) { sdp->sd_sb.sb_master_dir.no_addr = inum.no_addr; - log_warn(_("From per_node\'s \'..\' I " - "backtracked the master directory " - "to: 0x%llx\n"), inum.no_addr); + log_warn(_("From per_node's '..' master directory backtracked to: " + "0x%"PRIx64"\n"), inum.no_addr); } return; } - log_debug(_("Unknown system directory at block 0x%llx\n"), + log_debug(_("Unknown system directory at block 0x%"PRIx64"\n"), di->di_num.no_addr); goto out_discard_ip; } else if (!sdp->gfs1 && di->di_size == 8) { if (fix_md.inum || is_journal_copy(ip, bh)) goto out_discard_ip; fix_md.inum = ip; - log_warn(_("Found system inum file at: 0x%llx\n"), + log_warn(_("Found system inum file at: 0x%"PRIx64"\n"), di->di_num.no_addr); } else if (di->di_size == 24) { if (fix_md.statfs || is_journal_copy(ip, bh)) goto out_discard_ip; fix_md.statfs = ip; - log_warn(_("Found system statfs file at: 0x%llx\n"), + log_warn(_("Found system statfs file at: 0x%"PRIx64"\n"), di->di_num.no_addr); } else if ((di->di_size % 96) == 0) { if (fix_md.riinode || is_journal_copy(ip, bh)) goto out_discard_ip; fix_md.riinode = ip; - log_warn(_("Found system rindex file at: 0x%llx\n"), + log_warn(_("Found system rindex file at: 0x%"PRIx64"\n"), di->di_num.no_addr); } else if (!fix_md.qinode && di->di_size >= 176 && di->di_num.no_formal_ino >= 12 && @@ -1095,7 +1094,7 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, if (is_journal_copy(ip, bh)) goto out_discard_ip; fix_md.qinode = ip; - log_warn(_("Found system quota file at: 0x%llx\n"), + log_warn(_("Found system quota file at: 0x%"PRIx64"\n"), di->di_num.no_addr); } else { out_discard_ip: @@ -1123,17 +1122,17 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, struct gfs2_buffer_head *root_bh; if (di->di_num.no_addr == bh->b_blocknr) { - log_warn(_("Found the root directory at: 0x%llx.\n"), + log_warn(_("Found the root directory at: 0x%"PRIx64".\n"), di->di_num.no_addr); sdp->sd_sb.sb_root_dir.no_addr = di->di_num.no_addr; return; } - log_warn(_("The root dinode should be at block 0x%llx but it " + log_warn(_("The root dinode should be at block 0x%"PRIx64" but it " "seems to be destroyed.\n"), - (unsigned long long)di->di_num.no_addr); + di->di_num.no_addr); log_warn(_("Found a copy of the root directory in a journal " - "at block: 0x%llx.\n"), - (unsigned long long)bh->b_blocknr); + "at block: 0x%"PRIx64".\n"), + bh->b_blocknr); if (!query(_("Do you want to replace the root dinode from the " "copy? (y/n)"))) { log_err(_("Damaged root dinode not fixed.\n")); @@ -1155,7 +1154,7 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, gfs2_lookupi(ip, "..", 2, &parent_ip); if (parent_ip && parent_ip->i_di.di_num.no_addr == ip->i_di.di_num.no_addr) { - log_warn(_("Found the root directory at: 0x%llx\n"), + log_warn(_("Found the root directory at: 0x%"PRIx64"\n"), ip->i_di.di_num.no_addr); sdp->sd_sb.sb_root_dir.no_addr = ip->i_di.di_num.no_addr; @@ -1171,8 +1170,8 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di, error = dir_search(ip, "..", 2, NULL, &inum); if (!error && inum.no_addr && inum.no_addr < possible_root) { possible_root = inum.no_addr; - log_debug(_("Found a possible root at: 0x%llx\n"), - (unsigned long long)possible_root); + log_debug(_("Found a possible root at: 0x%"PRIx64"\n"), + possible_root); } inode_put(&ip); } @@ -1361,7 +1360,7 @@ static int sb_repair(struct gfs2_sbd *sdp) /* Step 3 - Rebuild the lock protocol and file system table name */ if (query(_("Okay to fix the GFS2 superblock? (y/n)"))) { struct gfs2_sb sb; - log_info(_("Found system master directory at: 0x%llx\n"), + log_info(_("Found system master directory at: 0x%"PRIx64"\n"), sdp->sd_sb.sb_master_dir.no_addr); sdp->master_dir = lgfs2_inode_read(sdp, sdp->sd_sb.sb_master_dir.no_addr); @@ -1371,7 +1370,7 @@ static int sb_repair(struct gfs2_sbd *sdp) } sdp->master_dir->i_di.di_num.no_addr = sdp->sd_sb.sb_master_dir.no_addr; - log_info(_("Found the root directory at: 0x%llx\n"), + log_info(_("Found the root directory at: 0x%"PRIx64"\n"), sdp->sd_sb.sb_root_dir.no_addr); sdp->md.rooti = lgfs2_inode_read(sdp, sdp->sd_sb.sb_root_dir.no_addr); diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c index 4d5d52c8..ebe616af 100644 --- a/gfs2/fsck/lost_n_found.c +++ b/gfs2/fsck/lost_n_found.c @@ -61,11 +61,11 @@ static void add_dotdot(struct gfs2_inode *ip) bmodified(dip->i_bh); } } else { - log_debug(_("Directory (0x%llx)'s link to parent " - "(0x%llx) had a formal inode discrepancy: " - "was 0x%llx, expected 0x%llx\n"), - (unsigned long long)ip->i_di.di_num.no_addr, - (unsigned long long)di->dotdot_parent.no_addr, + log_debug(_("Directory (0x%"PRIx64")'s link to parent " + "(0x%"PRIx64") had a formal inode discrepancy: " + "was 0x%"PRIx64", expected 0x%"PRIx64"\n"), + ip->i_di.di_num.no_addr, + di->dotdot_parent.no_addr, di->dotdot_parent.no_formal_ino, dip->i_di.di_num.no_formal_ino); log_debug(_("The parent directory was not changed.\n")); diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index 88fc4dc4..70549a3a 100644 --- a/gfs2/fsck/pass1.c +++ b/gfs2/fsck/pass1.c @@ -2209,11 +2209,10 @@ int pass1(struct gfs2_sbd *sdp) goto out; } next = osi_next(n); - log_debug("Checking metadata in resource group #%llu\n", - (unsigned long long)rg_count); + log_debug("Checking metadata in resource group #%"PRIu64"\n", rg_count); rgd = (struct rgrp_tree *)n; for (i = 0; i < rgd->ri.ri_length; i++) { - log_debug("rgrp block %lld (0x%llx) is now marked as 'rgrp data'\n", + log_debug("rgrp block %"PRIu64" (0x%"PRIx64") is now marked as 'rgrp data'\n", rgd->ri.ri_addr + i, rgd->ri.ri_addr + i); if (gfs2_blockmap_set(bl, rgd->ri.ri_addr + i, GFS2_BLKST_USED)) { diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c index 19b8e70d..b6a047c3 100644 --- a/gfs2/fsck/pass2.c +++ b/gfs2/fsck/pass2.c @@ -1947,7 +1947,7 @@ static int check_pernode_for(int x, struct gfs2_inode *pernode, const char *fn, else if (multiple && (ip->i_di.di_size % filelen)) valid_size = 0; if (!valid_size) { - log_err(_("System file %s has an invalid size. Is %llu, " + log_err(_("System file %s has an invalid size. Is %"PRIu64", " "should be %llu.\n"), fn, ip->i_di.di_size, filelen); if (!query( _("Rebuild the system file? (y/n) "))) goto out_good; diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c index 637e5271..cc7c9c9d 100644 --- a/gfs2/fsck/rgrepair.c +++ b/gfs2/fsck/rgrepair.c @@ -414,11 +414,8 @@ static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t blk, rgrp_dist++; } if (found) { - log_info( _("rgrp found at 0x%llx, length=%d, " - "used=%llu, free=%d\n"), - prevrgd->ri.ri_addr, length, - (unsigned long long)used_blocks, - free_blocks); + log_info(_("rgrp found at 0x%"PRIx64", length=%d, used=%"PRIu64", free=%d\n"), + prevrgd->ri.ri_addr, length, used_blocks, free_blocks); break; } } @@ -686,11 +683,9 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow) for (n = osi_first(&sdp->rgcalc), rgi = 0; n; n = next, rgi++) { next = osi_next(n); calc_rgd = (struct rgrp_tree *)n; - log_debug("%d: 0x%llx / %x / 0x%llx" - " / 0x%x / 0x%x\n", rgi + 1, - (unsigned long long)calc_rgd->ri.ri_addr, - calc_rgd->ri.ri_length, - calc_rgd->ri.ri_data0, calc_rgd->ri.ri_data, + log_debug("%d: 0x%"PRIx64"/%"PRIx32"/0x%"PRIx64"/0x%"PRIx32"/0x%"PRIx32"\n", + rgi + 1, calc_rgd->ri.ri_addr, calc_rgd->ri.ri_length, + calc_rgd->ri.ri_data0, calc_rgd->ri.ri_data, calc_rgd->ri.ri_bitbytes); } *num_rgs = number_of_rgs; @@ -1138,16 +1133,14 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok) if (actual->ri.ri_addr < expected->ri.ri_addr) { n = next; discrepancies++; - log_info(_("%d addr: 0x%llx < 0x%llx * mismatch\n"), - rg + 1, actual->ri.ri_addr, - expected->ri.ri_addr); + log_info(_("%d addr: 0x%"PRIx64" < 0x%"PRIx64" * mismatch\n"), + rg + 1, actual->ri.ri_addr, expected->ri.ri_addr); continue; } else if (expected->ri.ri_addr < actual->ri.ri_addr) { e = enext; discrepancies++; - log_info(_("%d addr: 0x%llx > 0x%llx * mismatch\n"), - rg + 1, actual->ri.ri_addr, - expected->ri.ri_addr); + log_info(_("%d addr: 0x%"PRIx64" > 0x%"PRIx64" * mismatch\n"), + rg + 1, actual->ri.ri_addr, expected->ri.ri_addr); continue; } if (!ri_equal(actual->ri, expected->ri, ri_length) || @@ -1155,9 +1148,8 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok) !ri_equal(actual->ri, expected->ri, ri_data) || !ri_equal(actual->ri, expected->ri, ri_bitbytes)) { discrepancies++; - log_info(_("%d addr: 0x%llx 0x%llx * has mismatch\n"), - rg + 1, actual->ri.ri_addr, - expected->ri.ri_addr); + log_info(_("%d addr: 0x%"PRIx64" 0x%"PRIx64" * has mismatch\n"), + rg + 1, actual->ri.ri_addr, expected->ri.ri_addr); } n = next; e = enext; @@ -1199,10 +1191,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok) damage, fill in a new one with the expected values. */ if (!n || /* end of actual rindex */ expected->ri.ri_addr < actual->ri.ri_addr) { - log_err( _("Entry missing from rindex: 0x%llx\n"), - (unsigned long long)expected->ri.ri_addr); - actual = rgrp_insert(&sdp->rgtree, - expected->ri.ri_addr); + log_err(_("Entry missing from rindex: 0x%"PRIx64"\n"), + expected->ri.ri_addr); + actual = rgrp_insert(&sdp->rgtree, expected->ri.ri_addr); if (!actual) { log_err(_("Out of memory!\n")); break; diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c index 0d68de8f..35a0b3db 100644 --- a/gfs2/libgfs2/ondisk.c +++ b/gfs2/libgfs2/ondisk.c @@ -57,8 +57,8 @@ void gfs2_inum_out(const struct gfs2_inum *no, char *buf) void gfs2_inum_print(const struct gfs2_inum *no) { - pv(no, no_formal_ino, "%llu", "0x%llx"); - pv(no, no_addr, "%llu", "0x%llx"); + pv(no, no_formal_ino, "%"PRIu64, "0x%"PRIx64); + pv(no, no_addr, "%"PRIu64, "0x%"PRIx64); } void gfs2_meta_header_in(struct gfs2_meta_header *mh, const char *buf) @@ -83,9 +83,9 @@ void gfs2_meta_header_out(const struct gfs2_meta_header *mh, char *buf) void gfs2_meta_header_print(const struct gfs2_meta_header *mh) { - pv(mh, mh_magic, "0x%08X", NULL); - pv(mh, mh_type, "%u", "0x%x"); - pv(mh, mh_format, "%u", "0x%x"); + pv(mh, mh_magic, "0x%08"PRIX32, NULL); + pv(mh, mh_type, "%"PRIu32, "0x%"PRIx32); + pv(mh, mh_format, "%"PRIu32, "0x%"PRIx32); } void gfs2_sb_in(struct gfs2_sb *sb, char *buf) @@ -144,11 +144,11 @@ void gfs2_sb_print(const struct gfs2_sb *sb) gfs2_meta_header_print(&sb->sb_header); - pv(sb, sb_fs_format, "%u", "0x%x"); - pv(sb, sb_multihost_format, "%u", "0x%x"); + pv(sb, sb_fs_format, "%"PRIu32, "0x%"PRIx32); + pv(sb, sb_multihost_format, "%"PRIu32, "0x%"PRIx32); - pv(sb, sb_bsize, "%u", "0x%x"); - pv(sb, sb_bsize_shift, "%u", "0x%x"); + 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); @@ -191,13 +191,13 @@ void gfs2_rindex_out(const struct gfs2_rindex *ri, char *buf) void gfs2_rindex_print(const struct gfs2_rindex *ri) { - pv(ri, ri_addr, "%llu", "0x%llx"); - pv(ri, ri_length, "%u", "0x%x"); + pv(ri, ri_addr, "%"PRIu64, "0x%"PRIx64); + pv(ri, ri_length, "%"PRIu32, "0x%"PRIx32); - pv(ri, ri_data0, "%llu", "0x%llx"); - pv(ri, ri_data, "%u", "0x%x"); + pv(ri, ri_data0, "%"PRIu64, "0x%"PRIx64); + pv(ri, ri_data, "%"PRIu32, "0x%"PRIx32); - pv(ri, ri_bitbytes, "%u", "0x%x"); + pv(ri, ri_bitbytes, "%"PRIu32, "0x%"PRIx32); } void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf) @@ -237,15 +237,15 @@ void gfs2_rgrp_out(const struct gfs2_rgrp *rg, char *buf) void gfs2_rgrp_print(const struct gfs2_rgrp *rg) { gfs2_meta_header_print(&rg->rg_header); - pv(rg, rg_flags, "%u", "0x%x"); - pv(rg, rg_free, "%u", "0x%x"); - pv(rg, rg_dinodes, "%u", "0x%x"); - pv(rg, rg_skip, "%u", "0x%x"); - pv(rg, rg_igeneration, "%llu", "0x%llx"); - 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"); + 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); } void gfs2_quota_in(struct gfs2_quota *qu, char *buf) @@ -270,9 +270,9 @@ void gfs2_quota_out(struct gfs2_quota *qu, char *buf) void gfs2_quota_print(const struct gfs2_quota *qu) { - pv(qu, qu_limit, "%llu", "0x%llx"); - pv(qu, qu_warn, "%llu", "0x%llx"); - pv(qu, qu_value, "%lld", "0x%llx"); + pv(qu, qu_limit, "%"PRIu64, "0x%"PRIx64); + pv(qu, qu_warn, "%"PRIu64, "0x%"PRIx64); + pv(qu, qu_value, "%"PRIu64, "0x%"PRIx64); } void gfs2_dinode_in(struct gfs2_dinode *di, char *buf) @@ -350,29 +350,29 @@ void gfs2_dinode_print(const struct gfs2_dinode *di) gfs2_meta_header_print(&di->di_header); gfs2_inum_print(&di->di_num); - pv(di, di_mode, "0%o", NULL); - pv(di, di_uid, "%u", "0x%x"); - pv(di, di_gid, "%u", "0x%x"); - pv(di, di_nlink, "%u", "0x%x"); - pv(di, di_size, "%llu", "0x%llx"); - pv(di, di_blocks, "%llu", "0x%llx"); - pv(di, di_atime, "%lld", "0x%llx"); - pv(di, di_mtime, "%lld", "0x%llx"); - pv(di, di_ctime, "%lld", "0x%llx"); - pv(di, di_major, "%u", "0x%llx"); - pv(di, di_minor, "%u", "0x%llx"); + pv(di, di_mode, "0%"PRIo32, NULL); + pv(di, di_uid, "%"PRIu32, "0x%"PRIx32); + pv(di, di_gid, "%"PRIu32, "0x%"PRIx32); + pv(di, di_nlink, "%"PRIu32, "0x%"PRIx32); + pv(di, di_size, "%"PRIu64, "0x%"PRIx64); + pv(di, di_blocks, "%"PRIu64, "0x%"PRIx64); + pv(di, di_atime, "%"PRIu64, "0x%"PRIx64); + pv(di, di_mtime, "%"PRIu64, "0x%"PRIx64); + pv(di, di_ctime, "%"PRIu64, "0x%"PRIx64); + pv(di, di_major, "%"PRIu32, "0x%"PRIx32); + pv(di, di_minor, "%"PRIu32, "0x%"PRIx32); - pv(di, di_goal_meta, "%llu", "0x%llx"); - pv(di, di_goal_data, "%llu", "0x%llx"); + pv(di, di_goal_meta, "%"PRIu64, "0x%"PRIx64); + pv(di, di_goal_data, "%"PRIu64, "0x%"PRIx64); - pv(di, di_flags, "0x%.8X", NULL); - pv(di, di_payload_format, "%u", "0x%x"); - pv(di, di_height, "%u", "0x%x"); + pv(di, di_flags, "0x%.8"PRIX32, NULL); + pv(di, di_payload_format, "%"PRIu32, "0x%"PRIx32); + pv(di, di_height, "%"PRIu16, "0x%"PRIx16); - pv(di, di_depth, "%u", "0x%x"); - pv(di, di_entries, "%u", "0x%x"); + pv(di, di_depth, "%"PRIu16, "0x%"PRIx16); + pv(di, di_entries, "%"PRIu32, "0x%"PRIx32); - pv(di, di_eattr, "%llu", "0x%llx"); + pv(di, di_eattr, "%"PRIu64, "0x%"PRIx64); } void gfs2_dirent_in(struct gfs2_dirent *de, char *buf) @@ -438,14 +438,14 @@ void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf) void gfs2_leaf_print(const struct gfs2_leaf *lf) { gfs2_meta_header_print(&lf->lf_header); - pv(lf, lf_depth, "%u", "0x%x"); - pv(lf, lf_entries, "%u", "0x%x"); - pv(lf, lf_dirent_format, "%u", "0x%x"); - pv(lf, lf_next, "%llu", "0x%llx"); - 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"); + 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 gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf) @@ -464,12 +464,12 @@ void gfs2_ea_header_print(const struct gfs2_ea_header *ea, char *name) { char buf[GFS2_EA_MAX_NAME_LEN + 1]; - pv(ea, ea_rec_len, "%u", "0x%x"); - pv(ea, ea_data_len, "%u", "0x%x"); - pv(ea, ea_name_len, "%u", "0x%x"); - pv(ea, ea_type, "%u", "0x%x"); - pv(ea, ea_flags, "%u", "0x%x"); - pv(ea, ea_num_ptrs, "%u", "0x%x"); + 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); @@ -523,21 +523,21 @@ void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf) void gfs2_log_header_print(const struct gfs2_log_header *lh) { gfs2_meta_header_print(&lh->lh_header); - pv(lh, lh_sequence, "%llu", "0x%llx"); - pv(lh, lh_flags, "0x%.8X", NULL); - pv(lh, lh_tail, "%u", "0x%x"); - pv(lh, lh_blkno, "%u", "0x%x"); - pv(lh, lh_hash, "0x%.8X", NULL); - pv(lh, lh_crc, "0x%.8X", NULL); - pv(lh, lh_nsec, "%u", "0x%x"); - pv(lh, lh_sec, "%llu", "0x%llx"); - pv(lh, lh_addr, "%llu", "0x%llx"); - pv(lh, lh_jinode, "%llu", "0x%llx"); - pv(lh, lh_statfs_addr, "%llu", "0x%llx"); - pv(lh, lh_quota_addr, "%llu", "0x%llx"); - pv(lh, lh_local_total, "%lld", "0x%llx"); - pv(lh, lh_local_free, "%lld", "0x%llx"); - pv(lh, lh_local_dinodes, "%lld", "0x%llx"); + pv(lh, lh_sequence, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_flags, "0x%.8"PRIX32, NULL); + pv(lh, lh_tail, "%"PRIu32, "0x%"PRIx32); + pv(lh, lh_blkno, "%"PRIu32, "0x%"PRIx32); + pv(lh, lh_hash, "0x%.8"PRIX32, NULL); + pv(lh, lh_crc, "0x%.8"PRIX32, NULL); + pv(lh, lh_nsec, "%"PRIu32, "0x%"PRIx32); + pv(lh, lh_sec, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_addr, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_jinode, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_statfs_addr, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_quota_addr, "%"PRIu64, "0x%"PRIx64); + pv(lh, lh_local_total, "%"PRId64, "0x%"PRIx64); + pv(lh, lh_local_free, "%"PRId64, "0x%"PRIx64); + pv(lh, lh_local_dinodes, "%"PRId64, "0x%"PRIx64); } void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf) @@ -569,10 +569,10 @@ void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf) void gfs2_log_descriptor_print(const struct gfs2_log_descriptor *ld) { gfs2_meta_header_print(&ld->ld_header); - pv(ld, ld_type, "%u", "0x%x"); - pv(ld, ld_length, "%u", "0x%x"); - pv(ld, ld_data1, "%u", "0x%x"); - pv(ld, ld_data2, "%u", "0x%x"); + 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); } void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf) @@ -595,9 +595,9 @@ void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf) void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc) { - pv(sc, sc_total, "%lld", "0x%llx"); - pv(sc, sc_free, "%lld", "0x%llx"); - pv(sc, sc_dinodes, "%lld", "0x%llx"); + pv(sc, sc_total, "%"PRId64, "0x%"PRIx64); + pv(sc, sc_free, "%"PRId64, "0x%"PRIx64); + pv(sc, sc_dinodes, "%"PRId64, "0x%"PRIx64); } void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf) @@ -622,8 +622,8 @@ void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf) void gfs2_quota_change_print(const struct gfs2_quota_change *qc) { - pv(qc, qc_change, "%lld", "0x%llx"); - pv(qc, qc_flags, "0x%.8X", NULL); - pv(qc, qc_id, "%u", "0x%x"); + pv(qc, qc_change, "%"PRId64, "0x%"PRIx64); + pv(qc, qc_flags, "0x%.8"PRIX32, NULL); + pv(qc, qc_id, "%"PRIu32, "0x%"PRIx32); } -- 2.30.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price ` (7 preceding siblings ...) 2021-04-19 19:11 ` [Cluster-devel] [PATCH 8/8] Use PRI* when printing gfs2 structures Andrew Price @ 2021-04-19 19:31 ` Andreas Gruenbacher 8 siblings, 0 replies; 16+ messages in thread From: Andreas Gruenbacher @ 2021-04-19 19:31 UTC (permalink / raw) To: cluster-devel.redhat.com Hi Andy, On Mon, Apr 19, 2021 at 9:11 PM Andrew Price <anprice@redhat.com> wrote: > v1: https://listman.redhat.com/archives/cluster-devel/2019-April/msg00021.html > > My previous attempt at this did a search+replace to satisfy the field types in gfs2_ondisk.h, which was a little OTT. This attempt adds a linux/types.h that gfs2_ondisk.h will pick up instead of the kernel one. > > Having our own gfs2_ondisk.h means that we can support new gfs2 features unconditionally and more easily experiment with on-disk changes; we can use the PRI* macros from inttypes.h for consistent string formatting (appease -Wformat) across architectures, and it gets us closer to being able to compile gfs2-utils on non-linux systems. this is looking good, thanks. Andreas ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-04-20 9:47 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-19 19:11 [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 1/8] " Andrew Price 2021-04-19 19:35 ` Andreas Gruenbacher 2021-04-19 20:47 ` Andrew Price 2021-04-20 6:00 ` Andreas Gruenbacher 2021-04-20 8:34 ` Andrew Price 2021-04-20 9:07 ` Andreas Gruenbacher 2021-04-20 9:47 ` Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 2/8] Remove HAS_UUID conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 3/8] Remove GFS2_HAS_LEAF_HINTS conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 4/8] Remove GFS2_HAS_DE_RAHEAD/COOKIE conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 5/8] Remove GFS2_HAS_RG_SKIP conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 6/8] Remove GFS2_HAS_RG_RI_FIELDS conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 7/8] Remove GFS2_HAS_LH_V2 conditionals Andrew Price 2021-04-19 19:11 ` [Cluster-devel] [PATCH 8/8] Use PRI* when printing gfs2 structures Andrew Price 2021-04-19 19:31 ` [Cluster-devel] [PATCH v2 0/8] gfs2-utils: Import linux/gfs2_ondisk.h Andreas Gruenbacher
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).