xfsprogs: Drop the 'platform_' prefix
v2 cover xfsprogs: Drop the 'platform_' prefix
Stop using commands with 'platform_' prefix. Either use directly linux standard command or drop the prefix from the function name.
Publicly visible commands with "platform_" prefix are kept for now, but will be deprecated soon.
Pavel Reichl (29):
xfsprogs: Stop using platform_uuid_compare()
xfsprogs: Stop using platform_test_xfs_fd()
xfsprogs: Stop using platform_test_xfs_path()
xfsprogs: Stop using platform_fstatfs()
xfsprogs: Stop using platform_getoptreset()
xfsprogs: Stop using platform_uuid_copy()
xfsprogs: Stop using platform_uuid_generate()
xfsprogs: Stop using platform_uuid_unparse()
xfsprogs: Stop using platform_uuid_clear()
xfsprogs: Stop using platform_uuid_parse()
xfsprogs: Stop using platform_uuid_is_null()
xfsprogs: Stop using platform_check_mount()
xfsprogs: Stop using platform_check_ismounted()
xfsprogs: Stop using platform_flush_device()
xfsprogs: Stop using platform_mntent_open()
xfsprogs: Stop using platform_mntent_next()
xfsprogs: Stop using platform_mntent_close()
xfsprogs: Stop using platform_findsizes()
xfsprogs: Stop using platform_discard_blocks
xfsprogs: Stop using platform_zero_range()
xfsprogs: Stop using platform_crash()
xfsprogs: Stop using platform_nproc()
xfsprogs: Stop using platform_check_iswritable()
xfsprogs: Stop using platform_set_blocksize()
xfsprogs: Stop using platform_findrawpath()
xfsprogs: Stop using platform_findblockpath()
xfsprogs: Stop using platform_direct_blockdev()
xfsprogs: Stop using platform_align_blockdev()
xfsprogs: Stop using platform_physmem()
copy/xfs_copy.c | 24 ++++----- db/command.c | 2 +- db/fprint.c | 2 +- db/sb.c | 14 +++--- fsr/xfs_fsr.c | 8 +-- growfs/xfs_growfs.c | 2 +- include/linux.h | 71 ++++++++++++++++++++++---- include/platform_defs.h.in | 1 + io/init.c | 2 +- io/open.c | 4 +- io/stat.c | 2 +- libfrog/linux.c | 99 ++++++++++++++++++++++++++++++++----- libfrog/paths.c | 2 +- libfrog/platform.h | 11 ++++- libfrog/topology.c | 6 +-- libxcmd/command.c | 2 +- libxfs/init.c | 32 ++++++------ libxfs/libxfs_io.h | 2 +- libxfs/libxfs_priv.h | 3 +- libxfs/rdwr.c | 4 +- libxfs/xfs_ag.c | 6 +-- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_btree.c | 4 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2_block.c | 2 +- libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 2 +- libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dquot_buf.c | 2 +- libxfs/xfs_ialloc.c | 4 +- libxfs/xfs_inode_buf.c | 2 +- libxfs/xfs_sb.c | 6 +-- libxfs/xfs_symlink_remote.c | 2 +- libxlog/util.c | 8 +-- logprint/log_misc.c | 2 +- mdrestore/xfs_mdrestore.c | 4 +- mkfs/xfs_mkfs.c | 22 ++++----- quota/free.c | 2 +- repair/agheader.c | 16 +++--- repair/attr_repair.c | 2 +- repair/dinode.c | 8 +-- repair/phase4.c | 6 +-- repair/phase5.c | 6 +-- repair/phase6.c | 2 +- repair/prefetch.c | 2 +- repair/scan.c | 4 +- repair/slab.c | 2 +- repair/xfs_repair.c | 6 +-- scrub/disk.c | 8 +-- spaceman/init.c | 2 +- 51 files changed, 284 insertions(+), 151 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/29 xfsprogs: Stop using platform_uuid_compare()
platform_uuid_compare() only calls uuid_compare() thus in should be replaced by uuid_compare() deprecated and removed in the future.
--- copy/xfs_copy.c | 2 +- db/sb.c | 2 +- libxfs/libxfs_priv.h | 2 +- libxlog/util.c | 2 +- repair/agheader.c | 4 ++-- repair/attr_repair.c | 2 +- repair/dinode.c | 6 +++--- repair/phase6.c | 2 +- repair/scan.c | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-)
copy/xfs_copy.c +1 -1
@@ -15,7 +15,7 @@#include "libfrog/platform.h" #define rounddown (x, y) (((x)/(y))*(y)) -#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0)extern int platform_check_ismounted (char *,char *,struct stat *,int );
db/sb.c +1 -1
@@ -17,7 +17,7 @@#include "output.h" #include "init.h" -#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0)static int sb_f (int argc,char **argv);static void sb_help (void );
libxfs/libxfs_priv.h +1 -1
@@ -505,7 +505,7 @@ static inline int retzero(void) { return 0; }#define xfs_qm_dqattach (i) (0)#define uuid_copy (s,d) platform_uuid_copy((s),(d)) -#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0)#define xfs_sb_validate_fsb_count (sbp, nblks) (0)
libxlog/util.c +1 -1
@@ -76,7 +76,7 @@ header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)if (print_skip_uuid)return 0 ; -if (!platform_uuid_compare (&mp->m_sb.sb_uuid, &head->h_fs_uuid)) +if (!uuid_compare (mp->m_sb.sb_uuid, head->h_fs_uuid))return 0 ;platform_uuid_unparse (&mp->m_sb.sb_uuid, uu_sb);
repair/agheader.c +2 -2
@@ -100,7 +100,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)if (!xfs_sb_version_hascrc (&mp->m_sb))return retval; -if (platform_uuid_compare (&agf->agf_uuid, &mp->m_sb.sb_meta_uuid)) { +if (uuid_compare (agf->agf_uuid, mp->m_sb.sb_meta_uuid)) {char uu[64 ]; retval =XR_AG_AGF ;
@@ -179,7 +179,7 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)if (!xfs_sb_version_hascrc (&mp->m_sb))return retval; -if (platform_uuid_compare (&agi->agi_uuid, &mp->m_sb.sb_meta_uuid)) { +if (uuid_compare (agi->agi_uuid, mp->m_sb.sb_meta_uuid)) {char uu[64 ]; retval =XR_AG_AGI ;
repair/attr_repair.c +1 -1
@@ -947,7 +947,7 @@ _("expected block %" PRIu64 ", got %llu, inode %" PRIu64 "attr block\n"),return 1 ; }/* verify uuid */ -if (platform_uuid_compare (&info->uuid, &mp->m_sb.sb_meta_uuid) !=0 ) { +if (uuid_compare (info->uuid, mp->m_sb.sb_meta_uuid) !=0 ) {do_warn (_ ("wrong FS UUID, inode %" PRIu64" attr block %" PRIu64"\n" ), ino, bp->b_bn);
repair/dinode.c +3 -3
@@ -1098,7 +1098,7 @@ null_check(char *name, int length)* This does /not/ do quotacheck, it validates the basic quota * inode metadata, checksums, etc. */ -#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0) static int process_quota_inode( struct xfs_mount *mp,
@@ -2329,8 +2329,8 @@ _("inode identifier %llu mismatch on inode %" PRIu64 "\n"),return 1 ; goto clear_bad_out; } -if (platform_uuid_compare (&dino->di_uuid, - &mp->m_sb.sb_meta_uuid)) { +if (uuid_compare (dino->di_uuid, + mp->m_sb.sb_meta_uuid)) {if (!uncertain)do_warn (_ ("UUID mismatch on inode %" PRIu64"\n" ), lino);
repair/phase6.c +1 -1
@@ -1886,7 +1886,7 @@ _("expected block %" PRIu64 ", got %llu, directory inode %" PRIu64 "\n"),return 1 ; }/* verify uuid */ -if (platform_uuid_compare (uuid, &mp->m_sb.sb_meta_uuid) !=0 ) { +if (uuid_compare (*uuid, mp->m_sb.sb_meta_uuid) !=0 ) {do_warn (_ ("wrong FS UUID, directory inode %" PRIu64" block %" PRIu64"\n" ), ino, bp->b_bn);
repair/scan.c +2 -2
@@ -268,8 +268,8 @@ _("expected block %" PRIu64 ", got %llu, bmbt block %" PRIu64 "\n"),return 1 ; }/* verify uuid */ -if (platform_uuid_compare (&block->bb_u.l.bb_uuid, - &mp->m_sb.sb_meta_uuid) !=0 ) { +if (uuid_compare (block->bb_u.l.bb_uuid, + mp->m_sb.sb_meta_uuid) !=0 ) {do_warn (_ ("wrong FS UUID, bmbt block %" PRIu64"\n" ), bno);
Signature · 1 line
2.31.1
PATCH v2 2/29 xfsprogs: Stop using platform_test_xfs_fd()
In reply to Pavel Reichl--- copy/xfs_copy.c | 4 ++-- growfs/xfs_growfs.c | 2 +- include/linux.h | 7 ++++++- io/init.c | 2 +- io/open.c | 4 ++-- spaceman/init.c | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-)
copy/xfs_copy.c +2 -2
@@ -670,7 +670,7 @@ main(int argc, char **argv)if (S_ISREG (statbuf.st_mode)) source_is_file =1 ; -if (source_is_file &&platform_test_xfs_fd (source_fd)) { +if (source_is_file &&test_xfs_fd (source_fd)) {if (fcntl (source_fd,F_SETFL , open_flags |O_DIRECT ) <0 ) {do_log (_ ("%s: Cannot set direct I/O flag on \"%s\".\n" ), progname, source_name);
@@ -869,7 +869,7 @@ main(int argc, char **argv) progname);die_perror (); } -if (platform_test_xfs_fd (target[i].fd)) { +if (test_xfs_fd (target[i].fd)) {if (xfsctl (target[i].name, target[i].fd,XFS_IOC_DIOINFO , &d) <0 ) { do_log(
growfs/xfs_growfs.c +1 -1
@@ -160,7 +160,7 @@ main(int argc, char **argv)return 1 ; } -if (!platform_test_xfs_fd (ffd)) { +if (!test_xfs_fd (ffd)) {fprintf (stderr,_ ("%s: specified file " "[\"%s\"] is not on an XFS filesystem\n" ), progname, fname);
include/linux.h +6 -1
@@ -46,7 +46,7 @@ static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)* so return 0 for those */ -static __inline__int platform_test_xfs_fd (int fd) +static __inline__int test_xfs_fd (int fd) {struct statfs statfsbuf;struct stat statbuf;
@@ -60,6 +60,11 @@ static __inline__ int platform_test_xfs_fd(int fd)return (statfsbuf.f_type ==0x58465342 );/* XFSB */ } +static __inline__int platform_test_xfs_fd (int fd) +{ +return test_xfs_fd (fd); +} +static __inline__int platform_test_xfs_path (const char *path) {struct statfs statfsbuf;
io/init.c +1 -1
@@ -219,7 +219,7 @@ init( c =openfile (argv[optind], &geometry, flags, mode, &fsp);if (c <0 )exit (1 ); -if (!platform_test_xfs_fd (c)) +if (!test_xfs_fd (c)) flags |=IO_FOREIGN ;if (addfile (argv[optind], c, &geometry, flags, &fsp) <0 )exit (1 );
io/open.c +2 -2
@@ -115,7 +115,7 @@ openfile( } } -if (!geom || !platform_test_xfs_fd (fd)) +if (!geom || !test_xfs_fd (fd))return fd;if (flags &IO_PATH ) {
@@ -326,7 +326,7 @@ open_f(return 0 ; } -if (!platform_test_xfs_fd (fd)) +if (!test_xfs_fd (fd)) flags |=IO_FOREIGN ;if (addfile (argv[optind], fd, &geometry, flags, &fsp) !=0 ) {
spaceman/init.c +1 -1
@@ -93,7 +93,7 @@ init( c =openfile (argv[optind], &xfd, &fsp);if (c <0 )exit (1 ); -if (!platform_test_xfs_fd (xfd.fd)) +if (!test_xfs_fd (xfd.fd))printf (_ ("Not an XFS filesystem!\n" )); c =addfile (argv[optind], &xfd, &fsp);if (c <0 )
Signature · 1 line
2.31.1
PATCH v2 3/29 xfsprogs: Stop using platform_test_xfs_path()
In reply to Pavel Reichl--- fsr/xfs_fsr.c | 2 +- include/linux.h | 7 ++++++- libfrog/paths.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
fsr/xfs_fsr.c +1 -1
@@ -248,7 +248,7 @@ main(int argc, char **argv) progname, argname);exit (1 ); }else if (S_ISDIR (sb.st_mode) ||S_ISREG (sb.st_mode)) { -if (!platform_test_xfs_path (argname)) { +if (!test_xfs_path (argname)) {fprintf (stderr,_ ("%s: cannot defragment: %s: Not XFS\n" ), progname, argname);
include/linux.h +6 -1
@@ -65,7 +65,7 @@ static __inline__ int platform_test_xfs_fd(int fd)return test_xfs_fd (fd); } -static __inline__int platform_test_xfs_path (const char *path) +static __inline__int test_xfs_path (const char *path) {struct statfs statfsbuf;struct stat statbuf;
@@ -79,6 +79,11 @@ static __inline__ int platform_test_xfs_path(const char *path)return (statfsbuf.f_type ==0x58465342 );/* XFSB */ } +static __inline__int platform_test_xfs_path (const char *path) +{ +return test_xfs_path (path); +} +static __inline__int platform_fstatfs (int fd,struct statfs *buf) {return fstatfs (fd, buf);
libfrog/paths.c +1 -1
@@ -161,7 +161,7 @@ fs_table_insert( goto out_nodev; } -if (!platform_test_xfs_path (dir)) +if (!test_xfs_path (dir)) flags |=FS_FOREIGN ;/*
Signature · 1 line
2.31.1
PATCH v2 4/29 xfsprogs: Stop using platform_fstatfs()
In reply to Pavel Reichl--- io/stat.c | 2 +- quota/free.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
io/stat.c +1 -1
@@ -182,7 +182,7 @@ statfs_f(int ret;printf (_ ("fd.path = \"%s\"\n" ), file->name); -if (platform_fstatfs (file->fd, &st) <0 ) { +if (fstatfs (file->fd, &st) <0 ) {perror ("fstatfs" ); exitcode =1 ; }else {
quota/free.c +1 -1
@@ -62,7 +62,7 @@ mount_free_space_data(return 0 ; } -if (platform_fstatfs (fd, &st) <0 ) { +if (fstatfs (fd, &st) <0 ) {perror ("fstatfs" );close (fd);return 0 ;
Signature · 1 line
2.31.1
PATCH v2 5/29 xfsprogs: Stop using platform_getoptreset()
In reply to Pavel Reichl--- db/command.c | 2 +- include/linux.h | 7 ++++++- libxcmd/command.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
db/command.c +1 -1
@@ -84,7 +84,7 @@ command(dbprintf (_ (" arguments\n" ));return 0 ; } -platform_getoptreset (); +getoptreset ();return ct->cfunc (argc, argv); }
include/linux.h +6 -1
@@ -89,12 +89,17 @@ static __inline__ int platform_fstatfs(int fd, struct statfs *buf)return fstatfs (fd, buf); } -static __inline__void platform_getoptreset (void ) +static __inline__void getoptreset (void ) {extern int optind; optind =0 ; } +static __inline__void platform_getoptreset (void ) +{ +platform_getoptreset (); +} +static __inline__int platform_uuid_compare (uuid_t *uu1,uuid_t *uu2) {return uuid_compare (*uu1, *uu2);
libxcmd/command.c +1 -1
@@ -92,7 +92,7 @@ command( argc-1, cmd, ct->argmin, ct->argmax);return 0 ; } -platform_getoptreset (); +getoptreset ();return ct->cfunc (argc, argv); }
Signature · 1 line
2.31.1
PATCH v2 6/29 xfsprogs: Stop using platform_uuid_copy()
In reply to Pavel Reichl--- copy/xfs_copy.c | 8 ++++---- libxfs/libxfs_priv.h | 1 - libxfs/xfs_ag.c | 6 +++--- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_btree.c | 4 ++-- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2_block.c | 2 +- libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 2 +- libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dquot_buf.c | 2 +- libxfs/xfs_ialloc.c | 4 ++-- libxfs/xfs_inode_buf.c | 2 +- libxfs/xfs_sb.c | 6 +++--- libxfs/xfs_symlink_remote.c | 2 +- mkfs/xfs_mkfs.c | 6 +++--- repair/agheader.c | 8 ++++---- repair/dinode.c | 2 +- repair/phase5.c | 6 +++--- 20 files changed, 35 insertions(+), 36 deletions(-)
copy/xfs_copy.c +4 -4
@@ -530,12 +530,12 @@ sb_update_uuid( feat =be32_to_cpu (ag_hdr->xfs_sb->sb_features_incompat); feat |=XFS_SB_FEAT_INCOMPAT_META_UUID ; ag_hdr->xfs_sb->sb_features_incompat =cpu_to_be32 (feat); -platform_uuid_copy (&ag_hdr->xfs_sb->sb_meta_uuid, - &sb->sb_uuid); +uuid_copy (ag_hdr->xfs_sb->sb_meta_uuid, + sb->sb_uuid); }/* Copy the (possibly new) fs-identifier UUID into sb_uuid */ -platform_uuid_copy (&ag_hdr->xfs_sb->sb_uuid, &tcarg->uuid); +uuid_copy (ag_hdr->xfs_sb->sb_uuid, tcarg->uuid);/* We may have changed the UUID, so update the superblock CRC */ if (xfs_sb_version_hascrc (sb))
@@ -948,7 +948,7 @@ main(int argc, char **argv)if (!duplicate)platform_uuid_generate (&tcarg->uuid);else -platform_uuid_copy (&tcarg->uuid, &mp->m_sb.sb_uuid); +uuid_copy (tcarg->uuid, mp->m_sb.sb_uuid);if (pthread_mutex_init (&tcarg->wait,NULL ) !=0 ) {do_log (_ ("Error creating thread mutex %d\n" ), i);
libxfs/libxfs_priv.h +0 -1
@@ -504,7 +504,6 @@ static inline int retzero(void) { return 0; }#define xfs_quota_reserve_blkres (i,b) (0)#define xfs_qm_dqattach (i) (0) -#define uuid_copy (s,d) platform_uuid_copy((s),(d))#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0)
libxfs/xfs_ag.c +3 -3
@@ -268,7 +268,7 @@ xfs_agfblock_init( agf->agf_freeblks =cpu_to_be32 (tmpsize); agf->agf_longest =cpu_to_be32 (tmpsize);if (xfs_sb_version_hascrc (&mp->m_sb)) -uuid_copy (&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agf->agf_uuid, mp->m_sb.sb_meta_uuid);if (xfs_sb_version_hasreflink (&mp->m_sb)) { agf->agf_refcount_root =cpu_to_be32 (xfs_refc_block (mp));
@@ -298,7 +298,7 @@ xfs_agflblock_init(if (xfs_sb_version_hascrc (&mp->m_sb)) { agfl->agfl_magicnum =cpu_to_be32 (XFS_AGFL_MAGIC ); agfl->agfl_seqno =cpu_to_be32 (id->agno); -uuid_copy (&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agfl->agfl_uuid, mp->m_sb.sb_meta_uuid); } agfl_bno =xfs_buf_to_agfl_bno (bp);
@@ -326,7 +326,7 @@ xfs_agiblock_init( agi->agi_newino =cpu_to_be32 (NULLAGINO ); agi->agi_dirino =cpu_to_be32 (NULLAGINO );if (xfs_sb_version_hascrc (&mp->m_sb)) -uuid_copy (&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agi->agi_uuid, mp->m_sb.sb_meta_uuid);if (xfs_sb_version_hasfinobt (&mp->m_sb)) { agi->agi_free_root =cpu_to_be32 (XFS_FIBT_BLOCK (mp)); agi->agi_free_level =cpu_to_be32 (1 );
libxfs/xfs_attr_leaf.c +1 -1
@@ -1272,7 +1272,7 @@ xfs_attr3_leaf_create( hdr3->blkno =cpu_to_be64 (bp->b_bn); hdr3->owner =cpu_to_be64 (dp->i_ino); -uuid_copy (&hdr3->uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (hdr3->uuid, mp->m_sb.sb_meta_uuid); ichdr.freemap[0 ].base =sizeof (struct xfs_attr3_leaf_hdr ); }else {
libxfs/xfs_attr_remote.c +1 -1
@@ -251,7 +251,7 @@ xfs_attr3_rmt_hdr_set( rmt->rm_magic =cpu_to_be32 (XFS_ATTR3_RMT_MAGIC ); rmt->rm_offset =cpu_to_be32 (offset); rmt->rm_bytes =cpu_to_be32 (size); -uuid_copy (&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (rmt->rm_uuid, mp->m_sb.sb_meta_uuid); rmt->rm_owner =cpu_to_be64 (ino); rmt->rm_blkno =cpu_to_be64 (bno);
libxfs/xfs_btree.c +2 -2
@@ -1097,7 +1097,7 @@ xfs_btree_init_block_int(if (crc) { buf->bb_u.l.bb_blkno =cpu_to_be64 (blkno); buf->bb_u.l.bb_owner =cpu_to_be64 (owner); -uuid_copy (&buf->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (buf->bb_u.l.bb_uuid, mp->m_sb.sb_meta_uuid); buf->bb_u.l.bb_pad =0 ; buf->bb_u.l.bb_lsn =0 ; }
@@ -1110,7 +1110,7 @@ xfs_btree_init_block_int(if (crc) { buf->bb_u.s.bb_blkno =cpu_to_be64 (blkno); buf->bb_u.s.bb_owner =cpu_to_be32 (__owner); -uuid_copy (&buf->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (buf->bb_u.s.bb_uuid, mp->m_sb.sb_meta_uuid); buf->bb_u.s.bb_lsn =0 ; } }
libxfs/xfs_da_btree.c +1 -1
@@ -446,7 +446,7 @@ xfs_da3_node_create( ichdr.magic =XFS_DA3_NODE_MAGIC ; hdr3->info.blkno =cpu_to_be64 (bp->b_bn); hdr3->info.owner =cpu_to_be64 (args->dp->i_ino); -uuid_copy (&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (hdr3->info.uuid, mp->m_sb.sb_meta_uuid); }else { ichdr.magic =XFS_DA_NODE_MAGIC ; }
libxfs/xfs_dir2_block.c +1 -1
@@ -173,7 +173,7 @@ xfs_dir3_block_init( hdr3->magic =cpu_to_be32 (XFS_DIR3_BLOCK_MAGIC ); hdr3->blkno =cpu_to_be64 (bp->b_bn); hdr3->owner =cpu_to_be64 (dp->i_ino); -uuid_copy (&hdr3->uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (hdr3->uuid, mp->m_sb.sb_meta_uuid);return ; }
libxfs/xfs_dir2_data.c +1 -1
@@ -721,7 +721,7 @@ xfs_dir3_data_init( hdr3->magic =cpu_to_be32 (XFS_DIR3_DATA_MAGIC ); hdr3->blkno =cpu_to_be64 (bp->b_bn); hdr3->owner =cpu_to_be64 (dp->i_ino); -uuid_copy (&hdr3->uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (hdr3->uuid, mp->m_sb.sb_meta_uuid); }else hdr->magic =cpu_to_be32 (XFS_DIR2_DATA_MAGIC );
libxfs/xfs_dir2_leaf.c +1 -1
@@ -312,7 +312,7 @@ xfs_dir3_leaf_init( : cpu_to_be16(XFS_DIR3_LEAFN_MAGIC); leaf3->info.blkno =cpu_to_be64 (bp->b_bn); leaf3->info.owner =cpu_to_be64 (owner); -uuid_copy (&leaf3->info.uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (leaf3->info.uuid, mp->m_sb.sb_meta_uuid); }else {memset (leaf,0 ,sizeof (*leaf)); leaf->hdr.info.magic =cpu_to_be16 (type);
libxfs/xfs_dir2_node.c +1 -1
@@ -345,7 +345,7 @@ xfs_dir3_free_get_buf( hdr3->hdr.blkno =cpu_to_be64 (bp->b_bn); hdr3->hdr.owner =cpu_to_be64 (dp->i_ino); -uuid_copy (&hdr3->hdr.uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (hdr3->hdr.uuid, mp->m_sb.sb_meta_uuid); }else hdr.magic =XFS_DIR2_FREE_MAGIC ;xfs_dir2_free_hdr_to_disk (mp, bp->b_addr, &hdr);
libxfs/xfs_dquot_buf.c +1 -1
@@ -133,7 +133,7 @@ xfs_dqblk_repair( dqb->dd_diskdq.d_id =cpu_to_be32 (id);if (xfs_sb_version_hascrc (&mp->m_sb)) { -uuid_copy (&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (dqb->dd_uuid, mp->m_sb.sb_meta_uuid);xfs_update_cksum ((char *)dqb,sizeof (struct xfs_dqblk ),XFS_DQUOT_CRC_OFF ); }
libxfs/xfs_ialloc.c +2 -2
@@ -345,8 +345,8 @@ xfs_ialloc_inode_init(if (version ==3 ) { free->di_ino =cpu_to_be64 (ino); ino++; -uuid_copy (&free->di_uuid, - &mp->m_sb.sb_meta_uuid); +uuid_copy (free->di_uuid, + mp->m_sb.sb_meta_uuid);xfs_dinode_calc_crc (mp, free); }else if (tp) {/* just log the inode core */
libxfs/xfs_inode_buf.c +1 -1
@@ -340,7 +340,7 @@ xfs_inode_to_disk( to->di_ino =cpu_to_be64 (ip->i_ino); to->di_lsn =cpu_to_be64 (lsn);memset (to->di_pad2,0 ,sizeof (to->di_pad2)); -uuid_copy (&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid); +uuid_copy (to->di_uuid, ip->i_mount->m_sb.sb_meta_uuid); to->di_flushiter =0 ; }else { to->di_version =2 ;
libxfs/xfs_sb.c +3 -3
@@ -513,9 +513,9 @@ __xfs_sb_from_disk(* feature flag is set; if not set we keep it only in memory. */ if (xfs_sb_version_hasmetauuid (to)) -uuid_copy (&to->sb_meta_uuid, &from->sb_meta_uuid); +uuid_copy (to->sb_meta_uuid, from->sb_meta_uuid);else -uuid_copy (&to->sb_meta_uuid, &from->sb_uuid); +uuid_copy (to->sb_meta_uuid, from->sb_uuid);/* Convert on-disk flags to in-memory flags? */ if (convert_xquota)xfs_sb_quota_from_disk (to);
@@ -658,7 +658,7 @@ xfs_sb_to_disk( to->sb_spino_align =cpu_to_be32 (from->sb_spino_align); to->sb_lsn =cpu_to_be64 (from->sb_lsn);if (xfs_sb_version_hasmetauuid (from)) -uuid_copy (&to->sb_meta_uuid, &from->sb_meta_uuid); +uuid_copy (to->sb_meta_uuid, from->sb_meta_uuid); } }
libxfs/xfs_symlink_remote.c +1 -1
@@ -46,7 +46,7 @@ xfs_symlink_hdr_set( dsl->sl_magic =cpu_to_be32 (XFS_SYMLINK_MAGIC ); dsl->sl_offset =cpu_to_be32 (offset); dsl->sl_bytes =cpu_to_be32 (size); -uuid_copy (&dsl->sl_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (dsl->sl_uuid, mp->m_sb.sb_meta_uuid); dsl->sl_owner =cpu_to_be64 (ino); dsl->sl_blkno =cpu_to_be64 (bp->b_bn); bp->b_ops = &xfs_symlink_buf_ops;
mkfs/xfs_mkfs.c +3 -3
@@ -2192,7 +2192,7 @@ _("cowextsize not supported without reflink support\n"));*/ cfg->sb_feat = cli->sb_feat;if (!platform_uuid_is_null (&cli->uuid)) -platform_uuid_copy (&cfg->uuid, &cli->uuid); +uuid_copy (cfg->uuid, cli->uuid); } static void
@@ -3452,9 +3452,9 @@ finish_superblock_setup( sbp->sb_dblocks = cfg->dblocks; sbp->sb_rextents = cfg->rtextents; -platform_uuid_copy (&sbp->sb_uuid, &cfg->uuid); +uuid_copy (sbp->sb_uuid, cfg->uuid);/* Only in memory; libxfs expects this as if read from disk */ -platform_uuid_copy (&sbp->sb_meta_uuid, &cfg->uuid); +uuid_copy (sbp->sb_meta_uuid, cfg->uuid); sbp->sb_logstart = cfg->logstart; sbp->sb_rootino = sbp->sb_rbmino = sbp->sb_rsumino =NULLFSINO ; sbp->sb_agcount = (xfs_agnumber_t )cfg->agcount;
repair/agheader.c +4 -4
@@ -108,8 +108,8 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)do_warn (_ ("bad uuid %s for agf %d\n" ), uu, i);if (!no_modify) -platform_uuid_copy (&agf->agf_uuid, - &mp->m_sb.sb_meta_uuid); +uuid_copy (agf->agf_uuid, + mp->m_sb.sb_meta_uuid); }return retval; }
@@ -187,8 +187,8 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)do_warn (_ ("bad uuid %s for agi %d\n" ), uu, agno);if (!no_modify) -platform_uuid_copy (&agi->agi_uuid, - &mp->m_sb.sb_meta_uuid); +uuid_copy (agi->agi_uuid, + mp->m_sb.sb_meta_uuid); }return retval;
repair/dinode.c +1 -1
@@ -121,7 +121,7 @@ clear_dinode_core(struct xfs_mount *mp, xfs_dinode_t *dinoc, xfs_ino_t ino_num)if (dinoc->di_version <3 )return ; dinoc->di_ino =cpu_to_be64 (ino_num); -platform_uuid_copy (&dinoc->di_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (dinoc->di_uuid, mp->m_sb.sb_meta_uuid);return ; }
repair/phase5.c +3 -3
@@ -163,7 +163,7 @@ build_agi( agi->agi_unlinked[i] =cpu_to_be32 (NULLAGINO );if (xfs_sb_version_hascrc (&mp->m_sb)) -platform_uuid_copy (&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agi->agi_uuid, mp->m_sb.sb_meta_uuid);if (xfs_sb_version_hasfinobt (&mp->m_sb)) { agi->agi_free_root =
@@ -312,7 +312,7 @@ build_agf_agfl(#endif if (xfs_sb_version_hascrc (&mp->m_sb)) -platform_uuid_copy (&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agf->agf_uuid, mp->m_sb.sb_meta_uuid);/* initialise the AGFL, then fill it if there are blocks left over. */ error = -libxfs_buf_get(mp->m_dev,
@@ -330,7 +330,7 @@ build_agf_agfl(if (xfs_sb_version_hascrc (&mp->m_sb)) { agfl->agfl_magicnum =cpu_to_be32 (XFS_AGFL_MAGIC ); agfl->agfl_seqno =cpu_to_be32 (agno); -platform_uuid_copy (&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); +uuid_copy (agfl->agfl_uuid, mp->m_sb.sb_meta_uuid);for (agfl_idx =0 ; agfl_idx <libxfs_agfl_size (mp); agfl_idx++) freelist[agfl_idx] =cpu_to_be32 (NULLAGBLOCK ); }
Signature · 1 line
2.31.1
PATCH v2 7/29 xfsprogs: Stop using platform_uuid_generate()
In reply to Pavel Reichl--- copy/xfs_copy.c | 2 +- db/sb.c | 2 +- mkfs/xfs_mkfs.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
copy/xfs_copy.c +1 -1
@@ -946,7 +946,7 @@ main(int argc, char **argv)for (i =0 , tcarg = targ; i < num_targets; i++, tcarg++) {if (!duplicate) -platform_uuid_generate (&tcarg->uuid); +uuid_generate (tcarg->uuid);else uuid_copy (tcarg->uuid, mp->m_sb.sb_uuid);
db/sb.c +1 -1
@@ -386,7 +386,7 @@ uuid_f( }if (!strcasecmp (argv[1 ],"generate" )) { -platform_uuid_generate (&uu); +uuid_generate (uu); }else if (!strcasecmp (argv[1 ],"nil" )) {platform_uuid_clear (&uu); }else if (!strcasecmp (argv[1 ],"rewrite" )) {
mkfs/xfs_mkfs.c +1 -1
@@ -3859,7 +3859,7 @@ main(struct list_head buffer_list;int error; -platform_uuid_generate (&cli.uuid); +uuid_generate (cli.uuid); progname =basename (argv[0 ]);setlocale (LC_ALL ,"" );bindtextdomain (PACKAGE ,LOCALEDIR );
Signature · 1 line
2.31.1
PATCH v2 8/29 xfsprogs: Stop using platform_uuid_unparse()
In reply to Pavel Reichl--- db/fprint.c | 2 +- db/sb.c | 6 +++--- libxlog/util.c | 4 ++-- logprint/log_misc.c | 2 +- repair/agheader.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
db/fprint.c +1 -1
@@ -273,7 +273,7 @@ fp_uuid( i++, p++) {if (array)dbprintf ("%d:" , i + base); -platform_uuid_unparse (p, bp); +uuid_unparse (*p, bp);dbprintf ("%s" , bp);if (i < count -1 )dbprintf (" " );
db/sb.c +3 -3
@@ -396,7 +396,7 @@ uuid_f(return 0 ; }memcpy (&uu, uup,sizeof (uuid_t)); -platform_uuid_unparse (&uu, bp); +uuid_unparse (uu, bp);dbprintf (_ ("old UUID = %s\n" ), bp); }else if (!strcasecmp (argv[1 ],"restore" )) {xfs_sb_t tsb;
@@ -427,7 +427,7 @@ uuid_f(break ; } -platform_uuid_unparse (&uu, bp); +uuid_unparse (uu, bp);dbprintf (_ ("new UUID = %s\n" ), bp);return 0 ;
@@ -460,7 +460,7 @@ uuid_f( "for FS with an external log\n")); } -platform_uuid_unparse (&uu, bp); +uuid_unparse (uu, bp);dbprintf (_ ("UUID = %s\n" ), bp); }
libxlog/util.c +2 -2
@@ -79,8 +79,8 @@ header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)if (!uuid_compare (mp->m_sb.sb_uuid, head->h_fs_uuid))return 0 ; -platform_uuid_unparse (&mp->m_sb.sb_uuid, uu_sb); -platform_uuid_unparse (&head->h_fs_uuid, uu_log); +uuid_unparse (mp->m_sb.sb_uuid, uu_sb); +uuid_unparse (head->h_fs_uuid, uu_log); printf(_("* ERROR: mismatched uuid in log\n" "* SB : %s\n* log: %s\n"),
logprint/log_misc.c +1 -1
@@ -1082,7 +1082,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len, int bad_hdr_warn)printf ("\n" ); } -platform_uuid_unparse (&head->h_fs_uuid, uub); +uuid_unparse (head->h_fs_uuid, uub);printf (_ ("uuid: %s format: " ), uub);switch (be32_to_cpu (head->h_fmt)) {case XLOG_FMT_UNKNOWN :
repair/agheader.c +2 -2
@@ -104,7 +104,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)char uu[64 ]; retval =XR_AG_AGF ; -platform_uuid_unparse (&agf->agf_uuid, uu); +uuid_unparse (agf->agf_uuid, uu);do_warn (_ ("bad uuid %s for agf %d\n" ), uu, i);if (!no_modify)
@@ -183,7 +183,7 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)char uu[64 ]; retval =XR_AG_AGI ; -platform_uuid_unparse (&agi->agi_uuid, uu); +uuid_unparse (agi->agi_uuid, uu);do_warn (_ ("bad uuid %s for agi %d\n" ), uu, agno);if (!no_modify)
Signature · 1 line
2.31.1
PATCH v2 9/29 xfsprogs: Stop using platform_uuid_clear()
In reply to Pavel Reichl--- db/sb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
db/sb.c +1 -1
@@ -388,7 +388,7 @@ uuid_f(if (!strcasecmp (argv[1 ],"generate" )) {uuid_generate (uu); }else if (!strcasecmp (argv[1 ],"nil" )) { -platform_uuid_clear (&uu); +uuid_clear (uu); }else if (!strcasecmp (argv[1 ],"rewrite" )) { uup =do_uuid (0 ,NULL );if (!uup) {
Signature · 1 line
2.31.1
PATCH v2 10/29 xfsprogs: Stop using platform_uuid_parse()
In reply to Pavel Reichl--- db/sb.c | 2 +- mkfs/xfs_mkfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
db/sb.c +1 -1
@@ -410,7 +410,7 @@ uuid_f(memcpy (&uu, mp->m_sb.sb_meta_uuid,sizeof (uuid_t)); }else { -if (platform_uuid_parse (argv[1 ], &uu)) { +if (uuid_parse (argv[1 ], uu)) {dbprintf (_ ("invalid UUID\n" ));return 0 ; }
mkfs/xfs_mkfs.c +1 -1
@@ -1656,7 +1656,7 @@ meta_opts_parser(case M_UUID :if (!value || *value =='\0' )reqval ('m' , opts->subopts, subopt); -if (platform_uuid_parse (value, &cli->uuid)) +if (uuid_parse (value, cli->uuid))illegal (value,"m uuid" );break ;case M_RMAPBT :
Signature · 1 line
2.31.1
PATCH v2 11/29 xfsprogs: Stop using platform_uuid_is_null()
In reply to Pavel Reichl--- libxlog/util.c | 2 +- mkfs/xfs_mkfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libxlog/util.c +1 -1
@@ -130,7 +130,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)int xlog_header_check_mount (xfs_mount_t *mp,xlog_rec_header_t *head) { -if (platform_uuid_is_null (&head->h_fs_uuid))return 0 ; +if (uuid_is_null (head->h_fs_uuid))return 0 ;if (header_check_uuid (mp, head)) {/* bail out now or just carry on regardless */ if (print_exit)
mkfs/xfs_mkfs.c +1 -1
@@ -2191,7 +2191,7 @@ _("cowextsize not supported without reflink support\n"));* Copy features across to config structure now. */ cfg->sb_feat = cli->sb_feat; -if (!platform_uuid_is_null (&cli->uuid)) +if (!uuid_is_null (cli->uuid))uuid_copy (cfg->uuid, cli->uuid); }
Signature · 1 line
2.31.1
PATCH v2 12/29 xfsprogs: Stop using platform_check_mount()
In reply to Pavel Reichl--- libfrog/linux.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
libfrog/linux.c +9 -3
@@ -40,7 +40,7 @@ static int max_block_alignment;#define CHECK_MOUNT_WRITABLE 0x2static int -platform_check_mount (char *name,char *block,struct stat *s,int flags) +check_mount (char *name,char *block,struct stat *s,int flags) {FILE *f;struct stat st, mst;
@@ -107,13 +107,19 @@ _("%s: %s contains a mounted filesystem\n"),return 1 ; } +static int +platform_check_mount (char *name,char *block,struct stat *s,int flags) +{ +return check_mount (name, block, s, flags); +} +int platform_check_ismounted (char *name,char *block,struct stat *s,int verbose) {int flags; flags = verbose ?CHECK_MOUNT_VERBOSE :0 ; -return platform_check_mount (name, block, s, flags); +return check_mount (name, block, s, flags); }int
@@ -123,7 +129,7 @@ platform_check_iswritable(char *name, char *block, struct stat *s)/* Writable checks are always verbose */ flags =CHECK_MOUNT_WRITABLE |CHECK_MOUNT_VERBOSE ; -return platform_check_mount (name, block, s, flags); +return check_mount (name, block, s, flags); }int
Signature · 1 line
2.31.1
PATCH v2 13/29 xfsprogs: Stop using platform_check_ismounted()
In reply to Pavel Reichl--- copy/xfs_copy.c | 6 +++--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 4 ++-- mdrestore/xfs_mdrestore.c | 4 ++-- 5 files changed, 15 insertions(+), 8 deletions(-)
copy/xfs_copy.c +3 -3
@@ -17,7 +17,7 @@#define rounddown (x, y) (((x)/(y))*(y))#define uuid_equal (s,d) (uuid_compare((*s),(*d)) == 0) -extern int platform_check_ismounted (char *,char *,struct stat *,int ); +extern int check_ismounted (char *,char *,struct stat *,int );static char *logfile_name;static FILE *logerr;
@@ -698,7 +698,7 @@ main(int argc, char **argv)* check to make sure a filesystem isn't mounted * on the device */ -if (platform_check_ismounted (source_name,NULL , &statbuf,0 )) { +if (check_ismounted (source_name,NULL , &statbuf,0 )) {do_log (_ ("%s: Warning -- a filesystem is mounted on the source device.\n" ), progname);
@@ -842,7 +842,7 @@ main(int argc, char **argv)* check to make sure a filesystem isn't mounted * on the device */ -if (platform_check_ismounted (target[i].name, +if (check_ismounted (target[i].name,NULL , &statbuf,0 )) { do_log(_("%s: a filesystem is mounted " "on target device \"%s\".\n"
libfrog/linux.c +7 -1
@@ -114,7 +114,7 @@ platform_check_mount(char *name, char *block, struct stat *s, int flags) }int -platform_check_ismounted (char *name,char *block,struct stat *s,int verbose) +check_ismounted (char *name,char *block,struct stat *s,int verbose) {int flags;
@@ -122,6 +122,12 @@ platform_check_ismounted(char *name, char *block, struct stat *s, int verbose)return check_mount (name, block, s, flags); } +int +platform_check_ismounted (char *name,char *block,struct stat *s,int verbose) +{ +return check_ismounted (name, block, s, verbose); +} +int platform_check_iswritable (char *name,char *block,struct stat *s) {
libfrog/platform.h +1 -0
@@ -9,6 +9,7 @@int platform_check_ismounted (char *path,char *block,struct stat *sptr,int verbose); +int check_ismounted (char *path,char *block,struct stat *sptr,int verbose);int platform_check_iswritable (char *path,char *block,struct stat *sptr);int platform_set_blocksize (int fd,char *path,dev_t device,int bsz,int fatal);
libxfs/init.c +2 -2
@@ -59,7 +59,7 @@ check_isactive(char *name, char *block, int fatal)return 0 ;if ((st.st_mode &S_IFMT ) !=S_IFBLK )return 0 ; -if (platform_check_ismounted (name, block, &st,0 ) ==0 ) +if (check_ismounted (name, block, &st,0 ) ==0 )return 0 ;if (platform_check_iswritable (name, block, &st))return fatal ?1 :0 ;
@@ -212,7 +212,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile) progname, path);return 0 ; } -if (!readonly && !inactive &&platform_check_ismounted (path, *blockfile,NULL ,1 )) +if (!readonly && !inactive &&check_ismounted (path, *blockfile,NULL ,1 ))return 0 ;if (inactive &&check_isactive (path, *blockfile, ((readonly|dangerously)?1 :0 )))
mdrestore/xfs_mdrestore.c +2 -2
@@ -182,7 +182,7 @@ usage(void)exit (1 ); } -extern int platform_check_ismounted (char *,char *,struct stat *,int ); +extern int check_ismounted (char *,char *,struct stat *,int );int main(
@@ -275,7 +275,7 @@ main(/* * check to make sure a filesystem isn't mounted on the device */ -if (platform_check_ismounted (argv[optind],NULL , &statbuf,0 )) +if (check_ismounted (argv[optind],NULL , &statbuf,0 ))fatal ("a filesystem is mounted on target device \"%s\"," " cannot restore to a mounted filesystem.\n" , argv[optind]);
Signature · 1 line
2.31.1
PATCH v2 14/29 xfsprogs: Stop using platform_flush_device()
In reply to Pavel Reichl--- copy/xfs_copy.c | 2 +- libfrog/linux.c | 10 +++++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- libxfs/rdwr.c | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-)
copy/xfs_copy.c +1 -1
@@ -140,7 +140,7 @@ check_errors(void)for (i =0 ; i < num_targets; i++) {if (target[i].state !=INACTIVE ) { -if (platform_flush_device (target[i].fd,0 )) { +if (flush_device (target[i].fd,0 )) { target[i].error = errno; target[i].state =INACTIVE ; target[i].err_type =2 ;
libfrog/linux.c +9 -1
@@ -159,7 +159,7 @@ platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fata* success or -1 (with errno set) for failure. */ int -platform_flush_device ( +flush_device (int fd,dev_t device) {
@@ -183,6 +183,14 @@ platform_flush_device(return 0 ; } +int +platform_flush_device ( +int fd, +dev_t device) +{ +return flush_device (fd, device); +} +void platform_findsizes (char *path,int fd,long long *sz,int *bsz) {
libfrog/platform.h +1 -0
@@ -14,6 +14,7 @@ int platform_check_iswritable(char *path, char *block, struct stat *sptr);int platform_set_blocksize (int fd,char *path,dev_t device,int bsz,int fatal);int platform_flush_device (int fd,dev_t device); +int flush_device (int fd,dev_t device);char *platform_findrawpath (char *path);char *platform_findblockpath (char *path);int platform_direct_blockdev (void );
libxfs/init.c +1 -1
@@ -171,7 +171,7 @@ libxfs_device_close(dev_t dev) fd = dev_map[d].fd; dev_map[d].dev = dev_map[d].fd =0 ; - ret =platform_flush_device (fd, dev); + ret =flush_device (fd, dev);if (ret) { ret = -errno; fprintf(stderr,
libxfs/rdwr.c +1 -1
@@ -1143,7 +1143,7 @@ libxfs_blkdev_issue_flush(return 0 ; fd =libxfs_device_to_fd (btp->bt_bdev); - ret =platform_flush_device (fd, btp->bt_bdev); + ret =flush_device (fd, btp->bt_bdev);return ret ? -errno :0 ; }
Signature · 1 line
2.31.1
PATCH v2 15/29 xfsprogs: Stop using platform_mntent_open()
In reply to Pavel Reichl--- fsr/xfs_fsr.c | 2 +- include/linux.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
fsr/xfs_fsr.c +1 -1
@@ -314,7 +314,7 @@ initallfs(char *mtab) mi =0 ; fs = fsbase; -if (platform_mntent_open (&cursor, mtab) !=0 ){ +if (mntent_open (&cursor, mtab) !=0 ){fprintf (stderr,"Error: can't get mntent entries.\n" );exit (1 ); }
include/linux.h +6 -1
@@ -166,7 +166,7 @@ struct mntent_cursor {FILE *mtabp; }; -static inline int platform_mntent_open (struct mntent_cursor * cursor,char *mtab) +static inline int mntent_open (struct mntent_cursor * cursor,char *mtab) { cursor->mtabp =setmntent (mtab,"r" );if (!cursor->mtabp) {
@@ -176,6 +176,11 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtabreturn 0 ; } +static inline int platform_mntent_open (struct mntent_cursor * cursor,char *mtab) +{ +return mntent_open (cursor, mtab); +} +static inline struct mntent *platform_mntent_next (struct mntent_cursor * cursor) {return getmntent (cursor->mtabp);
Signature · 1 line
2.31.1
PATCH v2 16/29 xfsprogs: Stop using platform_mntent_next()
In reply to Pavel Reichl--- fsr/xfs_fsr.c | 2 +- include/linux.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
fsr/xfs_fsr.c +1 -1
@@ -319,7 +319,7 @@ initallfs(char *mtab)exit (1 ); } -while ((mnt =platform_mntent_next (&cursor)) !=NULL ) { +while ((mnt =mntent_next (&cursor)) !=NULL ) {int rw =0 ; if (strcmp(mnt->mnt_type, MNTTYPE_XFS ) != 0 ||
include/linux.h +6 -1
@@ -181,11 +181,16 @@ static inline int platform_mntent_open(struct mntent_cursor * cursor, char *mtabreturn mntent_open (cursor, mtab); } -static inline struct mntent *platform_mntent_next (struct mntent_cursor * cursor) +static inline struct mntent *mntent_next (struct mntent_cursor * cursor) {return getmntent (cursor->mtabp); } +static inline struct mntent *platform_mntent_next (struct mntent_cursor * cursor) +{ +return mntent_next (cursor); +} +static inline void platform_mntent_close (struct mntent_cursor * cursor) {endmntent (cursor->mtabp);
Signature · 1 line
2.31.1
PATCH v2 17/29 xfsprogs: Stop using platform_mntent_close()
In reply to Pavel Reichl--- fsr/xfs_fsr.c | 2 +- include/linux.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
fsr/xfs_fsr.c +1 -1
@@ -369,7 +369,7 @@ initallfs(char *mtab) mi++; fs++; } -platform_mntent_close (&cursor); +mntent_close (&cursor); numfs = mi; fsend = (fsbase + numfs);
include/linux.h +6 -1
@@ -191,11 +191,16 @@ static inline struct mntent * platform_mntent_next(struct mntent_cursor * cursorreturn mntent_next (cursor); } -static inline void platform_mntent_close (struct mntent_cursor * cursor) +static inline void mntent_close (struct mntent_cursor * cursor) {endmntent (cursor->mtabp); } +static inline void platform_mntent_close (struct mntent_cursor * cursor) +{ +return platform_mntent_close (cursor); +} +#if defined(FALLOC_FL_ZERO_RANGE )static inline int platform_zero_range(
Signature · 1 line
2.31.1
PATCH v2 18/29 xfsprogs: Stop using platform_findsizes()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 2 +- libfrog/topology.c | 6 +++--- libxfs/init.c | 12 ++++++------ 4 files changed, 17 insertions(+), 11 deletions(-)
libfrog/linux.c +7 -1
@@ -192,7 +192,7 @@ platform_flush_device( }void -platform_findsizes (char *path,int fd,long long *sz,int *bsz) +findsizes (char *path,int fd,long long *sz,int *bsz) {struct stat st;uint64_t size;
@@ -251,6 +251,12 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) max_block_alignment = *bsz; } +void +platform_findsizes (char *path,int fd,long long *sz,int *bsz) +{ +findsizes (path, fd, sz, bsz); +} +char *platform_findrawpath (char *path) {
libfrog/platform.h +1 -1
@@ -21,8 +21,8 @@ int platform_direct_blockdev(void);int platform_align_blockdev (void );unsigned long platform_physmem (void );/* in kilobytes */ void platform_findsizes (char *path,int fd,long long *sz,int *bsz); +void findsizes (char *path,int fd,long long *sz,int *bsz);int platform_nproc (void ); -void platform_findsizes (char *path,int fd,long long *sz,int *bsz);#endif /* __LIBFROG_PLATFORM_H__ */
libfrog/topology.c +3 -3
@@ -117,7 +117,7 @@ check_overwrite( fd =open (device,O_RDONLY );if (fd <0 ) goto out; -platform_findsizes ((char *)device, fd, &size, &bsz); +findsizes ((char *)device, fd, &size, &bsz);close (fd);/* nothing to overwrite on a 0-length device */
@@ -296,7 +296,7 @@ void get_topology(char *dfile = xi->volname ? xi->volname : xi->dname;/* -* If our target is a regular file, use platform_findsizes +* If our target is a regular file, use findsizes * to try to obtain the underlying filesystem's requirements * for direct IO; we'll set our sector size to that if possible. */
@@ -312,7 +312,7 @@ void get_topology( fd =open (dfile, flags,0666 );if (fd >=0 ) { -platform_findsizes (dfile, fd, &dummy, &ft->lsectorsize); +findsizes (dfile, fd, &dummy, &ft->lsectorsize);close (fd); ft->psectorsize = ft->lsectorsize; }else
libxfs/init.c +6 -6
@@ -324,7 +324,7 @@ libxfs_init(libxfs_init_t *a) a->ddev=libxfs_device_open (dname, a->dcreat, flags, a->setblksize); a->dfd =libxfs_device_to_fd (a->ddev); -platform_findsizes (dname, a->dfd, &a->dsize, +findsizes (dname, a->dfd, &a->dsize, &a->dbsize); }else {if (!check_open (dname, flags, &rawfile, &blockfile))
@@ -332,7 +332,7 @@ libxfs_init(libxfs_init_t *a) a->ddev =libxfs_device_open (rawfile, a->dcreat, flags, a->setblksize); a->dfd =libxfs_device_to_fd (a->ddev); -platform_findsizes (rawfile, a->dfd, +findsizes (rawfile, a->dfd, &a->dsize, &a->dbsize); } }else
@@ -342,7 +342,7 @@ libxfs_init(libxfs_init_t *a) a->logdev =libxfs_device_open (logname, a->lcreat, flags, a->setblksize); a->logfd =libxfs_device_to_fd (a->logdev); -platform_findsizes (dname, a->logfd, &a->logBBsize, +findsizes (dname, a->logfd, &a->logBBsize, &a->lbsize); }else {if (!check_open (logname, flags, &rawfile, &blockfile))
@@ -350,7 +350,7 @@ libxfs_init(libxfs_init_t *a) a->logdev =libxfs_device_open (rawfile, a->lcreat, flags, a->setblksize); a->logfd =libxfs_device_to_fd (a->logdev); -platform_findsizes (rawfile, a->logfd, +findsizes (rawfile, a->logfd, &a->logBBsize, &a->lbsize); } }else
@@ -360,7 +360,7 @@ libxfs_init(libxfs_init_t *a) a->rtdev =libxfs_device_open (rtname, a->rcreat, flags, a->setblksize); a->rtfd =libxfs_device_to_fd (a->rtdev); -platform_findsizes (dname, a->rtfd, &a->rtsize, +findsizes (dname, a->rtfd, &a->rtsize, &a->rtbsize); }else {if (!check_open (rtname, flags, &rawfile, &blockfile))
@@ -368,7 +368,7 @@ libxfs_init(libxfs_init_t *a) a->rtdev =libxfs_device_open (rawfile, a->rcreat, flags, a->setblksize); a->rtfd =libxfs_device_to_fd (a->rtdev); -platform_findsizes (rawfile, a->rtfd, +findsizes (rawfile, a->rtfd, &a->rtsize, &a->rtbsize); } }else
Signature · 1 line
2.31.1
PATCH v2 19/29 xfsprogs: Stop using platform_discard_blocks
In reply to Pavel Reichl--- include/linux.h | 7 ++++++- mkfs/xfs_mkfs.c | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-)
include/linux.h +6 -1
@@ -140,7 +140,7 @@ static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)#endif static __inline__int -platform_discard_blocks (int fd,uint64_t start,uint64_t len) +discard_blocks (int fd,uint64_t start,uint64_t len) {uint64_t range[2 ] = { start, len };
@@ -149,6 +149,11 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)return 0 ; } +static __inline__int +platform_discard_blocks (int fd,uint64_t start,uint64_t len) +{ +return discard_blocks (fd, start, len); +}#define ENOATTR ENODATA/* Attribute not found */ #define EFSCORRUPTED EUCLEAN/* Filesystem is corrupted */ #define EFSBADCRC EBADMSG/* Bad CRC detected */
mkfs/xfs_mkfs.c +5 -5
@@ -1263,7 +1263,7 @@ done: }static void -discard_blocks (dev_t dev,uint64_t nsectors,int quiet) +discard_batch_of_blocks (dev_t dev,uint64_t nsectors,int quiet) {int fd;uint64_t offset =0 ;
@@ -1286,7 +1286,7 @@ discard_blocks(dev_t dev, uint64_t nsectors, int quiet)* not necessary for the mkfs functionality but just an * optimization. However we should stop on error. */ -if (platform_discard_blocks (fd, offset, tmp_step) ==0 ) { +if (discard_blocks (fd, offset, tmp_step) ==0 ) {if (offset ==0 && !quiet) {printf ("Discarding blocks..." );fflush (stdout);
@@ -2664,11 +2664,11 @@ discard_devices(*/ if (!xi->disfile) -discard_blocks (xi->ddev, xi->dsize, quiet); +discard_batch_of_blocks (xi->ddev, xi->dsize, quiet);if (xi->rtdev && !xi->risfile) -discard_blocks (xi->rtdev, xi->rtsize, quiet); +discard_batch_of_blocks (xi->rtdev, xi->rtsize, quiet);if (xi->logdev && xi->logdev != xi->ddev && !xi->lisfile) -discard_blocks (xi->logdev, xi->logBBsize, quiet); +discard_batch_of_blocks (xi->logdev, xi->logBBsize, quiet); } static void
Signature · 1 line
2.31.1
PATCH v2 20/29 xfsprogs: Stop using platform_zero_range()
In reply to Pavel Reichl--- include/linux.h | 14 ++++++++++++-- libxfs/rdwr.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-)
include/linux.h +12 -2
@@ -208,7 +208,7 @@ static inline void platform_mntent_close(struct mntent_cursor * cursor)#if defined(FALLOC_FL_ZERO_RANGE )static inline int -platform_zero_range ( +zero_range (int fd,xfs_off_t start,size_t len)
@@ -220,8 +220,18 @@ platform_zero_range(return 0 ; return -errno; } + +static inline int +platform_zero_range ( +int fd, +xfs_off_t start, +size_t len) +{ +return zero_range (fd, start, len); +}#else -#define platform_zero_range (fd, s, l) (-EOPNOTSUPP) +#define zero_range (fd, s, l) (-EOPNOTSUPP) +#define platform_zero_range (fs, s, l) zero_range(fd, s, l)#endif /*
libxfs/rdwr.c +1 -1
@@ -73,7 +73,7 @@ libxfs_device_zero(struct xfs_buftarg *btp, xfs_daddr_t start, uint len)/* try to use special zeroing methods, fall back to writes if needed */ len_bytes =LIBXFS_BBTOOFF64 (len); - error =platform_zero_range (fd, start_offset, len_bytes); + error =zero_range (fd, start_offset, len_bytes);if (!error) {xfs_buftarg_trip_write (btp);return 0 ;
Signature · 1 line
2.31.1
PATCH v2 21/29 xfsprogs: Stop using platform_crash()
In reply to Pavel Reichl--- include/linux.h | 8 +++++++- libxfs/libxfs_io.h | 2 +- repair/xfs_repair.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-)
include/linux.h +7 -1
@@ -239,12 +239,18 @@ platform_zero_range(* atexit handlers. */ static inline void -platform_crash (void ) +crash (void ) {kill (getpid (),SIGKILL );assert (0 ); } +static inline void +platform_crash (void ) +{ +return crash (); +} +/* * Check whether we have to define FS_IOC_FS[GS]ETXATTR ourselves. These * are a copy of the definitions moved to linux/uapi/fs.h in the 4.5 kernel,
libxfs/libxfs_io.h +1 -1
@@ -46,7 +46,7 @@ xfs_buftarg_trip_write(pthread_mutex_lock (&btp->lock); btp->writes_left--;if (!btp->writes_left) -platform_crash (); +crash ();pthread_mutex_unlock (&btp->lock); }
repair/xfs_repair.c +1 -1
@@ -882,7 +882,7 @@ phase_end(int phase)/* Fail if someone injected an post-phase error. */ if (fail_after_phase && phase == fail_after_phase) -platform_crash (); +crash (); }int
Signature · 1 line
2.31.1
PATCH v2 22/29 xfsprogs: Stop using platform_nproc()
In reply to Pavel Reichl--- include/platform_defs.h.in | 1 + libfrog/linux.c | 8 +++++++- repair/phase4.c | 6 +++--- repair/prefetch.c | 2 +- repair/slab.c | 2 +- repair/xfs_repair.c | 2 +- scrub/disk.c | 8 ++++---- 7 files changed, 18 insertions(+), 11 deletions(-)
include/platform_defs.h.in +1 -0
@@ -79,6 +79,7 @@ typedef unsigned short umode_t; #endif extern int platform_nproc(void); +extern int nproc(void); #define NSEC_PER_SEC (1000000000ULL) #define NSEC_PER_USEC (1000ULL)
libfrog/linux.c +7 -1
@@ -285,7 +285,7 @@ platform_align_blockdev(void)/* How many CPUs are online? */ int -platform_nproc (void ) +nproc (void ) {long nproc =sysconf (_SC_NPROCESSORS_ONLN);
@@ -296,6 +296,12 @@ platform_nproc(void)return nproc; } +int +platform_nproc (void ) +{ +return nproc (); +} +unsigned long platform_physmem (void ) {
repair/phase4.c +3 -3
@@ -235,7 +235,7 @@ process_rmap_data(if (!rmap_needs_work (mp))return ; -create_work_queue (&wq, mp,platform_nproc ()); +create_work_queue (&wq, mp,nproc ());for (i =0 ; i < mp->m_sb.sb_agcount; i++)queue_work (&wq, check_rmap_btrees, i,NULL );destroy_work_queue (&wq);
@@ -243,12 +243,12 @@ process_rmap_data(if (!xfs_sb_version_hasreflink (&mp->m_sb))return ; -create_work_queue (&wq, mp,platform_nproc ()); +create_work_queue (&wq, mp,nproc ());for (i =0 ; i < mp->m_sb.sb_agcount; i++)queue_work (&wq, compute_ag_refcounts, i,NULL );destroy_work_queue (&wq); -create_work_queue (&wq, mp,platform_nproc ()); +create_work_queue (&wq, mp,nproc ());for (i =0 ; i < mp->m_sb.sb_agcount; i++) {queue_work (&wq, process_inode_reflink_flags, i,NULL );queue_work (&wq, check_refcount_btrees, i,NULL );
repair/prefetch.c +1 -1
@@ -1024,7 +1024,7 @@ do_inode_prefetch(*/ if (check_cache && !libxfs_bcache_overflowed ()) { queue.wq_ctx = mp; -create_work_queue (&queue, mp,platform_nproc ()); +create_work_queue (&queue, mp,nproc ());for (i =0 ; i < mp->m_sb.sb_agcount; i++)queue_work (&queue, func, i,NULL );destroy_work_queue (&queue);
repair/slab.c +1 -1
@@ -234,7 +234,7 @@ qsort_slab(return ; } -create_work_queue (&wq,NULL ,platform_nproc ()); +create_work_queue (&wq,NULL ,nproc ()); hdr = slab->s_first;while (hdr) { qs =malloc (sizeof (struct qsort_slab ));
repair/xfs_repair.c +1 -1
@@ -1030,7 +1030,7 @@ main(int argc, char **argv) }if (ag_stride) { -int max_threads =platform_nproc () *8 ; +int max_threads =nproc () *8 ; thread_count = (glob_agcount + ag_stride -1 ) / ag_stride;while (thread_count > max_threads) {
scrub/disk.c +4 -4
@@ -43,19 +43,19 @@ __disk_heads( {int iomin;int ioopt; -int nproc =platform_nproc (); +int n_proc =nproc ();unsigned short rot;int error;/* If it's not a block device, throw all the CPUs at it. */ if (!S_ISBLK (disk->d_sb.st_mode)) -return nproc; +return n_proc;/* Non-rotational device? Throw all the CPUs at the problem. */ rot =1 ; error =ioctl (disk->d_fd,BLKROTATIONAL , &rot);if (error ==0 && rot ==0 ) -return nproc; +return n_proc;/* * Sometimes we can infer the number of devices from the
@@ -65,7 +65,7 @@ __disk_heads(if (ioctl (disk->d_fd,BLKIOMIN , &iomin) ==0 &&ioctl (disk->d_fd,BLKIOOPT , &ioopt) ==0 && iomin >0 && ioopt >0 ) { -return min (nproc,max (1 , ioopt / iomin)); +return min (n_proc,max (1 , ioopt / iomin)); }/* Rotating device? I guess? */
Signature · 1 line
2.31.1
PATCH v2 23/29 xfsprogs: Stop using platform_check_iswritable()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
libfrog/linux.c +7 -1
@@ -129,7 +129,7 @@ platform_check_ismounted(char *name, char *block, struct stat *s, int verbose) }int -platform_check_iswritable (char *name,char *block,struct stat *s) +check_iswritable (char *name,char *block,struct stat *s) {int flags;
@@ -138,6 +138,12 @@ platform_check_iswritable(char *name, char *block, struct stat *s)return check_mount (name, block, s, flags); } +int +platform_check_iswritable (char *name,char *block,struct stat *s) +{ +return check_iswritable (name, block, s); +} +int platform_set_blocksize (int fd,char *path,dev_t device,int blocksize,int fatal) {
libfrog/platform.h +1 -0
@@ -11,6 +11,7 @@ int platform_check_ismounted(char *path, char *block, struct stat *sptr, int verbose);int check_ismounted (char *path,char *block,struct stat *sptr,int verbose);int platform_check_iswritable (char *path,char *block,struct stat *sptr); +int check_iswritable (char *path,char *block,struct stat *sptr);int platform_set_blocksize (int fd,char *path,dev_t device,int bsz,int fatal);int platform_flush_device (int fd,dev_t device);
libxfs/init.c +1 -1
@@ -61,7 +61,7 @@ check_isactive(char *name, char *block, int fatal)return 0 ;if (check_ismounted (name, block, &st,0 ) ==0 )return 0 ; -if (platform_check_iswritable (name, block, &st)) +if (check_iswritable (name, block, &st))return fatal ?1 :0 ;return 0 ; }
Signature · 1 line
2.31.1
PATCH v2 24/29 xfsprogs: Stop using platform_set_blocksize()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-)
libfrog/linux.c +7 -1
@@ -145,7 +145,7 @@ platform_check_iswritable(char *name, char *block, struct stat *s) }int -platform_set_blocksize (int fd,char *path,dev_t device,int blocksize,int fatal) +set_blocksize (int fd,char *path,dev_t device,int blocksize,int fatal) {int error =0 ;
@@ -160,6 +160,12 @@ platform_set_blocksize(int fd, char *path, dev_t device, int blocksize, int fatareturn error; } +int +platform_set_blocksize (int fd,char *path,dev_t device,int blocksize,int fatal) +{ +return set_blocksize (fd, path, device, blocksize, fatal); +} +/* * Flush dirty pagecache and disk write cache to stable media. Returns 0 for * success or -1 (with errno set) for failure.
libfrog/platform.h +1 -0
@@ -14,6 +14,7 @@ int platform_check_iswritable(char *path, char *block, struct stat *sptr);int check_iswritable (char *path,char *block,struct stat *sptr);int platform_set_blocksize (int fd,char *path,dev_t device,int bsz,int fatal); +int set_blocksize (int fd,char *path,dev_t device,int bsz,int fatal);int platform_flush_device (int fd,dev_t device);int flush_device (int fd,dev_t device);char *platform_findrawpath (char *path);
libxfs/init.c +2 -2
@@ -123,10 +123,10 @@ retry:if (!readonly && setblksize && (statb.st_mode &S_IFMT ) ==S_IFBLK ) {if (setblksize ==1 )/* use the default blocksize */ - (void )platform_set_blocksize (fd, path, statb.st_rdev,XFS_MIN_SECTORSIZE ,0 ); + (void )set_blocksize (fd, path, statb.st_rdev,XFS_MIN_SECTORSIZE ,0 );else {/* given an explicit blocksize to use */ -if (platform_set_blocksize (fd, path, statb.st_rdev, setblksize,1 )) +if (set_blocksize (fd, path, statb.st_rdev, setblksize,1 ))exit (1 ); } }
Signature · 1 line
2.31.1
PATCH v2 25/29 xfsprogs: Stop using platform_findrawpath()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
libfrog/linux.c +7 -1
@@ -270,11 +270,17 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz) }char * -platform_findrawpath (char *path) +findrawpath (char *path) {return path; } +char * +platform_findrawpath (char *path) +{ +return findrawpath (path); +} +char *platform_findblockpath (char *path) {
libfrog/platform.h +1 -0
@@ -18,6 +18,7 @@ int set_blocksize(int fd, char *path, dev_t device, int bsz, int fatal);int platform_flush_device (int fd,dev_t device);int flush_device (int fd,dev_t device);char *platform_findrawpath (char *path); +char *findrawpath (char *path);char *platform_findblockpath (char *path);int platform_direct_blockdev (void );int platform_align_blockdev (void );
libxfs/init.c +1 -1
@@ -200,7 +200,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile)perror (path);return 0 ; } -if (!(*rawfile =platform_findrawpath (path))) { +if (!(*rawfile =findrawpath (path))) {fprintf (stderr,_ ("%s: " "can't find a character device matching %s\n" ), progname, path);
Signature · 1 line
2.31.1
PATCH v2 26/29 xfsprogs: Stop using platform_findblockpath()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
libfrog/linux.c +7 -1
@@ -282,11 +282,17 @@ platform_findrawpath(char *path) }char * -platform_findblockpath (char *path) +findblockpath (char *path) {return path; } +char * +platform_findblockpath (char *path) +{ +return findblockpath (path); +} +int platform_direct_blockdev (void ) {
libfrog/platform.h +1 -0
@@ -20,6 +20,7 @@ int flush_device(int fd, dev_t device);char *platform_findrawpath (char *path);char *findrawpath (char *path);char *platform_findblockpath (char *path); +char *findblockpath (char *path);int platform_direct_blockdev (void );int platform_align_blockdev (void );unsigned long platform_physmem (void );/* in kilobytes */
libxfs/init.c +1 -1
@@ -206,7 +206,7 @@ check_open(char *path, int flags, char **rawfile, char **blockfile) progname, path);return 0 ; } -if (!(*blockfile =platform_findblockpath (path))) { +if (!(*blockfile =findblockpath (path))) {fprintf (stderr,_ ("%s: " "can't find a block device matching %s\n" ), progname, path);
Signature · 1 line
2.31.1
PATCH v2 27/29 xfsprogs: Stop using platform_direct_blockdev()
In reply to Pavel Reichl--- libfrog/linux.c | 7 ++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-)
libfrog/linux.c +6 -1
@@ -294,11 +294,16 @@ platform_findblockpath(char *path) }int -platform_direct_blockdev (void ) +direct_blockdev (void ) {return 1 ; } +int platform_direct_blockdev () +{ +return direct_blockdev (); +} +int platform_align_blockdev (void ) {
libfrog/platform.h +1 -0
@@ -22,6 +22,7 @@ char *findrawpath(char *path);char *platform_findblockpath (char *path);char *findblockpath (char *path);int platform_direct_blockdev (void ); +int direct_blockdev (void );int platform_align_blockdev (void );unsigned long platform_physmem (void );/* in kilobytes */ void platform_findsizes (char *path,int fd,long long *sz,int *bsz);
libxfs/init.c +1 -1
@@ -98,7 +98,7 @@ libxfs_device_open(char *path, int creat, int xflags, int setblksize) readonly = (xflags &LIBXFS_ISREADONLY ); excl = (xflags &LIBXFS_EXCLUSIVELY ) && !creat; - dio = (xflags &LIBXFS_DIRECT ) && !creat &&platform_direct_blockdev (); + dio = (xflags &LIBXFS_DIRECT ) && !creat &&direct_blockdev (); retry: flags = (readonly ? O_RDONLY : O_RDWR) | \
Signature · 1 line
2.31.1
PATCH v2 28/29 xfsprogs: Stop using platform_align_blockdev()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + libxfs/init.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
libfrog/linux.c +7 -1
@@ -305,13 +305,19 @@ int platform_direct_blockdev() }int -platform_align_blockdev (void ) +align_blockdev (void ) {if (!max_block_alignment)return getpagesize ();return max_block_alignment; } +int +platform_align_blockdev (void ) +{ +return align_blockdev (); +} +/* How many CPUs are online? */ int nproc (void )
libfrog/platform.h +1 -0
@@ -24,6 +24,7 @@ char *findblockpath(char *path);int platform_direct_blockdev (void );int direct_blockdev (void );int platform_align_blockdev (void ); +int align_blockdev (void );unsigned long platform_physmem (void );/* in kilobytes */ void platform_findsizes (char *path,int fd,long long *sz,int *bsz);void findsizes (char *path,int fd,long long *sz,int *bsz);
libxfs/init.c +1 -1
@@ -1030,7 +1030,7 @@ libxfs_destroy(int libxfs_device_alignment (void ) { -return platform_align_blockdev (); +return align_blockdev (); }void
Signature · 1 line
2.31.1
PATCH v2 29/29 xfsprogs: Stop using platform_physmem()
In reply to Pavel Reichl--- libfrog/linux.c | 8 +++++++- libfrog/platform.h | 1 + repair/xfs_repair.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
libfrog/linux.c +7 -1
@@ -338,7 +338,7 @@ platform_nproc(void) }unsigned long -platform_physmem (void ) +physmem (void ) {struct sysinfo si;
@@ -349,3 +349,9 @@ platform_physmem(void) }return (si.totalram >>10 ) * si.mem_unit;/* kilobytes */ } + +unsigned long +platform_physmem (void ) +{ +return physmem (); +}
libfrog/platform.h +1 -0
@@ -26,6 +26,7 @@ int direct_blockdev(void);int platform_align_blockdev (void );int align_blockdev (void );unsigned long platform_physmem (void );/* in kilobytes */ +unsigned long physmem (void );/* in kilobytes */ void platform_findsizes (char *path,int fd,long long *sz,int *bsz);void findsizes (char *path,int fd,long long *sz,int *bsz);int platform_nproc (void );
repair/xfs_repair.c +1 -1
@@ -1081,7 +1081,7 @@ main(int argc, char **argv) (mp->m_sb.sb_dblocks >> (10 +1 )) +50000 ;/* rough estimate of 50MB overhead */ max_mem = max_mem_specified ? max_mem_specified *1024 : -platform_physmem () *3 /4 ; +physmem () *3 /4 ;if (getrlimit (RLIMIT_AS , &rlim) !=-1 && rlim.rlim_cur !=RLIM_INFINITY ) {
Signature · 1 line
2.31.1
Quoted 2 lines · Pavel Reichl
Stop using commands with '
platform_' prefix. Either use directly linux standard command or drop the prefix from the function name.
Looks like all of the patches in this series are missing signed-off-by lines. Most of them have empty commit messages, too, which we don't tend to do very often.
Quoted 1 line
51 files changed, 284 insertions(+), 151 deletions(-)
IMO, 29 patches for such a small change is way too fine grained for working through efficiently. Empty commit messages tend to be a sign that you can aggregate patches together.... i.e. One patch for all the uuid changes (currently 7 patches) with a description of why you're changing the platform_uuid interface, one for all the mount related stuff (at least 5 patches now), one for all the block device stuff (8 or so patches), one for all the path bits, and then one for whatever is left over.
Every patch has overhead, be it to produce, maintain, review, test, merge, etc. Breaking stuff down unnecessarily just increases the amount of work everyone has to do at every step. So if you find that you are writing dozens of patches that each have a trivial change in them that you are boiler-plating commit messages, you've probably made the overall changeset too fine grained.
Also....
Quoted 10 lines
libxfs/init.c | 32 ++++++------ libxfs/libxfs_io.h | 2 +- libxfs/libxfs_priv.h | 3 +- libxfs/rdwr.c | 4 +- libxfs/xfs_ag.c | 6 +-- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_btree.c | 4 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2_block.c | 2 +-
Quoted 8 lines
libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 2 +- libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dquot_buf.c | 2 +- libxfs/xfs_ialloc.c | 4 +- libxfs/xfs_inode_buf.c | 2 +- libxfs/xfs_sb.c | 6 +-- libxfs/xfs_symlink_remote.c | 2 +-
Why are all these libxfs files being changed?
$ git grep -l platform libxfs/ libxfs/init.c libxfs/libxfs_io.h libxfs/libxfs_priv.h libxfs/rdwr.c libxfs/xfs_log_format.h $
IOWs, there are calls to platform_*() functions in most of these libxfs files, so what is being changed here? If these are code changes, then they will end up needed to be ported across to the kernel libxfs, too.
I did a quick scan of a few of the patches but I didn't land on the one that had these changes in it; another reason for not doing stuff in such fine grained ways. Hence it's not clear to me why renaming platform_*() functions would touch these files.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 5 lines · Dave Chinner
Quoted 2 lines · Pavel Reichl
Stop using commands with '
platform_' prefix. Either use directly linux standard command or drop the prefix from the function name.Looks like all of the patches in this series are missing signed-off-by lines. Most of them have empty commit messages, too,
Sorry about the missing signed-off-by, I really need to have a check-list before posting patches...or send more patches :-).
Quoted 11 lines
which we don't tend to do very often.
Quoted 1 line
51 files changed, 284 insertions(+), 151 deletions(-)IMO, 29 patches for such a small change is way too fine grained for working through efficiently. Empty commit messages tend to be a sign that you can aggregate patches together.... i.e. One patch for all the uuid changes (currently 7 patches) with a description of why you're changing the
platform_uuidinterface, one for all the mount related stuff (at least 5 patches now), one for all the block device stuff (8 or so patches), one for all the path bits, and then one for whatever is left over.
OK, I'll do this in the next version.
Quoted 7 lines
Every patch has overhead, be it to produce, maintain, review, test, merge, etc. Breaking stuff down unnecessarily just increases the amount of work everyone has to do at every step. So if you find that you are writing dozens of patches that each have a trivial change in them that you are boiler-plating commit messages, you've probably made the overall changeset too fine grained.
OK, sincerely thank you for the 'rules-of-thump'. However, In the first version of the patch set I grouped the changes into way less patches and passed along a question about the preferred granularity of patches and got the following answer:
Quoted 4 lines
* What would be best for the reviewer - should I prepare a separate patch for every function rename or should I squash the changes into one huge patch?
One patch per function, please.
However, I agree that I should have mentioned that some patches would be too small and not blindly follow the request...I'll do better next time.
Quoted 21 lines
Also....
Quoted 10 lines
libxfs/init.c | 32 ++++++------ libxfs/libxfs_io.h | 2 +- libxfs/libxfs_priv.h | 3 +- libxfs/rdwr.c | 4 +- libxfs/xfs_ag.c | 6 +-- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_btree.c | 4 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2_block.c | 2 +-Quoted 8 lines
libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 2 +- libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dquot_buf.c | 2 +- libxfs/xfs_ialloc.c | 4 +- libxfs/xfs_inode_buf.c | 2 +- libxfs/xfs_sb.c | 6 +-- libxfs/xfs_symlink_remote.c | 2 +-
Quoted 1 line
Why are all these libxfs files being changed?
I believe this is because of patch #6 - xfsprogs: Stop using platform_uuid_copy()
Here I dropped the usage of platform_uuid_copy() even in libxfs by:
1) removing the uuid_copy() macro that was implemented by calling platform_uuid_copy() in libxfs/libxfs_priv.h
-#define uuid_copy(s,d) platform_uuid_copy((s),(d))
2) using directly standard uuid_copy() instead
Which resulted into plenty of trivial changes all over libxfs, the core of the changes being that uuid params are passed-by-value to standard uuid_copy(), but to libxfs' uuid_copy() it is passed-by-reference.
E.g.
- uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
+ uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);
Quoted 3 lines
Cheers,
Dave.
Hi Dave,
Thank you for you comments, please see reactions above. Have a nice day.
Quoted 9 lines · Pavel Reichl
Quoted 5 lines · Dave Chinner
Quoted 2 lines · Pavel Reichl
Stop using commands with '
platform_' prefix. Either use directly linux standard command or drop the prefix from the function name.Looks like all of the patches in this series are missing signed-off-by lines. Most of them have empty commit messages, too,
Sorry about the missing signed-off-by, I really need to have a check-list before posting patches...or send more patches :-).
Having a checklist is a good idea. :)
Quoted 24 lines
Quoted 11 lines
which we don't tend to do very often.
Quoted 1 line
51 files changed, 284 insertions(+), 151 deletions(-)IMO, 29 patches for such a small change is way too fine grained for working through efficiently. Empty commit messages tend to be a sign that you can aggregate patches together.... i.e. One patch for all the uuid changes (currently 7 patches) with a description of why you're changing the
platform_uuidinterface, one for all the mount related stuff (at least 5 patches now), one for all the block device stuff (8 or so patches), one for all the path bits, and then one for whatever is left over.OK, I'll do this in the next version.
Quoted 7 lines
Every patch has overhead, be it to produce, maintain, review, test, merge, etc. Breaking stuff down unnecessarily just increases the amount of work everyone has to do at every step. So if you find that you are writing dozens of patches that each have a trivial change in them that you are boiler-plating commit messages, you've probably made the overall changeset too fine grained.
OK, sincerely thank you for the 'rules-of-thump'. However, In the first version of the patch set I grouped the changes into way less patches and passed along a question about the preferred granularity of patches and got the following answer:
Quoted 8 lines
Quoted 4 lines
* What would be best for the reviewer - should I prepare a separate patch for every function rename or should I squash the changes into one huge patch?
One patch per function, please.However, I agree that I should have mentioned that some patches would be too small and not blindly follow the request...I'll do better next time.
Yeah, I tend to push back on black and white process requirements like this. Everything has shades of grey. The process of responding to so many small, trivial changes broken up like this is not an efficient or effective use of developer time.
One function per patch makes sense when there are lots of changes to a single function. But for stuff where there is only one or two users (e.g. platform_discard, platform_findrawpath, platform*_block* etc) splitting them in to single patches is not efficient.
I always think of it like this: would I like to have to reply to 29 emails just to add RVBs for such a change? Responding to 29 emails is a decent chunk of time that every reviewer must invest. Is the change complex enough to need such fine grained review effort.
In this case, I think no, especially because it hid where a significant issue was introduced....
Quoted 38 lines
Quoted 20 lines
Also....
Quoted 10 lines
libxfs/init.c | 32 ++++++------ libxfs/libxfs_io.h | 2 +- libxfs/libxfs_priv.h | 3 +- libxfs/rdwr.c | 4 +- libxfs/xfs_ag.c | 6 +-- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_btree.c | 4 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2_block.c | 2 +-Quoted 8 lines
libxfs/xfs_dir2_data.c | 2 +- libxfs/xfs_dir2_leaf.c | 2 +- libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dquot_buf.c | 2 +- libxfs/xfs_ialloc.c | 4 +- libxfs/xfs_inode_buf.c | 2 +- libxfs/xfs_sb.c | 6 +-- libxfs/xfs_symlink_remote.c | 2 +-Quoted 1 line
Why are all these libxfs files being changed?
I believe this is because of patch #6 - xfsprogs: Stop using
platform_uuid_copy()Here I dropped the usage of
platform_uuid_copy()even in libxfs by:1) removing the
uuid_copy()macro that was implemented by callingplatform_uuid_copy()inlibxfs/libxfs_priv.h-#define
uuid_copy(s,d)platform_uuid_copy((s),(d))2) using directly standard
uuid_copy()instead
Which resulted into plenty of trivial changes all over libxfs, the core of the changes being that uuid params are passed-by-value to standarduuid_copy(), but to libxfs'uuid_copy()it is passed-by-reference.
Quoted 3 lines
E.g.
-uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
+uuid_copy(agf->agf_uuid, mp->m_sb.sb_meta_uuid);
Ok, this is something that should definitely be mentioned in the commit message because it's not just a rename.
As it is, this is the sort of problem we have to solve in userspace. That was the purpose of the #define uuid_copy() you removed - it translates the kernel API to the userspace API. We still need something like that, which means the platform_uuid_copy() change-over likely needs it's own patch and documentation (because it's not just a straight rename anymore.
We do not want to make libxfs code unnecessarily different between user and kernel space because that increases the overhead of porting changes between kernel <-> userspace code bases. Hence we really need to solve the "same function name, different calling convention" in some way in userspace without requiring code diffs between kernel and userspace.
Maybe some pre-processor magic can be done here in userspace. Maybe we need to rename uuid_copy() in both the kernel and userspace, so both have a static inline wrapper that can call the native uuid_copy() with the correct parameters (another reason for it being a separate patch so it can be easily ported).
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]