Skip to contentSkip to conversation

xfsdump: a little bit of cleaning

PATCH In review Jan Tulak 2 participants 11 messages Nov 29, 2018 – Dec 6, 2018 Arm STM32

lore
Share & tools
lore

Jan Tulak

author
#0 lore raw

cover xfsdump: a little bit of cleaning

Rather than send a big list of changes at once like the last time, I'm sending just a few patches. Once these are reviewed and ok (should not be hard, 3 of the 4 are just few-line changes), then I will send some more. Hopefully, this will be easier and quicker for all of us.

Anyway, these four patches lay some preparatory work by fixing some of the compile-time warnings, so any if any further change (formatting or bug-fixing) introduces a new one, we can spot it without running a diff.

The first patch (trailing whitespaces) can be verified with objdump -d that it does not change the compiled code.

Cheers,
Jan

Jan Tulak (4):
xfsdump: (style) remove trailing whitespaces
xfsdump: do not split function call with ifdef common/types.h: Wrap #define UUID_STR_LEN 36 in #ifndef common/drive.c: include stdlib.h

 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          |  13 +-
 common/drive.h          |   8 +-
 common/drive_minrmt.c   |  63 ++++----
 common/drive_scsitape.c |  70 ++++----
 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           |  28 ++--
 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          |   4 +-
 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    |  30 ++--
 inventory/inv_fstab.c   |  58 +++----
 inventory/inv_idx.c     | 128 +++++++--------
 inventory/inv_mgr.c     | 114 ++++++-------
 inventory/inv_oref.c    |  96 +++++------
 inventory/inv_oref.h    |  12 +-
 inventory/inv_priv.h    |  64 ++++----
 inventory/inv_stobj.c   | 344 ++++++++++++++++++++--------------------
 inventory/inventory.h   |  64 ++++----
 inventory/testmain.c    |  80 +++++-----
 invutil/fstab.c         |   6 +-
 invutil/invidx.c        |  50 +++---
 invutil/invutil.c       |  56 +++----
 invutil/menu.c          |   8 +-
 invutil/screen.c        |   2 +-
 invutil/stobj.c         |   6 +-
 librmt/rmtioctl.c       |  34 ++--
 librmt/rmtlib.h         |   2 +-
 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 ++++----
 58 files changed, 1080 insertions(+), 1072 deletions(-)

--
2.19.1

author
#1 lore raw

PATCH 1/4 xfsdump: (style) 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.

Can be tested with objdump.

Created by this script:

#!/usr/bin/env bash
# remove trailing whitespaces

find . -name '*.[ch]' ! -type d -exec bash -c '

sed -i \
    -e "s/\s*$//" \
    $0

' {} \;

---
 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 |  70 ++++----
 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    |  30 ++--
 inventory/inv_fstab.c   |  58 +++----
 inventory/inv_idx.c     | 128 +++++++--------
 inventory/inv_mgr.c     | 114 ++++++-------
 inventory/inv_oref.c    |  96 +++++------
 inventory/inv_oref.h    |  12 +-
 inventory/inv_priv.h    |  64 ++++----
 inventory/inv_stobj.c   | 344 ++++++++++++++++++++--------------------
 inventory/inventory.h   |  64 ++++----
 inventory/testmain.c    |  80 +++++-----
 invutil/fstab.c         |   6 +-
 invutil/invidx.c        |  50 +++---
 invutil/invutil.c       |  56 +++----
 invutil/menu.c          |   8 +-
 invutil/screen.c        |   2 +-
 invutil/stobj.c         |   6 +-
 librmt/rmtioctl.c       |  34 ++--
 librmt/rmtlib.h         |   2 +-
 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 ++++----
 58 files changed, 1069 insertions(+), 1069 deletions(-)
common/arch_xlate.c +12 -12
index 1b8e687..4043a9d 100644
@@ -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
index 523f164..45339c6 100644
@@ -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
index a22a2db..a54f9db 100644
@@ -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
index 763c09f..c947474 100644
@@ -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
index 6936e05..38ba2a3 100644
@@ -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
index 032e6f7..77364a3 100644
@@ -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
index 5fe6867..4b0825f 100644
@@ -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
index 89b143e..37258e0 100644
@@ -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 -35

269 lines not on this page · raw message

common/drive_simple.c +5 -5
index b4e41da..54a3058 100644
@@ -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
index e70b8a0..73efd55 100644
@@ -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
index 0b738de..53351a1 100644
@@ -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
index 0709dbe..7a3584d 100644
@@ -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
index d3bdcf3..b3605d1 100644
@@ -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
index 02fde9c..817e99e 100644
@@ -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
index 46d25f8..61e80e1 100644
@@ -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
index b520131..0924bf2 100644
@@ -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
index e080f9e..628dd28 100644
@@ -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
index c770116..1db461d 100644
@@ -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
index 552447c..1ab783c 100644
@@ -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
index f5055ee..70c0f45 100644
@@ -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
index 4a1cc54..6126b77 100644
@@ -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
index 3047886..eadaaea 100644
@@ -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
index 424b47a..50c841e 100644
@@ -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
index bbca758..70b17eb 100644
@@ -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
index 558bf7e..07fdd36 100644
@@ -60,7 +60,7 @@ typedef char * ( *rfp_t )( void *contextp, size_t wantedsz, size_t *szp, int *st
 typedef 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
index 1dacf35..238fcaf 100644
@@ -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 -15
index 5ef519c..f9866a5 100644
@@ -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 );
inventory/inv_fstab.c +29 -29

152 lines not on this page · raw message

inventory/inv_idx.c +64 -64

112 lines not on this page · raw message

inventory/inv_mgr.c +57 -57

114 lines not on this page · raw message

inventory/inv_oref.c +48 -48

96 lines not on this page · raw message

inventory/inv_oref.h +6 -6
index 38303a4..0061722 100644

Lines of this file are not shown. View the 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 -40

80 lines not on this page · raw message

invutil/fstab.c +3 -3
index 4284cd1..a4333ad 100644

Lines of this file are not shown. View the raw message.

invutil/invidx.c +25 -25

50 lines not on this page · raw message

invutil/invutil.c +28 -28

56 lines not on this page · raw message

invutil/menu.c +4 -4
index f81f9b6..81baa42 100644

Lines of this file are not shown. View the raw message.

invutil/screen.c +1 -1
index 6e913a7..5e478c9 100644

Lines of this file are not shown. View the raw message.

invutil/stobj.c +3 -3
index f389c53..582858f 100644

Lines of this file are not shown. View the raw message.

librmt/rmtioctl.c +17 -17
index bd6f887..edcd611 100644

Lines of this file are not shown. View the raw message.

librmt/rmtlib.h +1 -1
index 1f877ca..6373075 100644

Lines of this file are not shown. View the raw message.

restore/bag.c +1 -1
index 55bba73..dfe7aa5 100644

Lines of this file are not shown. View the raw message.

restore/content.c +55 -55

110 lines not on this page · raw message

restore/dirattr.c +2 -2
index 7a423ab..f057b78 100644

Lines of this file are not shown. View the raw message.

restore/inomap.c +1 -1
index fd55907..5f81897 100644

Lines of this file are not shown. View the raw message.

restore/namreg.c +2 -2
index 97e6524..8e7ff76 100644

Lines of this file are not shown. View the raw message.

restore/node.c +1 -1
index 92a21ce..b6b6906 100644

Lines of this file are not shown. View the 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.

--
2.19.1

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [PATCH 1/4] xfsdump: (style) remove trailing whitespaces

Quoted 12 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.

Can be tested with objdump.

Created by this script:

#!/usr/bin/env bash
# remove trailing whitespaces

Quoted 7 lines

find . -name '*.[ch]' ! -type d -exec bash -c '

sed -i \
    -e "s/\s*$//" \
    $0

' {} \;

Hi Jan -

Finally got to looking at these, but this patch doesn't apply for me (even if retrieved from patchwork)

...

Quoted 6 lines
common/arch_xlate.c +0 -0
index 1b8e687..4043a9d 100644
@@ -135,12 +135,12 @@ xlate_drive_hdr(drive_hdr_t *dh1, drive_hdr_t *dh2, int dir)
 	     "\tdh_pad1 %s\n"

common/arch_xlate.c xlate_drive_hdr(drive_hdr_t *dh1, drive_hdr_t *dh2, int dir) · line 143

Quoted 10 lines
common/arch_xlate.c +2 -2
 	     "\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);

...

there seems to be no actual trailing whitespace on the "-" lines?

-Eric

author
#3 lore raw

PATCH RESEND 1/4 xfsdump: (style) remove trailing whitespaces

In reply to Jan Tulak

RESEND. It seems that I edited the patch file with an editor that stripped the blank spaces that should be stripped by the patch. Sorry. :-D Now I verified that the file contains the whitespaces before sending, so hopefully it will apply.

Jan

---

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.

Created by this script:

#!/usr/bin/env bash
# remove trailing whitespaces

find . -name '*.[ch]' ! -type d -exec bash -c '

sed -i \
    -e "s/\s*$//" \
    $0

' {} \;

---
 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 |  70 ++++----
 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    |  30 ++--
 inventory/inv_fstab.c   |  58 +++----
 inventory/inv_idx.c     | 128 +++++++--------
 inventory/inv_mgr.c     | 114 ++++++-------
 inventory/inv_oref.c    |  96 +++++------
 inventory/inv_oref.h    |  12 +-
 inventory/inv_priv.h    |  64 ++++----
 inventory/inv_stobj.c   | 344 ++++++++++++++++++++--------------------
 inventory/inventory.h   |  64 ++++----
 inventory/testmain.c    |  80 +++++-----
 invutil/fstab.c         |   6 +-
 invutil/invidx.c        |  50 +++---
 invutil/invutil.c       |  56 +++----
 invutil/menu.c          |   8 +-
 invutil/screen.c        |   2 +-
 invutil/stobj.c         |   6 +-
 librmt/rmtioctl.c       |  34 ++--
 librmt/rmtlib.h         |   2 +-
 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 ++++----
 58 files changed, 1069 insertions(+), 1069 deletions(-)
common/arch_xlate.c +12 -12
index 1b8e687..4043a9d 100644
@@ -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
index 523f164..45339c6 100644
@@ -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
index a22a2db..a54f9db 100644
@@ -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
index 763c09f..c947474 100644
@@ -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
index 6936e05..38ba2a3 100644
@@ -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
index 032e6f7..77364a3 100644
@@ -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
index 5fe6867..4b0825f 100644
@@ -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
index 89b143e..37258e0 100644
@@ -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 -35

269 lines not on this page · raw message

common/drive_simple.c +5 -5
index b4e41da..54a3058 100644
@@ -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
index e70b8a0..73efd55 100644
@@ -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
index 0b738de..53351a1 100644
@@ -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
index 0709dbe..7a3584d 100644
@@ -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
index d3bdcf3..b3605d1 100644
@@ -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
index 02fde9c..817e99e 100644
@@ -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
index 46d25f8..61e80e1 100644
@@ -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
index b520131..0924bf2 100644
@@ -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
index e080f9e..628dd28 100644
@@ -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
index c770116..1db461d 100644
@@ -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
index 552447c..1ab783c 100644
@@ -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
index f5055ee..70c0f45 100644
@@ -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
index 4a1cc54..6126b77 100644
@@ -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
index 3047886..eadaaea 100644
@@ -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
index 424b47a..50c841e 100644
@@ -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
index bbca758..70b17eb 100644
@@ -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
index 558bf7e..07fdd36 100644
@@ -60,7 +60,7 @@ typedef char * ( *rfp_t )( void *contextp, size_t wantedsz, size_t *szp, int *st
 typedef 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
index 1dacf35..238fcaf 100644
@@ -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 -15
index 5ef519c..f9866a5 100644
@@ -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 );
inventory/inv_fstab.c +29 -29

152 lines not on this page · raw message

inventory/inv_idx.c +64 -64

112 lines not on this page · raw message

inventory/inv_mgr.c +57 -57

114 lines not on this page · raw message

inventory/inv_oref.c +48 -48

96 lines not on this page · raw message

inventory/inv_oref.h +6 -6
index 38303a4..0061722 100644

Lines of this file are not shown. View the 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 -40

80 lines not on this page · raw message

invutil/fstab.c +3 -3
index 4284cd1..a4333ad 100644

Lines of this file are not shown. View the raw message.

invutil/invidx.c +25 -25

50 lines not on this page · raw message

invutil/invutil.c +28 -28

56 lines not on this page · raw message

invutil/menu.c +4 -4
index f81f9b6..81baa42 100644

Lines of this file are not shown. View the raw message.

invutil/screen.c +1 -1
index 6e913a7..5e478c9 100644

Lines of this file are not shown. View the raw message.

invutil/stobj.c +3 -3
index f389c53..582858f 100644

Lines of this file are not shown. View the raw message.

librmt/rmtioctl.c +17 -17
index bd6f887..edcd611 100644

Lines of this file are not shown. View the raw message.

librmt/rmtlib.h +1 -1
index 1f877ca..6373075 100644

Lines of this file are not shown. View the raw message.

restore/bag.c +1 -1
index 55bba73..dfe7aa5 100644

Lines of this file are not shown. View the raw message.

restore/content.c +55 -55

110 lines not on this page · raw message

restore/dirattr.c +2 -2
index 7a423ab..f057b78 100644

Lines of this file are not shown. View the raw message.

restore/inomap.c +1 -1
index fd55907..5f81897 100644

Lines of this file are not shown. View the raw message.

restore/namreg.c +2 -2
index 97e6524..8e7ff76 100644

Lines of this file are not shown. View the raw message.

restore/node.c +1 -1
index 92a21ce..b6b6906 100644

Lines of this file are not shown. View the 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.

Reviewed-by on v1 1/4
#4 lore raw

Re: [PATCH 1/4 RESEND] xfsdump: (style) remove trailing whitespaces

Quoted 19 lines · Jan Tulak

RESEND. It seems that I edited the patch file with an editor that stripped the blank spaces that should be stripped by the patch. Sorry. :-D Now I verified that the file contains the whitespaces before sending, so hopefully it will apply.

Jan

---

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.

Created by this script:

#!/usr/bin/env bash
# remove trailing whitespaces

Quoted 7 lines

find . -name '*.[ch]' ! -type d -exec bash -c '

sed -i \
    -e "s/\s*$//" \
    $0

' {} \;

# grep "^-" 1-4-RESEND-xfsdump-style-remove-trailing-whitespaces | grep -v "^---" |  grep -v " $" | grep -vP "\t$" 
#

looks legit ;)

Note, please put informational updates like your "RESEND" note /below/ the "---" in a patch, so they don't become part of the commit log (I'll edit this one out)

i.e.:

[ Normal commit log goes here]
[Signed off by etc goes at the end]
---
[informational info here, diffstat, version updates, etc] [actual patch follows]

-Eric

author
#5 lore raw

PATCH 2/4 xfsdump: do not split function call with ifdef

In reply to Jan Tulak

In two files in xfsdump, a function call is split in half by an ifdef macro to conditionally pick an argument at compile time. This causes the code to be a bit less obvious and some analysis tools have trouble with understanding it.

So, instead of splitting the function in half, move the whole function call into each of the ifdef macros.

---
 common/drive_minrmt.c | 3 ++-
 common/main.c         | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
common/drive_minrmt.c +2 -1
index 59a40a7..04fed3e 100644
@@ -2585,11 +2585,12 @@ read_label( drive_t *drivep )
 	if (( nread == 0 )  /* takes care of sun */
 	      ||            /* now handle SGI */
 	      (nread < 0 && saved_errno == ENOSPC )) {
-		mlog( MLOG_NORMAL | MLOG_DRIVE,
 #ifdef DUMP
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : assuming blank media\n") );
 #endif
 #ifdef RESTORE
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : end of data\n") );
 #endif
 		( void )rewind_and_verify( drivep );
common/main.c +6 -2
index b3605d1..0c23eb4 100644
@@ -581,12 +581,14 @@ main( int argc, char *argv[] )
 		sigaction( SIGTERM, &sa, NULL );
 		sigaction( SIGQUIT, &sa, NULL );
 
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
@@ -629,12 +631,14 @@ main( int argc, char *argv[] )
 	 * time-consuming chore. drive_init3 will synchronize with each slave.
 	 */
 	if ( ! init_error ) {
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
Signature · 1 line
2.19.1
Reviewed-by on v1 2/4
#6 lore raw

Re: [PATCH 2/4] xfsdump: do not split function call with ifdef

Quoted 9 lines · Jan Tulak

In two files in xfsdump, a function call is split in half by an ifdef macro to conditionally pick an argument at compile time. This causes the code to be a bit less obvious and some analysis tools have trouble with understanding it.

So, instead of splitting the function in half, move the whole function call into each of the ifdef macros.

It's still #ifdef hell, now with 0.05% less hell ;)

Quoted 60 lines
---
 common/drive_minrmt.c | 3 ++-
 common/main.c         | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
common/drive_minrmt.c +2 -1
index 59a40a7..04fed3e 100644
@@ -2585,11 +2585,12 @@ read_label( drive_t *drivep )
 	if (( nread == 0 )  /* takes care of sun */
 	      ||            /* now handle SGI */
 	      (nread < 0 && saved_errno == ENOSPC )) {
-		mlog( MLOG_NORMAL | MLOG_DRIVE,
 #ifdef DUMP
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : assuming blank media\n") );
 #endif
 #ifdef RESTORE
+		mlog( MLOG_NORMAL | MLOG_DRIVE,
 		      _("encountered EOD : end of data\n") );
 #endif
 		( void )rewind_and_verify( drivep );
common/main.c +6 -2
index b3605d1..0c23eb4 100644
@@ -581,12 +581,14 @@ main( int argc, char *argv[] )
 		sigaction( SIGTERM, &sa, NULL );
 		sigaction( SIGQUIT, &sa, NULL );
 
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
@@ -629,12 +631,14 @@ main( int argc, char *argv[] )
 	 * time-consuming chore. drive_init3 will synchronize with each slave.
 	 */
 	if ( ! init_error ) {
+#ifdef DUMP
 		ok = drive_init2( argc,
 				  argv,
-#ifdef DUMP
 				  gwhdrtemplatep );
 #endif /* DUMP */
 #ifdef RESTORE
+		ok = drive_init2( argc,
+				  argv,
 				  ( global_hdr_t * )0 );
 #endif /* RESTORE */
 		if ( ! ok ) {
author
#7 lore raw

PATCH 3/4 common/types.h: Wrap #define UUID_STR_LEN 36 in #ifndef

In reply to Jan Tulak

Current Fedora 28 has the constant it in uuid/uuid.h where it belongs (per comment next to the define), so we should treat the define as a backward-compatibility workaround, rather than enforcing it for all.

---
 common/types.h | 2 ++
 1 file changed, 2 insertions(+)
common/types.h +2 -0
index 50c841e..096c5b7 100644
@@ -35,7 +35,9 @@
 /*
  * Should be, but isn't, defined in uuid/uuid.h
  */
+#ifndef UUID_STR_LEN
 #define UUID_STR_LEN	36
+#endif
 
 /* fundamental page size - probably should not be hardwired, but
  * for now we will
Signature · 1 line
2.19.1
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] common/types.h: Wrap #define UUID_STR_LEN 36 in #ifndef

Quoted 5 lines · Jan Tulak

Current Fedora 28 has the constant it in uuid/uuid.h where it belongs (per comment next to the define), so we should treat the define as a backward-compatibility workaround, rather than enforcing it for all.

so I think the comment can use an update too, but I'll just do that on checkin:

- * Should be, but isn't, defined in uuid/uuid.h
+ * If not defined in uuid/uuid.h

[sandeen: tweak comment to match]
Quoted 19 lines
---
 common/types.h | 2 ++
 1 file changed, 2 insertions(+)
common/types.h +2 -0
index 50c841e..096c5b7 100644
@@ -35,7 +35,9 @@
 /*
  * Should be, but isn't, defined in uuid/uuid.h
  */
+#ifndef UUID_STR_LEN
 #define UUID_STR_LEN	36
+#endif
 
 /* fundamental page size - probably should not be hardwired, but
  * for now we will
author
#9 lore raw

PATCH 4/4 common/drive.c: include stdlib.h

In reply to Jan Tulak

We are using calloc() inside of this file, but it is not included in any way (resultin in "implicit declaration" warnings from the compiler). So, add the include.

---
 common/drive.c | 1 +
 1 file changed, 1 insertion(+)
common/drive.c +1 -0
index 4b0825f..edb63c0 100644
@@ -17,6 +17,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
Signature · 1 line
2.19.1
Reviewed-by on v1 4/4
#10 lore raw

Re: [PATCH 4/4] common/drive.c: include stdlib.h

Quoted 14 lines · Jan Tulak

We are using calloc() inside of this file, but it is not included in any way (resultin in "implicit declaration" warnings from the compiler). So, add the include.

---
 common/drive.c | 1 +
 1 file changed, 1 insertion(+)
common/drive.c +0 -0
index 4b0825f..edb63c0 100644

common/drive.c line 23

Quoted 7 lines
common/drive.c +1 -0
@@ -17,6 +17,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>

Seems fine, but why don't these files complain too?

# find . -name \*.c | xargs grep -lw calloc | xargs grep -L stdlib.h

./inventory/inv_oref.c
./inventory/inv_core.c
./inventory/inv_mgr.c
./inventory/testmain.c
(ok, narrator: because they aren't built?)

./common/global.c
./common/fs.c

*shrug*

If it fixes a warning I'm not going dig too much, seems fine.

Thanks,
-Eric