xfsdump whitespace changes
cover xfsdump whitespace changes
(I'm splitting the previous set into smaller ones, so changes doesn't
have to wait.)
This set is dealing with whitespaces only, no functional change, code shuffling, etc. should be present. The first patch clears out trailing whitespaces, the second one sorts out the crazy mishmash of tabs and spaces.
I know that these kind of changes are usually not welcomed as they conflict with other people's work, but that should not be an issue for xfsdump.
Jan Tulak (2):
xfsdump: remove trailing whitespaces
xfsdump: change indentation to tabs
common/arch_xlate.c | 330 ++-- common/cldmgr.c | 38 +- common/cldmgr.h | 6 +- common/cleanup.c | 10 +- common/cleanup.h | 12 +- common/content.h | 14 +- common/content_common.c | 28 +- common/content_inode.h | 14 +- common/dlog.c | 94 +- common/dlog.h | 42 +- common/drive.c | 38 +- common/drive.h | 74 +- common/drive_minrmt.c | 926 +++++----- common/drive_scsitape.c | 1377 ++++++++------- common/drive_simple.c | 308 ++-- common/fs.c | 28 +- common/fs.h | 22 +- common/getdents.c | 14 +- common/global.c | 120 +- common/global.h | 4 +- common/hsmapi.c | 50 +- common/inventory.c | 142 +- common/inventory.h | 46 +- common/main.c | 604 +++---- common/media.c | 62 +- common/media_rmvtape.h | 2 +- common/mlog.c | 78 +- common/mlog.h | 2 +- common/openutil.c | 14 +- common/qlock.c | 26 +- common/rec_hdr.h | 2 +- common/ring.c | 32 +- common/ring.h | 46 +- common/stream.c | 16 +- common/stream.h | 20 +- common/ts_mtio.h | 110 +- common/types.h | 76 +- common/util.c | 178 +- common/util.h | 46 +- dump/content.c | 2172 ++++++++++++------------ dump/inomap.c | 402 ++--- dump/inomap.h | 34 +- dump/var.c | 38 +- inventory/inv_api.c | 354 ++-- inventory/inv_core.c | 40 +- inventory/inv_files.c | 2 +- inventory/inv_fstab.c | 92 +- inventory/inv_idx.c | 197 ++- inventory/inv_mgr.c | 175 +- inventory/inv_oref.c | 140 +- inventory/inv_oref.h | 82 +- inventory/inv_priv.h | 128 +- inventory/inv_stobj.c | 516 +++--- inventory/inventory.h | 70 +- inventory/testmain.c | 147 +- invutil/cmenu.c | 654 +++---- invutil/cmenu.h | 82 +- invutil/fstab.c | 414 ++--- invutil/invidx.c | 1574 +++++++++-------- invutil/invutil.c | 1161 +++++++------ invutil/invutil.h | 12 +- invutil/list.c | 148 +- invutil/list.h | 37 +- invutil/menu.c | 292 ++-- invutil/screen.c | 64 +- invutil/stobj.c | 654 +++---- librmt/rmtabort.c | 2 +- librmt/rmtaccess.c | 2 - librmt/rmtclose.c | 2 - librmt/rmtcommand.c | 3 - librmt/rmtcreat.c | 2 - librmt/rmtdev.c | 2 - librmt/rmtfstat.c | 2 +- librmt/rmtioctl.c | 222 +-- librmt/rmtlib.h | 2 +- librmt/rmtlseek.c | 2 - librmt/rmtmsg.c | 26 +- librmt/rmtopen.c | 72 +- librmt/rmtstatus.c | 3 - restore/bag.c | 22 +- restore/bag.h | 4 +- restore/content.c | 3568 +++++++++++++++++++-------------------- restore/dirattr.c | 308 ++-- restore/dirattr.h | 6 +- restore/inomap.c | 118 +- restore/mmap.c | 16 +- restore/namreg.c | 82 +- restore/node.c | 98 +- restore/node.h | 12 +- restore/tree.c | 1082 ++++++------ restore/tree.h | 8 +- restore/win.c | 28 +- restore/win.h | 10 +- 93 files changed, 10202 insertions(+), 10234 deletions(-)
Signature · 1 line
2.19.1
PATCH 1/2 xfsdump: remove trailing whitespaces
There were many trailing whitespaces through the whole code. As the rate of changes in xfsdump is low, it should not cause trouble if we fix it in all files at once and avoid issues (unintended changes) with sensibly configured editors that automatically remove these on a file save.
--- common/arch_xlate.c | 24 +-- common/cleanup.c | 2 +- common/cleanup.h | 2 +- common/content.h | 2 +- common/content_inode.h | 4 +- common/dlog.c | 2 +- common/drive.c | 12 +- common/drive.h | 8 +- common/drive_minrmt.c | 60 +++---- common/drive_scsitape.c | 71 ++++----- common/drive_simple.c | 10 +- common/global.c | 6 +- common/global.h | 4 +- common/hsmapi.c | 2 +- common/inventory.c | 120 +++++++------- common/inventory.h | 46 +++--- common/main.c | 20 +-- common/media.c | 4 +- common/media_rmvtape.h | 2 +- common/mlog.c | 16 +- common/mlog.h | 2 +- common/qlock.c | 10 +- common/rec_hdr.h | 2 +- common/ring.c | 4 +- common/ring.h | 2 +- common/stream.c | 2 +- common/ts_mtio.h | 60 +++---- common/types.h | 2 +- common/util.c | 8 +- common/util.h | 2 +- dump/content.c | 84 +++++----- dump/inomap.c | 6 +- inventory/inv_api.c | 198 +++++++++++------------ inventory/inv_core.c | 32 ++-- inventory/inv_fstab.c | 58 +++---- inventory/inv_idx.c | 129 ++++++++------- inventory/inv_mgr.c | 115 +++++++------- inventory/inv_oref.c | 98 ++++++------ inventory/inv_oref.h | 12 +- inventory/inv_priv.h | 64 ++++---- inventory/inv_stobj.c | 344 ++++++++++++++++++++-------------------- inventory/inventory.h | 64 ++++---- inventory/testmain.c | 81 +++++----- invutil/fstab.c | 6 +- invutil/invidx.c | 50 +++--- invutil/invutil.c | 57 ++++--- invutil/list.h | 1 - invutil/menu.c | 8 +- invutil/screen.c | 2 +- invutil/stobj.c | 6 +- librmt/rmtaccess.c | 2 - librmt/rmtclose.c | 2 - librmt/rmtcommand.c | 3 - librmt/rmtcreat.c | 2 - librmt/rmtdev.c | 2 - librmt/rmtioctl.c | 34 ++-- librmt/rmtlib.h | 2 +- librmt/rmtlseek.c | 2 - librmt/rmtstatus.c | 3 - restore/bag.c | 2 +- restore/content.c | 110 ++++++------- restore/dirattr.c | 4 +- restore/inomap.c | 2 +- restore/namreg.c | 4 +- restore/node.c | 2 +- restore/tree.c | 62 ++++---- 66 files changed, 1069 insertions(+), 1095 deletions(-)
common/arch_xlate.c +12 -12
@@ -135,12 +135,12 @@ xlate_drive_hdr(drive_hdr_t *dh1, drive_hdr_t *dh2, int dir)"\tdh_pad1 %s\n" "\tdh_specific %s\n" "\tdh_upper %s\n" , - ptr1->dh_drivecnt, + ptr1->dh_drivecnt, ptr1->dh_driveix, ptr1->dh_strategyid, ptr1->dh_pad1, ptr1->dh_specific, - ptr1->dh_upper); + ptr1->dh_upper);mlog (MLOG_NITTY ,"xlate_drive_hdr: post-xlate\n" "\tdh_drivecnt %u\n"
@@ -149,12 +149,12 @@ xlate_drive_hdr(drive_hdr_t *dh1, drive_hdr_t *dh2, int dir)"\tdh_pad1 %s\n" "\tdh_specific %s\n" "\tdh_upper %s\n" , - ptr2->dh_drivecnt, + ptr2->dh_drivecnt, ptr2->dh_driveix, ptr2->dh_strategyid, ptr2->dh_pad1, ptr2->dh_specific, - ptr2->dh_upper); + ptr2->dh_upper); }/*
@@ -416,7 +416,7 @@ xlate_extenthdr(extenthdr_t *eh1, extenthdr_t *eh2, int dir) {extenthdr_t *ptr1 = eh1;extenthdr_t *ptr2 = eh2; - +mlog (MLOG_NITTY ,"xlate_extenthdr\n" );IXLATE (eh1, eh2, eh_sz);
@@ -522,7 +522,7 @@ xlate_direnthdr_v1(direnthdr_v1_t *dh1, direnthdr_v1_t *dh2, int dir) ptr2->dh_gen, ptr2->dh_sz, ptr2->dh_checksum, - ptr2->dh_name ); + ptr2->dh_name ); }/*
@@ -550,7 +550,7 @@ xlate_rec_hdr(rec_hdr_t *rh1, rec_hdr_t *rh2, int dir)rec_hdr_t *ptr2 = rh2;mlog (MLOG_NITTY ,"xlate_rec_hdr\n" ); - +IXLATE (rh1, rh2, magic);IXLATE (rh1, rh2, version);IXLATE (rh1, rh2, blksize);
@@ -569,7 +569,7 @@ xlate_rec_hdr(rec_hdr_t *rh1, rec_hdr_t *rh2, int dir)BXLATE (pad1);BXLATE (dump_uuid); -BXLATE (pad2); +BXLATE (pad2);mlog (MLOG_NITTY ,"xlate_rec_hdr: pre-xlate\n" "\tmagic %llu\n"
@@ -582,7 +582,7 @@ xlate_rec_hdr(rec_hdr_t *rh1, rec_hdr_t *rh2, int dir)"\trec_used %u\n" "\tchecksum %d\n" "\tischecksum %d\n" , - ptr1->magic, + ptr1->magic, ptr1->version, ptr1->blksize, ptr1->recsize,
@@ -604,7 +604,7 @@ xlate_rec_hdr(rec_hdr_t *rh1, rec_hdr_t *rh2, int dir)"\trec_used %u\n" "\tchecksum %d\n" "\tischecksum %d\n" , - ptr2->magic, + ptr2->magic, ptr2->version, ptr2->blksize, ptr2->recsize,
@@ -621,7 +621,7 @@ xlate_rec_hdr(rec_hdr_t *rh1, rec_hdr_t *rh2, int dir)*/ void xlate_invt_seshdr (invt_seshdr_t *ish1,invt_seshdr_t *ish2,int dir) -{ +{invt_seshdr_t *ptr1 = ish1;invt_seshdr_t *ptr2 = ish2;
@@ -705,7 +705,7 @@ xlate_invt_stream(invt_stream_t *ist1, invt_stream_t *ist2, int dir) ptr1 = ist2; ptr2 = ist1; } - +BXLATE (st_cmdarg);BXLATE (st_padding);
common/cleanup.c +1 -1
@@ -31,7 +31,7 @@ struct cu {/* Cleanup structure flags */ -#define CU_EARLY 0x00000001 +#define CU_EARLY 0x00000001/* call cleanup routine before calling killall */ typedef struct cu cu_t ;
common/cleanup.h +1 -1
@@ -30,7 +30,7 @@ extern cleanup_t *cleanup_register( void ( *funcp )( void *arg1, void *arg2 ),void *arg1, void *arg2 ); -extern cleanup_t *cleanup_register_early ( +extern cleanup_t *cleanup_register_early (void ( *funcp )(void *arg1,void *arg2 ),void *arg1,void *arg2 );
common/content.h +1 -1
@@ -59,7 +59,7 @@ struct content_hdr {/* content strategy-specific info */ }; -typedef struct content_hdr content_hdr_t ; +typedef struct content_hdr content_hdr_t ;#define CONTENT_QUOTAFILE "xfsdump_quotas"#define CONTENT_PQUOTAFILE "xfsdump_quotas_proj"
common/content_inode.h +2 -2
@@ -151,7 +151,7 @@ typedef struct timestruct timestruct_t;/* bstat_t - bulk stat structure * * used in filehdr_t below. derived from xfs_bstat_t, to achieve independence -* from changes to xfs_bstat_t. +* from changes to xfs_bstat_t. */ #define BSTAT_SZ 128#define MODE_SZ 4
@@ -209,7 +209,7 @@ bstat_projid(struct bstat *bs)* * each fs file placed on dump media begins with a FILEHDR_SZ-byte header. * following that are one or more variable-length content extents. -* the content extents contain the actual data associated with the fs file. +* the content extents contain the actual data associated with the fs file. */ #define FILEHDR_SZ 256
common/dlog.c +1 -1
@@ -480,7 +480,7 @@ promptinput( char *buf,*/ pthread_sigmask (SIG_SETMASK , &orig_set,NULL );sigemptyset ( &dlog_registered_sigs ); - +/* check for timeout or interrupt */ if ( nread <0 ) {
common/drive.c +6 -6
@@ -64,7 +64,7 @@ static void drive_allochdrs( drive_t *drivep,/* definition of locally defined global variables ****************************/ drive_t **drivepp; -size_t drivecnt; +size_t drivecnt;size_t partialmax;/* definition of locally defined static variables *****************************/
@@ -115,8 +115,8 @@ drive_init1( int argc, char *argv[ ] )/* initialize the partialmax value. Each drive can be completing a file * started in another drive (except for drive 0) and leave one file to -* be completed by another drive. This value is used to limit the -* search in the list of partially completed files shared between all +* be completed by another drive. This value is used to limit the +* search in the list of partially completed files shared between all * restore streams. Note, if drivecnt is one, then partialmax is zero * to indicate no partial files can span streams. */
@@ -167,7 +167,7 @@ drive_init1( int argc, char *argv[ ] ) drivecnt =1 ; -/* Adding this alloc to fix malloc corruption. +/* Adding this alloc to fix malloc corruption. * Bug #393618 - prasadb 04/16/97 * allocate an array to hold ptrs to drive descriptors */
@@ -177,7 +177,7 @@ drive_init1( int argc, char *argv[ ] ) drivepp[0 ] =drive_alloc ("stdio" ,0 );#ifdef DUMP /* ifdef added around dlog_desist() by prasadb to fix 435626 */ -dlog_desist ( ); +dlog_desist ( );#endif }
@@ -347,7 +347,7 @@ drive_display_metrics( void )/* definition of locally defined static functions ****************************/ -/* drive_alloc - allocate and initialize the generic portions of a drive +/* drive_alloc - allocate and initialize the generic portions of a drive * descriptor. do NOT allocate hdr buffers. */ static drive_t *
common/drive.h +4 -4
@@ -194,7 +194,7 @@ typedef void ( * drive_mcbfp_t )( void *context_t,* * caller allocates and passes ptr to do_set_mark, along with a callback func. * callback returns the record, which must be freed by the original caller. -* +* */ struct drive_markrec {drive_mark_t dm_log;/* identifies position within mfile */
@@ -534,7 +534,7 @@ struct drive_ops {/* if d_capabilities has DRIVE_CAP_BSF set, * drive has the capability to backward space * count files. returns the number of actual -* files backed to. +* files backed to. * can only be invoked when not reading or * writing (i.e., only after calling end_read * or end_write, or prior to calling begin_read
@@ -594,8 +594,8 @@ typedef struct drive_ops drive_ops_t;* valid after drive_init1() returns successfully */ extern drive_t **drivepp; -extern size_t drivecnt; -extern size_t partialmax; +extern size_t drivecnt; +extern size_t partialmax;/* drive capabilities - bit positions in the capabilities mask * DO NOT CHANGE: used in dh_capabilities field of scsi drive hdr.
common/drive_minrmt.c +30 -30
224 lines not on this page · raw message
common/drive_scsitape.c +35 -36
273 lines not on this page · raw message
common/drive_simple.c +5 -5
@@ -342,7 +342,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep ) drivep->d_pathname, strerror( errno ));return BOOL_FALSE ; - + } oflags =O_RDONLY ;switch ( statbuf.st_mode &S_IFMT ) {
@@ -495,7 +495,7 @@ do_begin_read( drive_t *drivep )return rval; }assert ( (size_t )nread ==GLOBAL_HDR_SZ ); - +mlog (MLOG_NITTY ,"do_begin_read: global_hdr\n" "\tgh_magic %.100s\n" "\tgh_version %u\n"
@@ -771,7 +771,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )if ( strmoff > mark ) {return DRIVE_ERROR_CORE ; } - +/* use read_buf util func to eat up difference */ nreadneeded64 = mark - strmoff;
@@ -897,7 +897,7 @@ do_begin_write( drive_t *drivep )/* indicate in the header that there is no recorded mark. */ *( (off64_t * )dwhdrp->dh_specific ) =0 ; - +/* prepare the drive context. initially the caller does not own * any of the write buffer, so the next portion of the buffer to * be supplied is the top of the buffer. emptyp never changes;
@@ -1491,7 +1491,7 @@ do_erase( drive_t *drivep )/* get_media_class() */ /* ARGSUSED */ -static int +static int do_get_device_class (drive_t *drivep ) { mlog( MLOG_NITTY | MLOG_DRIVE,
common/global.c +3 -3
@@ -163,7 +163,7 @@ global_hdr_alloc( int argc, char *argv[ ] )usage ( );return 0 ; } - +if ( !uuid_parse ( optarg, ghdrp->gh_dumpid ) ) { mlog( MLOG_NORMAL | MLOG_ERROR, _("-%c argument not a valid uuid\n"),
@@ -275,10 +275,10 @@ global_hdr_checksum_check( global_hdr_t *hdrp )return accum ==0 ?BOOL_TRUE :BOOL_FALSE ; } -/* global_version_check - if we know this version number, return BOOL_TRUE +/* global_version_check - if we know this version number, return BOOL_TRUE * else return BOOL_FALSE */ -bool_t +bool_t global_version_check (uint32_t version ) {switch (version) {
common/global.h +2 -2
@@ -32,7 +32,7 @@* version 2 adds encoding of holes and a change to on-tape inventory format. * version 1 adds extended file attribute dumping. * version 0 xfsrestore can't handle media produced -* by version 1 xfsdump. +* by version 1 xfsdump. */ #define GLOBAL_HDR_VERSION GLOBAL_HDR_VERSION_3
@@ -93,7 +93,7 @@ extern void global_hdr_checksum_set( global_hdr_t *hdrp );*/ extern bool_t global_hdr_checksum_check (global_hdr_t *hdrp ); -/* global_version_check - if we know this version number, return BOOL_TRUE +/* global_version_check - if we know this version number, return BOOL_TRUE * else return BOOL_FALSE */
common/hsmapi.c +1 -1
@@ -528,7 +528,7 @@ const xfs_bstat_t *statp) dmf_f_ctxtp->candidate =1 ; dmf_f_ctxtp->filesize = statp->bs_size;break ; - +default :break ; }
common/inventory.c +60 -60
345 lines not on this page · raw message
common/inventory.h +23 -23
117 lines not on this page · raw message
common/main.c +10 -10
@@ -204,7 +204,7 @@ main( int argc, char *argv[] )if ( ! ok ) {return mlog_exit (EXIT_ERROR ,RV_OPT ); } - +/* initialize message logging (stage 1) */ ok =mlog_init1 ( argc, argv );
@@ -698,7 +698,7 @@ main( int argc, char *argv[] ) prbcld_xc = xc; stop_requested =BOOL_TRUE ; } - +/* all children died normally. break out. */ if (cldmgr_remainingcnt ( ) ==0 ) {
@@ -743,7 +743,7 @@ main( int argc, char *argv[] ) } stop_timeout =STOP_TIMEOUT ; } - +/* important that this appear after dialog. * allows dialog to be terminated with SIGINT, * without infinite loop.
@@ -793,7 +793,7 @@ main( int argc, char *argv[] ) coredump_requested =BOOL_TRUE ; } } - +/* see if need to initiate a stop */ if ( stop_requested && ! stop_in_progress ) {
@@ -806,7 +806,7 @@ main( int argc, char *argv[] )assert ( stop_timeout >=0 ); stop_deadline = now + (time32_t )stop_timeout; } - +/* set alarm if needed (note time stands still during dialog) */ if ( stop_in_progress ) {
@@ -1381,7 +1381,7 @@ loadoptfile( int *argcp, char ***argvp )return BOOL_TRUE ; } -/* parent and children share this handler. +/* parent and children share this handler. */ static void sighandler (int signo )
@@ -2012,7 +2012,7 @@ sigintstr( void ) strerror( errno ));return 0 ; } - + intchr = termios.c_cc[VINTR ]; mlog( MLOG_NITTY | MLOG_PROC, "tty fd: %d; terminal interrupt character: %c (0%o)\n",
@@ -2071,7 +2071,7 @@ set_rlimits( size64_t *vmszp ) vmsz = (size64_t )rlimit64.rlim_cur;#endif /* RESTORE */ - +assert ( minstacksz <= maxstacksz ); rval =getrlimit64 (RLIMIT_STACK , &rlimit64 );assert ( ! rval );
@@ -2175,7 +2175,7 @@ set_rlimits( size64_t *vmszp )"RLIMIT_DATA org cur 0x%llx max 0x%llx\n" , rlimit64.rlim_cur, rlimit64.rlim_max ); - + rval =getrlimit64 (RLIMIT_FSIZE , &rlimit64 );assert ( ! rval ); mlog( MLOG_NITTY | MLOG_NOLOCK | MLOG_PROC,
@@ -2192,7 +2192,7 @@ set_rlimits( size64_t *vmszp )"RLIMIT_FSIZE now cur 0x%llx max 0x%llx\n" , rlimit64.rlim_cur, rlimit64.rlim_max ); - + rval =getrlimit64 (RLIMIT_CPU , &rlimit64 );assert ( ! rval ); mlog( MLOG_NITTY | MLOG_NOLOCK | MLOG_PROC,
common/media.c +2 -2
@@ -196,7 +196,7 @@ media_create( int argc, char *argv[ ], drive_strategy_t *dsp ) mediap->m_strategyp = chosen_sp; mediap->m_writehdrp->mh_strategyid = chosen_sp->ms_id; } - +/* initialize the strategy. this will cause each of the managers * to be initialized as well. if error, return 0. */
@@ -250,7 +250,7 @@ media_get_upper_hdrs( media_t *mediap,/* definition of locally defined static functions ****************************/ -/* media_alloc - allocate and initialize the generic portions of a media +/* media_alloc - allocate and initialize the generic portions of a media * descriptor and read and write media headers */ static media_t *
common/media_rmvtape.h +1 -1
@@ -21,7 +21,7 @@/* media_rmvtape.h - removalable tape media abstraction */ -/* This structure is overlayed on the mh_specific field of the media_hdr +/* This structure is overlayed on the mh_specific field of the media_hdr * structure. If is a maximum of 128 byptes long. */ struct media_rmvtape_spec {
common/mlog.c +8 -8
@@ -64,7 +64,7 @@ static int mlog_sym_lookup( char * );static size_t mlog_streamcnt; -static char mlog_levelstr[3 ]; +static char mlog_levelstr[3 ];#define MLOG_SS_NAME_MAX 15#ifdef DUMP
@@ -201,7 +201,7 @@ mlog_init1( int argc, char *argv[ ] )int suboptix;char *valstr; - suboptix =getsubopt ( &options, + suboptix =getsubopt ( &options, (constpp )suboptstrs, &valstr );if ( suboptix <0 ) {
@@ -349,7 +349,7 @@ mlog_override_level( int levelarg ) level = levelarg &MLOG_LEVELMASK ; ss = ( ix_t )( ( levelarg &MLOG_SS_MASK ) >>MLOG_SS_SHIFT ); -if (ss ==MLOG_SS_GEN ) {/* do level for all subsys */ +if (ss ==MLOG_SS_GEN ) {/* do level for all subsys */ for (ss =0 ; ss <MLOG_SS_CNT ; ss++ ) { mlog_level_ss[ ss ] = level; }
@@ -381,7 +381,7 @@ mlog_va( int levelarg, char *fmt, va_list args )if ( level > mlog_level_ss[ ss ] ) {return ; } - +if ( ! ( levelarg &MLOG_NOLOCK )) {mlog_lock ( ); }
@@ -473,7 +473,7 @@ struct rv_map {static struct rv_map rvs[_RV_NUM] = {/* Return Code Displayed Code Explanation */ - {RV_OK ,"OK" ,"success" }, + {RV_OK ,"OK" ,"success" }, {RV_NOTOK ,"ERASE_FAILED" ,"media erase request denied" }, {RV_NOMORE ,"NOMORE" ,"no more work to do" }, {RV_EOD ,"EOD" ,"ran out of data" },
@@ -502,7 +502,7 @@ rvs[_RV_NUM] = { { RV_UNKNOWN, "UNKNOWN", "unknown error" }, }; -static struct rv_map +static struct rv_map rv_unknown = { _RV_NUM,"???" ,"unknown error code" };
@@ -638,7 +638,7 @@ _mlog_exit_hint( const char *file, int line, rv_t rv ) tid =pthread_self (); rvp =rv_getdesc (rv); - + mlog( MLOG_DEBUG | MLOG_NOLOCK, "%s: %d: mlog_exit_hint called: " "hint: %s (%s)\n",
@@ -660,7 +660,7 @@ _mlog_exit_hint( const char *file, int line, rv_t rv )if (pthread_equal ( tid, parenttid ) ) mlog_main_exit_hint = rv; -else +else stream_set_hint ( tid, rv ); }
common/mlog.h +1 -1
@@ -57,7 +57,7 @@#define MLOG_SS_TREE 5/* restore tree */ #endif /* RESTORE */ #define MLOG_SS_EXCLFILES 6/* list excluded files */ -#define MLOG_SS_CNT 7/* NOTE! bump this when adding ss */ +#define MLOG_SS_CNT 7/* NOTE! bump this when adding ss */ #define MLOG_SS_SHIFT 8#define MLOG_SS_MASK ( 0xff << MLOG_SS_SHIFT )
common/qlock.c +5 -5
@@ -105,7 +105,7 @@ qlock_lock( qlockh_t qlockh )pthread_t tid;/* REFERENCED */ int rval; - +/* get the caller's tid */ tid =pthread_self ();
@@ -148,7 +148,7 @@ qlock_unlock( qlockh_t qlockh )qlock_t *qlockp = (qlock_t * )qlockh;/* REFERENCED */ int rval; - +/* verify lock is held by this thread */ assert (QLOCK_ORDMAP_GET ( thread_ordmap, qlockp->ql_ord ));
@@ -156,7 +156,7 @@ qlock_unlock( qlockh_t qlockh )/* clear lock's ord from thread's ord map */ QLOCK_ORDMAP_CLR ( thread_ordmap, qlockp->ql_ord ); - +/* release the lock */ rval =pthread_mutex_unlock ( &qlockp->ql_mutex );
@@ -203,7 +203,7 @@ qsemP( qsemh_t qsemh ) {sem_t *semp = (sem_t * )qsemh;int rval; - +/* "P" the semaphore */ rval =sem_wait ( semp );
@@ -215,7 +215,7 @@ qsemV( qsemh_t qsemh ) {sem_t *semp = (sem_t * )qsemh;int rval; - +/* "V" the semaphore */ rval =sem_post ( semp );
common/rec_hdr.h +1 -1
@@ -33,7 +33,7 @@/* * This structure is used by both drive_minrmt and drive_scsi. New * strategies should define their own here if they need a different -* structure, and add a endian conversion function to arch_xlate.c +* structure, and add a endian conversion function to arch_xlate.c */ struct rec_hdr {uint64_t magic;/* 8 8 */
common/ring.c +2 -2
@@ -210,7 +210,7 @@ ring_put( ring_t *ringp, ring_msg_t *msgp ) ringp->r_active_in_ix = ( ringp->r_active_in_ix +1 ) % ringp->r_len; - +/* bump the semaphore for the active queue ("V") */ qsemV ( ringp->r_active_qsemh );
@@ -395,7 +395,7 @@ ring_slave_put( ring_t *ringp, ring_msg_t *msgp ) ringp->r_ready_in_ix = ( ringp->r_ready_in_ix +1 ) % ringp->r_len; - +/* bump the semaphore for the ready queue ("V") */ qsemV ( ringp->r_ready_qsemh );
common/ring.h +1 -1
@@ -150,7 +150,7 @@ struct ring { };typedef struct ring ring_t ; - +/* ring_create - creates a ring. parameters supply the length of the ring, * the read/write buffer size, the drive index, a function for reading, a
common/stream.c +1 -1
@@ -277,7 +277,7 @@ stream_cnt( void )size_t bitix;assert (sizeof ( ixmap ) *NBBY >=STREAM_SIMMAX ); - +lock ();for ( ; p < ep ; p++ ) {if ( p->s_state ==S_RUNNING ) {
common/ts_mtio.h +30 -30
148 lines not on this page · raw message
common/types.h +1 -1
@@ -149,7 +149,7 @@ typedef struct stat64 stat64_t;typedef struct getbmapx getbmapx_t ;typedef struct fsdmidata fsdmidata_t ; -/* flg definitions for preemptchk +/* flg definitions for preemptchk */ #define PREEMPT_FULL 0#define PREEMPT_PROGRESSONLY 1
common/util.c +4 -4
@@ -73,7 +73,7 @@ write_buf( char *bufp, int read_buf( char *bufp, - size_t bufsz, + size_t bufsz, void *contextp, rfp_t read_funcp, rrbfp_t return_read_buf_funcp,
@@ -230,7 +230,7 @@ bigstat_iter( jdm_fshandle_t *fshandlep, "bulkstat seeked to EOS\n");return 0 ; } - +mlog (MLOG_DEBUG ,"bulkstat seeked to %llu\n" , lastino);
@@ -397,7 +397,7 @@ diriter( jdm_fshandle_t *fshandlep,assert ( cbrval ==0 ); nread =getdents_wrap ( fd, (char *)gdp, gdsz ); - +/* negative count indicates something very bad happened; * try to gracefully end this dir. */
@@ -511,7 +511,7 @@ diriter( jdm_fshandle_t *fshandlep, } } -int +int cvtnum (int blocksize,char *s ) {int i;
common/util.h +1 -1
@@ -60,7 +60,7 @@ typedef char * ( *rfp_t )( void *contextp, size_t wantedsz, size_t *szp, int *sttypedef void ( *rrbfp_t )(void *contextp,char *bufp,size_t bufsz ); extern int read_buf( char *bufp, - size_t bufsz, + size_t bufsz, void *contextp, rfp_t read_funcp, rrbfp_t return_read_buf_funcp,
dump/content.c +42 -42
309 lines not on this page · raw message
dump/inomap.c +3 -3
@@ -354,7 +354,7 @@ inomap_build( jdm_fshandle_t *fshandlep, bstatbufp, bstatbuflen ); *inomap_statphasep =0 ; - +if ( rval ) {cb_context_free ();free ( (void * )bstatbufp );
@@ -704,7 +704,7 @@ supprt_prune( void *arg1, /* ancestors marked as changed? */if ( state !=MAP_DIR_CHANGE && state !=MAP_DIR_NOCHNG && state !=MAP_DIR_SUPPRT ) { -/* +/* * if file is now a dir then it has * certainly changed. */
@@ -752,7 +752,7 @@ supprt_prune( void *arg1, /* ancestors marked as changed? */ state =inomap_get_state ( cb_inomap_contextp, statp->bs_ino );if ( state !=MAP_NDR_CHANGE && state !=MAP_NDR_NOCHNG ) { -/* +/* * if dir is now a file then it has * certainly changed. */
inventory/inv_api.c +99 -99
612 lines not on this page · raw message
inventory/inv_core.c +15 -17
@@ -60,7 +60,7 @@ get_counters( int fd, void **cntpp, size_t cntsz ) *cntpp =NULL ;return -1 ; } - + num = ((invt_counter_t *)(*cntpp))->ic_curnum;if ( ( (invt_counter_t *)(*cntpp))->ic_vernum !=INV_VERSION ) {
@@ -70,7 +70,7 @@ get_counters( int fd, void **cntpp, size_t cntsz ) (int) INV_VERSION );assert ( ((invt_counter_t *)(*cntpp))->ic_vernum ==INV_VERSION ); - } + }return (int ) num; }
@@ -100,7 +100,7 @@ get_headers( int fd, void **hdrs, size_t bufsz, size_t off ) *hdrs =NULL ;return -1 ; } - +return 1 ; }
@@ -111,14 +111,14 @@ get_headers( int fd, void **hdrs, size_t bufsz, size_t off )/*----------------------------------------------------------------------*/ int -get_invtrecord (int fd,void *buf,size_t bufsz,off64_t off, +get_invtrecord (int fd,void *buf,size_t bufsz,off64_t off,bool_t dolock ) {int nread; - +assert ( fd >=0 ); - -if ( dolock ) + +if ( dolock )INVLOCK ( fd,LOCK_SH ); nread =pread (fd, buf, bufsz, (off_t )off);
@@ -129,7 +129,7 @@ get_invtrecord( int fd, void *buf, size_t bufsz, off64_t off,return -1 ; } -if ( dolock ) +if ( dolock )INVLOCK ( fd,LOCK_UN );return nread;
@@ -148,10 +148,10 @@ int put_invtrecord( int fd, void *buf, size_t bufsz, off64_t off, bool_t dolock ) { int nwritten; - +if ( dolock )INVLOCK ( fd,LOCK_EX ); - + nwritten =pwrite (fd, buf, bufsz, (off_t )off);if (nwritten != (int ) bufsz ) {INV_PERROR (_ ("Error in writing inventory record :" ) );
@@ -179,8 +179,8 @@ put_invtrecord( int fd, void *buf, size_t bufsz, off64_t off, bool_t dolock )int get_headerinfo (int fd,void **hdrs,void **cnt,size_t hdrsz,size_t cntsz,bool_t dolock ) -{ -int num; +{ +int num;/* get a lock on the table for reading */ if ( dolock )INVLOCK ( fd,LOCK_SH );
@@ -207,17 +207,17 @@ get_headerinfo( int fd, void **hdrs, void **cnt,int get_lastheader (int fd,void **ent,size_t hdrsz,size_t cntsz ) -{ +{int nindices;void *arr =NULL ;invt_counter_t *cnt =NULL ;char *pos;/* get the entries in the inv_index */ -if ( ( nindices =GET_ALLHDRS_N_CNTS ( fd, &arr, (void **)&cnt, +if ( ( nindices =GET_ALLHDRS_N_CNTS ( fd, &arr, (void **)&cnt, hdrsz, cntsz )) <=0 ) {return -1 ; } - +/* if there's space anywhere at all, then it must be in the last entry */ *ent =malloc ( hdrsz );
@@ -228,5 +228,3 @@ get_lastheader( int fd, void **ent, size_t hdrsz, size_t cntsz )return nindices; } - -
inventory/inv_fstab.c +29 -29
152 lines not on this page · raw message
inventory/inv_idx.c +64 -65
103 lines not on this page · raw message
inventory/inv_mgr.c +57 -58
115 lines not on this page · raw message
inventory/inv_oref.c +48 -50
98 lines not on this page · raw message
inventory/inv_priv.h +32 -32
64 lines not on this page · raw message
inventory/inv_stobj.c +172 -172
344 lines not on this page · raw message
inventory/inventory.h +32 -32
64 lines not on this page · raw message
inventory/testmain.c +40 -41
81 lines not on this page · raw message
invutil/invidx.c +25 -25
50 lines not on this page · raw message
invutil/invutil.c +28 -29
57 lines not on this page · raw message
restore/content.c +55 -55
110 lines not on this page · raw message
restore/tree.c +31 -31
62 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.19.1
Part of the diff is not shown here. View the raw message.
Re: [PATCH 1/2] xfsdump: remove trailing whitespaces
Quoted 6 lines · Jan Tulak
There were many trailing whitespaces through the whole code. As the rate of changes in xfsdump is low, it should not cause trouble if we fix it in all files at once and avoid issues (unintended changes) with sensibly configured editors that automatically remove these on a file save.
Signed-off-by Jan Tulak <[email protected]>
Looks fine, this always bugged me. ;)
seems like truly nothing but trailing ws changes:
# grep " $" jtulak-ws1 | grep -v "^\-" | grep -v "^ " #
(haven't seen PATCH 2/2 yet tho)
Quoted 69 lines
--- common/arch_xlate.c | 24 +-- common/cleanup.c | 2 +- common/cleanup.h | 2 +- common/content.h | 2 +- common/content_inode.h | 4 +- common/dlog.c | 2 +- common/drive.c | 12 +- common/drive.h | 8 +- common/drive_minrmt.c | 60 +++---- common/drive_scsitape.c | 71 ++++----- common/drive_simple.c | 10 +- common/global.c | 6 +- common/global.h | 4 +- common/hsmapi.c | 2 +- common/inventory.c | 120 +++++++------- common/inventory.h | 46 +++--- common/main.c | 20 +-- common/media.c | 4 +- common/media_rmvtape.h | 2 +- common/mlog.c | 16 +- common/mlog.h | 2 +- common/qlock.c | 10 +- common/rec_hdr.h | 2 +- common/ring.c | 4 +- common/ring.h | 2 +- common/stream.c | 2 +- common/ts_mtio.h | 60 +++---- common/types.h | 2 +- common/util.c | 8 +- common/util.h | 2 +- dump/content.c | 84 +++++----- dump/inomap.c | 6 +- inventory/inv_api.c | 198 +++++++++++------------ inventory/inv_core.c | 32 ++-- inventory/inv_fstab.c | 58 +++---- inventory/inv_idx.c | 129 ++++++++------- inventory/inv_mgr.c | 115 +++++++------- inventory/inv_oref.c | 98 ++++++------ inventory/inv_oref.h | 12 +- inventory/inv_priv.h | 64 ++++---- inventory/inv_stobj.c | 344 ++++++++++++++++++++-------------------- inventory/inventory.h | 64 ++++---- inventory/testmain.c | 81 +++++----- invutil/fstab.c | 6 +- invutil/invidx.c | 50 +++--- invutil/invutil.c | 57 ++++--- invutil/list.h | 1 - invutil/menu.c | 8 +- invutil/screen.c | 2 +- invutil/stobj.c | 6 +- librmt/rmtaccess.c | 2 - librmt/rmtclose.c | 2 - librmt/rmtcommand.c | 3 - librmt/rmtcreat.c | 2 - librmt/rmtdev.c | 2 - librmt/rmtioctl.c | 34 ++-- librmt/rmtlib.h | 2 +- librmt/rmtlseek.c | 2 - librmt/rmtstatus.c | 3 - restore/bag.c | 2 +- restore/content.c | 110 ++++++------- restore/dirattr.c | 4 +- restore/inomap.c | 2 +- restore/namreg.c | 4 +- restore/node.c | 2 +- restore/tree.c | 62 ++++---- 66 files changed, 1069 insertions(+), 1095 deletions(-)
Quoted 7 lines · Jan Tulak
(I'm splitting the previous set into smaller ones, so changes doesn't
have to wait.)This set is dealing with whitespaces only, no functional change, code shuffling, etc. should be present. The first patch clears out trailing whitespaces, the second one sorts out the crazy mishmash of tabs and spaces.
patch 2 Didn't come through - it'll be too large for the list.
However, it's is the same change as what you originally posted to a git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesis
- convert all the code with 4 space indents to tabs, leaving vertically aligned function call parameters alone.
This will be a much smaller set of cleanups than a blanket space-to-tab script does...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 11 lines · Dave Chinner
Quoted 7 lines · Jan Tulak
(I'm splitting the previous set into smaller ones, so changes doesn't
have to wait.)This set is dealing with whitespaces only, no functional change, code shuffling, etc. should be present. The first patch clears out trailing whitespaces, the second one sorts out the crazy mishmash of tabs and spaces.
patch 2 Didn't come through - it'll be too large for the list.
Ah, I see.
Quoted 2 lines
However, it's is the same change as what you originally posted to a
Yes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
It is "s/ /\t/" limited to the beginning of the line. The function
parameters were caught in it too, but I don't think they would make the most of the lines.
Quoted 7 lines
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesis
I already started working on it. It is too complex for awk/sed, so I'm trying to find some better way through IDEs with autoformatting capabilities.
Quoted 2 lines
- convert all the code with 4 space indents to tabs, leaving vertically aligned function call parameters alone.
Part of the issue is that xfsdump is not even consistently using the number of spaces. E.g. just a two random functions in invutil/stobj.c:335-486 in master, you find that both 2 and 4 spaces per indent level are used and even stuff like \t<space*4> inside of "if", without it being a function parameter.
And the indentation of the parameters will change anyway, as we have parameters indented with tabs only, and with spaces only, and with some mix that makes no sense unless you configure your editor to show \t as an odd number of spaces except on the first Thursday of a month, but only on years that make a power of 2... Same as the rest of the code. :-) So I expect the resulting set to be roughly the same size as it is now. But I will break the patch by component, it should pass through then.
Thanks,
Jan
Quoted 10 lines
This will be a much smaller set of cleanups than a blanket space-to-tab script does...
Cheers,
Dave.
--
Dave Chinner
[email protected]
Quoted 60 lines · Jan Tulak
Quoted 11 lines · Dave Chinner
Quoted 7 lines · Jan Tulak
(I'm splitting the previous set into smaller ones, so changes doesn't
have to wait.)This set is dealing with whitespaces only, no functional change, code shuffling, etc. should be present. The first patch clears out trailing whitespaces, the second one sorts out the crazy mishmash of tabs and spaces.
patch 2 Didn't come through - it'll be too large for the list.
Ah, I see.
Quoted 2 lines
However, it's is the same change as what you originally posted to a
Yes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
It is "s/ /\t/" limited to the beginning of the line. The function
parameters were caught in it too, but I don't think they would make the most of the lines.Quoted 7 lines
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesisI already started working on it. It is too complex for awk/sed, so I'm trying to find some better way through IDEs with autoformatting capabilities.
Quoted 2 lines
- convert all the code with 4 space indents to tabs, leaving vertically aligned function call parameters alone.
Part of the issue is that xfsdump is not even consistently using the number of spaces. E.g. just a two random functions in invutil/stobj.c:335-486 in master, you find that both 2 and 4 spaces per indent level are used and even stuff like \t<space*4> inside of "if", without it being a function parameter.
And the indentation of the parameters will change anyway, as we have parameters indented with tabs only, and with spaces only, and with some mix that makes no sense unless you configure your editor to show \t as an odd number of spaces except on the first Thursday of a month, but only on years that make a power of 2... Same as the rest of the code. :-) So I expect the resulting set to be roughly the same size as it is now. But I will break the patch by component, it should pass through then.
Quoted 3 lines
Thanks,
Jan
Update: I found a reasonably working code prettifier with kernel-style config. The disadvantage is that I'm not really able to split the patches by type of change (indentation, spaces inside of parentheses, vertical align...) and it did it all at once, but hopefully that is not a big issue. You can look at it here [1] - it is 2,4MB in size of the patch files (only the formatting changes) and I want to check it a bit better before sending it here as emails, whether there is no new warning in gcc, etc. But it compiles and passes xfstests, so feel free to peek at it - I will be back online in the Monday.
[1] https://github.com/jtulak/xfsdump/tree/for-review (git clone
https://github.com/jtulak/xfsdump.git)
Thanks,
Jan
Quoted 10 lines
Quoted 10 lines
This will be a much smaller set of cleanups than a blanket space-to-tab script does...
Cheers,
Dave.
--
Dave Chinner
[email protected]
Signature · 1 line
Jan Tulak
Quoted 75 lines · Jan Tulak
Quoted 60 lines · Jan Tulak
Quoted 11 lines · Dave Chinner
Quoted 7 lines · Jan Tulak
(I'm splitting the previous set into smaller ones, so changes doesn't
have to wait.)This set is dealing with whitespaces only, no functional change, code shuffling, etc. should be present. The first patch clears out trailing whitespaces, the second one sorts out the crazy mishmash of tabs and spaces.
patch 2 Didn't come through - it'll be too large for the list.
Ah, I see.
Quoted 2 lines
However, it's is the same change as what you originally posted to a
Yes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
It is "s/ /\t/" limited to the beginning of the line. The function
parameters were caught in it too, but I don't think they would make the most of the lines.Quoted 7 lines
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesisI already started working on it. It is too complex for awk/sed, so I'm trying to find some better way through IDEs with autoformatting capabilities.
Quoted 2 lines
- convert all the code with 4 space indents to tabs, leaving vertically aligned function call parameters alone.
Part of the issue is that xfsdump is not even consistently using the number of spaces. E.g. just a two random functions in invutil/stobj.c:335-486 in master, you find that both 2 and 4 spaces per indent level are used and even stuff like \t<space*4> inside of "if", without it being a function parameter.
And the indentation of the parameters will change anyway, as we have parameters indented with tabs only, and with spaces only, and with some mix that makes no sense unless you configure your editor to show \t as an odd number of spaces except on the first Thursday of a month, but only on years that make a power of 2... Same as the rest of the code. :-) So I expect the resulting set to be roughly the same size as it is now. But I will break the patch by component, it should pass through then.
Quoted 3 lines
Thanks,
JanUpdate: I found a reasonably working code prettifier with kernel-style config. The disadvantage is that I'm not really able to split the patches by type of change (indentation, spaces inside of parentheses, vertical align...) and it did it all at once, but hopefully that is not a big issue. You can look at it here [1] - it is 2,4MB in size of the patch files (only the formatting changes) and I want to check it a bit better before sending it here as emails, whether there is no new warning in gcc, etc. But it compiles and passes xfstests, so feel free to peek at it - I will be back online in the Monday.
Quoted 2 lines
[1] https://github.com/jtulak/xfsdump/tree/for-review (git clone
https://github.com/jtulak/xfsdump.git)
IMO, it's largely unreviewable because not only does whitespace change, so does the way the code is laid out.
e.g it removes {} around single line if/for/while, so that could introduce bugs if there are multi-expression macros that aren't correctly encapsulated (and there are!).
And that's really hard to see in amongst all the indenting changes, the whitespace removal, etc. I'd much prefer "one type of change at a time" patches because they are much easier to review.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 16 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Update: I found a reasonably working code prettifier with kernel-style config. The disadvantage is that I'm not really able to split the patches by type of change (indentation, spaces inside of parentheses, vertical align...) and it did it all at once, but hopefully that is not a big issue. You can look at it here [1] - it is 2,4MB in size of the patch files (only the formatting changes) and I want to check it a bit better before sending it here as emails, whether there is no new warning in gcc, etc. But it compiles and passes xfstests, so feel free to peek at it - I will be back online in the Monday.
Quoted 2 lines
[1] https://github.com/jtulak/xfsdump/tree/for-review (git clone
https://github.com/jtulak/xfsdump.git)
Quoted 6 lines
IMO, it's largely unreviewable because not only does whitespace change, so does the way the code is laid out.
e.g it removes {} around single line if/for/while, so that could introduce bugs if there are multi-expression macros that aren't correctly encapsulated (and there are!).
I didn't realize that possibility. Fixing...
Quoted 4 lines
And that's really hard to see in amongst all the indenting changes, the whitespace removal, etc. I'd much prefer "one type of change at a time" patches because they are much easier to review.
Yeah, I understand. Let's see what I can do... Anyway, thanks for the feedback.
Cheers,
Jan
Signature · 1 line
Jan Tulak
Quoted 4 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to a
Quoted 8 lines
Yes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Because the above regex is "change the first occurrence anywhere on the line", not at the start of the line. IIRC, that's what the original patch did. I can't check, becuase you've removed it from your git tree... :/
Quoted 3 lines
The function
parameters were caught in it too, but I don't think they would make the most of the lines.
It was enough for me to notice both declarations and call sites made up a large amount of the change in the first 3rd of the diff I scrolled through... :/
Quoted 10 lines
Quoted 6 lines
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesisI already started working on it. It is too complex for awk/sed, so I'm trying to find some better way through IDEs with autoformatting capabilities.
It should be relatively straight forward with sed. e.g. off the top of my head, stripping the space after "(" is this expression:
$ echo "foo( bar" | sed -e 's/\([[:alnum:]](\) \([[:alnum:]]\)/\1\2/' foo(bar $
/me is slightly worried that he can now write non-trivial line noise in sed that does the right thing first go....
Another option is coccinelle - it was specifically designed to do such semantic transformations to C code:
http://coccinelle.lip6.fr/
http://coccinellery.org/
It's been widely used on the linux kernel for automated, widepsread code changes for bug fixes and cleanups.
Quoted 8 lines
Quoted 2 lines
- convert all the code with 4 space indents to tabs, leaving vertically aligned function call parameters alone.
Part of the issue is that xfsdump is not even consistently using the number of spaces. E.g. just a two random functions in invutil/stobj.c:335-486 in master, you find that both 2 and 4 spaces per indent level are used and even stuff like \t<space*4> inside of "if", without it being a function parameter.
Yes.
$ echo "foo( bar baz" | sed -e 's/\t \{4\}/_tab_and_4_spaces_/'
foo( bar_tab_and_4_spaces_baz
$You'll end up building lots of specific regexes to catch each of these cases. Which is painful, and you'll still have to manually clean stuff up afterwards.
Quoted 8 lines
And the indentation of the parameters will change anyway, as we have parameters indented with tabs only, and with spaces only, and with some mix that makes no sense unless you configure your editor to show \t as an odd number of spaces except on the first Thursday of a month, but only on years that make a power of 2... Same as the rest of the code. :-) So I expect the resulting set to be roughly the same size as it is now. But I will break the patch by component, it should pass through then.
Yup, which is precisely why you should be looking at using a semantic patching tool like coccinelle, not a literal one like sed that uses regexes.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 9 lines · Dave Chinner
Quoted 7 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
[snip]
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
I'd suggest that this is the least of the whitespace sins of xfsdump. yes, it's easy to script, but I don't think it's the right thing to do. The biggest problems I think we need to start with are:
- reformat all the function definitions according to common XFS style
- get rid of all the "( foo )" style white space aroudn parenthesisI already started working on it. It is too complex for awk/sed, so I'm trying to find some better way through IDEs with autoformatting capabilities.
Quoted 6 lines
It should be relatively straight forward with sed. e.g. off the top of my head, stripping the space after "(" is this expression:
$ echo "foo( bar" | sed -e 's/\([[:alnum:]](\) \([[:alnum:]]\)/\1\2/' foo(bar $
I tried something similar and the result was not ideal - it worked ok for common cases, but not always.
Quoted 6 lines
/me is slightly worried that he can now write non-trivial line noise in sed that does the right thing first go....
Another option is coccinelle - it was specifically designed to do such semantic transformations to C code:
Thanks for the tip, I will look at it.
Cheers,
Jan
Signature · 1 line
Jan Tulak
Quoted 14 lines · Jan Tulak
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
Which is handled by this regex: 's/^\(\t*\)* /\1\t/'
In this case, I'm using "*", which means "match zero or more of the preceding expression" - which in this case is \t. That regex is enclosed in \(...\) to group the result, which is then back referenced in the output expression by \1 (first group backref).
Regexes are extremely and flexible once you've learnt how the multiple object matching rules work.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 24 lines · Dave Chinner
Quoted 14 lines · Jan Tulak
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
Which is handled by this regex: 's/^\(\t*\)* /\1\t/'
Quoted 7 lines
In this case, I'm using "*", which means "match zero or more of the preceding expression" - which in this case is \t. That regex is enclosed in \(...\) to group the result, which is then back referenced in the output expression by \1 (first group backref).
Regexes are extremely and flexible once you've learnt how the multiple object matching rules work.
I know. But I don't see how your regex would take the number of four-space groups and inserted the same number of \t, which is what I was trying to do and AFAIK there is no way to do it with sed. I know it could be done with awk, but writing it would take more time for me
than re-running s/^ /\t\t/ with a manually changed number of
occurrences, from one to say 5 levels (or until I stop getting any changes).
Cheers,
Jan
Quoted 30 lines · Jan Tulak
Quoted 29 lines · Dave Chinner
Quoted 14 lines · Jan Tulak
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
Which is handled by this regex: 's/^\(\t*\)* /\1\t/'
In this case, I'm using "*", which means "match zero or more of the preceding expression" - which in this case is \t. That regex is enclosed in \(...\) to group the result, which is then back referenced in the output expression by \1 (first group backref).
Quoted 5 lines
Quoted 2 lines
Regexes are extremely and flexible once you've learnt how the multiple object matching rules work.
I know. But I don't see how your regex would take the number of four-space groups and inserted the same number of \t,
I thought you were asking about having multiple tabs preceding the "4 space group". If you simply want to change all 4 space
groups, it's 's/\( \)/\t/g':
$ echo " " |sed -e 's/\( \)/T/g' TTTT $
The positional match selector suffix is the key here. 'g' means "global match" and replaces every occurrence on the line. If you use a number, it replaces the N'th occurrence:
$ echo " " |sed -e 's/\( \)/T/1'
T
$ echo " " |sed -e 's/\( \)/T/2'
T
$ echo " " |sed -e 's/\( \)/T/3'
T
$ echo " " |sed -e 's/\( \)/T/4'
TQuoted 3 lines
which is what I
was trying to do and AFAIK there is no way to do it with sed. I know it could be done with awk,
awk is still regex based, it just allows you to get away with simple regexes by adding complex code :P
Quoted 4 lines
but writing it would take more time for me
than re-running s/^ /\t\t/ with a manually changed number of
occurrences, from one to say 5 levels (or until I stop getting any changes).
Grouping and positional selection is the answer here.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 35 lines · Dave Chinner
Quoted 33 lines · Jan Tulak
Quoted 31 lines · Dave Chinner
Quoted 14 lines · Jan Tulak
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
Which is handled by this regex: 's/^\(\t*\)* /\1\t/'
In this case, I'm using "*", which means "match zero or more of the preceding expression" - which in this case is \t. That regex is enclosed in \(...\) to group the result, which is then back referenced in the output expression by \1 (first group backref).
Regexes are extremely and flexible once you've learnt how the multiple object matching rules work.
Quoted 7 lines
Quoted 2 lines
I know. But I don't see how your regex would take the number of four-space groups and inserted the same number of \t,
I thought you were asking about having multiple tabs preceding the "4 space group". If you simply want to change all 4 space
groups, it's 's/\( \)/\t/g':
[snip]
Thanks, but I know regular expressions, even if I usually don't get a nontrivial expression on a first try. :-D
Anyway, how about this? I pushed it into a new branch (style-nov-8th)
https://github.com/jtulak/xfsdump/tree/style-nov-8th
(git clone --single-branch -b style-nov-8th
https://github.com/jtulak/xfsdump.git)
It is now in 16 patches, split usually one change at a time. Three of them are over 500k in size, so I will need to cut them somehow into more parts before sending them into the mailing list. But I ended up with a small script set that does it all, including the creation of commits, so I don't have to deal with conflicts if I will need to change anything.
Btw, I wonder if these formatting scripts could be useful if I push them somewhere publicly... About 2/3 are sed replacements, the last third are gradually stricter configurations for Uncrustify
(http://uncrustify.sourceforge.net/, available in distro repos).
Thanks,
Jan
Signature · 1 line
Jan Tulak
Quoted 49 lines · Jan Tulak
Quoted 35 lines · Dave Chinner
Quoted 33 lines · Jan Tulak
Quoted 31 lines · Dave Chinner
Quoted 14 lines · Jan Tulak
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Jan Tulak
Quoted 2 lines · Dave Chinner
On Thu, Nov 01, 2018 at 12:01:28PM +0100, Jan Tulak wrote:
However, it's is the same change as what you originally posted to aYes, it is the same thing, with changes where I found something misaligned on top.
Quoted 3 lines
git tree, then it needs revision. basically, most of the change was converting vertically aligned function call parameters to use tabs, and that broke the vertical alignment.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
It is "s/ /\t/" limited to the beginning of the line.
You mean 's/^ /\t/'?
Yes, but in multiple iterations to get \t, \t\t, \t\t\t, ...
Which is handled by this regex: 's/^\(\t*\)* /\1\t/'
In this case, I'm using "*", which means "match zero or more of the preceding expression" - which in this case is \t. That regex is enclosed in \(...\) to group the result, which is then back referenced in the output expression by \1 (first group backref).
Regexes are extremely and flexible once you've learnt how the multiple object matching rules work.
Quoted 7 lines
Quoted 2 lines
I know. But I don't see how your regex would take the number of four-space groups and inserted the same number of \t,
I thought you were asking about having multiple tabs preceding the "4 space group". If you simply want to change all 4 space
groups, it's 's/\( \)/\t/g':[snip]
Thanks, but I know regular expressions, even if I usually don't get a nontrivial expression on a first try. :-D
Quoted 8 lines
Anyway, how about this? I pushed it into a new branch (style-nov-8th)
https://github.com/jtulak/xfsdump/tree/style-nov-8th
(git clone --single-branch -b style-nov-8th
https://github.com/jtulak/xfsdump.git)It is now in 16 patches, split usually one change at a time. Three of them are over 500k in size, so I will need to cut them somehow into more parts before sending them into the mailing list.
Split them by dump/restore/inventory/common directories.
Quoted 9 lines
But I ended up
with a small script set that does it all, including the creation of commits, so I don't have to deal with conflicts if I will need to change anything.Btw, I wonder if these formatting scripts could be useful if I push them somewhere publicly... About 2/3 are sed replacements, the last third are gradually stricter configurations for Uncrustify
(http://uncrustify.sourceforge.net/, available in distro repos).
The scripts used for the transfomation should be documented in the the commit messages. e.g:
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]