Skip to contentSkip to conversation

xfsdump: Ouchie! My bleeding eyes!

PATCH In review Dave Chinner 2 participants 17 messages Oct 16, 2015 – Oct 30, 2015 Arm STM32

lore
Share & tools
lore
#0 lore raw

cover xfsdump: Ouchie! My bleeding eyes!

Hi folks,

Turns out that changes to exported XFS headers in xfsprogs v4.2.0 broke the xfsdump build. the XFS dump build was implicitly including the platform definitions calculated for the xfsprogs build and so removing them from the xfsprogs headers made xfsdump very unhappy.

I've spend the last couple of days dripping blood from my eyeballs all over my keyboard trying to clean up the mess a bit. This patch set fixes the build issue and tries to minimise the amount of XFS header inclusion across the xfsdump code base.

To this end:

1. remove xfsdump's use of ASSERT because the definition in the XFs headers overrode everything else. So the first patch is a global s/ASSERT/assert/, #include <assert.h> change.

2. fix the build issues. With the assert conflict out of the way, patch 2 includes all the bits xfsdump really needed from the xfsprogs platform defs. This is added to the include/config.h.in file, and this is then included across the code base.

3. xfs/jdm.h does "typedef int intgen_t;" for it's API. xfsdump uses it *everywhere* (~900 instances across the code base), yet everywhere it is used an "int" will sufficient and there's only a handful of jdm_* API calls anyway. Patch 3 is therefore s/intgen_t/int/g

4. why use uint*_t when you can use a random mix of types? Patch 4 is therefore s/u_int/uint/g

5. xfs_ino_t. Always going to be uint64_t. Use a local definition, not pull all of XFS into all of xfsdump just for a single typedef (patch 5).

6. Use <uuid/uuid.h>, not whatever hacked up uuid interface that you get from the XFS headers, which is not then used correctly because nothing uses the "platform_uuid_*()" abstraction the XFS headers provide. Clearly, xfsdump has only *ever* been compiled on Linux, as the build will break on BSD based platforms like Irix and FreeBSD. xfsdump is a Linux only source tree right now....

7. Yeah, lets put random stuff in a header file that is included all over the place that requires the XFS headers to be included. Patch 7 pulls out the bits used by logging/reporting and puts them in the logging/reporting source files.

8. Kill as many <xfs/xfs.h> and <xfs/jdm.h> includes as possible. Most of the files including them are now just missing system header includes and no longer need util.h, so patch 8 cleans up all that mess.

So, now the code base is a little bit cleaner, a lot less dependent on the xfsprogs header files, compiles cleanly on xfsprogs 3.2.x and 4.x releases, can easily have asserts build in or excluded (distro packages need to use "export DEBUG=-DNDEBUG" to exclude asserts), passes xfstests with asserts enabled and disabled, and best of all the source code is a little less eye-bleedy.

I really don't expect anyone to review this closely - it's *huge* chunk of boring search/replace change:

 94 files changed, 2929 insertions(+), 2652 deletions(-)

but I would like people to comment on/ack the approach I've taken here. If nobody objects/cares, I'll then do a 3.1.6 release early next week....

-Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH 1/8 cleanup: get rid of ASSERT

From: Dave Chinner <[email protected]>

ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op.

Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled.

---
 common/arch_xlate.c     |   1 +
 common/cldmgr.c         |   3 +-
 common/cleanup.c        |   7 +-
 common/content_common.c |  13 +-
 common/content_inode.h  |   4 +-
 common/dlog.c           |  13 +-
 common/drive.c          |  17 ++-
 common/drive_minrmt.c   | 369 ++++++++++++++++++++++-----------------------
 common/drive_scsitape.c | 389 ++++++++++++++++++++++++------------------------
 common/drive_simple.c   | 151 +++++++++----------
 common/fs.c             |  23 +--
 common/global.c         |  13 +-
 common/hsmapi.c         |   1 +
 common/inventory.c      |  33 ++--
 common/lock.c           |   3 +-
 common/main.c           |  99 ++++++------
 common/media.c          |  21 +--
 common/mlog.c           |  21 +--
 common/openutil.c       |   3 +-
 common/path.c           |  25 ++--
 common/qlock.c          |  29 ++--
 common/ring.c           |  65 ++++----
 common/stream.c         |  15 +-
 common/util.c           |  41 ++---
 dump/content.c          | 239 ++++++++++++++---------------
 dump/inomap.c           |  19 +--
 inventory/inv_api.c     |  33 ++--
 inventory/inv_core.c    |   7 +-
 inventory/inv_files.c   |   9 +-
 inventory/inv_fstab.c   |   5 +-
 inventory/inv_idx.c     |  11 +-
 inventory/inv_mgr.c     |   7 +-
 inventory/inv_oref.c    |  51 +++----
 inventory/inv_oref.h    |  24 +--
 inventory/inv_stobj.c   |  23 +--
 inventory/testmain.c    |  25 ++--
 librmt/rmtioctl.c       |   1 +
 restore/bag.c           |  19 +--
 restore/content.c       | 309 +++++++++++++++++++-------------------
 restore/dirattr.c       | 113 +++++++-------
 restore/inomap.c        |  25 ++--
 restore/namreg.c        |  39 ++---
 restore/node.c          |  79 +++++-----
 restore/tree.c          | 219 +++++++++++++--------------
 restore/win.c           |  65 ++++----
 45 files changed, 1362 insertions(+), 1319 deletions(-)
common/arch_xlate.c +1 -0
index bafc1a6..e6f897e 100644
@@ -18,6 +18,7 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "arch_xlate.h"
 #include "types.h"
common/cldmgr.c +2 -1
index be7de34..df33a3f 100644
@@ -25,6 +25,7 @@
 #include <sys/prctl.h>
 #include <errno.h>
 #include <pthread.h>
+#include <assert.h>
 
 #include "exit.h"
 #include "types.h"
@@ -79,7 +80,7 @@ cldmgr_create( int ( * entry )( void *arg1 ),
 	cld_t *cldp;
 	intgen_t rval;
 
-	ASSERT( pthread_equal( pthread_self( ), cldmgr_parenttid ) );
+	assert( pthread_equal( pthread_self( ), cldmgr_parenttid ) );
 
 	cldp = cldmgr_getcld( );
 	if ( ! cldp ) {
common/cleanup.c +4 -3
index 42e8750..523f164 100644
@@ -17,6 +17,7 @@
  */
 
 #include <stdlib.h>
+#include <assert.h>
 
 #include "cleanup.h"
 
@@ -51,7 +52,7 @@ cleanup_register_base( void ( * funcp )( void *arg1, void *arg2 ),
 	cu_t *p;
 
 	p = ( cu_t * )calloc( 1, sizeof( cu_t ));
-	ASSERT( p );
+	assert( p );
 	p->cu_funcp = funcp;
 	p->cu_arg1 = arg1;
 	p->cu_arg2 = arg2;
@@ -94,7 +95,7 @@ cleanup_cancel( cleanup_t *cleanupp )
 	cu_t *nextp;
 	cu_t *prevp;
 
-	ASSERT( cu_rootp );
+	assert( cu_rootp );
 
 	for ( prevp = 0, nextp = cu_rootp
 	      ;
@@ -103,7 +104,7 @@ cleanup_cancel( cleanup_t *cleanupp )
 	      prevp = nextp, nextp = nextp->cu_nextp )
 	;
 
-	ASSERT( nextp );
+	assert( nextp );
 	if ( prevp ) {
 		prevp->cu_nextp = p->cu_nextp;
 	} else {
common/content_common.c +7 -6
index 993ddae..65be31f 100644
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -66,7 +67,7 @@ retry:
 	preamblestr[ preamblecnt++ ] = "\n";
 	preamblestr[ preamblecnt++ ] = fold;
 	preamblestr[ preamblecnt++ ] = "\n\n";
-	ASSERT( preamblecnt <= PREAMBLEMAX );
+	assert( preamblecnt <= PREAMBLEMAX );
 	dlog_begin( preamblestr, preamblecnt );
 
 	/* query: ask if media changed or declined
@@ -77,13 +78,13 @@ retry:
 		 (unsigned int)drivep->d_index );
 	querycnt = 0;
 	querystr[ querycnt++ ] = question;
-	ASSERT( querycnt <= QUERYMAX );
+	assert( querycnt <= QUERYMAX );
 	choicecnt = 0;
 	dontix = choicecnt;
 	choicestr[ choicecnt++ ] = _("media change declined");
 	doix = choicecnt;
 	choicestr[ choicecnt++ ] = _("media changed");
-	ASSERT( choicecnt <= CHOICEMAX );
+	assert( choicecnt <= CHOICEMAX );
 	sigintix = IXMAX - 1;
 
 	responseix = dlog_multi_query( querystr,
@@ -105,11 +106,11 @@ retry:
 	} else if ( responseix == dontix ) {
 		ackstr[ ackcnt++ ] = _("media change aborted\n");
 	} else {
-		ASSERT( responseix == sigintix );
+		assert( responseix == sigintix );
 		ackstr[ ackcnt++ ] = _("keyboard interrupt\n");
 	}
 
-	ASSERT( ackcnt <= ACKMAX );
+	assert( ackcnt <= ACKMAX );
 	dlog_multi_ack( ackstr,
 			ackcnt );
 
@@ -118,7 +119,7 @@ retry:
 	postamblestr[ postamblecnt++ ] = "\n";
 	postamblestr[ postamblecnt++ ] = fold;
 	postamblestr[ postamblecnt++ ] = "\n\n";
-	ASSERT( postamblecnt <= POSTAMBLEMAX );
+	assert( postamblecnt <= POSTAMBLEMAX );
 	dlog_end( postamblestr,
 		  postamblecnt );
 
common/content_inode.h +2 -2
index 8f0390c..9013ca4 100644
@@ -389,7 +389,7 @@ calc_checksum(void *bufp, size_t len)
 	u_int32_t sum = 0;
 	u_int32_t *sump = bufp;
 	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	ASSERT(len % sizeof(u_int32_t) == 0);
+	assert(len % sizeof(u_int32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return ~sum + 1;
@@ -401,7 +401,7 @@ is_checksum_valid(void *bufp, size_t len)
 	u_int32_t sum = 0;
 	u_int32_t *sump = bufp;
 	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	ASSERT(len % sizeof(u_int32_t) == 0);
+	assert(len % sizeof(u_int32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return sum == 0 ? BOOL_TRUE : BOOL_FALSE;
common/dlog.c +7 -6
index ac0cafc..6220cfe 100644
@@ -26,6 +26,7 @@
 #include <time.h>
 #include <errno.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "types.h"
 #include "mlog.h"
@@ -57,7 +58,7 @@ dlog_init( int argc, char *argv[ ] )
 
 	/* can only call once
 	 */
-	ASSERT( dlog_ttyfd == -1 );
+	assert( dlog_ttyfd == -1 );
 
 	/* initially allow dialog, use stdin fd
 	 */
@@ -104,7 +105,7 @@ dlog_init( int argc, char *argv[ ] )
 		struct stat statbuf;
 		int rval;
 
-		ASSERT( dlog_ttyfd >= 0 );
+		assert( dlog_ttyfd >= 0 );
 		rval = fstat( dlog_ttyfd, &statbuf );
 		if ( rval ) {
 			mlog( MLOG_VERBOSE | MLOG_WARNING,
@@ -186,7 +187,7 @@ dlog_multi_query( char *querystr[ ],
 
 	/* sanity
 	 */
-	ASSERT( dlog_allowed_flag );
+	assert( dlog_allowed_flag );
 
 	/* display query description strings
 	 */
@@ -295,7 +296,7 @@ dlog_string_query( dlog_ucbp_t ucb, /* user's print func */
 
 	/* sanity
 	 */
-	ASSERT( dlog_allowed_flag );
+	assert( dlog_allowed_flag );
 
 	/* call the caller's callback with his context, print context, and
 	 * print operator
@@ -359,7 +360,7 @@ dlog_string_query_print( void *ctxp, char *fmt, ... )
 {
 	va_list args;
 
-	ASSERT( ! ctxp );
+	assert( ! ctxp );
 
 	va_start( args, fmt );
 	mlog_va( MLOG_NORMAL | MLOG_NOLOCK | MLOG_BARE, fmt, args );
@@ -510,7 +511,7 @@ promptinput( char *buf,
 		}
 		return BOOL_FALSE;
 	} else {
-		ASSERT( dlog_signo_received == -1 );
+		assert( dlog_signo_received == -1 );
 		*exceptionixp = 0;
 		return BOOL_TRUE;
 	}
common/drive.c +9 -8
index 32a7191..f9ba851 100644
@@ -21,6 +21,7 @@
 
 #include <sys/stat.h>
 #include <time.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -88,7 +89,7 @@ drive_init1( int argc, char *argv[ ] )
 
 	/* sanity check asserts
 	 */
-	ASSERT( sizeof( drive_hdr_t ) == DRIVE_HDR_SZ );
+	assert( sizeof( drive_hdr_t ) == DRIVE_HDR_SZ );
 
 	/* count drive arguments
 	 */
@@ -107,7 +108,7 @@ drive_init1( int argc, char *argv[ ] )
 	 */
 	if (drivecnt > 0) {
 		drivepp = ( drive_t ** )calloc( drivecnt, sizeof( drive_t * ));
-		ASSERT( drivepp );
+		assert( drivepp );
 	}
 
 	/* initialize the partialmax value.  Each drive can be completing a file
@@ -142,7 +143,7 @@ drive_init1( int argc, char *argv[ ] )
 			break;
 		}
 	}
-	ASSERT( driveix == drivecnt );
+	assert( driveix == drivecnt );
 
 	/* the user may specify stdin as the source, by
 	 * a single dash ('-') with no option letter. This must appear
@@ -169,7 +170,7 @@ drive_init1( int argc, char *argv[ ] )
 		 * allocate an array to hold ptrs to drive descriptors
 		 */
 		drivepp = ( drive_t ** )calloc( drivecnt, sizeof( drive_t * ));
-		ASSERT( drivepp );
+		assert( drivepp );
 
 		drivepp[ 0 ] = drive_alloc( "stdio", 0 );
 
@@ -215,7 +216,7 @@ drive_init1( int argc, char *argv[ ] )
 				bestscore = score;
 			}
 		}
-		ASSERT( bestsp );
+		assert( bestsp );
 		drivep->d_strategyp = bestsp;
 		drivep->d_recmarksep = bestsp->ds_recmarksep;
 		drivep->d_recmfilesz = bestsp->ds_recmfilesz;
@@ -356,7 +357,7 @@ drive_alloc( char *pathname, ix_t driveix )
 	/* allocate the descriptor
 	 */
 	drivep = ( drive_t * )calloc( 1, sizeof( drive_t ));
-	ASSERT( drivep );
+	assert( drivep );
 
 	/* convert the pathname to an absolute pathname
 	 * NOTE: string "stdio" is reserved to mean send to standard out
@@ -397,7 +398,7 @@ drive_allochdrs( drive_t *drivep, global_hdr_t *gwhdrtemplatep, ix_t driveix )
 	/* allocate the read header
 	 */
 	grhdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-	ASSERT( grhdrp );
+	assert( grhdrp );
 	gwhdrp = NULL;
 	dwhdrp = NULL;
 
@@ -411,7 +412,7 @@ drive_allochdrs( drive_t *drivep, global_hdr_t *gwhdrtemplatep, ix_t driveix )
 		/* allocate the write header
 		 */
 		gwhdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-		ASSERT( gwhdrp );
+		assert( gwhdrp );
 
 		/* copy the template
 		 */
common/drive_minrmt.c +185 -184

928 lines not on this page · raw message

common/drive_scsitape.c +195 -194

981 lines not on this page · raw message

common/drive_simple.c +76 -75

393 lines not on this page · raw message

common/fs.c +12 -11
index 6f4cb6c..b77f6cc 100644
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <mntent.h>
 #include <sys/ioctl.h>
+#include <assert.h>
 
 #include "types.h"
 #include "mlog.h"
@@ -127,11 +128,11 @@ fs_info( char *typb,		/* out */
 	if ( canstat && ( statb.st_mode & S_IFMT ) == S_IFBLK ) {
 		if ( ( tep = fs_tab_lookup_blk( usrs )) != 0 ) {
 			blks = tep->fte_blks;
-			ASSERT( strlen( blks ) < ( size_t )blkbz );
+			assert( strlen( blks ) < ( size_t )blkbz );
 			strcpy( blkb, blks );
 			mnts = tep->fte_mnts;
 			if ( mnts ) {
-				ASSERT( strlen( mnts ) < ( size_t )mntbz );
+				assert( strlen( mnts ) < ( size_t )mntbz );
 				strcpy( mntb, mnts );
 			} else {
 				mntb[ 0 ] = 0;
@@ -139,7 +140,7 @@ fs_info( char *typb,		/* out */
 			if ( ( typs = tep->fte_typs ) == 0 ) {
 				typs = typd;
 			}
-			ASSERT( strlen( typs ) < ( size_t )typbz );
+			assert( strlen( typs ) < ( size_t )typbz );
 			strcpy( typb, typs );
 			ok = BOOL_TRUE;
 		} else {
@@ -147,13 +148,13 @@ fs_info( char *typb,		/* out */
 		}
 	} else if ( ( tep = fs_tab_lookup_mnt( usrs )) != 0 ) {
 		blks = tep->fte_blks;
-		ASSERT( strlen( blks ) < ( size_t )blkbz );
+		assert( strlen( blks ) < ( size_t )blkbz );
 		strcpy( blkb, blks );
 		mnts = tep->fte_mnts;
-		ASSERT( strlen( mnts ) < ( size_t )mntbz );
+		assert( strlen( mnts ) < ( size_t )mntbz );
 		strcpy( mntb, mnts );
 		typs = tep->fte_typs;
-		ASSERT( strlen( typs ) < ( size_t )typbz );
+		assert( strlen( typs ) < ( size_t )typbz );
 		strcpy( typb, typs );
 		ok = BOOL_TRUE;
 	} else {
@@ -161,7 +162,7 @@ fs_info( char *typb,		/* out */
 	}
 
 	fs_tab_free( );
-	ASSERT( ok != BOOL_UNKNOWN );
+	assert( ok != BOOL_UNKNOWN );
 
 	if ( ok == BOOL_TRUE ) {
 		intgen_t rval = fs_getid( mntb, idb );
@@ -281,11 +282,11 @@ fs_tab_ent_build( struct mntent *mntentp )
 	char *cp;
 
 	tep = ( fs_tab_ent_t * )calloc( 1, sizeof( fs_tab_ent_t ));
-	ASSERT( tep );
+	assert( tep );
 
 	if ( mntentp->mnt_dir ) {
 		cp = calloc( 1, strlen( mntentp->mnt_dir ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_dir );
 		tep->fte_mnts = cp;
 	} else {
@@ -294,7 +295,7 @@ fs_tab_ent_build( struct mntent *mntentp )
 
 	if ( mntentp->mnt_type ) {
 		cp = calloc( 1, strlen( mntentp->mnt_type ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_type );
 		tep->fte_typs = cp;
 	} else {
@@ -303,7 +304,7 @@ fs_tab_ent_build( struct mntent *mntentp )
 
 	if ( mntentp->mnt_fsname ) {
 		cp = calloc( 1, strlen( mntentp->mnt_fsname ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_fsname );
 		tep->fte_blks = cp;
 	} else {
common/global.c +7 -6
index 8e49d8b..ed844cc 100644
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <errno.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -67,13 +68,13 @@ global_hdr_alloc( intgen_t argc, char *argv[ ] )
 
 	/* sanity checks
 	 */
-	ASSERT( sizeof( time32_t ) == GLOBAL_HDR_TIME_SZ );
-	ASSERT( sizeof( uuid_t ) == GLOBAL_HDR_UUID_SZ );
+	assert( sizeof( time32_t ) == GLOBAL_HDR_TIME_SZ );
+	assert( sizeof( uuid_t ) == GLOBAL_HDR_UUID_SZ );
 
 	/* allocate a global hdr
 	 */
 	ghdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-	ASSERT( ghdrp );
+	assert( ghdrp );
 
 	/* fill in the magic number
 	 */
@@ -326,7 +327,7 @@ prompt_label( char *bufp, size_t bufsz )
 	preamblestr[ preamblecnt++ ] = "\n";
 	preamblestr[ preamblecnt++ ] = fold;
 	preamblestr[ preamblecnt++ ] = "\n\n";
-	ASSERT( preamblecnt <= PREAMBLEMAX );
+	assert( preamblecnt <= PREAMBLEMAX );
 	dlog_begin( preamblestr, preamblecnt );
 
 	responseix = dlog_string_query( prompt_label_cb,
@@ -348,7 +349,7 @@ prompt_label( char *bufp, size_t bufsz )
 		ackstr[ ackcnt++ ] = _("session label left blank\n");
 	}
 
-	ASSERT( ackcnt <= ACKMAX );
+	assert( ackcnt <= ACKMAX );
 	dlog_string_ack( ackstr,
 			 ackcnt );
 
@@ -357,7 +358,7 @@ prompt_label( char *bufp, size_t bufsz )
 	postamblestr[ postamblecnt++ ] = "\n";
 	postamblestr[ postamblecnt++ ] = fold;
 	postamblestr[ postamblecnt++ ] = "\n\n";
-	ASSERT( postamblecnt <= POSTAMBLEMAX );
+	assert( postamblecnt <= POSTAMBLEMAX );
 	dlog_end( postamblestr,
 		  postamblecnt );
 
common/hsmapi.c +1 -0
index 7f9b45e..0bca9ff 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <attr/attributes.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "hsmapi.h"
 #include "mlog.h"
common/inventory.c +17 -16
index fb27048..681d28f 100644
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <assert.h>
 
 #include "types.h"
 #include "inventory_priv.h"
@@ -51,7 +52,7 @@ inv_open( inv_predicate_t bywhat, void *pred )
 	
 	int index = 0;
 	
-	ASSERT ( pred );
+	assert ( pred );
 	if ((fd = init_idb ( pred, bywhat, uuname, &tok )) < 0 )
 		return tok;
 
@@ -66,7 +67,7 @@ inv_open( inv_predicate_t bywhat, void *pred )
 		return INV_TOKEN_NULL;
 	}
 
-	ASSERT ( index > 0 );
+	assert ( index > 0 );
 
 	/* Now we need to make sure that this has enough space */
 	num = GET_SESCOUNTERS( stobjfd, &sescnt );
@@ -145,7 +146,7 @@ inv_lasttime_level_lessthan(
 	time32_t **tm )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	rval =  search_invt( tok, level, (void **) tm,
 			 (search_callback_t) tm_level_lessthan );
@@ -170,7 +171,7 @@ inv_lastsession_level_lessthan(
 	inv_session_t 	**ses )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	rval = search_invt( tok, level, (void **) ses, 
 			  (search_callback_t) lastsess_level_lessthan );
@@ -197,7 +198,7 @@ inv_lastsession_level_equalto(
 	inv_session_t	**ses )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 	rval = search_invt( tok, level, (void **) ses, 
 			  (search_callback_t) lastsess_level_equalto );
 
@@ -236,8 +237,8 @@ inv_writesession_open(
 	invt_seshdr_t  	hdr;
 	inv_sestoken_t	sestok;
 
-	ASSERT ( tok != INV_TOKEN_NULL );
-	ASSERT ( sesid && fsid && mntpt && devpath );
+	assert ( tok != INV_TOKEN_NULL );
+	assert ( sesid && fsid && mntpt && devpath );
 
 	if ( ! ( tok->d_update_flag & FSTAB_UPDATED ) ) {
 		if ( put_fstab_entry( fsid, mntpt, devpath ) < 0 ) {
@@ -264,7 +265,7 @@ inv_writesession_open(
 
 	fd = tok->d_stobj_fd;
 	
-	ASSERT ( fd > 0 );
+	assert ( fd > 0 );
 
 	hdr.sh_time = time;
 	hdr.sh_level = level;	
@@ -286,7 +287,7 @@ inv_writesession_open(
 	/* create the writesession, and get ready for the streams to come 
 	   afterwards */
 	rval = create_session( sestok, fd, sescnt, ses, &hdr );
-	ASSERT (rval > 0);
+	assert (rval > 0);
 
 
 	INVLOCK( fd, LOCK_UN );
@@ -324,7 +325,7 @@ inv_writesession_close( inv_sestoken_t tok )
 {
 	int		rval;
 	
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	/* now update end_time in the inv index header */
 	rval = put_sesstime( tok, INVT_ENDTIME );
@@ -354,7 +355,7 @@ inv_stream_open(
 	invt_seshdr_t  seshdr;
 	int fd;
 
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 	 
 	stream.st_nmediafiles = 0;
 	stream.st_interrupted = BOOL_FALSE;
@@ -505,9 +506,9 @@ inv_put_mediafile(
 	int 		 rval;
 
 
-	ASSERT ( tok != INV_TOKEN_NULL );
-	ASSERT ( tok->md_sesstok->sd_invtok->d_update_flag & FSTAB_UPDATED );
-	ASSERT ( tok->md_sesstok->sd_invtok->d_stobj_fd >= 0 );
+	assert ( tok != INV_TOKEN_NULL );
+	assert ( tok->md_sesstok->sd_invtok->d_update_flag & FSTAB_UPDATED );
+	assert ( tok->md_sesstok->sd_invtok->d_stobj_fd >= 0 );
 
 	mf = (invt_mediafile_t *) calloc( 1, sizeof( invt_mediafile_t ) );
 	
@@ -627,8 +628,8 @@ inv_get_session(
 	void		      **bufpp,	/* buf to fill */
 	size_t		       *bufszp )/* size of that buffer */
 {
-	ASSERT( tok != INV_TOKEN_NULL );
-	ASSERT( tok->sd_invtok );
+	assert( tok != INV_TOKEN_NULL );
+	assert( tok->sd_invtok );
 
 	/* First get the session header, and the session information. Then
 	   we can figure out how much space to allocate */
common/lock.c +2 -1
index ab5b210..347f6cd 100644
@@ -18,6 +18,7 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "types.h"
 #include "qlock.h"
@@ -30,7 +31,7 @@ lock_init( void )
 {
 	/* initialization sanity checks
 	 */
-	ASSERT( lock_qlockh == QLOCKH_NULL );
+	assert( lock_qlockh == QLOCKH_NULL );
 
 	/* allocate a qlock
 	 */
common/main.c +50 -49

191 lines not on this page · raw message

common/media.c +11 -10
index 4ad7776..53b94d1 100644

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

common/mlog.c +11 -10
index b0135b9..c546036 100644

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

common/openutil.c +2 -1
index 9a88d67..c3b8d9a 100644

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

common/path.c +13 -12
index ca24f6a..e40c473 100644

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

common/qlock.c +15 -14
index ae8466d..d88917c 100644

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

common/ring.c +33 -32

65 lines not on this page · raw message

common/stream.c +8 -7
index 6704661..0db1be3 100644

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

common/util.c +21 -20

41 lines not on this page · raw message

dump/content.c +120 -119

239 lines not on this page · raw message

dump/inomap.c +10 -9
index a35059a..7a3069f 100644

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

inventory/inv_api.c +17 -16
index 65102e6..bd473e9 100644

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

inventory/inv_core.c +4 -3
index 3f7edb6..a83e7ef 100644

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

inventory/inv_files.c +5 -4
index f77eeec..34b7aac 100644

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

inventory/inv_fstab.c +3 -2
index 6567846..e87152f 100644

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

inventory/inv_idx.c +6 -5
index 145745a..edb72b3 100644

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

inventory/inv_mgr.c +4 -3
index 1f4a425..926b4c8 100644

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

inventory/inv_oref.c +26 -25

51 lines not on this page · raw message

inventory/inv_oref.h +12 -12
index 5f4ed68..2562500 100644

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

inventory/inv_stobj.c +12 -11
index becac17..42969b1 100644

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

inventory/testmain.c +13 -12
index cfd0654..d8c61e2 100644

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

librmt/rmtioctl.c +1 -0
index c49e96d..4c108fb 100644

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

restore/bag.c +10 -9
index b7d8fe2..8c7a216 100644

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

restore/content.c +155 -154

309 lines not on this page · raw message

restore/dirattr.c +57 -56

113 lines not on this page · raw message

restore/inomap.c +13 -12
index 562492e..2c62afc 100644

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

restore/namreg.c +20 -19
index 41362d1..c64833d 100644

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

restore/node.c +40 -39

79 lines not on this page · raw message

restore/tree.c +110 -109

219 lines not on this page · raw message

restore/win.c +33 -32

65 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

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

#2 lore raw

Re: [PATCH 1/8] cleanup: get rid of ASSERT

Quoted 9 lines · Dave Chinner

From: Dave Chinner <[email protected]>

ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op.

Quoted 6 lines

Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled.

---

My initial concern when reading this was that asserts were now unconditionally enabled. According to the man page, assert() is enabled unless NDEBUG is defined at include time. The debian builder apparently does this, but is this standard for other such utils?

That aside, this seems like an inconsistent approach from our other tools. For example, the debian/rules from xfsprogs does the same thing, yet DEBUG must be defined to enable asserts in the first place. If the problem is that asserts cannot be enabled, I'm wondering why the appropriate fix isn't to define DEBUG somewhere for debug-enabled builds rather than unconditionally convert all of the ASSERT() calls into actual assert()'s..? We do actually have a bunch of '#ifdef DEBUG' code throughout xfsdump (and DEBUG appears in 'configure' as well, though I have no idea if that actually does anything)...

Brian

Quoted 9,136 lines
 common/arch_xlate.c     |   1 +
 common/cldmgr.c         |   3 +-
 common/cleanup.c        |   7 +-
 common/content_common.c |  13 +-
 common/content_inode.h  |   4 +-
 common/dlog.c           |  13 +-
 common/drive.c          |  17 ++-
 common/drive_minrmt.c   | 369 ++++++++++++++++++++++-----------------------
 common/drive_scsitape.c | 389 ++++++++++++++++++++++++------------------------
 common/drive_simple.c   | 151 +++++++++----------
 common/fs.c             |  23 +--
 common/global.c         |  13 +-
 common/hsmapi.c         |   1 +
 common/inventory.c      |  33 ++--
 common/lock.c           |   3 +-
 common/main.c           |  99 ++++++------
 common/media.c          |  21 +--
 common/mlog.c           |  21 +--
 common/openutil.c       |   3 +-
 common/path.c           |  25 ++--
 common/qlock.c          |  29 ++--
 common/ring.c           |  65 ++++----
 common/stream.c         |  15 +-
 common/util.c           |  41 ++---
 dump/content.c          | 239 ++++++++++++++---------------
 dump/inomap.c           |  19 +--
 inventory/inv_api.c     |  33 ++--
 inventory/inv_core.c    |   7 +-
 inventory/inv_files.c   |   9 +-
 inventory/inv_fstab.c   |   5 +-
 inventory/inv_idx.c     |  11 +-
 inventory/inv_mgr.c     |   7 +-
 inventory/inv_oref.c    |  51 +++----
 inventory/inv_oref.h    |  24 +--
 inventory/inv_stobj.c   |  23 +--
 inventory/testmain.c    |  25 ++--
 librmt/rmtioctl.c       |   1 +
 restore/bag.c           |  19 +--
 restore/content.c       | 309 +++++++++++++++++++-------------------
 restore/dirattr.c       | 113 +++++++-------
 restore/inomap.c        |  25 ++--
 restore/namreg.c        |  39 ++---
 restore/node.c          |  79 +++++-----
 restore/tree.c          | 219 +++++++++++++--------------
 restore/win.c           |  65 ++++----
 45 files changed, 1362 insertions(+), 1319 deletions(-)
common/arch_xlate.c +1 -0
index bafc1a6..e6f897e 100644
@@ -18,6 +18,7 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "arch_xlate.h"
 #include "types.h"
common/cldmgr.c +2 -1
index be7de34..df33a3f 100644
@@ -25,6 +25,7 @@
 #include <sys/prctl.h>
 #include <errno.h>
 #include <pthread.h>
+#include <assert.h>
 
 #include "exit.h"
 #include "types.h"
@@ -79,7 +80,7 @@ cldmgr_create( int ( * entry )( void *arg1 ),
 	cld_t *cldp;
 	intgen_t rval;
 
-	ASSERT( pthread_equal( pthread_self( ), cldmgr_parenttid ) );
+	assert( pthread_equal( pthread_self( ), cldmgr_parenttid ) );
 
 	cldp = cldmgr_getcld( );
 	if ( ! cldp ) {
common/cleanup.c +4 -3
index 42e8750..523f164 100644
@@ -17,6 +17,7 @@
  */
 
 #include <stdlib.h>
+#include <assert.h>
 
 #include "cleanup.h"
 
@@ -51,7 +52,7 @@ cleanup_register_base( void ( * funcp )( void *arg1, void *arg2 ),
 	cu_t *p;
 
 	p = ( cu_t * )calloc( 1, sizeof( cu_t ));
-	ASSERT( p );
+	assert( p );
 	p->cu_funcp = funcp;
 	p->cu_arg1 = arg1;
 	p->cu_arg2 = arg2;
@@ -94,7 +95,7 @@ cleanup_cancel( cleanup_t *cleanupp )
 	cu_t *nextp;
 	cu_t *prevp;
 
-	ASSERT( cu_rootp );
+	assert( cu_rootp );
 
 	for ( prevp = 0, nextp = cu_rootp
 	      ;
@@ -103,7 +104,7 @@ cleanup_cancel( cleanup_t *cleanupp )
 	      prevp = nextp, nextp = nextp->cu_nextp )
 	;
 
-	ASSERT( nextp );
+	assert( nextp );
 	if ( prevp ) {
 		prevp->cu_nextp = p->cu_nextp;
 	} else {
common/content_common.c +7 -6
index 993ddae..65be31f 100644
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -66,7 +67,7 @@ retry:
 	preamblestr[ preamblecnt++ ] = "\n";
 	preamblestr[ preamblecnt++ ] = fold;
 	preamblestr[ preamblecnt++ ] = "\n\n";
-	ASSERT( preamblecnt <= PREAMBLEMAX );
+	assert( preamblecnt <= PREAMBLEMAX );
 	dlog_begin( preamblestr, preamblecnt );
 
 	/* query: ask if media changed or declined
@@ -77,13 +78,13 @@ retry:
 		 (unsigned int)drivep->d_index );
 	querycnt = 0;
 	querystr[ querycnt++ ] = question;
-	ASSERT( querycnt <= QUERYMAX );
+	assert( querycnt <= QUERYMAX );
 	choicecnt = 0;
 	dontix = choicecnt;
 	choicestr[ choicecnt++ ] = _("media change declined");
 	doix = choicecnt;
 	choicestr[ choicecnt++ ] = _("media changed");
-	ASSERT( choicecnt <= CHOICEMAX );
+	assert( choicecnt <= CHOICEMAX );
 	sigintix = IXMAX - 1;
 
 	responseix = dlog_multi_query( querystr,
@@ -105,11 +106,11 @@ retry:
 	} else if ( responseix == dontix ) {
 		ackstr[ ackcnt++ ] = _("media change aborted\n");
 	} else {
-		ASSERT( responseix == sigintix );
+		assert( responseix == sigintix );
 		ackstr[ ackcnt++ ] = _("keyboard interrupt\n");
 	}
 
-	ASSERT( ackcnt <= ACKMAX );
+	assert( ackcnt <= ACKMAX );
 	dlog_multi_ack( ackstr,
 			ackcnt );
 
@@ -118,7 +119,7 @@ retry:
 	postamblestr[ postamblecnt++ ] = "\n";
 	postamblestr[ postamblecnt++ ] = fold;
 	postamblestr[ postamblecnt++ ] = "\n\n";
-	ASSERT( postamblecnt <= POSTAMBLEMAX );
+	assert( postamblecnt <= POSTAMBLEMAX );
 	dlog_end( postamblestr,
 		  postamblecnt );
 
common/content_inode.h +2 -2
index 8f0390c..9013ca4 100644
@@ -389,7 +389,7 @@ calc_checksum(void *bufp, size_t len)
 	u_int32_t sum = 0;
 	u_int32_t *sump = bufp;
 	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	ASSERT(len % sizeof(u_int32_t) == 0);
+	assert(len % sizeof(u_int32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return ~sum + 1;
@@ -401,7 +401,7 @@ is_checksum_valid(void *bufp, size_t len)
 	u_int32_t sum = 0;
 	u_int32_t *sump = bufp;
 	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	ASSERT(len % sizeof(u_int32_t) == 0);
+	assert(len % sizeof(u_int32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return sum == 0 ? BOOL_TRUE : BOOL_FALSE;
common/dlog.c +7 -6
index ac0cafc..6220cfe 100644
@@ -26,6 +26,7 @@
 #include <time.h>
 #include <errno.h>
 #include <signal.h>
+#include <assert.h>
 
 #include "types.h"
 #include "mlog.h"
@@ -57,7 +58,7 @@ dlog_init( int argc, char *argv[ ] )
 
 	/* can only call once
 	 */
-	ASSERT( dlog_ttyfd == -1 );
+	assert( dlog_ttyfd == -1 );
 
 	/* initially allow dialog, use stdin fd
 	 */
@@ -104,7 +105,7 @@ dlog_init( int argc, char *argv[ ] )
 		struct stat statbuf;
 		int rval;
 
-		ASSERT( dlog_ttyfd >= 0 );
+		assert( dlog_ttyfd >= 0 );
 		rval = fstat( dlog_ttyfd, &statbuf );
 		if ( rval ) {
 			mlog( MLOG_VERBOSE | MLOG_WARNING,
@@ -186,7 +187,7 @@ dlog_multi_query( char *querystr[ ],
 
 	/* sanity
 	 */
-	ASSERT( dlog_allowed_flag );
+	assert( dlog_allowed_flag );
 
 	/* display query description strings
 	 */
@@ -295,7 +296,7 @@ dlog_string_query( dlog_ucbp_t ucb, /* user's print func */
 
 	/* sanity
 	 */
-	ASSERT( dlog_allowed_flag );
+	assert( dlog_allowed_flag );
 
 	/* call the caller's callback with his context, print context, and
 	 * print operator
@@ -359,7 +360,7 @@ dlog_string_query_print( void *ctxp, char *fmt, ... )
 {
 	va_list args;
 
-	ASSERT( ! ctxp );
+	assert( ! ctxp );
 
 	va_start( args, fmt );
 	mlog_va( MLOG_NORMAL | MLOG_NOLOCK | MLOG_BARE, fmt, args );
@@ -510,7 +511,7 @@ promptinput( char *buf,
 		}
 		return BOOL_FALSE;
 	} else {
-		ASSERT( dlog_signo_received == -1 );
+		assert( dlog_signo_received == -1 );
 		*exceptionixp = 0;
 		return BOOL_TRUE;
 	}
common/drive.c +9 -8
index 32a7191..f9ba851 100644
@@ -21,6 +21,7 @@
 
 #include <sys/stat.h>
 #include <time.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -88,7 +89,7 @@ drive_init1( int argc, char *argv[ ] )
 
 	/* sanity check asserts
 	 */
-	ASSERT( sizeof( drive_hdr_t ) == DRIVE_HDR_SZ );
+	assert( sizeof( drive_hdr_t ) == DRIVE_HDR_SZ );
 
 	/* count drive arguments
 	 */
@@ -107,7 +108,7 @@ drive_init1( int argc, char *argv[ ] )
 	 */
 	if (drivecnt > 0) {
 		drivepp = ( drive_t ** )calloc( drivecnt, sizeof( drive_t * ));
-		ASSERT( drivepp );
+		assert( drivepp );
 	}
 
 	/* initialize the partialmax value.  Each drive can be completing a file
@@ -142,7 +143,7 @@ drive_init1( int argc, char *argv[ ] )
 			break;
 		}
 	}
-	ASSERT( driveix == drivecnt );
+	assert( driveix == drivecnt );
 
 	/* the user may specify stdin as the source, by
 	 * a single dash ('-') with no option letter. This must appear
@@ -169,7 +170,7 @@ drive_init1( int argc, char *argv[ ] )
 		 * allocate an array to hold ptrs to drive descriptors
 		 */
 		drivepp = ( drive_t ** )calloc( drivecnt, sizeof( drive_t * ));
-		ASSERT( drivepp );
+		assert( drivepp );
 
 		drivepp[ 0 ] = drive_alloc( "stdio", 0 );
 
@@ -215,7 +216,7 @@ drive_init1( int argc, char *argv[ ] )
 				bestscore = score;
 			}
 		}
-		ASSERT( bestsp );
+		assert( bestsp );
 		drivep->d_strategyp = bestsp;
 		drivep->d_recmarksep = bestsp->ds_recmarksep;
 		drivep->d_recmfilesz = bestsp->ds_recmfilesz;
@@ -356,7 +357,7 @@ drive_alloc( char *pathname, ix_t driveix )
 	/* allocate the descriptor
 	 */
 	drivep = ( drive_t * )calloc( 1, sizeof( drive_t ));
-	ASSERT( drivep );
+	assert( drivep );
 
 	/* convert the pathname to an absolute pathname
 	 * NOTE: string "stdio" is reserved to mean send to standard out
@@ -397,7 +398,7 @@ drive_allochdrs( drive_t *drivep, global_hdr_t *gwhdrtemplatep, ix_t driveix )
 	/* allocate the read header
 	 */
 	grhdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-	ASSERT( grhdrp );
+	assert( grhdrp );
 	gwhdrp = NULL;
 	dwhdrp = NULL;
 
@@ -411,7 +412,7 @@ drive_allochdrs( drive_t *drivep, global_hdr_t *gwhdrtemplatep, ix_t driveix )
 		/* allocate the write header
 		 */
 		gwhdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-		ASSERT( gwhdrp );
+		assert( gwhdrp );
 
 		/* copy the template
 		 */
common/drive_minrmt.c +185 -184
index 8c57699..6d58f1f 100644
@@ -29,6 +29,7 @@
 #include <sys/sysmacros.h>
 #include <malloc.h>
 #include <sched.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -471,11 +472,11 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 
 	/* opportunity for sanity checking
 	 */
-	ASSERT( sizeof( global_hdr_t ) <= STAPE_HDR_SZ );
-	ASSERT( sizeof( rec_hdr_t )
+	assert( sizeof( global_hdr_t ) <= STAPE_HDR_SZ );
+	assert( sizeof( rec_hdr_t )
 		==
 		sizeofmember( drive_hdr_t, dh_specific ));
-	ASSERT( ! ( STAPE_MAX_RECSZ % PGSZ ));
+	assert( ! ( STAPE_MAX_RECSZ % PGSZ ));
 
 	/* hook up the drive ops
 	 */
@@ -484,7 +485,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 	/* allocate context for the drive manager
 	 */
 	contextp = ( drive_context_t * )calloc( 1, sizeof( drive_context_t ));
-	ASSERT( contextp );
+	assert( contextp );
 	memset( ( void * )contextp, 0, sizeof( *contextp ));
 
 	/* do not enable a separate I/O thread,
@@ -583,7 +584,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 	 */
 	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_bufp = ( char * )memalign( PGSZ, STAPE_MAX_RECSZ );
-		ASSERT( contextp->dc_bufp );
+		assert( contextp->dc_bufp );
 	} else {
 		intgen_t rval;
 		mlog( (MLOG_NITTY + 1) | MLOG_DRIVE,
@@ -611,7 +612,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 				      _("not allowed "
 				      "to pin down I/O buffer ring\n") );
 			} else {
-				ASSERT( 0 );
+				assert( 0 );
 			}
 			return BOOL_FALSE;
 		}
@@ -721,18 +722,18 @@ do_begin_read( drive_t *drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( drivep->d_capabilities & DRIVE_CAP_READ );
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( ! contextp->dc_recp );
+	assert( drivep->d_capabilities & DRIVE_CAP_READ );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( ! contextp->dc_recp );
 
 	/* get a record buffer to use during initialization.
 	 */
 	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
-		ASSERT( contextp->dc_ringp );
+		assert( contextp->dc_ringp );
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 
@@ -742,7 +743,7 @@ do_begin_read( drive_t *drivep )
 	 */
 	contextp->dc_iocnt = 0;
 	if ( contextp->dc_fd < 0 ) {
-		ASSERT( contextp->dc_fd == -1 );
+		assert( contextp->dc_fd == -1 );
 		rval = prepare_drive( drivep );
 		if ( rval ) {
 			if ( ! contextp->dc_singlethreadedpr ) {
@@ -763,7 +764,7 @@ do_begin_read( drive_t *drivep )
 			return rval;
 		}
 	}
-	ASSERT( contextp->dc_iocnt == 1 );
+	assert( contextp->dc_iocnt == 1 );
 					/* set by prepare_drive or read_label */
 
 	/* all is well. adjust context. don't kick off read-aheads just yet;
@@ -824,10 +825,10 @@ do_read( drive_t *drivep,
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( wantedcnt > 0 );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( wantedcnt > 0 );
 
 	/* clear the return status field
 	 */
@@ -853,7 +854,7 @@ do_read( drive_t *drivep,
 	 */
 	contextp->dc_ownedp = contextp->dc_nextp;
 	contextp->dc_nextp += actualcnt;
-	ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
+	assert( contextp->dc_nextp <= contextp->dc_dataendp );
 
 	mlog( MLOG_NITTY | MLOG_DRIVE,
 	      "rmt drive op read actual == %d (0x%x)\n",
@@ -886,16 +887,16 @@ do_return_read_buf( drive_t *drivep, char *bufp, size_t retcnt )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( contextp->dc_ownedp );
-	ASSERT( bufp == contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( contextp->dc_ownedp );
+	assert( bufp == contextp->dc_ownedp );
 
 	/* calculate how much the caller owns
 	 */
-	ASSERT( contextp->dc_nextp >= contextp->dc_ownedp );
+	assert( contextp->dc_nextp >= contextp->dc_ownedp );
 	ownedcnt = ( size_t )( contextp->dc_nextp - contextp->dc_ownedp );
-	ASSERT( ownedcnt == retcnt );
+	assert( ownedcnt == retcnt );
 
 	/* take possession of buffer portion
 	 */
@@ -905,7 +906,7 @@ do_return_read_buf( drive_t *drivep, char *bufp, size_t retcnt )
 	 * and (if ring in use) give buffer to ring for read-ahead.
 	 */
 	if ( contextp->dc_nextp >= contextp->dc_dataendp ) {
-		ASSERT( contextp->dc_nextp == contextp->dc_dataendp );
+		assert( contextp->dc_nextp == contextp->dc_dataendp );
 		if ( ! contextp->dc_singlethreadedpr ) {
 			contextp->dc_msgp->rm_op = RING_OP_READ;
 			Ring_put( contextp->dc_ringp, contextp->dc_msgp );
@@ -936,9 +937,9 @@ do_get_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 	/* the mark is simply the offset into the media file of the
 	 * next byte to be read.
@@ -977,9 +978,9 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 
 	/* the desired mark is passed by reference, and is really just an
@@ -1002,18 +1003,18 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
-		ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+		assert( contextp->dc_nextp >= contextp->dc_recp );
 		recoff = ( u_int32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
-		ASSERT( recoff <= tape_recsz );
-		ASSERT( rechdrp->rec_used <= tape_recsz );
-		ASSERT( recoff >= STAPE_HDR_SZ );
-		ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-		ASSERT( recoff <= rechdrp->rec_used );
+		assert( recoff <= tape_recsz );
+		assert( rechdrp->rec_used <= tape_recsz );
+		assert( recoff >= STAPE_HDR_SZ );
+		assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+		assert( recoff <= rechdrp->rec_used );
 		currentoffset += ( off64_t )recoff;
 	}
-	ASSERT( wantedoffset >= currentoffset );
+	assert( wantedoffset >= currentoffset );
 
 	/* if we are currently holding a record and the desired offset
 	 * is not within the current record, eat the current record.
@@ -1036,12 +1037,12 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			 * must be just after it.
 			 */
 			if ( rechdrp->rec_used < tape_recsz ) {
-				ASSERT( wantedoffset == nextrecoffset );
+				assert( wantedoffset == nextrecoffset );
 			}
 
 			/* figure how much to ask for
 			 */
-			ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+			assert( contextp->dc_nextp >= contextp->dc_recp );
 			recoff = ( u_int32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
@@ -1059,13 +1060,13 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			if ( rval ) {
 				return rval;
 			}
-			ASSERT( actualcnt == wantedcnt );
+			assert( actualcnt == wantedcnt );
 			do_return_read_buf( drivep, dummybufp, actualcnt );
 			currentoffset += ( off64_t )actualcnt;
-			ASSERT( currentoffset == nextrecoffset );
-			ASSERT( wantedoffset >= currentoffset );
-			ASSERT( ! contextp->dc_recp );
-			ASSERT( currentoffset
+			assert( currentoffset == nextrecoffset );
+			assert( wantedoffset >= currentoffset );
+			assert( ! contextp->dc_recp );
+			assert( currentoffset
 				==
 				contextp->dc_reccnt * ( off64_t )tape_recsz );
 		}
@@ -1084,14 +1085,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		off64_t wantedreccnt;
 		seekmode_t seekmode;
 
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 		wantedreccnt = wantedoffset / ( off64_t )tape_recsz;
 		if ( contextp->dc_singlethreadedpr ) {
 			seekmode = SEEKMODE_RAW;
 		} else {
 			seekmode = SEEKMODE_BUF;
 		}
-		ASSERT( wantedreccnt != 0 ); /* so NOP below can be
+		assert( wantedreccnt != 0 ); /* so NOP below can be
 					      * distinguished from use
 					      * in do_begin_read
 					      */
@@ -1101,7 +1102,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 
 			if ( seekmode == SEEKMODE_BUF ) {
 				ring_stat_t rs;
-				ASSERT( ! contextp->dc_msgp );
+				assert( ! contextp->dc_msgp );
 				contextp->dc_msgp =
 						Ring_get( contextp->dc_ringp );
 				rs = contextp->dc_msgp->rm_stat;
@@ -1114,7 +1115,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				     rs != RING_STAT_INIT
 				     &&
 				     rs != RING_STAT_NOPACK ) {
-					ASSERT( 0 );
+					assert( 0 );
 					contextp->dc_errorpr = BOOL_TRUE;
 					return DRIVE_ERROR_CORE;
 				}
@@ -1136,8 +1137,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				continue;
 			}
 
-			ASSERT( contextp->dc_reccnt == contextp->dc_iocnt );
-			ASSERT( wantedreccnt > contextp->dc_reccnt );
+			assert( contextp->dc_reccnt == contextp->dc_iocnt );
+			assert( wantedreccnt > contextp->dc_reccnt );
 			recskipcnt64 = wantedreccnt - contextp->dc_reccnt;
 			recskipcnt64remaining = recskipcnt64;
 			while ( recskipcnt64remaining ) {
@@ -1145,14 +1146,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				intgen_t saved_errno;
 				intgen_t rval;
 
-				ASSERT( recskipcnt64remaining > 0 );
+				assert( recskipcnt64remaining > 0 );
 				if ( recskipcnt64remaining > INTGENMAX ) {
 					recskipcnt = INTGENMAX;
 				} else {
 					recskipcnt = ( intgen_t )
 						     recskipcnt64remaining;
 				}
-				ASSERT( recskipcnt > 0 );
+				assert( recskipcnt > 0 );
 				rval = mt_op( contextp->dc_fd,
 					      MTFSR,
 					      recskipcnt );
@@ -1174,8 +1175,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			currentoffset = contextp->dc_reccnt
 					*
 					( off64_t )tape_recsz;
-			ASSERT( wantedoffset >= currentoffset );
-			ASSERT( wantedoffset - currentoffset
+			assert( wantedoffset >= currentoffset );
+			assert( wantedoffset - currentoffset
 				<
 				( off64_t )tape_recsz );
 		}
@@ -1190,7 +1191,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		size_t actualcnt;
 		intgen_t rval;
 
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 
 		/* figure how much to ask for. to eat an entire record,
 		 * ask for a record sans the header. do_read will eat
@@ -1205,11 +1206,11 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		if ( rval ) {
 			return rval;
 		}
-		ASSERT( actualcnt == wantedcnt );
+		assert( actualcnt == wantedcnt );
 		do_return_read_buf( drivep, dummybufp, actualcnt );
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 		currentoffset += ( off64_t )tape_recsz;
-		ASSERT( currentoffset
+		assert( currentoffset
 			==
 			contextp->dc_reccnt * ( off64_t )tape_recsz );
 	}
@@ -1222,8 +1223,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		char *dummybufp;
 		size_t actualcnt;
 
-		ASSERT( wantedoffset > currentoffset );
-		ASSERT( wantedoffset - currentoffset < ( off64_t )tape_recsz );
+		assert( wantedoffset > currentoffset );
+		assert( wantedoffset - currentoffset < ( off64_t )tape_recsz );
 		wantedcnt = ( size_t )( wantedoffset - currentoffset );
 		if ( contextp->dc_recp ) {
 			u_int32_t recoff;
@@ -1233,14 +1234,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			recoff = ( u_int32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
-			ASSERT( recoff <= tape_recsz );
-			ASSERT( rechdrp->rec_used <= tape_recsz );
-			ASSERT( recoff >= STAPE_HDR_SZ );
-			ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-			ASSERT( recoff <= rechdrp->rec_used );
-			ASSERT( recoff + wantedcnt <= rechdrp->rec_used );
+			assert( recoff <= tape_recsz );
+			assert( rechdrp->rec_used <= tape_recsz );
+			assert( recoff >= STAPE_HDR_SZ );
+			assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+			assert( recoff <= rechdrp->rec_used );
+			assert( recoff + wantedcnt <= rechdrp->rec_used );
 		} else {
-			ASSERT( wantedcnt >= STAPE_HDR_SZ );
+			assert( wantedcnt >= STAPE_HDR_SZ );
 			wantedcnt -= STAPE_HDR_SZ;
 		}
 
@@ -1253,7 +1254,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		    if ( rval ) {
 			    return rval;
 		    }
-		    ASSERT( actualcnt == wantedcnt );
+		    assert( actualcnt == wantedcnt );
 		    do_return_read_buf( drivep, dummybufp, actualcnt );
 		}
 	}
@@ -1268,18 +1269,18 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
-		ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+		assert( contextp->dc_nextp >= contextp->dc_recp );
 		recoff = ( u_int32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
-		ASSERT( recoff <= tape_recsz );
-		ASSERT( rechdrp->rec_used <= tape_recsz );
-		ASSERT( recoff >= STAPE_HDR_SZ );
-		ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-		ASSERT( recoff <= rechdrp->rec_used );
+		assert( recoff <= tape_recsz );
+		assert( rechdrp->rec_used <= tape_recsz );
+		assert( recoff >= STAPE_HDR_SZ );
+		assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+		assert( recoff <= rechdrp->rec_used );
 		currentoffset += ( off64_t )recoff;
 	}
-	ASSERT( wantedoffset == currentoffset );
+	assert( wantedoffset == currentoffset );
 
 	return 0;
 }
@@ -1310,9 +1311,9 @@ do_next_mark( drive_t *drivep )
 
 	/* assert protocol being followed.
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "rmt drive op: next mark\n" );
@@ -1335,7 +1336,7 @@ noerrorsearch:
 		}
 		rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 
-		ASSERT( rechdrp->first_mark_offset != 0 );
+		assert( rechdrp->first_mark_offset != 0 );
 		if ( rechdrp->first_mark_offset > 0 ) {
 			 off64_t markoff = rechdrp->first_mark_offset
 					   -
@@ -1343,8 +1344,8 @@ noerrorsearch:
 			 off64_t curoff = ( off64_t )( contextp->dc_nextp
 						       -
 						       contextp->dc_recp );
-			 ASSERT( markoff > 0 );
-			 ASSERT( curoff > 0 );
+			 assert( markoff > 0 );
+			 assert( curoff > 0 );
 			 if ( markoff >= curoff ) {
 				break;
 			}
@@ -1359,7 +1360,7 @@ noerrorsearch:
 		contextp->dc_reccnt++;
 	}
 
-	ASSERT( rechdrp->first_mark_offset - rechdrp->file_offset
+	assert( rechdrp->first_mark_offset - rechdrp->file_offset
 		<=
 		( off64_t )tape_recsz );
 	contextp->dc_nextp = contextp->dc_recp
@@ -1367,8 +1368,8 @@ noerrorsearch:
 			     ( size_t )( rechdrp->first_mark_offset
 					 -
 					 rechdrp->file_offset );
-	ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
-	ASSERT( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
+	assert( contextp->dc_nextp <= contextp->dc_dataendp );
+	assert( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
 	if ( contextp->dc_nextp == contextp->dc_dataendp ) {
 		if ( ! contextp->dc_singlethreadedpr ) {
 			Ring_put( contextp->dc_ringp,
@@ -1394,7 +1395,7 @@ resetring:
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 	rechdrp = ( rec_hdr_t * )contextp->dc_recp;
@@ -1417,7 +1418,7 @@ validateread:
 	}
 
 	if ( nread >= 0 ) {
-		ASSERT( ( size_t )nread <= tape_recsz );
+		assert( ( size_t )nread <= tape_recsz );
 		mlog( MLOG_DEBUG | MLOG_DRIVE,
 		      "short read (nread == %d, record size == %d)\n",
 		      nread,
@@ -1460,24 +1461,24 @@ validatehdr:
 		goto readrecord;
 	}
 
-	ASSERT( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
+	assert( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
 	markoff = rechdrp->first_mark_offset - rechdrp->file_offset;
-	ASSERT( markoff >= ( off64_t )STAPE_HDR_SZ );
-	ASSERT( markoff < ( off64_t )tape_recsz );
-	ASSERT( rechdrp->rec_used > STAPE_HDR_SZ );
-	ASSERT( rechdrp->rec_used < tape_recsz );
+	assert( markoff >= ( off64_t )STAPE_HDR_SZ );
+	assert( markoff < ( off64_t )tape_recsz );
+	assert( rechdrp->rec_used > STAPE_HDR_SZ );
+	assert( rechdrp->rec_used < tape_recsz );
 
 	goto alliswell;
 
 alliswell:
 	contextp->dc_nextp = contextp->dc_recp + ( size_t )markoff;
-	ASSERT( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
+	assert( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
 	contextp->dc_reccnt = rechdrp->file_offset / ( off64_t )tape_recsz;
 	contextp->dc_iocnt = contextp->dc_reccnt + 1;
 	contextp->dc_recendp = contextp->dc_recp + tape_recsz;
 	contextp->dc_dataendp = contextp->dc_recp + rechdrp->rec_used;
-	ASSERT( contextp->dc_dataendp <= contextp->dc_recendp );
-	ASSERT( contextp->dc_nextp < contextp->dc_dataendp );
+	assert( contextp->dc_dataendp <= contextp->dc_recendp );
+	assert( contextp->dc_nextp < contextp->dc_dataendp );
 	contextp->dc_errorpr = BOOL_FALSE;
 
 	mlog( MLOG_NORMAL | MLOG_DRIVE,
@@ -1553,8 +1554,8 @@ do_end_read( drive_t *drivep )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
 
 	/* In the scsi version, read_label() does a status command to the
 	 * drive to then decide if doing a 'fsf' is appropriate.  For minrmt,
@@ -1608,9 +1609,9 @@ do_begin_write( drive_t *drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( ! drivep->d_markrecheadp );
-	ASSERT( ! contextp->dc_recp );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( ! drivep->d_markrecheadp );
+	assert( ! contextp->dc_recp );
 
 	/* get pointers into global write header
 	 */
@@ -1621,7 +1622,7 @@ do_begin_write( drive_t *drivep )
 	/* must already be open. The only way to open is to do a begin_read.
 	 * so all interaction with tape requires reading first.
 	 */
-	ASSERT( contextp->dc_fd != -1 );
+	assert( contextp->dc_fd != -1 );
 
 	/* fill in write header's drive specific info
 	 */
@@ -1637,15 +1638,15 @@ do_begin_write( drive_t *drivep )
 	/* get a record buffer. will be used for the media file header,
 	 * and is needed to "prime the pump" for first call to do_write.
 	 */
-	ASSERT( ! contextp->dc_recp );
+	assert( ! contextp->dc_recp );
 	if ( contextp->dc_singlethreadedpr ) {
-		ASSERT( contextp->dc_bufp );
+		assert( contextp->dc_bufp );
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
-		ASSERT( contextp->dc_ringp );
-		ASSERT( ! contextp->dc_msgp );
+		assert( contextp->dc_ringp );
+		assert( ! contextp->dc_msgp );
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 
@@ -1690,7 +1691,7 @@ do_begin_write( drive_t *drivep )
 	/* prepare the drive context. must have a record buffer ready to
 	 * go, header initialized.
 	 */
-	ASSERT( ! contextp->dc_ownedp );
+	assert( ! contextp->dc_ownedp );
 	contextp->dc_reccnt = 1; /* count the header record */
 	contextp->dc_recendp = contextp->dc_recp + tape_recsz;
 	contextp->dc_nextp = contextp->dc_recp + STAPE_HDR_SZ;
@@ -1735,15 +1736,15 @@ do_set_mark( drive_t *drivep,
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
 
 	/* calculate and fill in the mark record offset
 	 */
-	ASSERT( contextp->dc_recp );
+	assert( contextp->dc_recp );
 	nextoff = contextp->dc_reccnt * ( off64_t )tape_recsz
 		  +
 		  ( off64_t )( contextp->dc_nextp - contextp->dc_recp );
@@ -1758,7 +1759,7 @@ do_set_mark( drive_t *drivep,
 	 */
 	rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 	if ( rechdrp->first_mark_offset == -1LL ) {
-		ASSERT( nextoff != -1LL );
+		assert( nextoff != -1LL );
 		rechdrp->first_mark_offset = nextoff;
 	}
 
@@ -1771,7 +1772,7 @@ do_set_mark( drive_t *drivep,
 		drivep->d_markrecheadp = markrecp;
 		drivep->d_markrectailp = markrecp;
 	} else {
-		ASSERT( drivep->d_markrectailp );
+		assert( drivep->d_markrectailp );
 		drivep->d_markrectailp->dm_nextp = markrecp;
 		drivep->d_markrectailp = markrecp;
 	}
@@ -1798,12 +1799,12 @@ do_get_write_buf( drive_t *drivep, size_t wantedcnt, size_t *actualcntp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* figure how much is available; supply the min of what is
 	 * available and what is wanted.
@@ -1864,17 +1865,17 @@ do_write( drive_t *drivep, char *bufp, size_t retcnt )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp <= contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp <= contextp->dc_recendp );
 
 	/* verify the caller is returning exactly what is held
 	 */
-	ASSERT( bufp == contextp->dc_ownedp );
-	ASSERT( retcnt == heldcnt );
+	assert( bufp == contextp->dc_ownedp );
+	assert( retcnt == heldcnt );
 
 	/* take it back
 	 */
@@ -1915,7 +1916,7 @@ do_write( drive_t *drivep, char *bufp, size_t retcnt )
 			rval = contextp->dc_msgp->rm_rval;
 			break;
 		default:
-			ASSERT( 0 );
+			assert( 0 );
 			return DRIVE_ERROR_CORE;
 		}
 	}
@@ -1979,12 +1980,12 @@ do_get_align_cnt( drive_t * drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* calculate the next alignment point at or beyond the current nextp.
 	 * the following algorithm works because all buffers are page-aligned
@@ -1994,11 +1995,11 @@ do_get_align_cnt( drive_t * drivep )
 	next_alignment_off +=  PGMASK;
 	next_alignment_off &= ~PGMASK;
 	next_alignment_point = ( char * )next_alignment_off;
-	ASSERT( next_alignment_point <= contextp->dc_recendp );
+	assert( next_alignment_point <= contextp->dc_recendp );
 
 	/* return the number of bytes to the next alignment offset
 	 */
-	ASSERT( next_alignment_point >= contextp->dc_nextp );
+	assert( next_alignment_point >= contextp->dc_nextp );
 	return ( size_t )( next_alignment_point - contextp->dc_nextp );
 }
 
@@ -2025,12 +2026,12 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* pre-initialize return of count of bytes committed to media
 	 */
@@ -2072,7 +2073,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 					     contextp->dc_recp,
 					     BOOL_TRUE, BOOL_TRUE );
 		} else {
-			ASSERT( contextp->dc_msgp );
+			assert( contextp->dc_msgp );
 			contextp->dc_msgp->rm_op = RING_OP_WRITE;
 			contextp->dc_msgp->rm_user = contextp->dc_reccnt;
 			Ring_put( contextp->dc_ringp,
@@ -2088,7 +2089,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 				rval = contextp->dc_msgp->rm_rval;
 				break;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_recp = 0;
 				return DRIVE_ERROR_CORE;
 			}
@@ -2115,7 +2116,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 	}
 	if ( ! contextp->dc_singlethreadedpr ) {
 		while ( ! rval ) {
-			ASSERT( contextp->dc_msgp );
+			assert( contextp->dc_msgp );
 			contextp->dc_msgp->rm_op = RING_OP_TRACE;
 			Ring_put( contextp->dc_ringp,
 				  contextp->dc_msgp );
@@ -2127,14 +2128,14 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 			switch( contextp->dc_msgp->rm_stat ) {
 			case RING_STAT_OK:
 			case RING_STAT_INIT:
-				ASSERT( rval == 0 );
+				assert( rval == 0 );
 				break;
 			case RING_STAT_ERROR:
 				rval = contextp->dc_msgp->rm_rval;
 				first_rec_w_err = contextp->dc_msgp->rm_user;
 				break;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_recp = 0;
 				return DRIVE_ERROR_CORE;
 			}
@@ -2182,11 +2183,11 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 	 * to tape.
 	 */
 	if ( rval ) {
-		ASSERT( first_rec_w_err >= 0 );
+		assert( first_rec_w_err >= 0 );
 		recs_wtn_wo_err = first_rec_w_err;
 		recs_guaranteed = recs_wtn_wo_err - contextp->dc_lostrecmax;
 	} else {
-		ASSERT( first_rec_w_err == -1 );
+		assert( first_rec_w_err == -1 );
 		recs_wtn_wo_err = contextp->dc_iocnt;
 		recs_guaranteed = recs_wtn_wo_err;
 	}
@@ -2217,14 +2218,14 @@ do_fsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_mode == OM_NONE );
 
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "rmt drive op: fsf: count %d\n",
 	      count );
 
-	ASSERT( count );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( count );
+	assert( contextp->dc_mode == OM_NONE );
 
 	for ( i = 0 ; i < count; i++ ) {
 		done = 0;
@@ -2243,7 +2244,7 @@ do_fsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 			      _("advancing tape to next media file\n") );
 
 			op_failed = 0;
-			ASSERT( contextp->dc_fd >= 0 );
+			assert( contextp->dc_fd >= 0 );
 			if ( mt_op( contextp->dc_fd, MTFSF, 1 ) ) {
 				op_failed = 1;
 			}
@@ -2294,14 +2295,14 @@ do_bsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 	      "rmt drive op: bsf: count %d\n",
 	      count );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_mode == OM_NONE );
 
 	*statp = 0;
 
 	/* back space - places us to left of previous file mark
 	 * if we hit BOT, return
 	 */
-	ASSERT( drivep->d_capabilities & DRIVE_CAP_BSF );
+	assert( drivep->d_capabilities & DRIVE_CAP_BSF );
 	rval = bsf_and_verify( drivep );
 	if (rval) {
 		if (errno == ENOSPC/*IRIX*/ || errno == EIO/*Linux*/) {
@@ -2379,8 +2380,8 @@ do_rewind( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "rmt drive op: rewind\n" );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
 
 	/* use validating tape rewind util func
 	 */
@@ -2405,8 +2406,8 @@ do_erase( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "rmt drive op: erase\n" );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
 
 	/* use validating tape rewind util func
 	 */
@@ -2443,8 +2444,8 @@ do_eject_media( drive_t *drivep )
 
 	/* drive must be open
 	 */
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
 
 	/* issue tape unload
 	 */
@@ -2563,7 +2564,7 @@ read_label( drive_t *drivep )
 	/* if a read error, get status
 	 */
 	if ( nread != ( intgen_t )tape_recsz ) {
-		ASSERT( nread < ( intgen_t )tape_recsz );
+		assert( nread < ( intgen_t )tape_recsz );
 	} 
 
 	/* check for an unexpected errno
@@ -2720,7 +2721,7 @@ get_tpcaps( drive_t *drivep )
 #ifdef DEBUG
 	drive_context_t	*contextp = ( drive_context_t * )drivep->d_contextp;
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 #endif
 
 	/* can't ask about blksz, can't set blksz, can't ask about
@@ -2796,7 +2797,7 @@ mt_op(intgen_t fd, intgen_t sub_op, intgen_t param )
 	mop.mt_op   	= (short )sub_op;
 	mop.mt_count	= param;
 
-	ASSERT( fd >= 0 );
+	assert( fd >= 0 );
 
 	switch ( sub_op ) {
 	case MTSEEK:
@@ -3074,7 +3075,7 @@ prepare_drive( drive_t *drivep )
 
 	/* shouldn't be here if drive is open
 	 */
-	ASSERT( contextp->dc_fd == -1 );
+	assert( contextp->dc_fd == -1 );
 
 	mlog( MLOG_VERBOSE | MLOG_DRIVE,
 	      _("preparing drive\n") );
@@ -3181,7 +3182,7 @@ prepare_drive( drive_t *drivep )
 			      contextp->dc_recp,
 			      tape_recsz,
 			      &saved_errno );
-		ASSERT( saved_errno == 0 || nread < 0 );
+		assert( saved_errno == 0 || nread < 0 );
 
 		/* RMT can require a retry
 		 */
@@ -3340,7 +3341,7 @@ checkhdr:
 			rec_hdr_t *tprhdrp;
 			drhdrp = drivep->d_readhdrp;
 			tprhdrp = ( rec_hdr_t * )drhdrp->dh_specific;
-			ASSERT( tprhdrp->recsize >= 0 );
+			assert( tprhdrp->recsize >= 0 );
 			tape_recsz = ( size_t )tprhdrp->recsize;
 			break;
 		}
@@ -3410,7 +3411,7 @@ Open( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: opening drive\n" );
 
-	ASSERT( contextp->dc_fd == -1 );
+	assert( contextp->dc_fd == -1 );
 
 	errno = 0;
 	contextp->dc_fd = open( drivep->d_pathname, oflags );
@@ -3430,7 +3431,7 @@ Close( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: closing drive\n" );
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 
 	( void )close( contextp->dc_fd );
 
@@ -3447,8 +3448,8 @@ Read( drive_t *drivep, char *bufp, size_t cnt, intgen_t *errnop )
 	      "tape op: reading %u bytes\n",
 	      cnt );
 
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( bufp );
+	assert( contextp->dc_fd >= 0 );
+	assert( bufp );
 	*errnop = 0;
 	errno = 0;
 	nread = read( contextp->dc_fd, ( void * )bufp, cnt );
@@ -3483,8 +3484,8 @@ Write( drive_t *drivep, char *bufp, size_t cnt, intgen_t *errnop )
 	      "tape op: writing %u bytes\n",
 	      cnt );
 
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( bufp );
+	assert( contextp->dc_fd >= 0 );
+	assert( bufp );
 	*errnop = 0;
 	errno = 0;
 	nwritten = write( contextp->dc_fd, ( void * )bufp, cnt );
@@ -3664,7 +3665,7 @@ read_record(  drive_t *drivep, char *bufp )
 	/* short read
 	 */
 	if ( nread >= 0 ) {
-		ASSERT( nread <= ( intgen_t )tape_recsz );
+		assert( nread <= ( intgen_t )tape_recsz );
 		mlog( MLOG_DEBUG | MLOG_DRIVE,
 		      "short read record %lld (nread == %d)\n",
 		      contextp->dc_iocnt,
@@ -3726,7 +3727,7 @@ getrec( drive_t *drivep )
 				contextp->dc_errorpr = BOOL_TRUE;
 				return contextp->dc_msgp->rm_rval;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_errorpr = BOOL_TRUE;
 				return DRIVE_ERROR_CORE;
 			}
@@ -3739,7 +3740,7 @@ getrec( drive_t *drivep )
 		contextp->dc_nextp = contextp->dc_recp
 				     +
 				     STAPE_HDR_SZ;
-		ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
+		assert( contextp->dc_nextp <= contextp->dc_dataendp );
 	}
 
 	return 0;
@@ -3775,7 +3776,7 @@ write_record(  drive_t *drivep, char *bufp, bool_t chksumpr, bool_t xlatepr )
 	}
 
 	rval = determine_write_error( nwritten, saved_errno );
-	ASSERT(rval);
+	assert(rval);
 
 	return rval;
 }
@@ -3814,7 +3815,7 @@ Ring_reset(  ring_t *ringp, ring_msg_t *msgp )
 	mlog( (MLOG_NITTY + 1) | MLOG_DRIVE,
 	      "ring op: reset\n" );
 
-	ASSERT( ringp );
+	assert( ringp );
 
 	ring_reset( ringp, msgp );
 }
@@ -3845,14 +3846,14 @@ display_ring_metrics( drive_t *drivep, intgen_t mlog_flags )
 	char *bufszsfxp;
 
 	if ( tape_recsz == STAPE_MIN_MAX_BLKSZ ) {
-		ASSERT( ! ( STAPE_MIN_MAX_BLKSZ % 0x400 ));
+		assert( ! ( STAPE_MIN_MAX_BLKSZ % 0x400 ));
 		sprintf( bufszbuf, "%u", STAPE_MIN_MAX_BLKSZ / 0x400 );
-		ASSERT( strlen( bufszbuf ) < sizeof( bufszbuf ));
+		assert( strlen( bufszbuf ) < sizeof( bufszbuf ));
 		bufszsfxp = _("KB");
 	} else if ( tape_recsz == STAPE_MAX_RECSZ ) {
-		ASSERT( ! ( STAPE_MAX_RECSZ % 0x100000 ));
+		assert( ! ( STAPE_MAX_RECSZ % 0x100000 ));
 		sprintf( bufszbuf, "%u", STAPE_MAX_RECSZ / 0x100000 );
-		ASSERT( strlen( bufszbuf ) < sizeof( bufszbuf ));
+		assert( strlen( bufszbuf ) < sizeof( bufszbuf ));
 		bufszsfxp = _("MB");
 	} else {
 		sprintf( bufszbuf, "%u", (unsigned int)(tape_recsz / 0x400) );
common/drive_scsitape.c +195 -194
index 0abb5d0..3f45d01 100644
@@ -29,6 +29,7 @@
 #include <sys/sysmacros.h>
 #include <malloc.h>
 #include <sched.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -551,11 +552,11 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 
 	/* opportunity for sanity checking
 	 */
-	ASSERT( sizeof( global_hdr_t ) <= STAPE_HDR_SZ );
-	ASSERT( sizeof( rec_hdr_t )
+	assert( sizeof( global_hdr_t ) <= STAPE_HDR_SZ );
+	assert( sizeof( rec_hdr_t )
 		==
 		sizeofmember( drive_hdr_t, dh_specific ));
-	ASSERT( ! ( STAPE_MAX_RECSZ % PGSZ ));
+	assert( ! ( STAPE_MAX_RECSZ % PGSZ ));
 
 	/* hook up the drive ops
 	 */
@@ -564,7 +565,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 	/* allocate context for the drive manager
 	 */
 	contextp = ( drive_context_t * )calloc( 1, sizeof( drive_context_t ));
-	ASSERT( contextp );
+	assert( contextp );
 	memset( ( void * )contextp, 0, sizeof( *contextp ));
 
 	/* do not enable a separate I/O thread,
@@ -673,7 +674,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 	 */
 	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_bufp = ( char * )memalign( PGSZ, STAPE_MAX_RECSZ );
-		ASSERT( contextp->dc_bufp );
+		assert( contextp->dc_bufp );
 	} else {
 		intgen_t rval;
 		mlog( (MLOG_NITTY + 1) | MLOG_DRIVE,
@@ -701,7 +702,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 				      _("not allowed "
 				      "to pin down I/O buffer ring\n") );
 			} else {
-				ASSERT( 0 );
+				assert( 0 );
 			}
 			return BOOL_FALSE;
 		}
@@ -834,18 +835,18 @@ do_begin_read( drive_t *drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( drivep->d_capabilities & DRIVE_CAP_READ );
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( ! contextp->dc_recp );
+	assert( drivep->d_capabilities & DRIVE_CAP_READ );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( ! contextp->dc_recp );
 
 	/* get a record buffer to use during initialization.
 	 */
 	if ( contextp->dc_singlethreadedpr ) {
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
-		ASSERT( contextp->dc_ringp );
+		assert( contextp->dc_ringp );
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 
@@ -855,7 +856,7 @@ do_begin_read( drive_t *drivep )
 	 */
 	contextp->dc_iocnt = 0;
 	if ( contextp->dc_fd < 0 ) {
-		ASSERT( contextp->dc_fd == -1 );
+		assert( contextp->dc_fd == -1 );
 		rval = prepare_drive( drivep );
 		if ( rval ) {
 			if ( ! contextp->dc_singlethreadedpr ) {
@@ -876,7 +877,7 @@ do_begin_read( drive_t *drivep )
 			return rval;
 		}
 	}
-	ASSERT( contextp->dc_iocnt == 1 );
+	assert( contextp->dc_iocnt == 1 );
 					/* set by prepare_drive or read_label */
 
 	/* all is well. adjust context. don't kick off read-aheads just yet;
@@ -937,10 +938,10 @@ do_read( drive_t *drivep,
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( wantedcnt > 0 );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( wantedcnt > 0 );
 
 	/* clear the return status field
 	 */
@@ -966,7 +967,7 @@ do_read( drive_t *drivep,
 	 */
 	contextp->dc_ownedp = contextp->dc_nextp;
 	contextp->dc_nextp += actualcnt;
-	ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
+	assert( contextp->dc_nextp <= contextp->dc_dataendp );
 
 	mlog( MLOG_NITTY | MLOG_DRIVE,
 	      "drive op read actual == %d (0x%x)\n",
@@ -999,16 +1000,16 @@ do_return_read_buf( drive_t *drivep, char *bufp, size_t retcnt )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( contextp->dc_ownedp );
-	ASSERT( bufp == contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( contextp->dc_ownedp );
+	assert( bufp == contextp->dc_ownedp );
 
 	/* calculate how much the caller owns
 	 */
-	ASSERT( contextp->dc_nextp >= contextp->dc_ownedp );
+	assert( contextp->dc_nextp >= contextp->dc_ownedp );
 	ownedcnt = ( size_t )( contextp->dc_nextp - contextp->dc_ownedp );
-	ASSERT( ownedcnt == retcnt );
+	assert( ownedcnt == retcnt );
 
 	/* take possession of buffer portion
 	 */
@@ -1018,7 +1019,7 @@ do_return_read_buf( drive_t *drivep, char *bufp, size_t retcnt )
 	 * and (if ring in use) give buffer to ring for read-ahead.
 	 */
 	if ( contextp->dc_nextp >= contextp->dc_dataendp ) {
-		ASSERT( contextp->dc_nextp == contextp->dc_dataendp );
+		assert( contextp->dc_nextp == contextp->dc_dataendp );
 		if ( ! contextp->dc_singlethreadedpr ) {
 			contextp->dc_msgp->rm_op = RING_OP_READ;
 			Ring_put( contextp->dc_ringp, contextp->dc_msgp );
@@ -1049,9 +1050,9 @@ do_get_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 	/* the mark is simply the offset into the media file of the
 	 * next byte to be read.
@@ -1090,9 +1091,9 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 
 	/* the desired mark is passed by reference, and is really just an
@@ -1115,18 +1116,18 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
-		ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+		assert( contextp->dc_nextp >= contextp->dc_recp );
 		recoff = ( u_int32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
-		ASSERT( recoff <= tape_recsz );
-		ASSERT( rechdrp->rec_used <= tape_recsz );
-		ASSERT( recoff >= STAPE_HDR_SZ );
-		ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-		ASSERT( recoff <= rechdrp->rec_used );
+		assert( recoff <= tape_recsz );
+		assert( rechdrp->rec_used <= tape_recsz );
+		assert( recoff >= STAPE_HDR_SZ );
+		assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+		assert( recoff <= rechdrp->rec_used );
 		currentoffset += ( off64_t )recoff;
 	}
-	ASSERT( wantedoffset >= currentoffset );
+	assert( wantedoffset >= currentoffset );
 
 	/* if we are currently holding a record and the desired offset
 	 * is not within the current record, eat the current record.
@@ -1149,12 +1150,12 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			 * must be just after it.
 			 */
 			if ( rechdrp->rec_used < tape_recsz ) {
-				ASSERT( wantedoffset == nextrecoffset );
+				assert( wantedoffset == nextrecoffset );
 			}
 
 			/* figure how much to ask for
 			 */
-			ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+			assert( contextp->dc_nextp >= contextp->dc_recp );
 			recoff = ( u_int32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
@@ -1172,13 +1173,13 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			if ( rval ) {
 				return rval;
 			}
-			ASSERT( actualcnt == wantedcnt );
+			assert( actualcnt == wantedcnt );
 			do_return_read_buf( drivep, dummybufp, actualcnt );
 			currentoffset += ( off64_t )actualcnt;
-			ASSERT( currentoffset == nextrecoffset );
-			ASSERT( wantedoffset >= currentoffset );
-			ASSERT( ! contextp->dc_recp );
-			ASSERT( currentoffset
+			assert( currentoffset == nextrecoffset );
+			assert( wantedoffset >= currentoffset );
+			assert( ! contextp->dc_recp );
+			assert( currentoffset
 				==
 				contextp->dc_reccnt * ( off64_t )tape_recsz );
 		}
@@ -1197,14 +1198,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		off64_t wantedreccnt;
 		seekmode_t seekmode;
 
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 		wantedreccnt = wantedoffset / ( off64_t )tape_recsz;
 		if ( contextp->dc_singlethreadedpr ) {
 			seekmode = SEEKMODE_RAW;
 		} else {
 			seekmode = SEEKMODE_BUF;
 		}
-		ASSERT( wantedreccnt != 0 ); /* so NOP below can be
+		assert( wantedreccnt != 0 ); /* so NOP below can be
 					      * distinguished from use
 					      * in do_begin_read
 					      */
@@ -1214,7 +1215,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 
 			if ( seekmode == SEEKMODE_BUF ) {
 				ring_stat_t rs;
-				ASSERT( ! contextp->dc_msgp );
+				assert( ! contextp->dc_msgp );
 				contextp->dc_msgp =
 						Ring_get( contextp->dc_ringp );
 				rs = contextp->dc_msgp->rm_stat;
@@ -1227,7 +1228,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				     rs != RING_STAT_INIT
 				     &&
 				     rs != RING_STAT_NOPACK ) {
-					ASSERT( 0 );
+					assert( 0 );
 					contextp->dc_errorpr = BOOL_TRUE;
 					return DRIVE_ERROR_CORE;
 				}
@@ -1249,8 +1250,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				continue;
 			}
 
-			ASSERT( contextp->dc_reccnt == contextp->dc_iocnt );
-			ASSERT( wantedreccnt > contextp->dc_reccnt );
+			assert( contextp->dc_reccnt == contextp->dc_iocnt );
+			assert( wantedreccnt > contextp->dc_reccnt );
 			recskipcnt64 = wantedreccnt - contextp->dc_reccnt;
 			recskipcnt64remaining = recskipcnt64;
 			while ( recskipcnt64remaining ) {
@@ -1258,14 +1259,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				intgen_t saved_errno;
 				intgen_t rval;
 
-				ASSERT( recskipcnt64remaining > 0 );
+				assert( recskipcnt64remaining > 0 );
 				if ( recskipcnt64remaining > INTGENMAX ) {
 					recskipcnt = INTGENMAX;
 				} else {
 					recskipcnt = ( intgen_t )
 						     recskipcnt64remaining;
 				}
-				ASSERT( recskipcnt > 0 );
+				assert( recskipcnt > 0 );
 				rval = mt_op( contextp->dc_fd,
 					      MTFSR,
 					      recskipcnt );
@@ -1287,8 +1288,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			currentoffset = contextp->dc_reccnt
 					*
 					( off64_t )tape_recsz;
-			ASSERT( wantedoffset >= currentoffset );
-			ASSERT( wantedoffset - currentoffset
+			assert( wantedoffset >= currentoffset );
+			assert( wantedoffset - currentoffset
 				<
 				( off64_t )tape_recsz );
 		}
@@ -1303,7 +1304,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		size_t actualcnt;
 		intgen_t rval;
 
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 
 		/* figure how much to ask for. to eat an entire record,
 		 * ask for a record sans the header. do_read will eat
@@ -1318,11 +1319,11 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		if ( rval ) {
 			return rval;
 		}
-		ASSERT( actualcnt == wantedcnt );
+		assert( actualcnt == wantedcnt );
 		do_return_read_buf( drivep, dummybufp, actualcnt );
-		ASSERT( ! contextp->dc_recp );
+		assert( ! contextp->dc_recp );
 		currentoffset += ( off64_t )tape_recsz;
-		ASSERT( currentoffset
+		assert( currentoffset
 			==
 			contextp->dc_reccnt * ( off64_t )tape_recsz );
 	}
@@ -1335,8 +1336,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		char *dummybufp;
 		size_t actualcnt;
 
-		ASSERT( wantedoffset > currentoffset );
-		ASSERT( wantedoffset - currentoffset < ( off64_t )tape_recsz );
+		assert( wantedoffset > currentoffset );
+		assert( wantedoffset - currentoffset < ( off64_t )tape_recsz );
 		wantedcnt = ( size_t )( wantedoffset - currentoffset );
 		if ( contextp->dc_recp ) {
 			u_int32_t recoff;
@@ -1346,14 +1347,14 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			recoff = ( u_int32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
-			ASSERT( recoff <= tape_recsz );
-			ASSERT( rechdrp->rec_used <= tape_recsz );
-			ASSERT( recoff >= STAPE_HDR_SZ );
-			ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-			ASSERT( recoff <= rechdrp->rec_used );
-			ASSERT( recoff + wantedcnt <= rechdrp->rec_used );
+			assert( recoff <= tape_recsz );
+			assert( rechdrp->rec_used <= tape_recsz );
+			assert( recoff >= STAPE_HDR_SZ );
+			assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+			assert( recoff <= rechdrp->rec_used );
+			assert( recoff + wantedcnt <= rechdrp->rec_used );
 		} else {
-			ASSERT( wantedcnt >= STAPE_HDR_SZ );
+			assert( wantedcnt >= STAPE_HDR_SZ );
 			wantedcnt -= STAPE_HDR_SZ;
 		}
 
@@ -1366,7 +1367,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		    if ( rval ) {
 			    return rval;
 		    }
-		    ASSERT( actualcnt == wantedcnt );
+		    assert( actualcnt == wantedcnt );
 		    do_return_read_buf( drivep, dummybufp, actualcnt );
 		}
 	}
@@ -1381,18 +1382,18 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
-		ASSERT( contextp->dc_nextp >= contextp->dc_recp );
+		assert( contextp->dc_nextp >= contextp->dc_recp );
 		recoff = ( u_int32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
-		ASSERT( recoff <= tape_recsz );
-		ASSERT( rechdrp->rec_used <= tape_recsz );
-		ASSERT( recoff >= STAPE_HDR_SZ );
-		ASSERT( rechdrp->rec_used >= STAPE_HDR_SZ );
-		ASSERT( recoff <= rechdrp->rec_used );
+		assert( recoff <= tape_recsz );
+		assert( rechdrp->rec_used <= tape_recsz );
+		assert( recoff >= STAPE_HDR_SZ );
+		assert( rechdrp->rec_used >= STAPE_HDR_SZ );
+		assert( recoff <= rechdrp->rec_used );
 		currentoffset += ( off64_t )recoff;
 	}
-	ASSERT( wantedoffset == currentoffset );
+	assert( wantedoffset == currentoffset );
 
 	return 0;
 }
@@ -1425,9 +1426,9 @@ do_next_mark( drive_t *drivep )
 
 	/* assert protocol being followed.
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
 
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "drive op: next mark\n" );
@@ -1450,7 +1451,7 @@ noerrorsearch:
 		}
 		rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 
-		ASSERT( rechdrp->first_mark_offset != 0 );
+		assert( rechdrp->first_mark_offset != 0 );
 		if ( rechdrp->first_mark_offset > 0 ) {
 			 off64_t markoff = rechdrp->first_mark_offset
 					   -
@@ -1458,8 +1459,8 @@ noerrorsearch:
 			 off64_t curoff = ( off64_t )( contextp->dc_nextp
 						       -
 						       contextp->dc_recp );
-			 ASSERT( markoff > 0 );
-			 ASSERT( curoff > 0 );
+			 assert( markoff > 0 );
+			 assert( curoff > 0 );
 			 if ( markoff >= curoff ) {
 				break;
 			}
@@ -1474,7 +1475,7 @@ noerrorsearch:
 		contextp->dc_reccnt++;
 	}
 
-	ASSERT( rechdrp->first_mark_offset - rechdrp->file_offset
+	assert( rechdrp->first_mark_offset - rechdrp->file_offset
 		<=
 		( off64_t )tape_recsz );
 	contextp->dc_nextp = contextp->dc_recp
@@ -1482,8 +1483,8 @@ noerrorsearch:
 			     ( size_t )( rechdrp->first_mark_offset
 					 -
 					 rechdrp->file_offset );
-	ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
-	ASSERT( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
+	assert( contextp->dc_nextp <= contextp->dc_dataendp );
+	assert( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
 	if ( contextp->dc_nextp == contextp->dc_dataendp ) {
 		if ( ! contextp->dc_singlethreadedpr ) {
 			Ring_put( contextp->dc_ringp,
@@ -1509,7 +1510,7 @@ resetring:
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 	rechdrp = ( rec_hdr_t * )contextp->dc_recp;
@@ -1561,7 +1562,7 @@ validateread:
 	}
 
 	if ( nread >= 0 ) {
-		ASSERT( ( size_t )nread <= tape_recsz );
+		assert( ( size_t )nread <= tape_recsz );
 		mlog( MLOG_DEBUG | MLOG_DRIVE,
 		      "short read (nread == %d, record size == %d)\n",
 		      nread,
@@ -1604,24 +1605,24 @@ validatehdr:
 		goto readrecord;
 	}
 
-	ASSERT( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
+	assert( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
 	markoff = rechdrp->first_mark_offset - rechdrp->file_offset;
-	ASSERT( markoff >= ( off64_t )STAPE_HDR_SZ );
-	ASSERT( markoff < ( off64_t )tape_recsz );
-	ASSERT( rechdrp->rec_used > STAPE_HDR_SZ );
-	ASSERT( rechdrp->rec_used < tape_recsz );
+	assert( markoff >= ( off64_t )STAPE_HDR_SZ );
+	assert( markoff < ( off64_t )tape_recsz );
+	assert( rechdrp->rec_used > STAPE_HDR_SZ );
+	assert( rechdrp->rec_used < tape_recsz );
 
 	goto alliswell;
 
 alliswell:
 	contextp->dc_nextp = contextp->dc_recp + ( size_t )markoff;
-	ASSERT( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
+	assert( ! ( rechdrp->file_offset % ( off64_t )tape_recsz ));
 	contextp->dc_reccnt = rechdrp->file_offset / ( off64_t )tape_recsz;
 	contextp->dc_iocnt = contextp->dc_reccnt + 1;
 	contextp->dc_recendp = contextp->dc_recp + tape_recsz;
 	contextp->dc_dataendp = contextp->dc_recp + rechdrp->rec_used;
-	ASSERT( contextp->dc_dataendp <= contextp->dc_recendp );
-	ASSERT( contextp->dc_nextp < contextp->dc_dataendp );
+	assert( contextp->dc_dataendp <= contextp->dc_recendp );
+	assert( contextp->dc_nextp < contextp->dc_dataendp );
 	contextp->dc_errorpr = BOOL_FALSE;
 
 	mlog( MLOG_NORMAL | MLOG_DRIVE,
@@ -1696,8 +1697,8 @@ do_end_read( drive_t *drivep )
 
 	/* assert protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
 
 	if ( ! contextp->dc_singlethreadedpr ) {
 		Ring_reset( contextp->dc_ringp, contextp->dc_msgp );
@@ -1745,9 +1746,9 @@ do_begin_write( drive_t *drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( ! drivep->d_markrecheadp );
-	ASSERT( ! contextp->dc_recp );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( ! drivep->d_markrecheadp );
+	assert( ! contextp->dc_recp );
 
 	/* get pointers into global write header
 	 */
@@ -1758,7 +1759,7 @@ do_begin_write( drive_t *drivep )
 	/* must already be open. The only way to open is to do a begin_read.
 	 * so all interaction with scsi tape requires reading first.
 	 */
-	ASSERT( contextp->dc_fd != -1 );
+	assert( contextp->dc_fd != -1 );
 
 	/* get tape device status. verify tape is positioned
  	 */
@@ -1787,15 +1788,15 @@ do_begin_write( drive_t *drivep )
 	/* get a record buffer. will be used for the media file header,
 	 * and is needed to "prime the pump" for first call to do_write.
 	 */
-	ASSERT( ! contextp->dc_recp );
+	assert( ! contextp->dc_recp );
 	if ( contextp->dc_singlethreadedpr ) {
-		ASSERT( contextp->dc_bufp );
+		assert( contextp->dc_bufp );
 		contextp->dc_recp = contextp->dc_bufp;
 	} else {
-		ASSERT( contextp->dc_ringp );
-		ASSERT( ! contextp->dc_msgp );
+		assert( contextp->dc_ringp );
+		assert( ! contextp->dc_msgp );
 		contextp->dc_msgp = Ring_get( contextp->dc_ringp );
-		ASSERT( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
+		assert( contextp->dc_msgp->rm_stat == RING_STAT_INIT );
 		contextp->dc_recp = contextp->dc_msgp->rm_bufp;
 	}
 
@@ -1840,7 +1841,7 @@ do_begin_write( drive_t *drivep )
 	/* prepare the drive context. must have a record buffer ready to
 	 * go, header initialized.
 	 */
-	ASSERT( ! contextp->dc_ownedp );
+	assert( ! contextp->dc_ownedp );
 	contextp->dc_reccnt = 1; /* count the header record */
 	contextp->dc_recendp = contextp->dc_recp + tape_recsz;
 	contextp->dc_nextp = contextp->dc_recp + STAPE_HDR_SZ;
@@ -1885,15 +1886,15 @@ do_set_mark( drive_t *drivep,
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
 
 	/* calculate and fill in the mark record offset
 	 */
-	ASSERT( contextp->dc_recp );
+	assert( contextp->dc_recp );
 	nextoff = contextp->dc_reccnt * ( off64_t )tape_recsz
 		  +
 		  ( off64_t )( contextp->dc_nextp - contextp->dc_recp );
@@ -1908,7 +1909,7 @@ do_set_mark( drive_t *drivep,
 	 */
 	rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 	if ( rechdrp->first_mark_offset == -1LL ) {
-		ASSERT( nextoff != -1LL );
+		assert( nextoff != -1LL );
 		rechdrp->first_mark_offset = nextoff;
 	}
 
@@ -1921,7 +1922,7 @@ do_set_mark( drive_t *drivep,
 		drivep->d_markrecheadp = markrecp;
 		drivep->d_markrectailp = markrecp;
 	} else {
-		ASSERT( drivep->d_markrectailp );
+		assert( drivep->d_markrectailp );
 		drivep->d_markrectailp->dm_nextp = markrecp;
 		drivep->d_markrectailp = markrecp;
 	}
@@ -1948,12 +1949,12 @@ do_get_write_buf( drive_t *drivep, size_t wantedcnt, size_t *actualcntp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* figure how much is available; supply the min of what is
 	 * available and what is wanted.
@@ -2014,17 +2015,17 @@ do_write( drive_t *drivep, char *bufp, size_t retcnt )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp <= contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp <= contextp->dc_recendp );
 
 	/* verify the caller is returning exactly what is held
 	 */
-	ASSERT( bufp == contextp->dc_ownedp );
-	ASSERT( retcnt == heldcnt );
+	assert( bufp == contextp->dc_ownedp );
+	assert( retcnt == heldcnt );
 
 	/* take it back
 	 */
@@ -2065,7 +2066,7 @@ do_write( drive_t *drivep, char *bufp, size_t retcnt )
 			rval = contextp->dc_msgp->rm_rval;
 			break;
 		default:
-			ASSERT( 0 );
+			assert( 0 );
 			return DRIVE_ERROR_CORE;
 		}
 	}
@@ -2129,12 +2130,12 @@ do_get_align_cnt( drive_t * drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_errorpr );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_errorpr );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* calculate the next alignment point at or beyond the current nextp.
 	 * the following algorithm works because all buffers are page-aligned
@@ -2144,11 +2145,11 @@ do_get_align_cnt( drive_t * drivep )
 	next_alignment_off +=  PGMASK;
 	next_alignment_off &= ~PGMASK;
 	next_alignment_point = ( char * )next_alignment_off;
-	ASSERT( next_alignment_point <= contextp->dc_recendp );
+	assert( next_alignment_point <= contextp->dc_recendp );
 
 	/* return the number of bytes to the next alignment offset
 	 */
-	ASSERT( next_alignment_point >= contextp->dc_nextp );
+	assert( next_alignment_point >= contextp->dc_nextp );
 	return ( size_t )( next_alignment_point - contextp->dc_nextp );
 }
 
@@ -2175,12 +2176,12 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_recp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
-	ASSERT( contextp->dc_nextp < contextp->dc_recendp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_recp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp >= contextp->dc_recp + STAPE_HDR_SZ );
+	assert( contextp->dc_nextp < contextp->dc_recendp );
 
 	/* pre-initialize return of count of bytes committed to media
 	 */
@@ -2222,7 +2223,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 					     contextp->dc_recp,
 					     BOOL_TRUE, BOOL_TRUE );
 		} else {
-			ASSERT( contextp->dc_msgp );
+			assert( contextp->dc_msgp );
 			contextp->dc_msgp->rm_op = RING_OP_WRITE;
 			contextp->dc_msgp->rm_user = contextp->dc_reccnt;
 			Ring_put( contextp->dc_ringp,
@@ -2238,7 +2239,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 				rval = contextp->dc_msgp->rm_rval;
 				break;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_recp = 0;
 				return DRIVE_ERROR_CORE;
 			}
@@ -2265,7 +2266,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 	}
 	if ( ! contextp->dc_singlethreadedpr ) {
 		while ( ! rval ) {
-			ASSERT( contextp->dc_msgp );
+			assert( contextp->dc_msgp );
 			contextp->dc_msgp->rm_op = RING_OP_TRACE;
 			Ring_put( contextp->dc_ringp,
 				  contextp->dc_msgp );
@@ -2277,14 +2278,14 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 			switch( contextp->dc_msgp->rm_stat ) {
 			case RING_STAT_OK:
 			case RING_STAT_INIT:
-				ASSERT( rval == 0 );
+				assert( rval == 0 );
 				break;
 			case RING_STAT_ERROR:
 				rval = contextp->dc_msgp->rm_rval;
 				first_rec_w_err = contextp->dc_msgp->rm_user;
 				break;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_recp = 0;
 				return DRIVE_ERROR_CORE;
 			}
@@ -2346,11 +2347,11 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 	 * to tape.
 	 */
 	if ( rval ) {
-		ASSERT( first_rec_w_err >= 0 );
+		assert( first_rec_w_err >= 0 );
 		recs_wtn_wo_err = first_rec_w_err;
 		recs_guaranteed = recs_wtn_wo_err - contextp->dc_lostrecmax;
 	} else {
-		ASSERT( first_rec_w_err == -1 );
+		assert( first_rec_w_err == -1 );
 		recs_wtn_wo_err = contextp->dc_iocnt;
 		recs_guaranteed = recs_wtn_wo_err;
 	}
@@ -2382,14 +2383,14 @@ do_fsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_mode == OM_NONE );
 
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "drive op: fsf: count %d\n",
 	      count );
 
-	ASSERT( count );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( count );
+	assert( contextp->dc_mode == OM_NONE );
 
 	/* get tape status
   	 */
@@ -2426,7 +2427,7 @@ do_fsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 			      _("advancing tape to next media file\n") );
 
 			op_failed = 0;
-			ASSERT( contextp->dc_fd >= 0 );
+			assert( contextp->dc_fd >= 0 );
 			if ( mt_op( contextp->dc_fd, MTFSF, 1 ) ) {
 				op_failed = 1;
 			}
@@ -2482,7 +2483,7 @@ do_bsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 	      "drive op: bsf: count %d\n",
 	      count );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_mode == OM_NONE );
 
 	*statp = 0;
 
@@ -2515,7 +2516,7 @@ do_bsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 			*statp = DRIVE_ERROR_DEVICE;
 			return 0;
 		}
-		ASSERT( IS_BOT(mtstat ));
+		assert( IS_BOT(mtstat ));
 
 
 		*statp = DRIVE_ERROR_BOM;
@@ -2531,7 +2532,7 @@ do_bsf( drive_t *drivep, intgen_t count, intgen_t *statp )
 
 	/* back space - places us to left of previous file mark
 	 */
-	ASSERT( drivep->d_capabilities & DRIVE_CAP_BSF );
+	assert( drivep->d_capabilities & DRIVE_CAP_BSF );
 	mtstat = bsf_and_verify( drivep );
 
 	/* check again for beginning-of-tape condition
@@ -2606,8 +2607,8 @@ do_rewind( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "drive op: rewind\n" );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
 
 	/* use validating tape rewind util func
 	 */
@@ -2637,8 +2638,8 @@ do_erase( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "drive op: erase\n" );
 
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
 
 	/* use validating tape rewind util func
 	 */
@@ -2681,8 +2682,8 @@ do_eject_media( drive_t *drivep )
 
 	/* drive must be open
 	 */
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
 
 	/* issue tape unload
 	 */
@@ -2913,7 +2914,7 @@ read_label( drive_t *drivep )
 	/* if a read error, get status
 	 */
 	if ( nread != ( intgen_t )tape_recsz ) {
-		ASSERT( nread < ( intgen_t )tape_recsz );
+		assert( nread < ( intgen_t )tape_recsz );
 		ok = mt_get_status( drivep, &mtstat );
 		if ( ! ok ) {
 			status_failed_message( drivep );
@@ -3135,10 +3136,10 @@ set_fixed_blksz( drive_t *drivep, size_t blksz )
 
 	/* sanity checks
 	 */
-	ASSERT( blksz );
-	ASSERT( contextp->dc_isvarpr == BOOL_FALSE );
-	ASSERT( contextp->dc_cansetblkszpr );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( blksz );
+	assert( contextp->dc_isvarpr == BOOL_FALSE );
+	assert( contextp->dc_cansetblkszpr );
+	assert( contextp->dc_fd >= 0 );
 
 	/* give it two tries: first without rewinding, second with rewinding
 	 */
@@ -3213,7 +3214,7 @@ get_tpcaps( drive_t *drivep )
 {
 	drive_context_t	*contextp = ( drive_context_t * )drivep->d_contextp;
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 
 	if ( contextp->dc_isrmtpr ) {
 		/* can't ask about blksz, can't set blksz, can't ask about
@@ -3386,7 +3387,7 @@ mt_op(intgen_t fd, intgen_t sub_op, intgen_t param )
 	mop.mt_op   	= (short )sub_op;
 	mop.mt_count	= param;
 
-	ASSERT( fd >= 0 );
+	assert( fd >= 0 );
 
 	switch ( sub_op ) {
 	case MTSEEK:
@@ -3458,7 +3459,7 @@ mt_get_fileno( drive_t *drivep, long *fileno)
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: get fileno\n" );
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 
 	if ( ioctl(contextp->dc_fd, MTIOCGET, &mt_stat) < 0 ) {
 		/* failure
@@ -3491,7 +3492,7 @@ mt_get_status( drive_t *drivep, long *status)
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: get status\n" );
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 
 	if (TS_ISDRIVER) {
 		/*
@@ -3864,7 +3865,7 @@ retry:
 
 	/* shouldn't be here if drive is open
 	 */
-	ASSERT( contextp->dc_fd == -1 );
+	assert( contextp->dc_fd == -1 );
 
 	mlog( MLOG_VERBOSE | MLOG_DRIVE,
 	      _("preparing drive\n") );
@@ -3966,7 +3967,7 @@ retry:
 
 		Close( drivep );
 	}
-	ASSERT( IS_ONL( mtstat ));
+	assert( IS_ONL( mtstat ));
 
 	/* determine tape capabilities. this will set the drivep->d_capabilities
 	 * and contextp->dc_{...}blksz and dc_isQICpr, as well as recommended
@@ -4156,7 +4157,7 @@ retry:
 			      contextp->dc_recp,
 			      tape_recsz,
 			      &saved_errno );
-		ASSERT( saved_errno == 0 || nread < 0 );
+		assert( saved_errno == 0 || nread < 0 );
 
 		/* RMT can require a retry
 		 */
@@ -4536,7 +4537,7 @@ checkhdr:
 			rec_hdr_t *tprhdrp;
 			drhdrp = drivep->d_readhdrp;
 			tprhdrp = ( rec_hdr_t * )drhdrp->dh_specific;
-			ASSERT( tprhdrp->recsize >= 0 );
+			assert( tprhdrp->recsize >= 0 );
 			tape_recsz = ( size_t )tprhdrp->recsize;
 			mlog( MLOG_DEBUG | MLOG_DRIVE,
 			      "tape record size set to header's "
@@ -4657,7 +4658,7 @@ Open( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: opening drive\n" );
 
-	ASSERT( contextp->dc_fd == -1 );
+	assert( contextp->dc_fd == -1 );
 
 	errno = 0;
 	contextp->dc_fd = open( drivep->d_pathname, oflags );
@@ -4678,7 +4679,7 @@ Close( drive_t *drivep )
 	mlog( MLOG_DEBUG | MLOG_DRIVE,
 	      "tape op: closing drive\n" );
 
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_fd >= 0 );
 
 	( void )close( contextp->dc_fd );
 
@@ -4695,8 +4696,8 @@ Read( drive_t *drivep, char *bufp, size_t cnt, intgen_t *errnop )
 	      "tape op: reading %u bytes\n",
 	      cnt );
 
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( bufp );
+	assert( contextp->dc_fd >= 0 );
+	assert( bufp );
 	*errnop = 0;
 	errno = 0;
 	nread = read( contextp->dc_fd, ( void * )bufp, cnt );
@@ -4731,8 +4732,8 @@ Write( drive_t *drivep, char *bufp, size_t cnt, intgen_t *errnop )
 	      "tape op: writing %u bytes\n",
 	      cnt );
 
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( bufp );
+	assert( contextp->dc_fd >= 0 );
+	assert( bufp );
 	*errnop = 0;
 	errno = 0;
 	nwritten = write( contextp->dc_fd, ( void * )bufp, cnt );
@@ -4944,7 +4945,7 @@ read_record(  drive_t *drivep, char *bufp )
 	/* short read
 	 */
 	if ( nread >= 0 ) {
-		ASSERT( nread <= ( intgen_t )tape_recsz );
+		assert( nread <= ( intgen_t )tape_recsz );
 		mlog( MLOG_DEBUG | MLOG_DRIVE,
 		      "short read record %lld (nread == %d)\n",
 		      contextp->dc_iocnt,
@@ -5006,7 +5007,7 @@ getrec( drive_t *drivep )
 				contextp->dc_errorpr = BOOL_TRUE;
 				return contextp->dc_msgp->rm_rval;
 			default:
-				ASSERT( 0 );
+				assert( 0 );
 				contextp->dc_errorpr = BOOL_TRUE;
 				return DRIVE_ERROR_CORE;
 			}
@@ -5019,7 +5020,7 @@ getrec( drive_t *drivep )
 		contextp->dc_nextp = contextp->dc_recp
 				     +
 				     STAPE_HDR_SZ;
-		ASSERT( contextp->dc_nextp <= contextp->dc_dataendp );
+		assert( contextp->dc_nextp <= contextp->dc_dataendp );
 	}
 
 	return 0;
@@ -5055,7 +5056,7 @@ write_record(  drive_t *drivep, char *bufp, bool_t chksumpr, bool_t xlatepr )
 	}
 
 	rval = determine_write_error( drivep, nwritten, saved_errno );
-	ASSERT( rval );
+	assert( rval );
 
 	return rval;
 }
@@ -5094,7 +5095,7 @@ Ring_reset(  ring_t *ringp, ring_msg_t *msgp )
 	mlog( (MLOG_NITTY + 1) | MLOG_DRIVE,
 	      "ring op: reset\n" );
 
-	ASSERT( ringp );
+	assert( ringp );
 
 	ring_reset( ringp, msgp );
 }
@@ -5125,19 +5126,19 @@ display_ring_metrics( drive_t *drivep, intgen_t mlog_flags )
 	char *bufszsfxp;
 
 	if ( tape_recsz == STAPE_MIN_MAX_BLKSZ ) {
-		ASSERT( ! ( STAPE_MIN_MAX_BLKSZ % 0x400 ));
+		assert( ! ( STAPE_MIN_MAX_BLKSZ % 0x400 ));
 		sprintf( bufszbuf, "%u", STAPE_MIN_MAX_BLKSZ / 0x400 );
-		ASSERT( strlen( bufszbuf ) < sizeof( bufszbuf ));
+		assert( strlen( bufszbuf ) < sizeof( bufszbuf ));
 		bufszsfxp = "KB";
 	} else if ( tape_recsz == STAPE_MAX_RECSZ ) {
-		ASSERT( ! ( STAPE_MAX_RECSZ % 0x100000 ));
+		assert( ! ( STAPE_MAX_RECSZ % 0x100000 ));
 		sprintf( bufszbuf, "%u", STAPE_MAX_RECSZ / 0x100000 );
-		ASSERT( strlen( bufszbuf ) < sizeof( bufszbuf ));
+		assert( strlen( bufszbuf ) < sizeof( bufszbuf ));
 		bufszsfxp = "MB";
 	} else if ( tape_recsz == STAPE_MAX_LINUX_RECSZ ) {
-		ASSERT( ! ( STAPE_MAX_LINUX_RECSZ % 0x100000 ));
+		assert( ! ( STAPE_MAX_LINUX_RECSZ % 0x100000 ));
 		sprintf( bufszbuf, "%u", STAPE_MAX_LINUX_RECSZ / 0x100000 );
-		ASSERT( strlen( bufszbuf ) < sizeof( bufszbuf ));
+		assert( strlen( bufszbuf ) < sizeof( bufszbuf ));
 		bufszsfxp = "MB";
 	} else {
 		bufszsfxp = "";
common/drive_simple.c +76 -75
index 2b0447d..2e57d8c 100644
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <sched.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -185,7 +186,7 @@ ds_match( int argc, char *argv[], drive_t *drivep )
 
 	/* sanity checks
 	 */
-	ASSERT( ! ( sizeofmember( drive_context_t, dc_buf ) % PGSZ ));
+	assert( ! ( sizeofmember( drive_context_t, dc_buf ) % PGSZ ));
 
 	/* determine if this is an rmt file. if so, give a weak match:
 	 * might be an ordinary file accessed via the rmt protocol.
@@ -234,8 +235,8 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 	 */
 	contextp = ( drive_context_t * )memalign( PGSZ,
 						  sizeof( drive_context_t ));
-	ASSERT( contextp );
-	ASSERT( ( void * )contextp->dc_buf == ( void * )contextp );
+	assert( contextp );
+	assert( ( void * )contextp->dc_buf == ( void * )contextp );
 	memset( ( void * )contextp, 0, sizeof( *contextp ));
 
 	/* scan drive device pathname to see if remote tape
@@ -439,9 +440,9 @@ do_begin_read( drive_t *drivep )
 
 	/* verify protocol being followed
 	 */
-	ASSERT( dcaps & DRIVE_CAP_READ );
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( dcaps & DRIVE_CAP_READ );
+	assert( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
 
 	/* can only read one media file
 	 */
@@ -484,7 +485,7 @@ do_begin_read( drive_t *drivep )
 		free(tmphdr);
 		return rval;
 	}
-	ASSERT( ( size_t )nread == GLOBAL_HDR_SZ );
+	assert( ( size_t )nread == GLOBAL_HDR_SZ );
 
 	mlog(MLOG_NITTY, "do_begin_read: global_hdr\n"
 	     "\tgh_magic %.100s\n"
@@ -585,9 +586,9 @@ do_read( drive_t *drivep,
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( wantedcnt > 0 );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
+	assert( wantedcnt > 0 );
 
 	/* pre-initialize reference return
 	 */
@@ -595,7 +596,7 @@ do_read( drive_t *drivep,
 
 	/* count number of unread bytes in buffer
 	 */
-	ASSERT( contextp->dc_emptyp >= contextp->dc_nextp );
+	assert( contextp->dc_emptyp >= contextp->dc_nextp );
 	remainingcnt = ( size_t )( contextp->dc_emptyp - contextp->dc_nextp );
 
 	/* if no unread bytes in buffer, refill
@@ -628,7 +629,7 @@ do_read( drive_t *drivep,
 		/* record the ptrs to the first empty byte and the next
 		 * byte to be read
 		 */
-		ASSERT( nread <= BUFSZ );
+		assert( nread <= BUFSZ );
 		contextp->dc_emptyp = contextp->dc_buf + nread;
 		contextp->dc_nextp = contextp->dc_buf;
 
@@ -656,7 +657,7 @@ do_read( drive_t *drivep,
 	/* advance the next ptr to the next byte to be supplied
 	 */
 	contextp->dc_nextp += actualcnt;
-	ASSERT( contextp->dc_nextp <= contextp->dc_emptyp );
+	assert( contextp->dc_nextp <= contextp->dc_emptyp );
 
 	/* return the actual number of bytes supplied, and a ptr to the first
 	 */
@@ -681,17 +682,17 @@ do_return_read_buf( drive_t *drivep, char *retp, size_t retcnt )
 
 	/* verify protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( contextp->dc_ownedp );
 
 	/* verify returning right buffer
 	 */
-	ASSERT( retp == contextp->dc_ownedp );
+	assert( retp == contextp->dc_ownedp );
 
 	/* verify all of buffer provided is being returned
 	 */
 	ownedcnt = ( size_t )( contextp->dc_nextp - contextp->dc_ownedp );
-	ASSERT( retcnt == ownedcnt );
+	assert( retcnt == ownedcnt );
 
 	/* indicate nothing now owned by caller
 	 */
@@ -713,8 +714,8 @@ do_get_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
 
 	/* calculate the offset of the next byte to be supplied relative to
 	 * the beginning of the buffer and relative to the beginning of
@@ -746,8 +747,8 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
 
 	/* calculate the current offset within the media file
 	 * of the next byte to be read
@@ -784,7 +785,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 	 */
 	nextoff = ( off64_t )( contextp->dc_nextp - contextp->dc_buf );
 	strmoff = contextp->dc_bufstroff + nextoff;
-	ASSERT( strmoff == mark );
+	assert( strmoff == mark );
 
 	return 0;
 }
@@ -808,9 +809,9 @@ do_next_mark( drive_t *drivep )
 
 	/* assert protocol
 	 */
-	ASSERT( dcaps & DRIVE_CAP_NEXTMARK );
-	ASSERT( contextp->dc_mode == OM_READ );
-	ASSERT( ! contextp->dc_ownedp );
+	assert( dcaps & DRIVE_CAP_NEXTMARK );
+	assert( contextp->dc_mode == OM_READ );
+	assert( ! contextp->dc_ownedp );
 
 	if ( ! mark ) {
 		return DRIVE_ERROR_EOF;
@@ -837,13 +838,13 @@ do_end_read( drive_t *drivep )
 
 	/* be sure we are following protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_READ );
+	assert( contextp->dc_mode == OM_READ );
 	contextp->dc_mode = OM_NONE;
 
 	/* bump the file mark cnt
 	 */
 	contextp->dc_fmarkcnt++;
-	ASSERT( contextp->dc_fmarkcnt == 1 );
+	assert( contextp->dc_fmarkcnt == 1 );
 }
 
 /* begin_write - prepare file for writing
@@ -871,12 +872,12 @@ do_begin_write( drive_t *drivep )
 
 	/* sanity checks
 	 */
-	ASSERT( dwhdrp->dh_strategyid == DRIVE_STRATEGY_SIMPLE );
+	assert( dwhdrp->dh_strategyid == DRIVE_STRATEGY_SIMPLE );
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_fd >= 0 );
-	ASSERT( contextp->dc_mode == OM_NONE );
+	assert( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
 
 	/* only one media file may be written
 	 */
@@ -918,7 +919,7 @@ do_begin_write( drive_t *drivep )
 	contextp->dc_mode = OM_WRITE;
 
 	tmphdr = (global_hdr_t *)malloc(GLOBAL_HDR_SZ);
-	ASSERT(tmphdr);
+	assert(tmphdr);
 	memset(tmphdr, 0, GLOBAL_HDR_SZ);
 	tmpdh = (drive_hdr_t *)tmphdr->gh_upper;
 	tmpmh = (media_hdr_t *)tmpdh->dh_upper;
@@ -997,9 +998,9 @@ do_set_mark( drive_t *drivep,
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_nextp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_nextp );
 
 	/* calculate the mark offset
 	 */
@@ -1053,7 +1054,7 @@ do_set_mark( drive_t *drivep,
 
 			/* assert the header has been flushed
 			 */
-			ASSERT( contextp->dc_bufstroff >= sizeof( *gwhdrp ));
+			assert( contextp->dc_bufstroff >= sizeof( *gwhdrp ));
 
 			/* record mark in hdr
 			 */
@@ -1082,7 +1083,7 @@ do_set_mark( drive_t *drivep,
 				content_hdr_t		*ch = (content_hdr_t *)mh->mh_upper;
 				content_inode_hdr_t	*cih = (content_inode_hdr_t *)ch->ch_specific;
 
-				ASSERT( newoff == 0 );
+				assert( newoff == 0 );
 
 				/* write and seek back to current offset
 				 */
@@ -1092,7 +1093,7 @@ do_set_mark( drive_t *drivep,
 				     "(on media)\n" );
 
 				tmphdr = (global_hdr_t *)malloc(GLOBAL_HDR_SZ);
-				ASSERT(tmphdr);
+				assert(tmphdr);
 				tmpdh = (drive_hdr_t *)tmphdr->gh_upper;
 				tmpmh = (media_hdr_t *)tmpdh->dh_upper;
 				tmpch = (content_hdr_t *)tmpmh->mh_upper;
@@ -1129,13 +1130,13 @@ do_set_mark( drive_t *drivep,
 				nwritten = write( contextp->dc_fd,
 						  tmphdr,
 						  sizeof( *tmphdr ));
-				ASSERT( ( size_t )nwritten == sizeof( *tmphdr ));
+				assert( ( size_t )nwritten == sizeof( *tmphdr ));
 				free(tmphdr);
 
 				newoff = lseek64( contextp->dc_fd,
 						  contextp->dc_bufstroff,
 						  SEEK_SET );
-				ASSERT( newoff == contextp->dc_bufstroff );
+				assert( newoff == contextp->dc_bufstroff );
 			}
 		}
 	}
@@ -1144,7 +1145,7 @@ do_set_mark( drive_t *drivep,
 	 * otherwise put the mark record on the tail of the queue.
 	 */
 	if ( contextp->dc_nextp == contextp->dc_buf ) {
-		ASSERT( drivep->d_markrecheadp == 0 );
+		assert( drivep->d_markrecheadp == 0 );
 		( * cbfuncp )( cbcontextp, markrecp, BOOL_TRUE );
 		return;
 	} else {
@@ -1155,7 +1156,7 @@ do_set_mark( drive_t *drivep,
 			drivep->d_markrecheadp = markrecp;
 			drivep->d_markrectailp = markrecp;
 		} else {
-			ASSERT( drivep->d_markrectailp );
+			assert( drivep->d_markrectailp );
 			drivep->d_markrectailp->dm_nextp = markrecp;
 			drivep->d_markrectailp = markrecp;
 		}
@@ -1180,11 +1181,11 @@ do_get_write_buf( drive_t *drivep, size_t wanted_bufsz, size_t *actual_bufszp )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_emptyp );
-	ASSERT( contextp->dc_ownedsz == 0 );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_emptyp );
+	assert( contextp->dc_ownedsz == 0 );
 
 	/* calculate how much buffer remains
 	 */
@@ -1237,18 +1238,18 @@ do_write( drive_t *drivep, char *bufp, size_t writesz )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( contextp->dc_ownedp );
-	ASSERT( bufp == contextp->dc_ownedp );
-	ASSERT( ! contextp->dc_nextp );
-	ASSERT( contextp->dc_ownedp < contextp->dc_emptyp );
-	ASSERT( writesz == contextp->dc_ownedsz );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( contextp->dc_ownedp );
+	assert( bufp == contextp->dc_ownedp );
+	assert( ! contextp->dc_nextp );
+	assert( contextp->dc_ownedp < contextp->dc_emptyp );
+	assert( writesz == contextp->dc_ownedsz );
 
 	/* calculate next portion of buffer available for get_write_buf,
 	 * and indicate no portion is owned.
 	 */
 	contextp->dc_nextp = contextp->dc_ownedp + writesz;
-	ASSERT( contextp->dc_nextp <= contextp->dc_emptyp );
+	assert( contextp->dc_nextp <= contextp->dc_emptyp );
 	contextp->dc_ownedp = 0;
 	contextp->dc_ownedsz = 0;
 
@@ -1304,10 +1305,10 @@ do_get_align_cnt( drive_t *drivep )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_emptyp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_emptyp );
 
 	/* calculate the next alignment point at or beyond the current nextp.
 	 * the following algorithm works because dc_buf is page-aligned and
@@ -1317,7 +1318,7 @@ do_get_align_cnt( drive_t *drivep )
 	next_alignment_off +=  PGMASK;
 	next_alignment_off &= ~PGMASK;
 	next_alignment_point = ( char * )next_alignment_off;
-	ASSERT( next_alignment_point <= contextp->dc_emptyp );
+	assert( next_alignment_point <= contextp->dc_emptyp );
 
 	/* return the number of bytes to the next alignment point
 	 */
@@ -1338,14 +1339,14 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_WRITE );
-	ASSERT( ! contextp->dc_ownedp );
-	ASSERT( contextp->dc_nextp );
-	ASSERT( contextp->dc_nextp < contextp->dc_emptyp );
+	assert( contextp->dc_mode == OM_WRITE );
+	assert( ! contextp->dc_ownedp );
+	assert( contextp->dc_nextp );
+	assert( contextp->dc_nextp < contextp->dc_emptyp );
 
 	/* calculate length of un-written portion of buffer
 	 */
-	ASSERT( contextp->dc_nextp >= contextp->dc_buf );
+	assert( contextp->dc_nextp >= contextp->dc_buf );
 	remaining_bufsz = ( size_t )( contextp->dc_nextp - contextp->dc_buf );
 
 	if ( remaining_bufsz ) {
@@ -1387,7 +1388,7 @@ do_end_write( drive_t *drivep, off64_t *ncommittedp )
 	/* bump the file mark cnt
 	 */
 	contextp->dc_fmarkcnt++;
-	ASSERT( contextp->dc_fmarkcnt == 1 );
+	assert( contextp->dc_fmarkcnt == 1 );
 
 	*ncommittedp = contextp->dc_bufstroff;
 	contextp->dc_mode = OM_NONE;
@@ -1410,15 +1411,15 @@ do_rewind( drive_t *drivep )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( dcaps & DRIVE_CAP_REWIND );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( dcaps & DRIVE_CAP_REWIND );
+	assert( contextp->dc_fd >= 0 );
 
 	/* seek to beginning of file
 	 */
 	newoff = lseek64( contextp->dc_fd, ( off64_t )0, SEEK_SET );
 	if ( newoff ) {
-		ASSERT( newoff < 0 );
+		assert( newoff < 0 );
 		mlog( MLOG_NORMAL | MLOG_WARNING | MLOG_DRIVE,
 		      _("could not rewind %s: %s\n"),
 		      drivep->d_pathname,
@@ -1446,15 +1447,15 @@ do_erase( drive_t *drivep )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( dcaps & DRIVE_CAP_ERASE );
-	ASSERT( contextp->dc_fd >= 0 );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( dcaps & DRIVE_CAP_ERASE );
+	assert( contextp->dc_fd >= 0 );
 
 	/* seek to beginning of file
 	 */
 	newoff = lseek64( contextp->dc_fd, ( off64_t )0, SEEK_SET );
 	if ( newoff ) {
-		ASSERT( newoff < 0 );
+		assert( newoff < 0 );
 		mlog( MLOG_NORMAL | MLOG_WARNING | MLOG_DRIVE,
 		      _("could not rewind %s in prep for erase: %s\n"),
 		      drivep->d_pathname,
@@ -1486,7 +1487,7 @@ do_get_device_class( drive_t *drivep )
 {
 	mlog( MLOG_NITTY | MLOG_DRIVE,
 	      "drive_simple get_device_class( )\n" );
-	ASSERT( drivep );
+	assert( drivep );
 	return DEVICE_NONREMOVABLE;
 }
 
@@ -1500,8 +1501,8 @@ do_quit( drive_t *drivep )
 
 	/* assert protocol
 	 */
-	ASSERT( contextp->dc_mode == OM_NONE );
-	ASSERT( contextp );
+	assert( contextp->dc_mode == OM_NONE );
+	assert( contextp );
 
 	/* close file
 	 */
common/fs.c +12 -11
index 6f4cb6c..b77f6cc 100644
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <mntent.h>
 #include <sys/ioctl.h>
+#include <assert.h>
 
 #include "types.h"
 #include "mlog.h"
@@ -127,11 +128,11 @@ fs_info( char *typb,		/* out */
 	if ( canstat && ( statb.st_mode & S_IFMT ) == S_IFBLK ) {
 		if ( ( tep = fs_tab_lookup_blk( usrs )) != 0 ) {
 			blks = tep->fte_blks;
-			ASSERT( strlen( blks ) < ( size_t )blkbz );
+			assert( strlen( blks ) < ( size_t )blkbz );
 			strcpy( blkb, blks );
 			mnts = tep->fte_mnts;
 			if ( mnts ) {
-				ASSERT( strlen( mnts ) < ( size_t )mntbz );
+				assert( strlen( mnts ) < ( size_t )mntbz );
 				strcpy( mntb, mnts );
 			} else {
 				mntb[ 0 ] = 0;
@@ -139,7 +140,7 @@ fs_info( char *typb,		/* out */
 			if ( ( typs = tep->fte_typs ) == 0 ) {
 				typs = typd;
 			}
-			ASSERT( strlen( typs ) < ( size_t )typbz );
+			assert( strlen( typs ) < ( size_t )typbz );
 			strcpy( typb, typs );
 			ok = BOOL_TRUE;
 		} else {
@@ -147,13 +148,13 @@ fs_info( char *typb,		/* out */
 		}
 	} else if ( ( tep = fs_tab_lookup_mnt( usrs )) != 0 ) {
 		blks = tep->fte_blks;
-		ASSERT( strlen( blks ) < ( size_t )blkbz );
+		assert( strlen( blks ) < ( size_t )blkbz );
 		strcpy( blkb, blks );
 		mnts = tep->fte_mnts;
-		ASSERT( strlen( mnts ) < ( size_t )mntbz );
+		assert( strlen( mnts ) < ( size_t )mntbz );
 		strcpy( mntb, mnts );
 		typs = tep->fte_typs;
-		ASSERT( strlen( typs ) < ( size_t )typbz );
+		assert( strlen( typs ) < ( size_t )typbz );
 		strcpy( typb, typs );
 		ok = BOOL_TRUE;
 	} else {
@@ -161,7 +162,7 @@ fs_info( char *typb,		/* out */
 	}
 
 	fs_tab_free( );
-	ASSERT( ok != BOOL_UNKNOWN );
+	assert( ok != BOOL_UNKNOWN );
 
 	if ( ok == BOOL_TRUE ) {
 		intgen_t rval = fs_getid( mntb, idb );
@@ -281,11 +282,11 @@ fs_tab_ent_build( struct mntent *mntentp )
 	char *cp;
 
 	tep = ( fs_tab_ent_t * )calloc( 1, sizeof( fs_tab_ent_t ));
-	ASSERT( tep );
+	assert( tep );
 
 	if ( mntentp->mnt_dir ) {
 		cp = calloc( 1, strlen( mntentp->mnt_dir ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_dir );
 		tep->fte_mnts = cp;
 	} else {
@@ -294,7 +295,7 @@ fs_tab_ent_build( struct mntent *mntentp )
 
 	if ( mntentp->mnt_type ) {
 		cp = calloc( 1, strlen( mntentp->mnt_type ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_type );
 		tep->fte_typs = cp;
 	} else {
@@ -303,7 +304,7 @@ fs_tab_ent_build( struct mntent *mntentp )
 
 	if ( mntentp->mnt_fsname ) {
 		cp = calloc( 1, strlen( mntentp->mnt_fsname ) + 1 );
-		ASSERT( cp );
+		assert( cp );
 		( void )strcpy( cp, mntentp->mnt_fsname );
 		tep->fte_blks = cp;
 	} else {
common/global.c +7 -6
index 8e49d8b..ed844cc 100644
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <errno.h>
+#include <assert.h>
 
 #include "types.h"
 #include "util.h"
@@ -67,13 +68,13 @@ global_hdr_alloc( intgen_t argc, char *argv[ ] )
 
 	/* sanity checks
 	 */
-	ASSERT( sizeof( time32_t ) == GLOBAL_HDR_TIME_SZ );
-	ASSERT( sizeof( uuid_t ) == GLOBAL_HDR_UUID_SZ );
+	assert( sizeof( time32_t ) == GLOBAL_HDR_TIME_SZ );
+	assert( sizeof( uuid_t ) == GLOBAL_HDR_UUID_SZ );
 
 	/* allocate a global hdr
 	 */
 	ghdrp = ( global_hdr_t * )calloc( 1, sizeof( global_hdr_t ));
-	ASSERT( ghdrp );
+	assert( ghdrp );
 
 	/* fill in the magic number
 	 */
@@ -326,7 +327,7 @@ prompt_label( char *bufp, size_t bufsz )
 	preamblestr[ preamblecnt++ ] = "\n";
 	preamblestr[ preamblecnt++ ] = fold;
 	preamblestr[ preamblecnt++ ] = "\n\n";
-	ASSERT( preamblecnt <= PREAMBLEMAX );
+	assert( preamblecnt <= PREAMBLEMAX );
 	dlog_begin( preamblestr, preamblecnt );
 
 	responseix = dlog_string_query( prompt_label_cb,
@@ -348,7 +349,7 @@ prompt_label( char *bufp, size_t bufsz )
 		ackstr[ ackcnt++ ] = _("session label left blank\n");
 	}
 
-	ASSERT( ackcnt <= ACKMAX );
+	assert( ackcnt <= ACKMAX );
 	dlog_string_ack( ackstr,
 			 ackcnt );
 
@@ -357,7 +358,7 @@ prompt_label( char *bufp, size_t bufsz )
 	postamblestr[ postamblecnt++ ] = "\n";
 	postamblestr[ postamblecnt++ ] = fold;
 	postamblestr[ postamblecnt++ ] = "\n\n";
-	ASSERT( postamblecnt <= POSTAMBLEMAX );
+	assert( postamblecnt <= POSTAMBLEMAX );
 	dlog_end( postamblestr,
 		  postamblecnt );
 
common/hsmapi.c +1 -0
index 7f9b45e..0bca9ff 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <attr/attributes.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "hsmapi.h"
 #include "mlog.h"
common/inventory.c +17 -16
index fb27048..681d28f 100644
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <assert.h>
 
 #include "types.h"
 #include "inventory_priv.h"
@@ -51,7 +52,7 @@ inv_open( inv_predicate_t bywhat, void *pred )
 
 	int index = 0;
 
-	ASSERT ( pred );
+	assert ( pred );
 	if ((fd = init_idb ( pred, bywhat, uuname, &tok )) < 0 )
 		return tok;
 
@@ -66,7 +67,7 @@ inv_open( inv_predicate_t bywhat, void *pred )
 		return INV_TOKEN_NULL;
 	}
 
-	ASSERT ( index > 0 );
+	assert ( index > 0 );
 
 	/* Now we need to make sure that this has enough space */
 	num = GET_SESCOUNTERS( stobjfd, &sescnt );
@@ -145,7 +146,7 @@ inv_lasttime_level_lessthan(
 	time32_t **tm )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	rval =  search_invt( tok, level, (void **) tm,
 			 (search_callback_t) tm_level_lessthan );
@@ -170,7 +171,7 @@ inv_lastsession_level_lessthan(
 	inv_session_t 	**ses )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	rval = search_invt( tok, level, (void **) ses, 
 			  (search_callback_t) lastsess_level_lessthan );
@@ -197,7 +198,7 @@ inv_lastsession_level_equalto(
 	inv_session_t	**ses )
 {
 	int 	rval;
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 	rval = search_invt( tok, level, (void **) ses, 
 			  (search_callback_t) lastsess_level_equalto );
 
@@ -236,8 +237,8 @@ inv_writesession_open(
 	invt_seshdr_t  	hdr;
 	inv_sestoken_t	sestok;
 
-	ASSERT ( tok != INV_TOKEN_NULL );
-	ASSERT ( sesid && fsid && mntpt && devpath );
+	assert ( tok != INV_TOKEN_NULL );
+	assert ( sesid && fsid && mntpt && devpath );
 
 	if ( ! ( tok->d_update_flag & FSTAB_UPDATED ) ) {
 		if ( put_fstab_entry( fsid, mntpt, devpath ) < 0 ) {
@@ -264,7 +265,7 @@ inv_writesession_open(
 
 	fd = tok->d_stobj_fd;
 
-	ASSERT ( fd > 0 );
+	assert ( fd > 0 );
 
 	hdr.sh_time = time;
 	hdr.sh_level = level;	
@@ -286,7 +287,7 @@ inv_writesession_open(
 	/* create the writesession, and get ready for the streams to come 
 	   afterwards */
 	rval = create_session( sestok, fd, sescnt, ses, &hdr );
-	ASSERT (rval > 0);
+	assert (rval > 0);
 
 
 	INVLOCK( fd, LOCK_UN );
@@ -324,7 +325,7 @@ inv_writesession_close( inv_sestoken_t tok )
 {
 	int		rval;
 
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	/* now update end_time in the inv index header */
 	rval = put_sesstime( tok, INVT_ENDTIME );
@@ -354,7 +355,7 @@ inv_stream_open(
 	invt_seshdr_t  seshdr;
 	int fd;
 
-	ASSERT ( tok != INV_TOKEN_NULL );
+	assert ( tok != INV_TOKEN_NULL );
 
 	stream.st_nmediafiles = 0;
 	stream.st_interrupted = BOOL_FALSE;
@@ -505,9 +506,9 @@ inv_put_mediafile(
 	int 		 rval;
 
 
-	ASSERT ( tok != INV_TOKEN_NULL );
-	ASSERT ( tok->md_sesstok->sd_invtok->d_update_flag & FSTAB_UPDATED );
-	ASSERT ( tok->md_sesstok->sd_invtok->d_stobj_fd >= 0 );
+	assert ( tok != INV_TOKEN_NULL );
+	assert ( tok->md_sesstok->sd_invtok->d_update_flag & FSTAB_UPDATED );
+	assert ( tok->md_sesstok->sd_invtok->d_stobj_fd >= 0 );
 
 	mf = (invt_mediafile_t *) calloc( 1, sizeof( invt_mediafile_t ) );
 
@@ -627,8 +628,8 @@ inv_get_session(
 	void		      **bufpp,	/* buf to fill */
 	size_t		       *bufszp )/* size of that buffer */
 {
-	ASSERT( tok != INV_TOKEN_NULL );
-	ASSERT( tok->sd_invtok );
+	assert( tok != INV_TOKEN_NULL );
+	assert( tok->sd_invtok );
 
 	/* First get the session header, and the session information. Then
 	   we can figure out how much space to allocate */
common/lock.c +2 -1
index ab5b210..347f6cd 100644
@@ -18,6 +18,7 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+#include <assert.h>
 
 #include "types.h"
 #include "qlock.h"
@@ -30,7 +31,7 @@ lock_init( void )
 {
 	/* initialization sanity checks
 	 */
-	ASSERT( lock_qlockh == QLOCKH_NULL );
+	assert( lock_qlockh == QLOCKH_NULL );
 
 	/* allocate a qlock
 	 */
common/main.c +50 -49
index 8e7451f..f392856 100644
@@ -33,6 +33,7 @@
 #include <stdint.h>
 #include <sched.h>
 #include <pthread.h>
+#include <assert.h>
 
 #include "exit.h"
 #include "types.h"
@@ -161,14 +162,14 @@ main( int argc, char *argv[] )
 
 	/* sanity checks
 	 */
-	ASSERT( sizeof( char_t ) == 1 );
-	ASSERT( sizeof( u_char_t ) == 1 );
-	ASSERT( sizeof( int32_t ) == 4 );
-	ASSERT( sizeof( u_int32_t ) == 4 );
-	ASSERT( sizeof( size32_t ) == 4 );
-	ASSERT( sizeof( int64_t ) == 8 );
-	ASSERT( sizeof( u_int64_t ) == 8 );
-	ASSERT( sizeof( size64_t ) == 8 );
+	assert( sizeof( char_t ) == 1 );
+	assert( sizeof( u_char_t ) == 1 );
+	assert( sizeof( int32_t ) == 4 );
+	assert( sizeof( u_int32_t ) == 4 );
+	assert( sizeof( size32_t ) == 4 );
+	assert( sizeof( int64_t ) == 8 );
+	assert( sizeof( u_int64_t ) == 8 );
+	assert( sizeof( size64_t ) == 8 );
 
 	/* record the command name used to invoke
 	 */
@@ -365,7 +366,7 @@ main( int argc, char *argv[] )
 	mlog( MLOG_DEBUG | MLOG_PROC,
 	      "getpagesize( ) returns %u\n",
 	      pgsz );
-	ASSERT( ( intgen_t )pgsz > 0 );
+	assert( ( intgen_t )pgsz > 0 );
 	pgmask = pgsz - 1;
 
 	/* report parent tid
@@ -792,7 +793,7 @@ main( int argc, char *argv[] )
 			mlog_exit_hint(RV_INTR);
 			stop_in_progress = BOOL_TRUE;
 			cldmgr_stop( );
-			ASSERT( stop_timeout >= 0 );
+			assert( stop_timeout >= 0 );
 			stop_deadline = now + ( time32_t )stop_timeout;
 		}
 
@@ -1146,7 +1147,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 				return BOOL_FALSE;
 			}
 			optfilename = optarg;
-			ASSERT( optind > 2 );
+			assert( optind > 2 );
 			optfileix = ( ix_t )optind - 2;
 			break;
 		}
@@ -1211,7 +1212,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 	/* allocate an argument buffer
 	 */
 	argbuf = ( char * )malloc( sz );
-	ASSERT( argbuf );
+	assert( argbuf );
 
 	/* copy arg0 (the executable's name ) in first
 	 */
@@ -1233,7 +1234,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 		close( fd );
 		return BOOL_FALSE;
 	}
-	ASSERT( ( off64_t )nread == stat.st_size );
+	assert( ( off64_t )nread == stat.st_size );
 	p += ( size_t )stat.st_size;
 	*p++ = ' ';
 
@@ -1251,7 +1252,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 	/* null-terminate the entire buffer
 	 */
 	*p++ = 0;
-	ASSERT( ( size_t )( p - argbuf ) <= sz );
+	assert( ( size_t )( p - argbuf ) <= sz );
 
 	/* change newlines and carriage returns into spaces
 	 */
@@ -1303,7 +1304,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 	/* allocate a new argv array to hold the tokens
 	 */
 	newargv = ( char ** )calloc( tokencnt, sizeof( char * ));
-	ASSERT( newargv );
+	assert( newargv );
 
 	/* null-terminate tokens and place in new argv, after
 	 * extracting quotes and escapes
@@ -1326,7 +1327,7 @@ loadoptfile( intgen_t *argcp, char ***argvp )
 
 		/* better not disagree with counting scan!
 		 */
-		ASSERT( i < ( intgen_t )tokencnt );
+		assert( i < ( intgen_t )tokencnt );
 
 		/* find the end of the first token
 		 */
@@ -1533,7 +1534,7 @@ sigint_dialog( void )
 			_("\nsession interrupt in progress\n");
 	}
 	preamblestr[ preamblecnt++ ] = "\n";
-	ASSERT( preamblecnt <= PREAMBLEMAX );
+	assert( preamblecnt <= PREAMBLEMAX );
 	dlog_begin( preamblestr, preamblecnt );
 
 	/* top-level query: a function of session interrupt status
@@ -1541,7 +1542,7 @@ sigint_dialog( void )
 	querycnt = 0;
 	querystr[ querycnt++ ] = _("please select one of "
 				 "the following operations\n");
-	ASSERT( querycnt <= QUERYMAX );
+	assert( querycnt <= QUERYMAX );
 	choicecnt = 0;
 	if ( ! stop_in_progress ) {
 		interruptix = choicecnt;
@@ -1564,7 +1565,7 @@ sigint_dialog( void )
 	choicestr[ choicecnt++ ] = _("other controls");
 	continueix = choicecnt;
 	choicestr[ choicecnt++ ] = _("continue");
-	ASSERT( choicecnt <= CHOICEMAX );
+	assert( choicecnt <= CHOICEMAX );
 
 	responseix = dlog_multi_query( querystr,
 				       querycnt,
@@ -1586,13 +1587,13 @@ sigint_dialog( void )
 				ackcnt );
 		querycnt = 0;
 		querystr[ querycnt++ ] = _("please confirm\n");
-		ASSERT( querycnt <= QUERYMAX );
+		assert( querycnt <= QUERYMAX );
 		choicecnt = 0;
 		interruptix = choicecnt;
 		choicestr[ choicecnt++ ] = _("interrupt this session");
 		nochangeix = choicecnt;
 		choicestr[ choicecnt++ ] = _("continue");
-		ASSERT( choicecnt <= CHOICEMAX );
+		assert( choicecnt <= CHOICEMAX );
 		responseix = dlog_multi_query( querystr,
 					       querycnt,
 					       choicestr,
@@ -1623,7 +1624,7 @@ sigint_dialog( void )
 		querycnt = 0;
 		querystr[ querycnt++ ] = _("please select one of "
 					 "the following subsystems\n");
-		ASSERT( querycnt <= QUERYMAX );
+		assert( querycnt <= QUERYMAX );
 		choicecnt = 0;
 		/* number of lines must match number of subsystems
 		 */
@@ -1634,7 +1635,7 @@ sigint_dialog( void )
 		choicestr[ choicecnt++ ] = _("all of the above");
 		nochangeix = choicecnt;
 		choicestr[ choicecnt++ ] = _("no change");
-		ASSERT( choicecnt <= CHOICEMAX );
+		assert( choicecnt <= CHOICEMAX );
 		responseix = dlog_multi_query( querystr,
 					       querycnt,
 					       choicestr,
@@ -1664,7 +1665,7 @@ sigint_dialog( void )
 			querycnt = 0;
 			querystr[ querycnt++ ] = ("please select one of the "
 						  "following verbosity levels\n");
-			ASSERT( querycnt <= QUERYMAX );
+			assert( querycnt <= QUERYMAX );
 			choicecnt = 0;
 			choicestr[ choicecnt++ ] = _("silent");
 			choicestr[ choicecnt++ ] = _("verbose");
@@ -1674,7 +1675,7 @@ sigint_dialog( void )
 			choicestr[ choicecnt++ ] = _("nitty + 1");
 			nochangeix = choicecnt;
 			choicestr[ choicecnt++ ] = _("no change");
-			ASSERT( choicecnt <= CHOICEMAX );
+			assert( choicecnt <= CHOICEMAX );
 			responseix = dlog_multi_query( querystr,
 						       querycnt,
 						       choicestr,
@@ -1708,7 +1709,7 @@ sigint_dialog( void )
 			} else {
 				if ( ssselected < 0 ) {
 					ix_t ssix;
-					ASSERT( ssselected == -1 );
+					assert( ssselected == -1 );
 					for ( ssix = 0
 					      ;
 					      ssix < MLOG_SS_CNT
@@ -1734,7 +1735,7 @@ sigint_dialog( void )
 		querycnt = 0;
 		querystr[ querycnt++ ] = _("please select one of "
 					  "the following metrics\n");
-		ASSERT( querycnt <= QUERYMAX );
+		assert( querycnt <= QUERYMAX );
 		choicecnt = 0;
 		ioix = choicecnt;
 		choicestr[ choicecnt++ ] = _("I/O");
@@ -1746,7 +1747,7 @@ sigint_dialog( void )
 #endif /* RESTORE */
 		nochangeix = choicecnt;
 		choicestr[ choicecnt++ ] = _("continue");
-		ASSERT( choicecnt <= CHOICEMAX );
+		assert( choicecnt <= CHOICEMAX );
 		responseix = dlog_multi_query( querystr,
 					       querycnt,
 					       choicestr,
@@ -1779,11 +1780,11 @@ sigint_dialog( void )
 		if ( responseix != nochangeix ) {
 			querycnt = 0;
 			querystr[ querycnt++ ] = "\n";
[… more lines in the raw message]

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

common/media.c +11 -10
index 4ad7776..53b94d1 100644

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

common/mlog.c +11 -10
index b0135b9..c546036 100644

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

common/openutil.c +2 -1
index 9a88d67..c3b8d9a 100644

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

common/path.c +13 -12
index ca24f6a..e40c473 100644

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

common/qlock.c +15 -14
index ae8466d..d88917c 100644

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

common/ring.c +33 -32
index 0d2feb0..f3de7c4 100644

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

common/stream.c +8 -7
index 6704661..0db1be3 100644

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

common/util.c +21 -20
index 73f18fe..1dc6d6c 100644

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

dump/content.c +120 -119
index 5f7b4d9..3682358 100644

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

dump/inomap.c +10 -9
index a35059a..7a3069f 100644

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

inventory/inv_api.c +17 -16
index 65102e6..bd473e9 100644

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

inventory/inv_core.c +4 -3
index 3f7edb6..a83e7ef 100644

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

inventory/inv_files.c +5 -4
index f77eeec..34b7aac 100644

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

inventory/inv_fstab.c +3 -2
index 6567846..e87152f 100644

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

inventory/inv_idx.c +6 -5
index 145745a..edb72b3 100644

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

inventory/inv_mgr.c +4 -3
index 1f4a425..926b4c8 100644

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

inventory/inv_oref.c +26 -25
index a124b07..b6cd61d 100644

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

inventory/inv_oref.h +12 -12
index 5f4ed68..2562500 100644

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

inventory/inv_stobj.c +12 -11
index becac17..42969b1 100644

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

inventory/testmain.c +13 -12
index cfd0654..d8c61e2 100644

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

librmt/rmtioctl.c +1 -0
index c49e96d..4c108fb 100644

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

restore/bag.c +10 -9
index b7d8fe2..8c7a216 100644

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

restore/content.c +155 -154
index f2d361b..4796aea 100644

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

restore/dirattr.c +57 -56
index fcfa0c8..c829808 100644

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

restore/inomap.c +13 -12
index 562492e..2c62afc 100644

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

restore/namreg.c +20 -19
index 41362d1..c64833d 100644

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

restore/node.c +40 -39
index 4cc8fb0..f0297a5 100644

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

restore/tree.c +110 -109
index 08e177f..d377590 100644

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

restore/win.c +33 -32
index 0f3b573..a9f0239 100644

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

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

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

#3 lore raw

Re: [PATCH 1/8] cleanup: get rid of ASSERT

Quoted 14 lines · Brian Foster
Quoted 13 lines · Dave Chinner

From: Dave Chinner <[email protected]>

ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op.

Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled.

Quoted 7 lines
Quoted 2 lines

---

My initial concern when reading this was that asserts were now unconditionally enabled. According to the man page, assert() is enabled unless NDEBUG is defined at include time. The debian builder apparently does this, but is this standard for other such utils?

For other XFS utilities? Yes. For other packages I don't maintain? I don't know, I don't care, and I don't think it's relevant at all. How the distro builds and packages a utility is up to the distro maintainers - if they define -NDEBUG, then there is absolutely no change in behaviour of xfsdump. I think the binary is effectively unchanged as assert() is defined out in that case...

Quoted 3 lines

That aside, this seems like an inconsistent approach from our other tools. For example, the debian/rules from xfsprogs does the same thing, yet DEBUG must be defined to enable asserts in the first place.

That's a issue with the way xfsprogs uses asserts - ASSERT should never have been exported in the first, nor should the xfsdump buildi rely on it, but here we are....

Quoted 5 lines

If the
problem is that asserts cannot be enabled, I'm wondering why the appropriate fix isn't to define DEBUG somewhere for debug-enabled builds rather than unconditionally convert all of the ASSERT() calls into actual assert()'s..?

Becuase it has to build with both old and new xfsprogs userspace headers. Hence we cannot use ASSERT reliably in xfsdump at all, because it's owned by the old xfsprogs headers and it's behaviour is determined by whatever that xfsprogs installation defined......

Quoted 3 lines

We do actually have a bunch of '#ifdef DEBUG' code throughout xfsdump (and DEBUG appears in 'configure' as well, though I have no idea if that actually does anything)...

I'm not going to pull that string and have this turn into a massive "we have to change everything" exercise. I've built the code with and without NDEBUG enabled, and had no problems with the assert code either way.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

Re: [PATCH 1/8] cleanup: get rid of ASSERT

Quoted 23 lines · Dave Chinner
Quoted 14 lines · Brian Foster
Quoted 13 lines · Dave Chinner

From: Dave Chinner <[email protected]>

ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op.

Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled.

Quoted 7 lines
Quoted 2 lines

---

My initial concern when reading this was that asserts were now unconditionally enabled. According to the man page, assert() is enabled unless NDEBUG is defined at include time. The debian builder apparently does this, but is this standard for other such utils?

Quoted 7 lines

For other XFS utilities? Yes. For other packages I don't maintain? I don't know, I don't care, and I don't think it's relevant at all. How the distro builds and packages a utility is up to the distro maintainers - if they define -NDEBUG, then there is absolutely no change in behaviour of xfsdump. I think the binary is effectively unchanged as assert() is defined out in that case...

I'm talking about common packaging tools (e.g., yum/dnf being the obvious next example) and XFS packages, not random other packages. If they don't define NDEBUG, then apparently there is a change in behavior.

Quoted 8 lines
Quoted 3 lines

That aside, this seems like an inconsistent approach from our other tools. For example, the debian/rules from xfsprogs does the same thing, yet DEBUG must be defined to enable asserts in the first place.

That's a issue with the way xfsprogs uses asserts - ASSERT should never have been exported in the first, nor should the xfsdump buildi rely on it, but here we are....

Sure...

Quoted 11 lines
Quoted 5 lines

If the
problem is that asserts cannot be enabled, I'm wondering why the appropriate fix isn't to define DEBUG somewhere for debug-enabled builds rather than unconditionally convert all of the ASSERT() calls into actual assert()'s..?

Becuase it has to build with both old and new xfsprogs userspace headers. Hence we cannot use ASSERT reliably in xfsdump at all, because it's owned by the old xfsprogs headers and it's behaviour is determined by whatever that xfsprogs installation defined......

Then why not try to undef/redef in xfsdump or just rename the #define that's used? I don't care too much either way, I just don't follow why there's a need to change behavior at all to fix a naming conflict.

Are we saying that ASSERT() probably shouldn't exist in userspace (incl. xfsprogs) and we should always use the generic assert() mechanism? Or are we saying ASSERT() can exist in userspace, but it's purely a libxfs thing and should not be exported beyond that (e.g., libxfs can use ASSERT(), actual userspace tools like repair, etc. should eventually use assert())..? Or perhaps we want to enable assert functionality, but DEBUG is broken (?) and we don't want to deal with that just to fix asserts and the build? Any of those seem reasonable to me.

Quoted 9 lines
Quoted 3 lines

We do actually have a bunch of '#ifdef DEBUG' code throughout xfsdump (and DEBUG appears in 'configure' as well, though I have no idea if that actually does anything)...

I'm not going to pull that string and have this turn into a massive "we have to change everything" exercise. I've built the code with and without NDEBUG enabled, and had no problems with the assert code either way.

I'm not sure what that has to do with fixing ASSERT(). If DEBUG is in fact broken on xfsdump today, then it could technically be fixed separately whenever somebody has the time and motivation to do so.

Brian

Quoted 11 lines

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw

Re: [PATCH 1/8] cleanup: get rid of ASSERT

Quoted 32 lines · Brian Foster
Quoted 23 lines · Dave Chinner
Quoted 14 lines · Brian Foster
Quoted 13 lines · Dave Chinner

From: Dave Chinner <[email protected]>

ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op.

Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled.

Quoted 7 lines
Quoted 2 lines

---

My initial concern when reading this was that asserts were now unconditionally enabled. According to the man page, assert() is enabled unless NDEBUG is defined at include time. The debian builder apparently does this, but is this standard for other such utils?

Quoted 7 lines

For other XFS utilities? Yes. For other packages I don't maintain? I don't know, I don't care, and I don't think it's relevant at all. How the distro builds and packages a utility is up to the distro maintainers - if they define -NDEBUG, then there is absolutely no change in behaviour of xfsdump. I think the binary is effectively unchanged as assert() is defined out in that case...

Quoted 3 lines

I'm talking about common packaging tools (e.g., yum/dnf being the obvious next example) and XFS packages, not random other packages. If they don't define NDEBUG, then apparently there is a change in behavior.

If they don't define that, then they've been building the packages incorrectly... ;)

Quoted 16 lines
Quoted 11 lines
Quoted 5 lines

If the
problem is that asserts cannot be enabled, I'm wondering why the appropriate fix isn't to define DEBUG somewhere for debug-enabled builds rather than unconditionally convert all of the ASSERT() calls into actual assert()'s..?

Becuase it has to build with both old and new xfsprogs userspace headers. Hence we cannot use ASSERT reliably in xfsdump at all, because it's owned by the old xfsprogs headers and it's behaviour is determined by whatever that xfsprogs installation defined......

Then why not try to undef/redef in xfsdump or just rename the #define that's used? I don't care too much either way, I just don't follow why there's a need to change behavior at all to fix a naming conflict.

Quoted 6 lines

Are we saying that ASSERT() probably shouldn't exist in userspace (incl. xfsprogs) and we should always use the generic assert() mechanism? Or are we saying ASSERT() can exist in userspace, but it's purely a libxfs thing and should not be exported beyond that (e.g., libxfs can use ASSERT(), actual userspace tools like repair, etc. should eventually use assert())..?

Precisely this. ASSERT is used in the kernel side libxfs code, and so only exists in userspace to support the libxfs code in userspace. We don't want the libxfs code in userspace aborting on corrupt structures or invalid situations, because we need to handle/parse/repair such brokenness. IOWS, the ASSERTs in libxfs/ in userspace need to be turned off for userspace to work correctly. That's what the DEBUG define in libxfs does.

That leads to the xfsprogs userspace still needing an assert facility - that comes from using assert() and NDEBUG to turn it off and on.

Essentially, ASSERT is internal to libxfs and should not be exported anywhere. assert() should used outside libxfs in xfsprogs and other XFS code bases.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Acked-by
#6 lore raw

Re: [PATCH 1/8] cleanup: get rid of ASSERT

Quoted 1 line · Dave Chinner

On Thu, Oct 29, 2015 at 08:13:34AM -0400, Brian Foster wrote:

...

Quoted 11 lines
Quoted 10 lines

Then why not try to undef/redef in xfsdump or just rename the #define that's used? I don't care too much either way, I just don't follow why there's a need to change behavior at all to fix a naming conflict.

Are we saying that ASSERT() probably shouldn't exist in userspace (incl. xfsprogs) and we should always use the generic assert() mechanism? Or are we saying ASSERT() can exist in userspace, but it's purely a libxfs thing and should not be exported beyond that (e.g., libxfs can use ASSERT(), actual userspace tools like repair, etc. should eventually use assert())..?

Quoted 8 lines

Precisely this. ASSERT is used in the kernel side libxfs code, and so only exists in userspace to support the libxfs code in userspace. We don't want the libxfs code in userspace aborting on corrupt structures or invalid situations, because we need to handle/parse/repair such brokenness. IOWS, the ASSERTs in libxfs/ in userspace need to be turned off for userspace to work correctly. That's what the DEBUG define in libxfs does.

Indeed.

Quoted 8 lines

That leads to the xfsprogs userspace still needing an assert facility - that comes from using assert() and NDEBUG to turn it off and on.

Essentially, ASSERT is internal to libxfs and should not be exported anywhere. assert() should used outside libxfs in xfsprogs and other XFS code bases.

Makes sense to me. Thanks for the explanation. It would be good if the commit log description included some of this info. Otherwise, for the series:

Quoted 11 lines

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#7 lore raw

PATCH 2/8 build: don't rely on xfs/xfs.h to include necessary headers

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Quoted 1 line

From xfsprogs 4.2.0, the xfs headers no long include lots of

xfsprogs specific build information. xfsdump hasbeen implicitly relying on those header for a clean build, rather than having it's own definitions. Hence we need to add the missing bits to config.h.in and include it in all the files that require the specific help that the xfs headers used to provide.

---
 common/arch_xlate.c     |  4 ++++
 common/arch_xlate.h     |  1 +
 common/cldmgr.c         |  4 ++++
 common/content_common.c |  4 ++++
 common/dlog.c           |  4 ++++
 common/drive.c          |  3 +++
 common/drive_minrmt.c   |  5 +++++
 common/drive_scsitape.c |  5 +++++
 common/drive_simple.c   |  5 +++++
 common/fs.c             |  4 ++++
 common/global.c         |  4 ++++
 common/hsmapi.c         |  4 ++++
 common/lock.c           |  2 ++
 common/main.c           |  5 +++++
 common/media.c          |  2 ++
 common/mlog.c           |  3 +++
 common/openutil.c       |  5 +++++
 common/path.c           |  7 +++++++
 common/qlock.c          |  2 ++
 common/ring.c           |  2 ++
 common/stream.c         |  3 +++
 common/util.c           |  5 +++++
 dump/content.c          |  5 +++++
 dump/inomap.c           |  5 +++++
 dump/var.c              |  5 +++++
 include/config.h.in     | 45 +++++++++++++++++++++++++++++++++++----------
 inventory/inv_api.c     |  5 +++++
 inventory/inv_core.c    |  5 +++++
 inventory/inv_files.c   |  3 +++
 inventory/inv_fstab.c   |  5 +++++
 inventory/inv_idx.c     |  5 +++++
 inventory/inv_mgr.c     |  5 +++++
 inventory/inv_oref.c    |  2 ++
 inventory/inv_stobj.c   |  5 +++++
 inventory/testmain.c    |  4 ++++
 invutil/cmenu.c         |  3 +++
 invutil/fstab.c         |  3 +++
 invutil/invidx.c        |  4 ++++
 invutil/invutil.c       |  4 ++++
 invutil/screen.c        |  3 +++
 invutil/stobj.c         |  4 ++++
 librmt/rmtabort.c       |  1 +
 librmt/rmtclose.c       |  1 +
 librmt/rmtcommand.c     |  2 ++
 librmt/rmtfstat.c       |  2 ++
 librmt/rmtioctl.c       | 10 ++++++----
 librmt/rmtlib.h         |  3 ---
 librmt/rmtlseek.c       |  2 ++
 librmt/rmtmsg.c         |  5 +++++
 librmt/rmtopen.c        |  4 +++-
 librmt/rmtread.c        |  2 ++
 librmt/rmtstatus.c      |  2 ++
 librmt/rmtwrite.c       |  2 ++
 restore/bag.c           |  2 ++
 restore/content.c       |  5 +++++
 restore/dirattr.c       |  5 +++++
 restore/inomap.c        |  5 +++++
 restore/namreg.c        |  5 +++++
 restore/node.c          |  4 ++++
 restore/tree.c          |  7 +++++++
 restore/win.c           |  2 ++
 61 files changed, 256 insertions(+), 18 deletions(-)
common/arch_xlate.c +4 -0
index e6f897e..f8aa50f 100644
@@ -20,6 +20,10 @@
 #include <xfs/jdm.h>
 #include <assert.h>
 
+#include <strings.h>
+
+#include "config.h"
+
 #include "arch_xlate.h"
 #include "types.h"
 #include "global.h"
common/arch_xlate.h +1 -0
index 35333c6..fa201cd 100644
@@ -22,6 +22,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <strings.h>
 #include "types.h"
 #include "global.h"
 #include "content.h"
common/cldmgr.c +4 -0
index df33a3f..88fd7fd 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <sys/wait.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -26,6 +27,9 @@
 #include <errno.h>
 #include <pthread.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "exit.h"
 #include "types.h"
common/content_common.c +4 -0
index 65be31f..99b1a4b 100644
@@ -19,12 +19,16 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <signal.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/dlog.c +4 -0
index 6220cfe..dac4e64 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/select.h>
@@ -27,6 +28,9 @@
 #include <errno.h>
 #include <signal.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "mlog.h"
common/drive.c +3 -0
index f9ba851..afef147 100644
@@ -22,6 +22,9 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/drive_minrmt.c +5 -0
index 6d58f1f..51685dc 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -30,6 +32,9 @@
 #include <malloc.h>
 #include <sched.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/drive_scsitape.c +5 -0
index 3f45d01..eade6ac 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -30,6 +32,9 @@
 #include <malloc.h>
 #include <sched.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/drive_simple.c +5 -0
index 2e57d8c..69fce4b 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
@@ -26,6 +28,9 @@
 #include <malloc.h>
 #include <sched.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/fs.c +4 -0
index b77f6cc..2cd2f72 100644
@@ -20,6 +20,7 @@
 #include <xfs/jdm.h>
 #include "config.h"
 
+#include <unistd.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #include <time.h>
@@ -28,6 +29,9 @@
 #include <mntent.h>
 #include <sys/ioctl.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "mlog.h"
common/global.c +4 -0
index ed844cc..319d4df 100644
@@ -19,10 +19,14 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <errno.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
common/hsmapi.c +4 -0
index 0bca9ff..ed29370 100644
@@ -21,6 +21,10 @@
 #include <xfs/jdm.h>
 #include <assert.h>
 
+#include <string.h>
+
+#include "config.h"
+
 #include "hsmapi.h"
 #include "mlog.h"
 
common/lock.c +2 -0
index 347f6cd..a237931 100644
@@ -20,6 +20,8 @@
 #include <xfs/jdm.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "qlock.h"
 #include "mlog.h"
common/main.c +5 -0
index f392856..3b82a76 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/prctl.h>
@@ -34,6 +36,9 @@
 #include <sched.h>
 #include <pthread.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "exit.h"
 #include "types.h"
common/media.c +2 -0
index 53b94d1..7d17405 100644
@@ -28,6 +28,8 @@
 #include <getopt.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "util.h"
 #include "mlog.h"
common/mlog.c +3 -0
index c546036..1fef185 100644
@@ -28,6 +28,9 @@
 #include <getopt.h>
 #include <pthread.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "qlock.h"
common/openutil.c +5 -0
index c3b8d9a..9df42ae 100644
@@ -18,11 +18,16 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <limits.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "mlog.h"
common/path.c +7 -0
index e40c473..b73121d 100644
@@ -19,6 +19,13 @@
 #include <xfs/xfs.h>
 #include <assert.h>
 
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+
 #include "path.h"
 
 struct pem {
common/qlock.c +2 -0
index d88917c..1b466d6 100644
@@ -23,6 +23,8 @@
 #include <semaphore.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "qlock.h"
 #include "mlog.h"
common/ring.c +2 -0
index f3de7c4..37a2d1d 100644
@@ -29,6 +29,8 @@
 #include <malloc.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "qlock.h"
 #include "cldmgr.h"
common/stream.c +3 -0
index 0db1be3..90d315a 100644
@@ -21,6 +21,9 @@
 
 #include <pthread.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "exit.h"
common/util.c +5 -0
index 1dc6d6c..af48162 100644
@@ -20,12 +20,17 @@
 #include <xfs/jdm.h>
 #include "config.h"
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <dirent.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
dump/content.c +5 -0
index 3682358..5d630bb 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/prctl.h>
 #include <time.h>
@@ -31,6 +33,7 @@
 #include <sys/quota.h>
 #include <malloc.h>
 #include <assert.h>
+#include <string.h>
 
 #ifdef linux
 #include <xfs/xqm.h>
@@ -38,6 +41,8 @@
 
 #include <attr/attributes.h>
 
+#include "config.h"
+
 #include "hsmapi.h"
 
 #include "exit.h"
dump/inomap.c +5 -0
index 7a3069f..dacf954 100644
@@ -20,12 +20,17 @@
 #include <xfs/jdm.h>
 #include <malloc.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <time.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
dump/var.c +5 -0
index 8370fa4..ceb7e3a 100644
@@ -19,9 +19,14 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <dirent.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "fs.h"
include/config.h.in +35 -10

54 lines not on this page · raw message

inventory/inv_api.c +5 -0
index bd473e9..b564d2f 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <time.h>
 #include <stdlib.h>
@@ -27,6 +29,9 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "mlog.h"
inventory/inv_core.c +5 -0
index a83e7ef..7020f7f 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -26,6 +27,10 @@
 #include <errno.h>
 #include <sys/dir.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
 #include "types.h"
 #include "inv_priv.h"
 
inventory/inv_files.c +3 -0
index 34b7aac..409ee0d 100644
@@ -24,6 +24,9 @@
 #include <sys/stat.h>
 #include <sys/dir.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 
 /*----------------------------------------------------------------------*/
inventory/inv_fstab.c +5 -0
index e87152f..8263852 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -26,6 +28,9 @@
 #include <fcntl.h>
 #include <sys/dir.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "mlog.h"
inventory/inv_idx.c +5 -0
index edb72b3..0378c5a 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <stdlib.h>
 #include <time.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -26,6 +27,10 @@
 #include <sys/stat.h>
 #include <sys/dir.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "inv_priv.h"
inventory/inv_mgr.c +5 -0
index 926b4c8..f1341b9 100644
@@ -19,12 +19,17 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
 #include <time.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/dir.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "inv_priv.h"
inventory/inv_oref.c +2 -0
index b6cd61d..ebcae95 100644
@@ -20,6 +20,8 @@
 #include <xfs/jdm.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "inv_priv.h"
 #include "inv_oref.h"
 
inventory/inv_stobj.c +5 -0
index 42969b1..bae2fc5 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <time.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -27,6 +29,9 @@
 #include <sys/dir.h>
 #include <sys/mman.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "timeutil.h"
inventory/testmain.c +4 -0
index d8c61e2..51b7774 100644
@@ -19,10 +19,14 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <stdio.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <assert.h>
+
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "getopt.h"
invutil/cmenu.c +3 -0
index ff4abef..ce23d28 100644
@@ -19,9 +19,12 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <ncurses.h>
 #include <signal.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/fstab.c +3 -0
index acbe94b..ac8f775 100644
@@ -19,9 +19,12 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <signal.h>
 #include <ncurses.h>
 #include <sys/mman.h>
+#include <string.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/invidx.c +4 -0
index 8de137c..b6ce4fa 100644
@@ -19,9 +19,13 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
 #include <ncurses.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/invutil.c +4 -0
index b75db14..e1c8868 100644
@@ -19,11 +19,15 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <time.h>
 #include <sys/mman.h>
+#include <string.h>
+#include <libgen.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/screen.c +3 -0
index 12074f0..c4b79d8 100644
@@ -18,6 +18,9 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+
+#include <stdio.h>
+#include <string.h>
 #include <ncurses.h>
 
 #include "cmenu.h"
invutil/stobj.c +4 -0
index a74ba0f..eb04385 100644
@@ -18,9 +18,13 @@
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
+
+#include <unistd.h>
+#include <stdlib.h>
 #include <ncurses.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #include "types.h"
 #include "mlog.h"
librmt/rmtabort.c +1 -0
index 3efa651..a7db4b1 100644
@@ -21,6 +21,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <unistd.h>
 #include "rmtlib.h"
 
 /*
librmt/rmtclose.c +1 -0
index a155366..97f53c7 100644
@@ -21,6 +21,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <unistd.h>
 #include "rmtlib.h"
 
 static int _rmt_close(int);
librmt/rmtcommand.c +2 -0
index fbd7a6a..82c9032 100644
@@ -22,6 +22,8 @@
  */
 
 #include <errno.h>
+#include <unistd.h>
+#include <string.h>
 
 #include "rmtlib.h"
 
librmt/rmtfstat.c +2 -0
index 3506567..92a49d7 100644
@@ -24,6 +24,8 @@
 #include "rmtlib.h"
 
 #include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
librmt/rmtioctl.c +6 -4
index 4c108fb..bd6f887 100644
@@ -21,17 +21,19 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <unistd.h>
 #include <errno.h>
-
-#include "rmtlib.h"
-#include "swap.h"
-
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/mtio.h>
 #include <sys/param.h>
 #include <assert.h>
 
+#include "config.h"
+#include "rmtlib.h"
+#include "swap.h"
+
+
 /*
  * uses old_mtget IRIX structure since we don't bother
  * sending the "V" version command.
librmt/rmtlib.h +0 -3
index bc6961c..1f877ca 100644
@@ -27,9 +27,6 @@
  *
  */
 
-
-#include <xfs/xfs.h>
-
 /*
  *	Note that local vs remote file descriptors are distinquished
  *	by adding a bias to the remote descriptors.  This is a quick
librmt/rmtlseek.c +2 -0
index 8903886..bf8c0fa 100644
@@ -21,7 +21,9 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdio.h>
 #include <sys/types.h>
+#include <unistd.h>
 #include "rmtlib.h"
 
 static off_t _rmt_lseek(int, off_t, int);
librmt/rmtmsg.c +5 -0
index 17addd1..d28a1f2 100644
@@ -21,6 +21,11 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
 #include "rmtlib.h"
 
 /*
librmt/rmtopen.c +3 -1
index 6a05ab3..4bf9383 100644
@@ -24,13 +24,15 @@
 #include <unistd.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <string.h>
 #include <sys/signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
-
+#include "config.h"
 #include "rmtlib.h"
 
 #define RMT_DEBUG_FILE "/tmp/librmt_debug" /* file for debug output on server */
librmt/rmtread.c +2 -0
index d5a840e..3456901 100644
@@ -21,6 +21,8 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdio.h>
+#include <unistd.h>
 #include <errno.h>
 
 #include "rmtlib.h"
librmt/rmtstatus.c +2 -0
index 8528bc4..21d909d 100644
@@ -21,6 +21,8 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdlib.h>
+#include <unistd.h>
 #include <errno.h>
 
 #include "rmtlib.h"
librmt/rmtwrite.c +2 -0
index c42b1ab..9e5a1a3 100644
@@ -21,6 +21,8 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <unistd.h>
+#include <stdio.h>
 #include <errno.h>
 
 #include "rmtlib.h"
restore/bag.c +2 -0
index 8c7a216..3927877 100644
@@ -24,6 +24,8 @@
 #include <memory.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "bag.h"
restore/content.c +5 -0
index 4796aea..b02e38a 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/mman.h>
@@ -35,6 +37,9 @@
 #include <malloc.h>
 #include <pthread.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "timeutil.h"
restore/dirattr.c +5 -0
index c829808..a15abe5 100644
@@ -29,6 +29,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
@@ -37,6 +39,9 @@
 #include <fcntl.h>
 #include <dirent.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
restore/inomap.c +5 -0
index 2c62afc..e5bcb55 100644
@@ -19,6 +19,8 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <errno.h>
@@ -27,6 +29,9 @@
 #include <dirent.h>
 #include <time.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "util.h"
restore/namreg.c +5 -0
index c64833d..18ba6d9 100644
@@ -19,12 +19,17 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "lock.h"
restore/node.c +4 -0
index f0297a5..046f2f6 100644
@@ -19,12 +19,16 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/mman.h>
 #include <errno.h>
 #include <memory.h>
 #include <limits.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "win.h"
restore/tree.c +7 -0
index d377590..98f6952 100644
@@ -19,7 +19,11 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 
+#include <unistd.h>
+#include <stdlib.h>
 #include <sys/mman.h>
+#include <sys/types.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <utime.h>
@@ -29,6 +33,9 @@
 #include <dirent.h>
 #include <sys/ioctl.h>
 #include <assert.h>
+#include <string.h>
+
+#include "config.h"
 
 #include "types.h"
 #include "exit.h"
restore/win.c +2 -0
index a9f0239..3ca2af8 100644
@@ -27,6 +27,8 @@
 #include <errno.h>
 #include <assert.h>
 
+#include "config.h"
+
 #include "types.h"
 #include "mlog.h"
 #include "qlock.h"
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#8 lore raw

PATCH 3/8 cleanup: kill intgen_t

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

intgen_t is for jdm (libhandle) interfaces, not as a random substitute for "int". Do a global s/intgen_t/int across the codebase with sed to remove this stupidity so that we don't have to include xfs/jdm.h across almost the entire code base.

After a manual pass back over the callers of the jdm API, there are no places where the return value needs to be an intgen_t. Indeed, jdm_open passes back a file descriptor, so intgen_t by definition cannot be anything other than an int.

---
 common/cldmgr.c         |  14 +--
 common/cldmgr.h         |   2 +-
 common/content.h        |   8 +-
 common/dlog.c           |   6 +-
 common/dlog.h           |   2 +-
 common/drive.c          |   6 +-
 common/drive.h          |  44 +++++-----
 common/drive_minrmt.c   | 222 +++++++++++++++++++++++------------------------
 common/drive_scsitape.c | 226 ++++++++++++++++++++++++------------------------
 common/drive_simple.c   |  84 +++++++++---------
 common/exit.h           |   2 +-
 common/fs.c             |  12 +--
 common/fs.h             |   8 +-
 common/global.c         |   4 +-
 common/global.h         |   2 +-
 common/inventory.c      |   4 +-
 common/inventory.h      |   2 +-
 common/main.c           |  76 ++++++++--------
 common/media.c          |   2 +-
 common/mlog.c           |  38 ++++----
 common/mlog.h           |  16 ++--
 common/openutil.c       |  28 +++---
 common/openutil.h       |  14 +--
 common/qlock.c          |  16 ++--
 common/ring.c           |   4 +-
 common/ring.h           |   4 +-
 common/stream.c         |  10 +--
 common/stream.h         |   6 +-
 common/types.h          |   6 +-
 common/util.c           |  66 +++++++-------
 common/util.h           |  42 ++++-----
 dump/content.c          | 106 +++++++++++------------
 dump/inomap.c           | 156 ++++++++++++++++-----------------
 dump/inomap.h           |   6 +-
 dump/var.c              |   4 +-
 inventory/inv_api.c     |   6 +-
 inventory/inv_core.c    |  14 +--
 inventory/inv_fstab.c   |   6 +-
 inventory/inv_idx.c     |  14 +--
 inventory/inv_mgr.c     |   8 +-
 inventory/inv_oref.c    |  30 +++----
 inventory/inv_oref.h    |  10 +--
 inventory/inv_priv.h    |  70 +++++++--------
 inventory/inv_stobj.c   |  20 ++---
 inventory/inventory.h   |   2 +-
 inventory/testmain.c    |   8 +-
 invutil/invidx.c        |   2 +-
 restore/content.c       | 132 ++++++++++++++--------------
 restore/dirattr.c       |  30 +++----
 restore/inomap.c        |  48 +++++-----
 restore/inomap.h        |   2 +-
 restore/namreg.c        |  10 +--
 restore/namreg.h        |   2 +-
 restore/node.c          |  14 +--
 restore/node.h          |   4 +-
 restore/tree.c          |  54 ++++++------
 restore/win.c           |   6 +-
 restore/win.h           |   4 +-
 58 files changed, 872 insertions(+), 872 deletions(-)
common/cldmgr.c +7 -7
index 88fd7fd..624da62 100644
@@ -47,7 +47,7 @@ typedef enum { C_AVAIL, C_ALIVE, C_EXITED } state_t;
 
 struct cld {
 	state_t c_state;
-	intgen_t c_exit_code;
+	int c_exit_code;
 	pthread_t c_tid;
 	ix_t c_streamix;
 	int ( * c_entry )( void *arg1 );
@@ -82,7 +82,7 @@ cldmgr_create( int ( * entry )( void *arg1 ),
 	       void *arg1 )
 {
 	cld_t *cldp;
-	intgen_t rval;
+	int rval;
 
 	assert( pthread_equal( pthread_self( ), cldmgr_parenttid ) );
 
@@ -128,17 +128,17 @@ cldmgr_stop( void )
 	cldmgr_stopflag = BOOL_TRUE;
 }
 
-intgen_t
+int
 cldmgr_join( void )
 {
 	cld_t *p = cld;
 	cld_t *ep = cld + sizeof( cld ) / sizeof( cld[ 0 ] );
-	intgen_t xc = EXIT_NORMAL;
+	int xc = EXIT_NORMAL;
 
 	lock();
 	for ( ; p < ep ; p++ ) {
 		if ( p->c_state == C_EXITED ) {
-			if ( ( intgen_t )( p->c_streamix ) >= 0 ) {
+			if ( ( int )( p->c_streamix ) >= 0 ) {
 				stream_dead( p->c_tid );
 			}
 			pthread_join( p->c_tid, NULL );
@@ -230,8 +230,8 @@ cldmgr_entry( void *arg1 )
 
 	pthread_cleanup_push( cldmgr_cleanup, arg1 );
 
-	if ( ( intgen_t )( cldp->c_streamix ) >= 0 ) {
-		stream_register( tid, ( intgen_t )cldp->c_streamix );
+	if ( ( int )( cldp->c_streamix ) >= 0 ) {
+		stream_register( tid, ( int )cldp->c_streamix );
 	}
 	mlog( MLOG_DEBUG | MLOG_PROC,
 	      "thread %lu created for stream %d\n",
common/cldmgr.h +1 -1
index 1df0c0c..c3384fa 100644
@@ -44,7 +44,7 @@ extern void cldmgr_stop( void );
  * EXIT_FAULT if any threads requested a core dump, or another EXIT_*
  * value if any threads exited abnormally.
  */
-extern intgen_t cldmgr_join( void );
+extern int cldmgr_join( void );
 
 /* cldmgr_stop_requested - returns TRUE if the child should gracefully
  * terminate.
common/content.h +4 -4
index 03b72f0..763c09f 100644
@@ -84,13 +84,13 @@ extern bool_t is_quota_file(ino_t ino);
 #endif /* DUMP */
 
 #ifdef DUMP
-extern bool_t content_init( intgen_t argc,
+extern bool_t content_init( int argc,
 			    char *argv[ ],
 			    global_hdr_t *gwhdrtemplatep );
 	/* prepares for multi-stream dump
 	 */
 
-extern intgen_t content_stream_dump( ix_t strmix );
+extern int content_stream_dump( ix_t strmix );
 	/* does stream dump
 	 */
 
@@ -98,11 +98,11 @@ extern intgen_t content_stream_dump( ix_t strmix );
 #ifdef RESTORE
 extern size_t perssz;
 
-extern bool_t content_init( intgen_t argc, char *argv[ ], size64_t vmsz );
+extern bool_t content_init( int argc, char *argv[ ], size64_t vmsz );
 	/* prepares for multi-thread restore
 	 */
 
-extern intgen_t content_stream_restore( ix_t thrdix );
+extern int content_stream_restore( ix_t thrdix );
 	/* does thread restore
 	 */
 
common/dlog.c +3 -3
index dac4e64..cb5c11a 100644
@@ -58,7 +58,7 @@ static void dlog_string_query_print( void *ctxp, char *fmt, ... );
 bool_t
 dlog_init( int argc, char *argv[ ] )
 {
-	intgen_t c;
+	int c;
 
 	/* can only call once
 	 */
@@ -140,7 +140,7 @@ dlog_desist( void )
 	dlog_allowed_flag = BOOL_FALSE;
 }
 
-intgen_t
+int
 dlog_fd( void )
 {
 	return dlog_ttyfd;
@@ -385,7 +385,7 @@ promptinput( char *buf,
 {
 	va_list args;
 	time32_t now = time( NULL );
-	intgen_t nread = -1;
+	int nread = -1;
 	sigset_t orig_set;
 	char *bufp = buf;
 
common/dlog.h +1 -1
index bc17c41..31ed9c2 100644
@@ -39,7 +39,7 @@ extern void dlog_desist( void );
 
 /* returns the dialog tty file descriptor. returns -1 if none
  */
-extern intgen_t dlog_fd( void );
+extern int dlog_fd( void );
 
 /* returns BOOL_TRUE if a dialog consumed the given signal
  */
common/drive.c +3 -3
index afef147..9fb0bb7 100644
@@ -87,7 +87,7 @@ static drive_strategy_t *strategypp[] = {
 bool_t
 drive_init1( int argc, char *argv[ ] )
 {
-	intgen_t c;
+	int c;
 	ix_t driveix;
 
 	/* sanity check asserts
@@ -202,7 +202,7 @@ drive_init1( int argc, char *argv[ ] )
 	 */
 	for ( driveix = 0 ; driveix < drivecnt ; driveix++ ) {
 		drive_t *drivep = drivepp[ driveix ];
-		intgen_t bestscore = 0 - INTGENMAX;
+		int bestscore = 0 - INTGENMAX;
 		ix_t six;
 		ix_t scnt = sizeof( strategypp ) / sizeof( strategypp[ 0 ] );
 		drive_strategy_t *bestsp = 0;
@@ -210,7 +210,7 @@ drive_init1( int argc, char *argv[ ] )
 
 		for ( six = 0 ; six < scnt ; six++ ) {
 			drive_strategy_t *sp = strategypp[ six ];
-			intgen_t score;
+			int score;
 			score = ( * sp->ds_match )( argc,
 						    argv,
 						    drivep );
common/drive.h +22 -22

143 lines not on this page · raw message

common/drive_minrmt.c +111 -111

612 lines not on this page · raw message

common/drive_scsitape.c +113 -113

640 lines not on this page · raw message

common/drive_simple.c +42 -42

236 lines not on this page · raw message

common/exit.h +1 -1
index f7e4878..403946d 100644
@@ -26,7 +26,7 @@
 #define EXIT_FAULT	4	/* code fault */
 
 static inline const char *
-exit_codestring( intgen_t code )
+exit_codestring( int code )
 {
 	switch ( code ) {
 	case EXIT_NORMAL:    return "SUCCESS";
common/fs.c +6 -6
index 2cd2f72..184f08d 100644
@@ -109,12 +109,12 @@ static fs_tab_ent_t *fs_tab_lookup_mnt( char * );
 /* ARGSUSED */
 bool_t
 fs_info( char *typb,		/* out */
-	 intgen_t typbz,
+	 int typbz,
 	 char *typd,
 	 char *blkb,		/* out */
-	 intgen_t blkbz,
+	 int blkbz,
 	 char *mntb,		/* out */
-	 intgen_t mntbz,
+	 int mntbz,
 	 uuid_t *idb,		/* out */
 	 char *usrs )		/* in */
 {
@@ -169,7 +169,7 @@ fs_info( char *typb,		/* out */
 	assert( ok != BOOL_UNKNOWN );
 
 	if ( ok == BOOL_TRUE ) {
-		intgen_t rval = fs_getid( mntb, idb );
+		int rval = fs_getid( mntb, idb );
 		if ( rval ) {
 			mlog( MLOG_NORMAL,
 			      _("unable to determine uuid of fs mounted at %s: "
@@ -201,7 +201,7 @@ fs_mounted( char *typs, char *chrs, char *mnts, uuid_t *idp )
 	return strlen( mnts ) > 0 ? BOOL_TRUE : BOOL_FALSE;
 }
 
-intgen_t
+int
 fs_getid( char *mnts, uuid_t *idb )
 {
 	xfs_fsop_geom_v1_t geo;
@@ -227,7 +227,7 @@ size_t
 fs_getinocnt( char *mnts )
 {
 	struct statvfs vfsstat;
-	intgen_t rval;
+	int rval;
 
 	rval = statvfs( mnts, &vfsstat );
 	if ( rval ) {
common/fs.h +4 -4
index 9ad1636..4a9d9d1 100644
@@ -32,12 +32,12 @@
  * returns BOOL_FALSE if srcname does not describe a file system.
  */
 extern bool_t fs_info( char *fstype,		/* out: fs type (fsid.h) */
-		       intgen_t fstypesz,	/* in: buffer size */
+		       int fstypesz,	/* in: buffer size */
 		       char *fstypedef,		/* in: default fs type */
 		       char *fsdevice,		/* out: blk spec. dev. file */
-		       intgen_t fsdevicesz,	/* in: buffer size */
+		       int fsdevicesz,	/* in: buffer size */
 		       char *mntpt,		/* out: where fs mounted */
-		       intgen_t mntptsz,	/* in: buffer size */
+		       int mntptsz,	/* in: buffer size */
 		       uuid_t *fsid,		/* out: fs uuid */
 		       char *srcname );		/* in: how user named the fs */
 
@@ -51,7 +51,7 @@ extern bool_t fs_mounted( char *fstype,
 /* fs_getid - retrieves the uuid of the file system containing the named
  * file. returns -1 with errno set on error.
  */
-extern intgen_t fs_getid( char *fullpathname, uuid_t *fsidp );
+extern int fs_getid( char *fullpathname, uuid_t *fsidp );
 
 /* tells how many inos in use
  */
common/global.c +2 -2
index 319d4df..2129941 100644
@@ -58,7 +58,7 @@ static char * prompt_label( char *bufp, size_t bufsz );
 /* definition of locally defined global functions ****************************/
 
 global_hdr_t *
-global_hdr_alloc( intgen_t argc, char *argv[ ] )
+global_hdr_alloc( int argc, char *argv[ ] )
 {
 	global_hdr_t *ghdrp;
 	int c;
@@ -68,7 +68,7 @@ global_hdr_alloc( intgen_t argc, char *argv[ ] )
 	struct stat64 statb;
 #endif /* DUMP */
 
-	intgen_t rval;
+	int rval;
 
 	/* sanity checks
 	 */
common/global.h +1 -1
index 6556a68..537be0c 100644
@@ -73,7 +73,7 @@ typedef struct global_hdr global_hdr_t;
 /* used by main( ) to allocate and populate a global header template.
  * drive managers will copy this into the write header.
  */
-extern global_hdr_t * global_hdr_alloc( intgen_t argc, char *argv[ ] );
+extern global_hdr_t * global_hdr_alloc( int argc, char *argv[ ] );
 
 
 /* used by main( ) to free the global header template after drive ini.
common/inventory.c +2 -2
index 681d28f..d1c067b 100644
@@ -232,7 +232,7 @@ inv_writesession_open(
 {
 	invt_session_t *ses;
 	int		fd;
-	intgen_t	rval;
+	int	rval;
 	invt_sescounter_t *sescnt = NULL;
 	invt_seshdr_t  	hdr;
 	inv_sestoken_t	sestok;
@@ -547,7 +547,7 @@ inv_put_mediafile(
 /*          get                                                         */
 /*----------------------------------------------------------------------*/
 
-intgen_t
+int
 inv_get_inolist(
 	inv_inolist_t 	**inolist )
 {
common/inventory.h +1 -1
index ee5a977..351f6e0 100644
@@ -237,7 +237,7 @@ inv_DEBUG_printallsessions(
 
 #endif /* ifdef DEBUG */
 
-extern intgen_t
+extern int
 inv_setup_base( void );
 
 extern char *
common/main.c +38 -38

266 lines not on this page · raw message

common/media.c +1 -1
index 7d17405..fceb78d 100644
@@ -89,7 +89,7 @@ media_create( int argc, char *argv[ ], drive_strategy_t *dsp )
 					     /
 					     sizeof( strategyp[ 0 ] );
 	media_strategy_t *chosen_sp;
-	intgen_t id;
+	int id;
 	bool_t ok;
 
 	/* sanity check asserts
common/mlog.c +19 -19
index 1fef185..fd21c18 100644
@@ -54,15 +54,15 @@ static FILE *mlog_fp = NULL; /* stderr */;
 static FILE *mlog_fp = NULL; /* stdout */;
 #endif /* RESTORE */
 
-intgen_t mlog_level_ss[ MLOG_SS_CNT ];
+int mlog_level_ss[ MLOG_SS_CNT ];
 
-intgen_t mlog_showlevel = BOOL_FALSE;
+int mlog_showlevel = BOOL_FALSE;
 
-intgen_t mlog_showss = BOOL_FALSE;
+int mlog_showss = BOOL_FALSE;
 
-intgen_t mlog_timestamp = BOOL_FALSE;
+int mlog_timestamp = BOOL_FALSE;
 
-static intgen_t mlog_sym_lookup( char * );
+static int mlog_sym_lookup( char * );
 
 static size_t mlog_streamcnt;
 
@@ -84,7 +84,7 @@ static char mlog_tsstr[ 10 ];
 
 struct mlog_sym {
 	char *sym;
-	intgen_t level;
+	int level;
 };
 
 typedef struct mlog_sym mlog_sym_t;
@@ -146,13 +146,13 @@ mlog_init0( void )
 }
 
 bool_t
-mlog_init1( intgen_t argc, char *argv[ ] )
+mlog_init1( int argc, char *argv[ ] )
 {
 	char **suboptstrs;
 	ix_t ssix;
 	ix_t soix;
 	size_t vsymcnt;
-	intgen_t c;
+	int c;
 
 	/* prepare an array of suboption token strings. this will be the
 	 * concatenation of the subsystem names with the verbosity symbols.
@@ -200,7 +200,7 @@ mlog_init1( intgen_t argc, char *argv[ ] )
 			}
 			options = optarg;
 			while ( *options ) {
-				intgen_t suboptix;
+				int suboptix;
 				char *valstr;
 
 				suboptix = getsubopt( &options, 
@@ -343,9 +343,9 @@ mlog_unlock( void )
  * too much output.
  */
 void
-mlog_override_level( intgen_t levelarg )
+mlog_override_level( int levelarg )
 {
-	intgen_t level;
+	int level;
 	ix_t ss; /* SubSystem */
 
 	level = levelarg & MLOG_LEVELMASK;
@@ -362,7 +362,7 @@ mlog_override_level( intgen_t levelarg )
 }
 
 void
-mlog( intgen_t levelarg, char *fmt, ... )
+mlog( int levelarg, char *fmt, ... )
 {
 	va_list args;
 	va_start( args, fmt );
@@ -371,9 +371,9 @@ mlog( intgen_t levelarg, char *fmt, ... )
 }
 
 void
-mlog_va( intgen_t levelarg, char *fmt, va_list args )
+mlog_va( int levelarg, char *fmt, va_list args )
 {
-	intgen_t level;
+	int level;
 	ix_t ss;
 
 	level = levelarg & MLOG_LEVELMASK;
@@ -389,7 +389,7 @@ mlog_va( intgen_t levelarg, char *fmt, va_list args )
 	}
 
 	if ( ! ( levelarg & MLOG_BARE )) {
-		intgen_t streamix;
+		int streamix;
 		streamix = stream_getix( pthread_self( ) );
 
 		if ( mlog_showss ) {
@@ -419,7 +419,7 @@ mlog_va( intgen_t levelarg, char *fmt, va_list args )
 				mlog_levelstr[ 1 ] = ( char )
 						     ( level
 						       +
-						       ( intgen_t )'0' );
+						       ( int )'0' );
 			}
 		} else {
 			mlog_levelstr[ 0 ] = 0;
@@ -609,7 +609,7 @@ _mlog_exit( const char *file, int line, int exit_code, rv_t rv )
 	else {
 		stream_state_t states[] = { S_RUNNING };
 		stream_state_t state;
-		intgen_t streamix;
+		int streamix;
 		int exit_code;
 		rv_t exit_return, exit_hint;
 
@@ -726,7 +726,7 @@ mlog_exit_flush(void)
 
 		for (i = 0; i < ntids; i++) {
 			stream_state_t state;
-			intgen_t streamix;
+			int streamix;
 			int exit_code;
 			rv_t exit_return, exit_hint;
 			/* REFERENCED */
@@ -786,7 +786,7 @@ mlog_exit_flush(void)
 	fflush(mlog_fp);
 }
 
-static intgen_t
+static int
 mlog_sym_lookup( char *sym )
 {
 	mlog_sym_t *p = mlog_sym;
common/mlog.h +8 -8
index ce143bd..d7bbfce 100644
@@ -80,13 +80,13 @@
 /* mlog_level - set during initialization, exported to facilitate
  * message logging decisions. one per subsystem (see above)
  */
-extern intgen_t mlog_level_ss[ MLOG_SS_CNT ];
+extern int mlog_level_ss[ MLOG_SS_CNT ];
 
 /* made external so main.c sigint dialog can change
  */
-extern intgen_t mlog_showlevel;
-extern intgen_t mlog_showss;
-extern intgen_t mlog_timestamp;
+extern int mlog_showlevel;
+extern int mlog_showss;
+extern int mlog_timestamp;
 
 /* mlog_ss_name - so main.c sigint dialog can allow changes
  */
@@ -96,7 +96,7 @@ extern char *mlog_ss_names[ MLOG_SS_CNT ];
  * unravel some initialization sequencing problems.
  */
 extern void mlog_init0( void );
-extern bool_t mlog_init1( intgen_t argc, char *argv[ ] );
+extern bool_t mlog_init1( int argc, char *argv[ ] );
 extern bool_t mlog_init2( void );
 
 /* post-initialization, to tell mlog how many streams
@@ -105,12 +105,12 @@ extern void mlog_tell_streamcnt( size_t streamcnt );
 
 /* override the -v option
  */
-void mlog_override_level( intgen_t levelarg );
+void mlog_override_level( int levelarg );
 
 /* vprintf-based message format
  */
-extern void mlog( intgen_t level, char *fmt, ... );
-extern void mlog_va( intgen_t levelarg, char *fmt, va_list args );
+extern void mlog( int level, char *fmt, ... );
+extern void mlog_va( int levelarg, char *fmt, va_list args );
 #define mlog_exit( e, r ) _mlog_exit( __FILE__, __LINE__, (e), (r) )
 extern int  _mlog_exit( const char *file, int line, int exit_code, rv_t return_code );
 #define mlog_exit_hint( r ) _mlog_exit_hint( __FILE__, __LINE__, (r) )
common/openutil.c +14 -14
index 9df42ae..6cc0efa 100644
@@ -73,10 +73,10 @@ open_pathalloc( char *dirname, char *basename, pid_t pid )
   	return namebuf;
 }
 
-intgen_t
+int
 open_trwp( char *pathname )
 {
-	intgen_t fd;
+	int fd;
 
 	fd = open( pathname, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR );
 	if ( fd < 0 ) {
@@ -89,10 +89,10 @@ open_trwp( char *pathname )
 	return fd;
 }
 
-intgen_t
+int
 open_erwp( char *pathname )
 {
-	intgen_t fd;
+	int fd;
 
 	fd = open( pathname, O_EXCL | O_CREAT | O_RDWR, S_IRUSR | S_IWUSR );
 	if ( fd < 0 ) {
@@ -105,31 +105,31 @@ open_erwp( char *pathname )
 	return fd;
 }
 
-intgen_t
+int
 open_rwp( char *pathname )
 {
-	intgen_t fd;
+	int fd;
 
 	fd = open( pathname, O_RDWR );
 
 	return fd;
 }
 
-intgen_t
+int
 mkdir_tp( char *pathname )
 {
-	intgen_t rval;
+	int rval;
 
 	rval = mkdir( pathname, S_IRWXU );
 
 	return rval;
 }
 
-intgen_t
+int
 open_trwdb( char *dirname, char *basename, pid_t pid )
 {
 	char *pathname;
-	intgen_t fd;
+	int fd;
 
 	pathname = open_pathalloc( dirname, basename, pid );
 	fd = open_trwp( pathname );
@@ -138,11 +138,11 @@ open_trwdb( char *dirname, char *basename, pid_t pid )
 	return fd;
 }
 
-intgen_t
+int
 open_erwdb( char *dirname, char *basename, pid_t pid )
 {
 	char *pathname;
-	intgen_t fd;
+	int fd;
 
 	pathname = open_pathalloc( dirname, basename, pid );
 	fd = open_erwp( pathname );
@@ -151,11 +151,11 @@ open_erwdb( char *dirname, char *basename, pid_t pid )
 	return fd;
 }
 
-intgen_t
+int
 open_rwdb( char *dirname, char *basename, pid_t pid )
 {
 	char *pathname;
-	intgen_t fd;
+	int fd;
 
 	pathname = open_pathalloc( dirname, basename, pid );
 	fd = open_rwp( pathname );
common/openutil.h +7 -7
index c00233d..587462c 100644
@@ -35,28 +35,28 @@ extern char *open_pathalloc( char *dirname, char *basename, pid_t pid );
  * return the file descriptor, or -1 with errno set. uses mlog( MLOG_NORMAL...
  * if the creation fails.
  */
-extern intgen_t open_trwdb( char *dirname, char *basename, pid_t pid );
-extern intgen_t open_trwp( char *pathname );
+extern int open_trwdb( char *dirname, char *basename, pid_t pid );
+extern int open_trwp( char *pathname );
 
 
 /* open the specified file, with read and write permissions, given a
  * directory and base.* return the file descriptor, or -1 with errno set.
  * uses mlog( MLOG_NORMAL... if the open fails.
  */
-extern intgen_t open_rwdb( char *dirname, char *basename, pid_t pid );
-extern intgen_t open_rwp( char *pathname );
+extern int open_rwdb( char *dirname, char *basename, pid_t pid );
+extern int open_rwp( char *pathname );
 
 
 /* create and open the specified file, failing if already exists
  */
-extern intgen_t open_erwp( char *pathname );
-extern intgen_t open_erwdb( char *dirname, char *basename, pid_t pid );
+extern int open_erwp( char *pathname );
+extern int open_erwdb( char *dirname, char *basename, pid_t pid );
 
 
 /* create the specified directory, guaranteed to be initially empty. returns
  * 0 on success, -1 if trouble. uses mlog( MLOG_NORMAL... if the creation fails.
  */
-extern intgen_t mkdir_tp( char *pathname );
+extern int mkdir_tp( char *pathname );
 
 
 #endif /* UTIL_H */
common/qlock.c +8 -8
index 1b466d6..0583a63 100644
@@ -106,7 +106,7 @@ qlock_lock( qlockh_t qlockh )
 	qlock_t *qlockp = ( qlock_t * )qlockh;
 	pthread_t tid;
 	/* REFERENCED */
-	intgen_t rval;
+	int rval;
 	
 	/* get the caller's tid
 	 */
@@ -149,7 +149,7 @@ qlock_unlock( qlockh_t qlockh )
 {
 	qlock_t *qlockp = ( qlock_t * )qlockh;
 	/* REFERENCED */
-	intgen_t rval;
+	int rval;
 	
 	/* verify lock is held by this thread
 	 */
@@ -169,7 +169,7 @@ qsemh_t
 qsem_alloc( ix_t cnt )
 {
 	sem_t *semp;
-	intgen_t rval;
+	int rval;
 
 	/* allocate a semaphore
 	 */
@@ -188,7 +188,7 @@ void
 qsem_free( qsemh_t qsemh )
 {
 	sem_t *semp = ( sem_t * )qsemh;
-	intgen_t rval;
+	int rval;
 
 	/* destroy the mutex and condition
 	 */
@@ -204,7 +204,7 @@ void
 qsemP( qsemh_t qsemh )
 {
 	sem_t *semp = ( sem_t * )qsemh;
-	intgen_t rval;
+	int rval;
 	
 	/* "P" the semaphore
 	 */
@@ -216,7 +216,7 @@ void
 qsemV( qsemh_t qsemh )
 {
 	sem_t *semp = ( sem_t * )qsemh;
-	intgen_t rval;
+	int rval;
 	
 	/* "V" the semaphore
 	 */
@@ -229,7 +229,7 @@ qsemPwouldblock( qsemh_t qsemh )
 {
 	sem_t *semp = ( sem_t * )qsemh;
 	int count;
-	intgen_t rval;
+	int rval;
 
 	rval = sem_getvalue( semp, &count );
 	assert( !rval );
@@ -242,7 +242,7 @@ qsemPavail( qsemh_t qsemh )
 {
 	sem_t *semp = ( sem_t * )qsemh;
 	int count;
-	intgen_t rval;
+	int rval;
 
 	rval = sem_getvalue( semp, &count );
 	assert( !rval );
common/ring.c +2 -2
index 37a2d1d..bb90901 100644
@@ -46,7 +46,7 @@ ring_create( size_t ringlen,
 	     int ( *readfunc )( void *clientctxp, char *bufp ),
 	     int ( *writefunc )( void *clientctxp, char *bufp ),
 	     void *clientctxp,
-	     intgen_t *rvalp )
+	     int *rvalp )
 {
 	bool_t ok;
 	ring_t *ringp;
@@ -107,7 +107,7 @@ ring_create( size_t ringlen,
 			return 0;
 		}
 		if ( pinpr ) {
-			intgen_t rval;
+			int rval;
 			rval = mlock( ( void * )msgp->rm_bufp, bufsz );
 			if ( rval ) {
 				if ( errno == ENOMEM ) {
common/ring.h +2 -2
index caa505c..4a1cc54 100644
@@ -113,7 +113,7 @@ typedef enum ring_loc ring_loc_t;
 struct ring_msg {
 	ring_op_t rm_op;
 	ring_stat_t rm_stat;
-	intgen_t rm_rval;
+	int rm_rval;
 	off64_t rm_user;
 	char *rm_bufp;
 /* ALL BELOW PRIVATE!!! */
@@ -171,7 +171,7 @@ extern ring_t *ring_create( size_t ringlen,
 			    int ( * readfunc )( void *clientctxp, char *bufp ),
 			    int ( * writefunc )( void *clientctxp, char *bufp ),
 			    void *clientctxp,
-			    intgen_t *rvalp );
+			    int *rvalp );
 
 
 /* ring_get - get a message off the ready queue
common/stream.c +5 -5
index 90d315a..549bf59 100644
@@ -36,7 +36,7 @@
 struct spm {
 	stream_state_t	s_state;
 	pthread_t	s_tid;
-	intgen_t	s_ix;
+	int	s_ix;
 	int		s_exit_code;
 	rv_t		s_exit_return;
 	rv_t		s_exit_hint;
@@ -64,7 +64,7 @@ stream_init( void )
  */
 
 void
-stream_register( pthread_t tid, intgen_t streamix )
+stream_register( pthread_t tid, int streamix )
 {
 	spm_t *p = spm;
 	spm_t *ep = spm + N(spm);
@@ -187,12 +187,12 @@ stream_find( pthread_t tid, stream_state_t s[], int nstates )
  * another lock. So no locking is done in this function.
  */
 
-intgen_t
+int
 stream_getix( pthread_t tid )
 {
 	stream_state_t states[] = { S_RUNNING };
 	spm_t *p;
-	intgen_t ix;
+	int ix;
 	p = stream_find( tid, states, N(states) );
 	ix = p ? p->s_ix : -1;
 	return ix;
@@ -246,7 +246,7 @@ stream_get_exit_status( pthread_t tid,
 			stream_state_t states[],
 			int nstates,
 			stream_state_t *state,
-			intgen_t *ix,
+			int *ix,
 			int *exit_code,
 			rv_t *exit_return,
 			rv_t *exit_hint)
common/stream.h +3 -3
index 4b3799f..a83a5a5 100644
@@ -42,7 +42,7 @@
 typedef enum { S_FREE, S_RUNNING, S_ZOMBIE } stream_state_t;
 
 extern void stream_init( void );
-extern void stream_register( pthread_t tid, intgen_t streamix );
+extern void stream_register( pthread_t tid, int streamix );
 /* NOTE: lock() must be held when calling stream_dead */
 extern void stream_dead( pthread_t tid );
 extern void stream_free( pthread_t tid );
@@ -50,7 +50,7 @@ extern int stream_find_all( stream_state_t states[],
 			    int nstates,
 			    pthread_t tids[],
 			    int ntids );
-extern intgen_t stream_getix( pthread_t tid );
+extern int stream_getix( pthread_t tid );
 extern void stream_set_code( pthread_t tid, int code );
 extern void stream_set_return( pthread_t tid, rv_t rv );
 extern void stream_set_hint( pthread_t tid, rv_t rv );
@@ -59,7 +59,7 @@ extern bool_t stream_get_exit_status( pthread_t tid,
 				      stream_state_t states[],
 				      int nstates,
 				      stream_state_t *state,
-				      intgen_t *ix,
+				      int *ix,
 				      int *exit_code,
 				      rv_t *exit_return,
 				      rv_t *exit_hint);
common/types.h +3 -3
index 9d3606a..9afb3a7 100644
@@ -38,7 +38,7 @@ typedef u_int32_t size32_t;
 typedef u_int64_t size64_t;
 typedef char char_t;
 typedef unsigned char u_char_t;
-typedef unsigned int u_intgen_t;
+typedef unsigned int u_int;
 typedef long long_t;
 typedef unsigned long u_long_t;
 typedef size_t ix_t;
@@ -70,8 +70,8 @@ typedef int32_t time32_t;
 #define SIZE64MAX	MKUMAX( size64_t )
 #define INO64MAX	MKUMAX( xfs_ino_t )
 #define OFF64MAX	MKSMAX( off64_t )
-#define INTGENMAX	MKSMAX( intgen_t )
-#define UINTGENMAX	MKUMAX( u_intgen_t )
+#define INTGENMAX	MKSMAX( int )
+#define UINTGENMAX	MKUMAX( u_int )
 #define OFFMAX		MKSMAX( off_t )
 #define SIZEMAX		MKUMAX( size_t )
 #define IXMAX		MKUMAX( size_t )
common/util.c +33 -33

171 lines not on this page · raw message

common/util.h +21 -21

98 lines not on this page · raw message

dump/content.c +53 -53

111 lines not on this page · raw message

dump/inomap.c +78 -78

156 lines not on this page · raw message

dump/inomap.h +3 -3
index 7d1db1f..663b434 100644

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

dump/var.c +2 -2
index ceb7e3a..d3fa3be 100644

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

inventory/inv_api.c +3 -3
index b564d2f..4c1855b 100644

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

inventory/inv_core.c +7 -7
index 7020f7f..419f575 100644

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

inventory/inv_fstab.c +3 -3
index 8263852..1c2bf3d 100644

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

inventory/inv_idx.c +7 -7
index 0378c5a..13b64db 100644

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

inventory/inv_mgr.c +4 -4
index f1341b9..1b99d5c 100644

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

inventory/inv_oref.c +15 -15
index ebcae95..66a03f4 100644

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

inventory/inv_oref.h +5 -5
index 2562500..e16684d 100644

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

inventory/inv_priv.h +35 -35

70 lines not on this page · raw message

inventory/inv_stobj.c +10 -10
index bae2fc5..0b6aa45 100644

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

inventory/inventory.h +1 -1
index 32156dd..43ac969 100644

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

inventory/testmain.c +4 -4
index 51b7774..7a268ea 100644

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

invutil/invidx.c +1 -1
index b6ce4fa..56995f0 100644

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

restore/content.c +66 -66

132 lines not on this page · raw message

restore/dirattr.c +15 -15
index a15abe5..d8d5140 100644

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

restore/inomap.c +24 -24

48 lines not on this page · raw message

restore/inomap.h +1 -1
index f208199..bc40f3e 100644

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

restore/namreg.c +5 -5
index 18ba6d9..8c3b74f 100644

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

restore/namreg.h +1 -1
index 11004b6..8bc7b53 100644

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

restore/node.c +7 -7
index 046f2f6..92a21ce 100644

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

restore/node.h +2 -2
index ba98d49..25fdaad 100644

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

restore/tree.c +27 -27

54 lines not on this page · raw message

restore/win.c +3 -3
index 3ca2af8..e6c0be3 100644

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

restore/win.h +2 -2
index 50d1dcc..a6bd002 100644

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

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

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

#9 lore raw

PATCH 4/8 cleanup: kill u_int*_t types

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

They are the same as uint*_t type defined in <stdint.h>, so seek and destroy these to reduce the type proliferation issues that this code has.

---
 common/content_inode.h  | 78 ++++++++++++++++++++++++-------------------------
 common/drive.h          |  4 +--
 common/drive_minrmt.c   | 56 +++++++++++++++++------------------
 common/drive_scsitape.c | 40 ++++++++++++-------------
 common/global.c         | 20 ++++++-------
 common/global.h         |  8 ++---
 common/hsmapi.c         | 10 +++----
 common/hsmapi.h         |  4 +--
 common/inventory.c      |  4 +--
 common/inventory.h      |  4 +--
 common/main.c           | 10 +++----
 common/media.h          | 10 +++----
 common/rec_hdr.h        |  4 +--
 common/types.h          | 17 +++++++----
 dump/content.c          | 66 ++++++++++++++++++++---------------------
 dump/inomap.c           | 30 +++++++++----------
 dump/inomap.h           |  8 ++---
 inventory/inv_api.c     |  6 ++--
 inventory/inv_core.c    |  4 +--
 inventory/inv_idx.c     | 18 ++++++------
 inventory/inv_mgr.c     |  4 +--
 inventory/inv_priv.h    | 32 ++++++++++----------
 inventory/inv_stobj.c   | 46 ++++++++++++++---------------
 inventory/inventory.h   | 12 ++++----
 inventory/testmain.c    |  2 +-
 invutil/invidx.c        |  6 ++--
 restore/content.c       | 20 ++++++-------
 restore/dirattr.c       | 54 +++++++++++++++++-----------------
 restore/dirattr.h       | 12 ++++----
 restore/inomap.c        | 24 +++++++--------
 restore/inomap.h        |  6 ++--
 restore/namreg.c        |  2 +-
 restore/namreg.h        |  2 +-
 restore/tree.c          |  6 ++--
 restore/tree.h          |  4 +--
 35 files changed, 319 insertions(+), 314 deletions(-)
common/content_inode.h +39 -39
index 9013ca4..a69a9a0 100644
@@ -88,19 +88,19 @@ struct content_inode_hdr {
 		/* starting point of media file contents */
 	startpt_t cih_endpt;				/*  18  70 */
 		/* starting point of next stream */
-	u_int64_t cih_inomap_hnkcnt;			/*   8  78 */
+	uint64_t cih_inomap_hnkcnt;			/*   8  78 */
 
-	u_int64_t cih_inomap_segcnt;			/*   8  80 */
+	uint64_t cih_inomap_segcnt;			/*   8  80 */
 
-	u_int64_t cih_inomap_dircnt;			/*   8  88 */
+	uint64_t cih_inomap_dircnt;			/*   8  88 */
 
-	u_int64_t cih_inomap_nondircnt;			/*   8  90 */
+	uint64_t cih_inomap_nondircnt;			/*   8  90 */
 
 	xfs_ino_t cih_inomap_firstino;			/*   8  98 */
 
 	xfs_ino_t cih_inomap_lastino;			/*   8  a0 */
 
-	u_int64_t cih_inomap_datasz;			/*   8  a8 */
+	uint64_t cih_inomap_datasz;			/*   8  a8 */
 		/* bytes of non-metadata dumped */
 	char cih_pad2[ CONTENT_INODE_HDR_SZ - 0xa8 ];	/*  18  c0 */
 		/* padding */
@@ -158,27 +158,27 @@ typedef struct timestruct timestruct_t;
 
 struct bstat {				/*		     bytes accum */
 	xfs_ino_t	bs_ino;		/* inode number		 8     8 */
-	u_int32_t	bs_mode;	/* type and mode	 4     c */
-	u_int32_t	bs_nlink;	/* number of links	 4    10 */
+	uint32_t	bs_mode;	/* type and mode	 4     c */
+	uint32_t	bs_nlink;	/* number of links	 4    10 */
 	int32_t		bs_uid;		/* user id		 4    14 */
 	int32_t		bs_gid;		/* group id		 4    18 */
-	u_int32_t	bs_rdev;	/* device value		 4    1c */
+	uint32_t	bs_rdev;	/* device value		 4    1c */
 	int32_t		bs_blksize;	/* block size		 4    20 */
 	off64_t		bs_size;	/* file size		 8    28 */
 	timestruct_t	bs_atime;	/* access time		 8    30 */
 	timestruct_t	bs_mtime;	/* modify time		 8    38 */
 	timestruct_t	bs_ctime;	/* inode change time	 8    40 */
 	int64_t		bs_blocks;	/* number of blocks	 8    48 */
-	u_int32_t	bs_xflags;	/* extended flags	 4    4c */
+	uint32_t	bs_xflags;	/* extended flags	 4    4c */
 	int32_t		bs_extsize;	/* extent size		 4    50 */
 	int32_t		bs_extents;	/* number of extents	 4    54 */
-	u_int32_t	bs_gen;		/* generation count	 4    58 */
-	u_int16_t	bs_projid_lo;	/* low 16 of project id	 2    5a */
-	u_int16_t	bs_forkoff;	/* inode fork offset	 2    5c */
-	u_int16_t	bs_projid_hi;	/* hi 16 of project id	 2    5e */
+	uint32_t	bs_gen;		/* generation count	 4    58 */
+	uint16_t	bs_projid_lo;	/* low 16 of project id	 2    5a */
+	uint16_t	bs_forkoff;	/* inode fork offset	 2    5c */
+	uint16_t	bs_projid_hi;	/* hi 16 of project id	 2    5e */
 	char		bs_pad[ 10 ];	/* for expansion	 e    68 */
-	u_int32_t	bs_dmevmask;	/* DMI event mask        4    6c */
-	u_int16_t	bs_dmstate;	/* DMI state info        2    6e */
+	uint32_t	bs_dmevmask;	/* DMI event mask        4    6c */
+	uint16_t	bs_dmstate;	/* DMI state info        2    6e */
 	char		bs_pad1[ 18 ];	/* for expansion        12    80 */
 					/* NOTE: old dumps didn't always
 					 * zero first 2 bytes of bs_pad1 */
@@ -216,12 +216,12 @@ bstat_projid(struct bstat *bs)
 struct filehdr {
 	int64_t fh_offset;
 	int32_t fh_flags;
-	u_int32_t fh_checksum;
+	uint32_t fh_checksum;
 	bstat_t fh_stat;
 	char fh_pad2[ FILEHDR_SZ
 		      - sizeof( int64_t )
 		      - sizeof( int32_t )
-		      - sizeof( u_int32_t )
+		      - sizeof( uint32_t )
 		      - sizeof( bstat_t ) ];
 };
 
@@ -260,7 +260,7 @@ struct extenthdr {
 	off64_t eh_offset;
 	int32_t eh_type;
 	int32_t eh_flags;
-	u_int32_t eh_checksum;
+	uint32_t eh_checksum;
 	char eh_pad[ 4 ];
 };
 
@@ -298,7 +298,7 @@ typedef struct extenthdr extenthdr_t;
  * a sequence of directory entries is always terminated with a null direnthdr_t.
  * this is detected by looking for a zero ino.
  */
-typedef u_int32_t gen_t;
+typedef uint32_t gen_t;
 
 #define DIRENTHDR_ALIGN	8
 
@@ -307,8 +307,8 @@ typedef u_int32_t gen_t;
 struct direnthdr {
 	xfs_ino_t dh_ino;
 	gen_t dh_gen;
-	u_int32_t dh_checksum;
-	u_int16_t dh_sz; /* overall size of record */
+	uint32_t dh_checksum;
+	uint16_t dh_sz; /* overall size of record */
 	char dh_name[ 6 ];
 };
 
@@ -320,9 +320,9 @@ typedef struct direnthdr direnthdr_t;
 
 struct direnthdr_v1 {
 	xfs_ino_t dh_ino;
-	u_int16_t dh_gen; /* generation count & DENTGENMASK of ref'ed inode */
-	u_int16_t dh_sz; /* overall size of record */
-	u_int32_t dh_checksum;
+	uint16_t dh_gen; /* generation count & DENTGENMASK of ref'ed inode */
+	uint16_t dh_sz; /* overall size of record */
+	uint32_t dh_checksum;
 	char dh_name[ 8 ];
 };
 
@@ -353,11 +353,11 @@ typedef struct direnthdr_v1 direnthdr_v1_t;
 #define EXTATTRHDR_ALIGN	8
 
 struct extattrhdr {
-	u_int32_t ah_sz; /* overall size of extended attribute record */
-	u_int16_t ah_valoff; /* byte offset within record of value */
-	u_int16_t ah_flags; /* see EXTATTRHDR_FLAGS_... below */
-	u_int32_t ah_valsz; /* size of value */
-	u_int32_t ah_checksum; /* hdr checksum */
+	uint32_t ah_sz; /* overall size of extended attribute record */
+	uint16_t ah_valoff; /* byte offset within record of value */
+	uint16_t ah_flags; /* see EXTATTRHDR_FLAGS_... below */
+	uint32_t ah_valsz; /* size of value */
+	uint32_t ah_checksum; /* hdr checksum */
 };
 
 typedef struct extattrhdr extattrhdr_t;
@@ -381,15 +381,15 @@ typedef struct extattrhdr extattrhdr_t;
 	 */
 
 /* Routines for calculating and validating checksums on xfsdump headers.
- * The header length must be an integral number of u_int32_t's.
+ * The header length must be an integral number of uint32_t's.
  */
-static inline u_int32_t
+static inline uint32_t
 calc_checksum(void *bufp, size_t len)
 {
-	u_int32_t sum = 0;
-	u_int32_t *sump = bufp;
-	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	assert(len % sizeof(u_int32_t) == 0);
+	uint32_t sum = 0;
+	uint32_t *sump = bufp;
+	uint32_t *endp = sump + len / sizeof(uint32_t);
+	assert(len % sizeof(uint32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return ~sum + 1;
@@ -398,10 +398,10 @@ calc_checksum(void *bufp, size_t len)
 static inline bool_t
 is_checksum_valid(void *bufp, size_t len)
 {
-	u_int32_t sum = 0;
-	u_int32_t *sump = bufp;
-	u_int32_t *endp = sump + len / sizeof(u_int32_t);
-	assert(len % sizeof(u_int32_t) == 0);
+	uint32_t sum = 0;
+	uint32_t *sump = bufp;
+	uint32_t *endp = sump + len / sizeof(uint32_t);
+	assert(len % sizeof(uint32_t) == 0);
 	while (sump < endp)
 		sum += *sump++;
 	return sum == 0 ? BOOL_TRUE : BOOL_FALSE;
common/drive.h +2 -2
index b0efa4c..89b143e 100644
@@ -102,9 +102,9 @@
 #define DRIVE_HDR_SZ		sizeofmember( global_hdr_t, gh_upper )
 
 struct drive_hdr {
-	u_int32_t dh_drivecnt;				/*   4    4 */
+	uint32_t dh_drivecnt;				/*   4    4 */
 		/* number of drives used to dump the fs */
-	u_int32_t dh_driveix;				/*   4    8 */
+	uint32_t dh_driveix;				/*   4    8 */
 		/* 0-based index of the drive used to dump this stream */
 	int32_t dh_strategyid;				/*   4    c */
 		/* ID of the drive strategy used to produce this dump */
common/drive_minrmt.c +28 -28

165 lines not on this page · raw message

common/drive_scsitape.c +20 -20
index 605675f..06ba2f4 100644
@@ -288,7 +288,7 @@ typedef long mtstat_t;
 
 extern void usage( void );
 #ifdef DUMP
-extern u_int64_t hdr_mfilesz;
+extern uint64_t hdr_mfilesz;
 #endif /* DUMP */
 
 /* remote tape protocol declarations (should be a system header file)
@@ -446,7 +446,7 @@ static drive_ops_t drive_ops = {
 	do_quit,		/* do_quit */
 };
 
-static u_int32_t cmdlineblksize = 0;
+static uint32_t cmdlineblksize = 0;
 
 /* definition of locally defined global functions ****************************/
 
@@ -633,7 +633,7 @@ ds_instantiate( int argc, char *argv[], drive_t *drivep )
 				    c );
 			    return -10;
 			}
-			cmdlineblksize = ( u_int32_t )atoi( optarg );
+			cmdlineblksize = ( uint32_t )atoi( optarg );
 			break;
 #ifdef DUMP
 		case GETOPT_OVERWRITE:
@@ -1116,13 +1116,13 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 	 */
 	currentoffset = contextp->dc_reccnt * ( off64_t )tape_recsz;
 	if ( contextp->dc_recp ) {
-		u_int32_t recoff;
+		uint32_t recoff;
 #ifdef DEBUG
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
 		assert( contextp->dc_nextp >= contextp->dc_recp );
-		recoff = ( u_int32_t )( contextp->dc_nextp
+		recoff = ( uint32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
 		assert( recoff <= tape_recsz );
@@ -1145,7 +1145,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 				+
 				( off64_t )rechdrp->rec_used;
 		if ( wantedoffset >= nextrecoffset ) {
-			u_int32_t recoff;
+			uint32_t recoff;
 			size_t wantedcnt;
 			char *dummybufp;
 			size_t actualcnt;
@@ -1161,7 +1161,7 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 			/* figure how much to ask for
 			 */
 			assert( contextp->dc_nextp >= contextp->dc_recp );
-			recoff = ( u_int32_t )( contextp->dc_nextp
+			recoff = ( uint32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
 			wantedcnt = ( size_t )( rechdrp->rec_used
@@ -1345,11 +1345,11 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 		assert( wantedoffset - currentoffset < ( off64_t )tape_recsz );
 		wantedcnt = ( size_t )( wantedoffset - currentoffset );
 		if ( contextp->dc_recp ) {
-			u_int32_t recoff;
+			uint32_t recoff;
 #ifdef DEBUG
 			rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
-			recoff = ( u_int32_t )( contextp->dc_nextp
+			recoff = ( uint32_t )( contextp->dc_nextp
 						-
 						contextp->dc_recp );
 			assert( recoff <= tape_recsz );
@@ -1382,13 +1382,13 @@ do_seek_mark( drive_t *drivep, drive_mark_t *markp )
 	 */
 	currentoffset = contextp->dc_reccnt * ( off64_t )tape_recsz;
 	if ( contextp->dc_recp ) {
-		u_int32_t recoff;
+		uint32_t recoff;
 #ifdef DEBUG
 		rec_hdr_t *rechdrp = ( rec_hdr_t * )contextp->dc_recp;
 #endif
 
 		assert( contextp->dc_nextp >= contextp->dc_recp );
-		recoff = ( u_int32_t )( contextp->dc_nextp
+		recoff = ( uint32_t )( contextp->dc_nextp
 					-
 					contextp->dc_recp );
 		assert( recoff <= tape_recsz );
@@ -1665,7 +1665,7 @@ huntQIC:
 	      p < contextp->dc_recendp
 	      ;
 	      p += QIC_BLKSZ ) {
-		if ( *( u_int64_t * )p == STAPE_MAGIC ) {
+		if ( *( uint64_t * )p == STAPE_MAGIC ) {
 			goto adjustQIC;
 		}
 	}
@@ -3614,10 +3614,10 @@ static void
 tape_rec_checksum_set( drive_context_t *contextp, char *bufp )
 {
 	rec_hdr_t *rechdrp = ( rec_hdr_t * )bufp;
-	u_int32_t *beginp = ( u_int32_t * )bufp;
-	u_int32_t *endp = ( u_int32_t * )( bufp + tape_recsz );
-	u_int32_t *p;
-	u_int32_t accum;
+	uint32_t *beginp = ( uint32_t * )bufp;
+	uint32_t *endp = ( uint32_t * )( bufp + tape_recsz );
+	uint32_t *p;
+	uint32_t accum;
 
 	if ( ! contextp->dc_recchksumpr ) {
 		return;
@@ -3636,10 +3636,10 @@ static bool_t
 tape_rec_checksum_check( drive_context_t *contextp, char *bufp )
 {
 	rec_hdr_t *rechdrp = ( rec_hdr_t * )bufp;
-	u_int32_t *beginp = ( u_int32_t * )bufp;
-	u_int32_t *endp = ( u_int32_t * )( bufp + tape_recsz );
-	u_int32_t *p;
-	u_int32_t accum;
+	uint32_t *beginp = ( uint32_t * )bufp;
+	uint32_t *endp = ( uint32_t * )( bufp + tape_recsz );
+	uint32_t *p;
+	uint32_t accum;
 
 	if ( contextp->dc_recchksumpr && INT_GET(rechdrp->ischecksum, ARCH_CONVERT)) {
 		accum = 0;
common/global.c +10 -10
index 2129941..ea7ad6d 100644
@@ -96,7 +96,7 @@ global_hdr_alloc( int argc, char *argv[ ] )
 
 	/* fill in the host id: typecast to fit into a 64 bit field
 	 */
-	ghdrp->gh_ipaddr = ( u_int64_t )( unsigned long )gethostid( );
+	ghdrp->gh_ipaddr = ( uint64_t )( unsigned long )gethostid( );
 
 #ifdef DUMP
 	uuid_generate( ghdrp->gh_dumpid );
@@ -243,10 +243,10 @@ global_hdr_free( global_hdr_t *ghdrp )
 void
 global_hdr_checksum_set( global_hdr_t *hdrp )
 {
-	u_int32_t *beginp = ( u_int32_t * )&hdrp[ 0 ];
-	u_int32_t *endp = ( u_int32_t * )&hdrp[ 1 ];
-	u_int32_t *p;
-	u_int32_t accum;
+	uint32_t *beginp = ( uint32_t * )&hdrp[ 0 ];
+	uint32_t *endp = ( uint32_t * )&hdrp[ 1 ];
+	uint32_t *p;
+	uint32_t accum;
 
 	hdrp->gh_checksum = 0;
 	accum = 0;
@@ -263,10 +263,10 @@ global_hdr_checksum_set( global_hdr_t *hdrp )
 bool_t
 global_hdr_checksum_check( global_hdr_t *hdrp )
 {
-	u_int32_t *beginp = ( u_int32_t * )&hdrp[ 0 ];
-	u_int32_t *endp = ( u_int32_t * )&hdrp[ 1 ];
-	u_int32_t *p;
-	u_int32_t accum;
+	uint32_t *beginp = ( uint32_t * )&hdrp[ 0 ];
+	uint32_t *endp = ( uint32_t * )&hdrp[ 1 ];
+	uint32_t *p;
+	uint32_t accum;
 
 	accum = 0;
 	for ( p = beginp ; p < endp ; p++ ) {
@@ -279,7 +279,7 @@ global_hdr_checksum_check( global_hdr_t *hdrp )
  * else return BOOL_FALSE
  */
 bool_t 
-global_version_check( u_int32_t version )
+global_version_check( uint32_t version )
 {
 	switch (version) {
 		case GLOBAL_HDR_VERSION_0:
common/global.h +4 -4
index 537be0c..0b738de 100644
@@ -43,15 +43,15 @@
 struct global_hdr {
 	char gh_magic[ GLOBAL_HDR_MAGIC_SZ ];		/*   8    8 */
 		/* unique signature of xfsdump */
-	u_int32_t gh_version;				/*   4    c */
+	uint32_t gh_version;				/*   4    c */
 		/* header version */
-	u_int32_t gh_checksum;				/*   4   10 */
+	uint32_t gh_checksum;				/*   4   10 */
 		/* 32-bit unsigned additive inverse of entire header */
 	time32_t gh_timestamp;				/*   4   14 */
 		/* time32_t of dump */
 	char gh_pad1[ 4 ];				/*   4   18 */
 		/* alignment */
-	u_int64_t gh_ipaddr;				/*   8   20 */
+	uint64_t gh_ipaddr;				/*   8   20 */
 		/* from gethostid(2), room for expansion */
 	uuid_t gh_dumpid;				/*  10   30 */
 		/* ID of dump session	 */
@@ -97,7 +97,7 @@ extern bool_t global_hdr_checksum_check( global_hdr_t *hdrp );
  * else return BOOL_FALSE
  */
 
-extern bool_t global_version_check( u_int32_t version );
+extern bool_t global_version_check( uint32_t version );
 
 
 #endif /* GLOBAL_H */
common/hsmapi.c +5 -5
index ed29370..489223d 100644
@@ -137,7 +137,7 @@ typedef	struct	{
 static inline void
 msb_store(
 	u_char		*dest,
-	u_int64_t	src,
+	uint64_t	src,
 	int		length)
 {
         int             i;
@@ -155,12 +155,12 @@ msb_store(
 * Returns
 *	value
 ******************************************************************************/
-static inline u_int64_t
+static inline uint64_t
 msb_load(
 	u_char		*src,
 	int		length)
 {
-        u_int64_t        tmp = 0;
+        uint64_t        tmp = 0;
         int             i;
 
         for (i = 0; i < length; i++) {
@@ -634,7 +634,7 @@ extern int
 HsmFilterExistingAttribute(
 	hsm_f_ctxt_t	*hsm_f_ctxtp,
 const	char		*namep,		/* attribute name */
-	u_int32_t	valuesz,	/* value size */
+	uint32_t	valuesz,	/* value size */
 	int		flag,
 	int		*skip_entry)
 {
@@ -698,7 +698,7 @@ HsmAddNewAttribute(
 	int		flag,
 	char		**namepp,	/* pointer to new attribute name */
 	char		**valuepp,	/* pointer to its value */
-	u_int32_t	*valueszp)	/* pointer to the value size */
+	uint32_t	*valueszp)	/* pointer to the value size */
 {
 	dmf_f_ctxt_t	*dmf_f_ctxtp = (dmf_f_ctxt_t *)hsm_f_ctxtp;
 	XFSattrvalue1_t	*dmfattr1p = (XFSattrvalue1_t *)dmf_f_ctxtp->attrval;
common/hsmapi.h +2 -2
index 665499c..b6d035d 100644
@@ -252,7 +252,7 @@ extern int
 HsmFilterExistingAttribute(
 	hsm_f_ctxt_t	*hsm_f_ctxtp,
 const	char		*namep,		/* name of attribute to filter */
-	u_int32_t	valuesz,	/* attribute's current value size */
+	uint32_t	valuesz,	/* attribute's current value size */
 	int		flag,		/* ext attr flags */
 	int		*skip_entry);
 
@@ -290,7 +290,7 @@ HsmAddNewAttribute(
 	int		flag,		/* ext attr flags */
 	char		**namepp,	/* pointer to new attribute name */
 	char		**valuepp,	/* pointer to its value */
-	u_int32_t	*valueszp);	/* pointer to the value size */
+	uint32_t	*valueszp);	/* pointer to the value size */
 
 
 /******************************************************************************
common/inventory.c +2 -2
index d1c067b..83e1ebb 100644
@@ -80,7 +80,7 @@ inv_open( inv_predicate_t bywhat, void *pred )
 	}
 	/* create another storage object ( and, an inv_index entry for it too )
 	   if we've filled this one up */
-	if ( (u_int) num >= sescnt->ic_maxnum ) {
+	if ( (uint) num >= sescnt->ic_maxnum ) {
 #ifdef INVT_DEBUG
 		printf("$ creating a new storage obj & index entry. \n" );
 #endif
@@ -225,7 +225,7 @@ inv_writesession_open(
 	uuid_t		*sesid,
 	char		*label,
 	u_char		level,
-	u_int		nstreams,
+	uint		nstreams,
 	time32_t	time,
 	char		*mntpt,
 	char		*devpath )
common/inventory.h +2 -2
index 351f6e0..f9fcb19 100644
@@ -98,7 +98,7 @@ typedef struct inv_stream {
 typedef struct inv_session {
 	uuid_t		 s_fsid;	/* file system */
 	uuid_t 		 s_sesid;	/* this dump session's id: 16 bytes*/
-	u_int		 s_nstreams;	/* number of media streams recorded */
+	uint		 s_nstreams;	/* number of media streams recorded */
 	inv_stream_t	*s_streams;	/* array of streams */
 	time32_t	 s_time;   	/* time of the dump */
 	u_char		 s_level;  	/* dump level */
@@ -159,7 +159,7 @@ inv_writesession_open(
 	uuid_t		*sesid,
 	char		*label,
 	u_char		level,
-	u_int		nstreams,
+	uint		nstreams,
 	time32_t	time,
 	char		*mntpt,
 	char		*devpath );
common/main.c +5 -5
index 08bf574..e381e85 100644
@@ -170,10 +170,10 @@ main( int argc, char *argv[] )
 	assert( sizeof( char_t ) == 1 );
 	assert( sizeof( u_char_t ) == 1 );
 	assert( sizeof( int32_t ) == 4 );
-	assert( sizeof( u_int32_t ) == 4 );
+	assert( sizeof( uint32_t ) == 4 );
 	assert( sizeof( size32_t ) == 4 );
 	assert( sizeof( int64_t ) == 8 );
-	assert( sizeof( u_int64_t ) == 8 );
+	assert( sizeof( uint64_t ) == 8 );
 	assert( sizeof( size64_t ) == 8 );
 
 	/* record the command name used to invoke
@@ -662,7 +662,7 @@ main( int argc, char *argv[] )
 	 * signals.
 	 */
 	if ( progrpt_enabledpr ) {
-		( void )alarm( ( u_int )progrpt_interval );
+		( void )alarm( ( uint )progrpt_interval );
 	}
 	for ( ; ; ) {
 		time32_t now;
@@ -813,7 +813,7 @@ main( int argc, char *argv[] )
 			      "setting alarm for %d second%s\n",
 			      timeout,
 			      timeout == 1 ? "" : "s" );
-			( void )alarm( ( u_int )timeout );
+			( void )alarm( ( uint )timeout );
 			if ( timeout == 0 ) {
 				continue;
 			}
@@ -835,7 +835,7 @@ main( int argc, char *argv[] )
 					      statline[ i ] );
 				}
 			}
-			( void )alarm( ( u_int )( progrpt_deadline
+			( void )alarm( ( uint )( progrpt_deadline
 						       -
 						       now ));
 		}
common/media.h +5 -5
index ee1975f..0b727e5 100644
@@ -46,15 +46,15 @@ struct media_hdr {
 		/* ID of upstream media object */
 	char mh_pad2[ GLOBAL_HDR_UUID_SZ ];		/*  10  330 */
 		/* in case more IDs needed */
-	u_int32_t mh_mediaix;				/*   4  334 */
+	uint32_t mh_mediaix;				/*   4  334 */
 		/* 0-based index of this media object within the dump stream */
-	u_int32_t mh_mediafileix;			/*   4  338 */
+	uint32_t mh_mediafileix;			/*   4  338 */
 		/* 0-based index of this file within this media object */
-	u_int32_t mh_dumpfileix;			/*   4  33c */
+	uint32_t mh_dumpfileix;			/*   4  33c */
 		/* 0-based index of this file within this dump stream */
-	u_int32_t mh_dumpmediafileix;			/*   4  340 */
+	uint32_t mh_dumpmediafileix;			/*   4  340 */
 		/* 0-based index of file within dump stream and media object */
-	u_int32_t mh_dumpmediaix;			/*   4  344 */
+	uint32_t mh_dumpmediaix;			/*   4  344 */
 		/* 0-based index of this dump within the media object */
 	int32_t mh_strategyid;				/*   4  348 */
 		/* ID of the media strategy used to produce this dump */
common/rec_hdr.h +2 -2
index b8f4571..552447c 100644
@@ -36,7 +36,7 @@
  * structure, and add a endian conversion function to arch_xlate.c 
  */
 struct rec_hdr {
-	u_int64_t magic;			/*   8   8 */
+	uint64_t magic;			/*   8   8 */
 		/* magic number STAPE_MAGIC (see above)
 		 */
 	int32_t version;			/*   4   c */
@@ -62,7 +62,7 @@ struct rec_hdr {
 		/* raw media file byte offset of first mark set
 		 * in this record. set to -1 if no marks in record
 		 */
-	u_int32_t rec_used;			/*   4  34 */
+	uint32_t rec_used;			/*   4  34 */
 		/* portion of record containing user data plus rec hdr (bytes).
 		 * normally set to record size. last record written may
 		 * indicate smaller value. includes record header.
common/types.h +11 -6
index 9afb3a7..235f52a 100644
@@ -18,6 +18,11 @@
 #ifndef TYPES_H
 #define TYPES_H
 
+/*
+ * Pull in all the standard C types first.
+ */
+#include <stdint.h>
+
 #define XFSDUMP_DIRPATH	inv_basepath()
 
 /*
@@ -34,11 +39,11 @@
 
 /* integers
  */
-typedef u_int32_t size32_t;
-typedef u_int64_t size64_t;
+typedef uint32_t size32_t;
+typedef uint64_t size64_t;
 typedef char char_t;
 typedef unsigned char u_char_t;
-typedef unsigned int u_int;
+typedef unsigned int uint;
 typedef long long_t;
 typedef unsigned long u_long_t;
 typedef size_t ix_t;
@@ -63,15 +68,15 @@ typedef int32_t time32_t;
 #define MKSMAX( t )	MKMAX( t, 1ull )
 #define MKUMAX( t )	MKMAX( t, 0ull )
 #define INT32MAX	MKSMAX( int32_t )
-#define UINT32MAX	MKUMAX( u_int32_t )
+#define UINT32MAX	MKUMAX( uint32_t )
 #define SIZE32MAX	MKUMAX( size32_t )
 #define INT64MAX	MKSMAX( int64_t )
-#define UINT64MAX	MKUMAX( u_int64_t )
+#define UINT64MAX	MKUMAX( uint64_t )
 #define SIZE64MAX	MKUMAX( size64_t )
 #define INO64MAX	MKUMAX( xfs_ino_t )
 #define OFF64MAX	MKSMAX( off64_t )
 #define INTGENMAX	MKSMAX( int )
-#define UINTGENMAX	MKUMAX( u_int )
+#define UINTGENMAX	MKUMAX( uint )
 #define OFFMAX		MKSMAX( off_t )
 #define SIZEMAX		MKUMAX( size_t )
 #define IXMAX		MKUMAX( size_t )
dump/content.c +33 -33

168 lines not on this page · raw message

dump/inomap.c +15 -15
index 06f3869..4e57a78 100644
@@ -62,7 +62,7 @@
 extern bool_t preemptchk( int );
 extern size_t pgsz;
 extern hsm_fs_ctxt_t *hsm_fs_ctxtp;
-extern u_int64_t maxdumpfilesize;
+extern uint64_t maxdumpfilesize;
 extern bool_t allowexcludefiles_pr;
 
 /* forward declarations of locally defined static functions ******************/
@@ -133,8 +133,8 @@ static int subtreelist_parse( jdm_fshandle_t *,
 static ix_t *inomap_statphasep;
 static ix_t *inomap_statpassp;
 static size64_t *inomap_statdonep;
-static u_int64_t inomap_exclude_filesize = 0;
-static u_int64_t inomap_exclude_skipattr = 0;
+static uint64_t inomap_exclude_filesize = 0;
+static uint64_t inomap_exclude_skipattr = 0;
 
 /* definition of locally defined global functions ****************************/
 
@@ -949,7 +949,7 @@ cb_startpt( void *arg1,
 /* define structure for ino to gen mapping.
  */
 struct i2gseg {
-	u_int64_t s_valid;
+	uint64_t s_valid;
 	gen_t s_gen[ INOPERSEG ];
 };
 typedef struct i2gseg i2gseg_t;
@@ -971,10 +971,10 @@ static inline void
 SEG_SET_BITS( seg_t *segp, xfs_ino_t ino, int state )
 {
 	register xfs_ino_t relino;
-	register u_int64_t mask;
-	register u_int64_t clrmask;
+	register uint64_t mask;
+	register uint64_t clrmask;
 	relino = ino - segp->base;
-	mask = ( u_int64_t )1 << relino;
+	mask = ( uint64_t )1 << relino;
 	clrmask = ~mask;
 	switch( state ) {
 	case 0:
@@ -1025,9 +1025,9 @@ SEG_GET_BITS( seg_t *segp, xfs_ino_t ino )
 {
 	int state;
 	register xfs_ino_t relino;
-	register u_int64_t mask;
+	register uint64_t mask;
 	relino = ino - segp->base;
-	mask = ( u_int64_t )1 << relino;
+	mask = ( uint64_t )1 << relino;
 	if ( segp->lobits & mask ) {
 		state = 1;
 	} else {
@@ -1063,7 +1063,7 @@ inomap_init( int igrpcnt )
 	return 0;
 }
 
-u_int64_t
+uint64_t
 inomap_getsz( void )
 {
 	return (inomap.lastseg.hnkoff + 1) * HNKSZ;
@@ -1378,7 +1378,7 @@ inomap_set_gen(void *contextp, xfs_ino_t ino, gen_t gen)
 	i2gsegp = &inomap.i2gmap[inomap_addr2segix( addrp )];
 
 	relino = ino - segp->base;
-	i2gsegp->s_valid |= (u_int64_t)1 << relino;
+	i2gsegp->s_valid |= (uint64_t)1 << relino;
 	i2gsegp->s_gen[relino] = gen;
 }
 
@@ -1399,7 +1399,7 @@ inomap_get_gen( void *contextp, xfs_ino_t ino, gen_t *gen )
 	i2gsegp = &inomap.i2gmap[inomap_addr2segix( addrp )];
 
 	relino = ino - segp->base;
-	if ( ! (i2gsegp->s_valid & ((u_int64_t)1 << relino)) )
+	if ( ! (i2gsegp->s_valid & ((uint64_t)1 << relino)) )
 		return 1;
 
 	*gen = i2gsegp->s_gen[relino];
@@ -1413,11 +1413,11 @@ inomap_writehdr( content_inode_hdr_t *scwhdrp )
 	 */
 	scwhdrp->cih_inomap_hnkcnt = inomap.lastseg.hnkoff + 1;
 	scwhdrp->cih_inomap_segcnt = inomap_addr2segix( &inomap.lastseg ) + 1;
-	scwhdrp->cih_inomap_dircnt = ( u_int64_t )cb_dircnt;
-	scwhdrp->cih_inomap_nondircnt = ( u_int64_t )cb_nondircnt;
+	scwhdrp->cih_inomap_dircnt = ( uint64_t )cb_dircnt;
+	scwhdrp->cih_inomap_nondircnt = ( uint64_t )cb_nondircnt;
 	scwhdrp->cih_inomap_firstino = inomap.hnkmap[0].seg[ 0 ].base;
 	scwhdrp->cih_inomap_lastino = inomap.hnkmap[inomap.lastseg.hnkoff].maxino;
-	scwhdrp->cih_inomap_datasz = ( u_int64_t )cb_datasz;
+	scwhdrp->cih_inomap_datasz = ( uint64_t )cb_datasz;
 }
 
 rv_t
dump/inomap.h +4 -4
index 663b434..f222642 100644
@@ -65,7 +65,7 @@ extern bool_t inomap_build( jdm_fshandle_t *fshandlep,
 			    size64_t statcnt,
 			    size64_t *statdonep );
 
-extern u_int64_t inomap_getsz( void );
+extern uint64_t inomap_getsz( void );
 
 /* inomap_skip - tell inomap about inodes to skip in the dump
  */
@@ -103,9 +103,9 @@ extern rv_t inomap_dump( drive_t *drivep );
  */
 struct seg {
 	xfs_ino_t base;
-	u_int64_t lobits;
-	u_int64_t mebits;
-	u_int64_t hibits;
+	uint64_t lobits;
+	uint64_t mebits;
+	uint64_t hibits;
 };
 
 typedef struct seg seg_t;
inventory/inv_api.c +3 -3
index 4c1855b..888c425 100644
@@ -94,7 +94,7 @@ inv_open( inv_predicate_t bywhat, inv_oflag_t forwhat, void *pred )
 	/* create another storage object ( and, an inv_index entry for it 
 	   too ) if we've filled this one up */
 
-	if ( (u_int) num >= sescnt->ic_maxnum ) {
+	if ( (uint) num >= sescnt->ic_maxnum ) {
 		mlog( MLOG_DEBUG | MLOG_INV, "$ INV: creating a new storage obj & "
 		      "index entry. \n" );
 		INVLOCK( stobjfd, LOCK_UN );
@@ -163,7 +163,7 @@ inv_writesession_open(
 	bool_t		ispartial,
 	bool_t		isresumed,
 	u_char		level,
-	u_int		nstreams,
+	uint		nstreams,
 	time32_t	time,
 	char		*mntpt,
 	char		*devpath )
@@ -439,7 +439,7 @@ inv_put_mediafile(
 	inv_stmtoken_t 	tok, 
 	uuid_t 		*moid, 
 	char 		*label,
-	u_int		mfileindex,
+	uint		mfileindex,
 	xfs_ino_t	startino,
 	off64_t		startino_offset,
 	xfs_ino_t	endino,
inventory/inv_core.c +2 -2
index 419f575..a17c2c9 100644
@@ -49,7 +49,7 @@ int
 get_counters( int fd, void **cntpp, size_t cntsz )
 {
 	/* object must be locked at least SHARED by caller */
-	u_int num;
+	uint num;
 	assert( cntsz >= sizeof( invt_counter_t ) );
 
 	*cntpp =  calloc( 1, cntsz);
@@ -238,7 +238,7 @@ get_lastheader( int fd, void **ent, size_t hdrsz, size_t cntsz )
 	/* if there's space anywhere at all, then it must be in the last
 	   entry */
 	*ent = malloc( hdrsz );
-	pos = (char *) arr + ( (u_int)nindices - 1 ) * hdrsz;
+	pos = (char *) arr + ( (uint)nindices - 1 ) * hdrsz;
 	memcpy( *ent, pos, hdrsz );
 	free ( arr );
 	free ( cnt );
inventory/inv_idx.c +9 -9
index 13b64db..95529e8 100644
@@ -43,13 +43,13 @@
 /* given a time, find the invindex that has the time-period it can fit  */
 /* into.                                                                */
 /*----------------------------------------------------------------------*/
-u_int
+uint
 idx_insert_newentry( int fd, /* kept locked EX by caller */
 		     int *stobjfd, /* OUT */
 		     invt_entry_t *iarr, invt_counter_t *icnt,
 		     time32_t tm )
 {
-	u_int i;
+	uint i;
 	inv_oflag_t forwhat = INV_SEARCH_N_MOD;
 /*	invt_entry_t ient;
 	ient.ie_timeperiod.tp_start = ient.ie_timeperiod.tp_end = tm; */
@@ -162,7 +162,7 @@ idx_put_newentry(
 	int stobjfd;
 	
 	int fd = idx->invfd; 	/* kept locked EX by caller */
-	u_int index = idx->index + 1;
+	uint index = idx->index + 1;
 	invt_entry_t *iarr = idx->iarr;
 	invt_counter_t *icnt = idx->icnt;
 
@@ -356,7 +356,7 @@ idx_put_sesstime( inv_sestoken_t tok, bool_t whichtime)
 				sizeof( invt_counter_t ))) < 0 ) {
 			return -1;		 
 		}
-		idx_DEBUG_printinvindices( iarr, (u_int) nindices );
+		idx_DEBUG_printinvindices( iarr, (uint) nindices );
 		free( iarr );
 		free( icnt );
 	}
@@ -496,10 +496,10 @@ idx_get_stobj( int invfd, inv_oflag_t forwhat, int *index )
 
 
 int
-idx_DEBUG_printinvindices( invt_entry_t *iarr, u_int num )
+idx_DEBUG_printinvindices( invt_entry_t *iarr, uint num )
 {
-	u_int i;
-	u_int k;
+	uint i;
+	uint k;
 
 	char s[9];
 	printf( "\n ==================================\n"
@@ -533,7 +533,7 @@ idx_DEBUG_print ( int fd )
 				         sizeof( invt_counter_t ))) < 0 ) {
 		return -1;		 
 	}
-	idx_DEBUG_printinvindices( iarr, (u_int) nindices );
+	idx_DEBUG_printinvindices( iarr, (uint) nindices );
 	free( iarr );
 	free( icnt );
 
@@ -543,7 +543,7 @@ idx_DEBUG_print ( int fd )
 
 
 int
-DEBUG_displayallsessions( int fd, invt_seshdr_t *hdr, u_int ref,
+DEBUG_displayallsessions( int fd, invt_seshdr_t *hdr, uint ref,
 			  invt_pr_ctx_t *prctx)
 {
 	inv_session_t *ses;
inventory/inv_mgr.c +2 -2
index 1b99d5c..e521f24 100644
@@ -346,7 +346,7 @@ invmgr_inv_print(
 	invt_entry_t	*iarr = NULL;
 	invt_counter_t	*icnt = NULL;
 	int	     	nindices;
-	u_int           ref = 0;
+	uint           ref = 0;
 
 	if (invfd == I_EMPTYINV)
 		return 0;
@@ -363,7 +363,7 @@ invmgr_inv_print(
 	free( icnt );
 
 	if (prctx->invidx) {
-		idx_DEBUG_printinvindices( iarr, (u_int) nindices );
+		idx_DEBUG_printinvindices( iarr, (uint) nindices );
 		free(iarr);
 		return (0);
 	}
inventory/inv_priv.h +16 -16
index 598c366..1690271 100644
@@ -48,8 +48,8 @@
 #define NEW_INVINDEX		2
 
 /* session flags ( seshdr.sh_flag ) */
-#define INVT_PARTIAL		(u_int)0x0001
-#define INVT_RESUMED            (u_int)0x0002
+#define INVT_PARTIAL		(uint)0x0001
+#define INVT_RESUMED            (uint)0x0002
 
 /* media file flags ( mfile.mf_flag ) */
 #define INVT_MFILE_GOOD         (u_char)0x01
@@ -108,9 +108,9 @@ typedef struct invt_session {
 	char		 s_label[INV_STRLEN];  /* session label */
 	char		 s_mountpt[INV_STRLEN];/* path to the mount point */
 	char		 s_devpath[INV_STRLEN];/* path to the device */
-	u_int		 s_cur_nstreams;/* number of streams created under
+	uint		 s_cur_nstreams;/* number of streams created under
 					   this session so far */
-	u_int		 s_max_nstreams;/* number of media streams in 
+	uint		 s_max_nstreams;/* number of media streams in 
 					   the session */
 	char		 s_padding[16];
 } invt_session_t;			   
@@ -148,7 +148,7 @@ typedef struct invt_stream {
 	off64_t		st_firstmfile;	/*offsets to the start and end of*/
 	off64_t		st_lastmfile;	/* .. linked list of mediafiles */
 	char            st_cmdarg[INV_STRLEN]; /* drive path */
-	u_int		st_nmediafiles; /* number of mediafiles */
+	uint		st_nmediafiles; /* number of mediafiles */
 	bool_t		st_interrupted;	/* was this stream interrupted ? */
 	char		st_padding[16];
 } invt_stream_t;
@@ -163,7 +163,7 @@ typedef struct invt_mediafile {
 					   media file with */
 	off64_t		 mf_nextmf;	/* links to other mfiles */
 	off64_t		 mf_prevmf;
-	u_int		 mf_mfileidx; 	/* index within the media object */
+	uint		 mf_mfileidx; 	/* index within the media object */
 	u_char           mf_flag;       /* Currently MFILE_GOOD, INVDUMP */
 	off64_t		 mf_size;       /* size of the media file */
 	char		 mf_padding[15];
@@ -185,9 +185,9 @@ typedef struct invt_entry {
 /* Cheap Inheritance, and an attempt to avoid a nested type */
 #define INVT_COUNTER_FIELDS  \
         __uint32_t    ic_vernum;/* on disk version number for posterity */\
-	u_int	      ic_curnum;/* number of sessions/invindices recorded \
+	uint	      ic_curnum;/* number of sessions/invindices recorded \
 				   so far */				  \
-	u_int	      ic_maxnum;/* maximum number of sessions/inv_indices \
+	uint	      ic_maxnum;/* maximum number of sessions/inv_indices \
 				   that we can record on this stobj */
 #define INVT_COUNTER_FIELDS_SIZE 0xc
 
@@ -272,7 +272,7 @@ typedef struct invt_idxinfo {
 	int 		invfd;
 	invt_counter_t	*icnt;
 	invt_entry_t	*iarr;
-	u_int		index;
+	uint		index;
 }invt_idxinfo_t;
 
 #define INVT_MOID	1
@@ -366,7 +366,7 @@ idx_put_sesstime( inv_sestoken_t tok, bool_t whichtime);
 int
 idx_find_stobj( invt_idxinfo_t *idx, time32_t tm );
 
-u_int
+uint
 idx_insert_newentry( int fd, int *stobjfd, invt_entry_t *iarr, 
 		     invt_counter_t *icnt,
 		     time32_t tm );
@@ -380,7 +380,7 @@ int
 idx_recons_time( time32_t tm, invt_idxinfo_t *idx );
 
 int
-idx_DEBUG_printinvindices( invt_entry_t *iarr, u_int num );
+idx_DEBUG_printinvindices( invt_entry_t *iarr, uint num );
 
 int
 idx_DEBUG_print ( int fd );
@@ -415,10 +415,10 @@ int
 stobj_hdrcmp( const void *h1, const void *h2 );
 
 int
-stobj_sortheaders( int fd, u_int num );
+stobj_sortheaders( int fd, uint num );
 
-u_int
-stobj_find_splitpoint( int fd, invt_seshdr_t *harr, u_int ns, time32_t tm );
+uint
+stobj_find_splitpoint( int fd, invt_seshdr_t *harr, uint ns, time32_t tm );
 
 int
 stobj_split( invt_idxinfo_t *idx, int fd, invt_sescounter_t *sescnt, 
@@ -467,7 +467,7 @@ stobj_copy_invsess( int fd, invt_seshdr_t *hdr, invt_session_t *ses,
 		    inv_session_t **buf);
 
 void
-DEBUG_sessionprint( inv_session_t *ses, u_int ref, invt_pr_ctx_t *prctx);
+DEBUG_sessionprint( inv_session_t *ses, uint ref, invt_pr_ctx_t *prctx);
 
 void
 DEBUG_sessprint( invt_session_t *ses );
@@ -572,7 +572,7 @@ bool_t
 lastsess_level_equalto( int fd, invt_seshdr_t *hdr,  void *arg, void **buf );
 
 int
-DEBUG_displayallsessions( int fd, invt_seshdr_t *hdr, u_int ref, 
+DEBUG_displayallsessions( int fd, invt_seshdr_t *hdr, uint ref, 
 			  invt_pr_ctx_t *prctx);
 
 int
inventory/inv_stobj.c +23 -23

149 lines not on this page · raw message

inventory/inventory.h +6 -6
index 43ac969..134b9ba 100644
@@ -115,7 +115,7 @@ typedef enum {
 		     
 typedef struct inv_mediafile {
 	uuid_t		 m_moid;	/* media object id */
-	u_int		 m_mfile_index; /* index within the media object */
+	uint		 m_mfile_index; /* index within the media object */
 	xfs_ino_t	 m_startino;	/* file that we started out with */
 	off64_t		 m_startino_off;
 	xfs_ino_t	 m_endino;	/* the dump file we ended this .. */
@@ -139,7 +139,7 @@ typedef struct inv_stream {
 					   including this breakpoint. */
 	off64_t		st_endino_off;
 	char            st_cmdarg[INV_STRLEN]; /* the driver path user entered */
-	u_int		st_nmediafiles; /* number of mediafiles */
+	uint		st_nmediafiles; /* number of mediafiles */
 	inv_mediafile_t *st_mediafiles; /* array of all media files */
 } inv_stream_t;
 
@@ -161,9 +161,9 @@ typedef struct inv_session {
 	char		 s_label[INV_STRLEN];  /* session label */
 	char		 s_mountpt[INV_STRLEN];/* path to the mount point */
 	char		 s_devpath[INV_STRLEN];/* path to the device */
-	u_int		 s_nstreams;	/* num of media streams recorded */
+	uint		 s_nstreams;	/* num of media streams recorded */
 	inv_stream_t	*s_streams;	/* array of streams */
-        u_int            s_refnum;      /* storage location dependent ref.
+        uint            s_refnum;      /* storage location dependent ref.
 					   used in displaying the session and 
 					   nowhere else */
 					   
@@ -206,7 +206,7 @@ inv_writesession_open(
 	bool_t		ispartial,
         bool_t          isresumed,
 	u_char		level,
-	u_int		nstreams,
+	uint		nstreams,
 	time32_t	time,
 	char		*mntpt,
 	char		*devpath );	      
@@ -230,7 +230,7 @@ inv_put_mediafile(
 	inv_stmtoken_t 	tok, 
 	uuid_t 		*moid, 
 	char 		*label,
-	u_int		mfileindex,
+	uint		mfileindex,
 	xfs_ino_t	startino,
 	off64_t		startino_offset,
 	xfs_ino_t	endino,
inventory/testmain.c +1 -1
index 7a268ea..3f742e4 100644
@@ -145,7 +145,7 @@ delete_test( int n )
 int
 sess_queries_byuuid(char *uu)
 {
-	u_int stat;
+	uint stat;
 	uuid_t uuid;
 	inv_session_t *ses;
 	invt_pr_ctx_t prctx;
invutil/invidx.c +3 -3
index 56995f0..44c5e7f 100644
@@ -626,11 +626,11 @@ stobj_put_streams( int fd, invt_seshdr_t *hdr, invt_session_t *ses,
 		   invt_stream_t *strms,
 		   invt_mediafile_t *mfiles )
 {
-    u_int	nstm	= ses->s_cur_nstreams;
+    uint	nstm	= ses->s_cur_nstreams;
     off64_t	off	= hdr->sh_streams_off;
     off64_t	mfileoff= off + (off64_t)( nstm * sizeof( invt_stream_t ) );
-    u_int	nmfiles = 0;
-    u_int	i,j;
+    uint	nmfiles = 0;
+    uint	i,j;
 
     /* fix the offsets in streams */
      for ( i = 0; i < nstm; i++ ) {
restore/content.c +10 -10
index ac7d72a..5e6e88e 100644
@@ -526,10 +526,10 @@ struct pers {
 			/* the following stats are not valid until the
 			 * first media file header has been read.
 			 */
-		u_int64_t stat_inocnt;
+		uint64_t stat_inocnt;
 			/* number of non-dir inos to restore during session
 			 */
-		u_int64_t stat_inodone;
+		uint64_t stat_inodone;
 			/* number of non-dir inos restored so far
 			 */
 		off64_t stat_datacnt;
@@ -1615,11 +1615,11 @@ content_init( int argc, char *argv[ ], size64_t vmsz )
 			      strerror( errno ));
 			return BOOL_FALSE;
 		}
-		ok = dirattr_init( tranp->t_hkdir, BOOL_TRUE, ( u_int64_t )0 );
+		ok = dirattr_init( tranp->t_hkdir, BOOL_TRUE, ( uint64_t )0 );
 		if ( ! ok ) {
 			return BOOL_FALSE;
 		}
-		ok = namreg_init( tranp->t_hkdir, BOOL_TRUE, ( u_int64_t )0 );
+		ok = namreg_init( tranp->t_hkdir, BOOL_TRUE, ( uint64_t )0 );
 		if ( ! ok ) {
 			return BOOL_FALSE;
 		}
@@ -1841,7 +1841,7 @@ content_init( int argc, char *argv[ ], size64_t vmsz )
 	 * determine if full init needed instead.
 	 */
 	if ( persp->a.valpr && persp->s.valpr ) {
-		ok = dirattr_init( tranp->t_hkdir, BOOL_TRUE, ( u_int64_t )0 );
+		ok = dirattr_init( tranp->t_hkdir, BOOL_TRUE, ( uint64_t )0 );
 		if ( ! ok ) {
 			return BOOL_FALSE;
 		}
@@ -1853,7 +1853,7 @@ content_init( int argc, char *argv[ ], size64_t vmsz )
 	 * determine if full init needed instead.
 	 */
 	if ( persp->a.valpr ) {
-		ok = namreg_init( tranp->t_hkdir, BOOL_TRUE, ( u_int64_t )0 );
+		ok = namreg_init( tranp->t_hkdir, BOOL_TRUE, ( uint64_t )0 );
 		if ( ! ok ) {
 			return BOOL_FALSE;
 		}
@@ -7532,7 +7532,7 @@ restore_reg( drive_t *drivep,
 		assert( bstatp->bs_extsize >= 0 );
 		memset((void *)&fsxattr, 0, sizeof( fsxattr ));
 		fsxattr.fsx_xflags = bstatp->bs_xflags & ~POST_DATA_XFLAGS;
-		fsxattr.fsx_extsize = (u_int32_t) bstatp->bs_extsize;
+		fsxattr.fsx_extsize = (uint32_t) bstatp->bs_extsize;
 		fsxattr.fsx_projid = bstat_projid(bstatp);
 
 		rval = ioctl( *fdp, XFS_IOC_FSSETXATTR, (void *)&fsxattr);
@@ -7753,7 +7753,7 @@ restore_complete_reg(stream_context_t *strcxtp)
 		struct fsxattr fsxattr;
 		memset((void *)&fsxattr, 0, sizeof( fsxattr ));
 		fsxattr.fsx_xflags = bstatp->bs_xflags;
-		fsxattr.fsx_extsize = (u_int32_t)bstatp->bs_extsize;
+		fsxattr.fsx_extsize = (uint32_t)bstatp->bs_extsize;
 		fsxattr.fsx_projid = bstat_projid(bstatp);
 
 		rval = ioctl( fd, XFS_IOC_FSSETXATTR, (void *)&fsxattr );
@@ -8364,8 +8364,8 @@ read_extattrhdr( drive_t *drivep, extattrhdr_t *ahdrp, bool_t ahcs )
 	mlog( MLOG_NITTY,
 	      "read extattr hdr sz %u valoff %u flags 0x%x valsz %u cs 0x%x\n",
 	      ahdrp->ah_sz,
-	      ( u_int )ahdrp->ah_valoff,
-	      ( u_int )ahdrp->ah_flags,
+	      ( uint )ahdrp->ah_valoff,
+	      ( uint )ahdrp->ah_flags,
 	      ahdrp->ah_valsz,
 	      ahdrp->ah_checksum );
 
restore/dirattr.c +27 -27

170 lines not on this page · raw message

restore/dirattr.h +6 -6
index d671883..aaf276d 100644
@@ -33,7 +33,7 @@ typedef size32_t dah_t;
  */
 extern bool_t dirattr_init( char *housekeepingdir,
 			    bool_t resync,
-			    u_int64_t dircnt );
+			    uint64_t dircnt );
 
 
 /* dirattr_cleanup - removes all traces
@@ -62,11 +62,11 @@ gid_t dirattr_get_gid( dah_t dah );
 time32_t dirattr_get_atime( dah_t dah );
 time32_t dirattr_get_mtime( dah_t dah );
 time32_t dirattr_get_ctime( dah_t dah );
-u_int32_t dirattr_get_xflags( dah_t dah );
-u_int32_t dirattr_get_extsize( dah_t dah );
-u_int32_t dirattr_get_projid( dah_t dah );
-u_int32_t dirattr_get_dmevmask( dah_t dah );
-u_int32_t dirattr_get_dmstate( dah_t dah );
+uint32_t dirattr_get_xflags( dah_t dah );
+uint32_t dirattr_get_extsize( dah_t dah );
+uint32_t dirattr_get_projid( dah_t dah );
+uint32_t dirattr_get_dmevmask( dah_t dah );
+uint32_t dirattr_get_dmstate( dah_t dah );
 
 /* dirattr_flush - flush dirattr I/O buffer.  Returns 0 if successful.
  */
restore/inomap.c +12 -12
index f1604c4..fd55907 100644
@@ -92,8 +92,8 @@ static int pers_fd = -1;
 
 /* context for inomap construction - initialized by inomap_restore_pers
  */
-static u_int64_t hnkcnt;
-static u_int64_t segcnt;
+static uint64_t hnkcnt;
+static uint64_t segcnt;
 static hnk_t *roothnkp = 0;
 static hnk_t *tailhnkp;
 static seg_t *lastsegp;
@@ -106,10 +106,10 @@ static inline void
 SEG_SET_BITS( seg_t *segp, xfs_ino_t ino, int state )
 {
 	register xfs_ino_t relino;
-	register u_int64_t mask;
-	register u_int64_t clrmask;
+	register uint64_t mask;
+	register uint64_t clrmask;
 	relino = ino - segp->base;
-	mask = ( u_int64_t )1 << relino;
+	mask = ( uint64_t )1 << relino;
 	clrmask = ~mask;
 	switch( state ) {
 	case 0:
@@ -160,9 +160,9 @@ SEG_GET_BITS( seg_t *segp, xfs_ino_t ino )
 {
 	int state;
 	register xfs_ino_t relino;
-	register u_int64_t mask;
+	register uint64_t mask;
 	relino = ino - segp->base;
-	mask = ( u_int64_t )1 << relino;
+	mask = ( uint64_t )1 << relino;
 	if ( segp->lobits & mask ) {
 		state = 1;
 	} else {
@@ -310,7 +310,7 @@ rv_t
 inomap_discard( drive_t *drivep, content_inode_hdr_t *scrhdrp )
 {
 	drive_ops_t *dop = drivep->d_opsp;
-	u_int64_t tmphnkcnt;
+	uint64_t tmphnkcnt;
 	/* REFERENCED */
 	int nread;
 	int rval;
@@ -654,10 +654,10 @@ map_getset( xfs_ino_t ino, int newstate, bool_t setflag )
 static seg_t *
 map_getsegment( xfs_ino_t ino )
 {
-	u_int64_t min;
-	u_int64_t max;
-	u_int64_t hnk;
-	u_int64_t seg;
+	uint64_t min;
+	uint64_t max;
+	uint64_t hnk;
+	uint64_t seg;
 
 	/* Use binary search to find the hunk that contains the inode number,
 	 * if any.  This counts on the fact that all the hunks are contiguous
restore/inomap.h +3 -3
index bc40f3e..03facdb 100644
@@ -48,9 +48,9 @@
  */
 struct seg {
 	xfs_ino_t base;
-	u_int64_t lobits;
-	u_int64_t mebits;
-	u_int64_t hibits;
+	uint64_t lobits;
+	uint64_t mebits;
+	uint64_t hibits;
 };
 
 typedef struct seg seg_t;
restore/namreg.c +1 -1
index 8c3b74f..97e6524 100644
@@ -116,7 +116,7 @@ static namreg_pers_t *npp = 0;
 /* definition of locally defined global functions ****************************/
 
 bool_t
-namreg_init( char *hkdir, bool_t resume, u_int64_t inocnt )
+namreg_init( char *hkdir, bool_t resume, uint64_t inocnt )
 {
 	if ( ntp ) {
 		return BOOL_TRUE;
restore/namreg.h +1 -1
index 8bc7b53..859ccd7 100644
@@ -36,7 +36,7 @@ typedef size64_t nrh_t;
  */
 extern bool_t namreg_init( char *housekeepingdir,
 			   bool_t resync,
-			   u_int64_t inocnt );
+			   uint64_t inocnt );
 
 
 /* namreg_add - registers a name. name does not need to be null-terminated.
restore/tree.c +3 -3
index 46ba715..363f0f1 100644
@@ -349,7 +349,7 @@ tree_init( char *hkdir,
 	   bool_t fullpr,
 	   bool_t restoredmpr,
 	   bool_t dstdirisxfspr,
-	   u_int32_t dumpformat,
+	   uint32_t dumpformat,
 	   bool_t truncategenpr )
 {
 	off64_t nodeoff;
@@ -661,7 +661,7 @@ tree_sync( char *hkdir,
 }
 
 bool_t
-tree_check_dump_format( u_int32_t dumpformat )
+tree_check_dump_format( uint32_t dumpformat )
 {
 	if ( dumpformat < GLOBAL_HDR_VERSION_3 && !persp->p_truncategenpr ) {
 		mlog( MLOG_NORMAL | MLOG_ERROR | MLOG_TREE, _(
@@ -2554,7 +2554,7 @@ setdirattr( dah_t dah, char *path )
 
 		fssetdm.fsd_dmevmask = dirattr_get_dmevmask( dah );
 		fssetdm.fsd_padding = 0;	/* not used */
-		fssetdm.fsd_dmstate = ( u_int16_t )dirattr_get_dmstate( dah );
+		fssetdm.fsd_dmstate = ( uint16_t )dirattr_get_dmstate( dah );
 
 		/* restore DMAPI event settings etc.
 		 */
restore/tree.h +2 -2
index 7b1a76a..47911c4 100644
@@ -33,7 +33,7 @@ extern bool_t tree_init( char *hkdir,
 			 bool_t fullpr,
 			 bool_t restoredmpr,
 			 bool_t dstdirisxfspr,
-			 u_int32_t dumpformat,
+			 uint32_t dumpformat,
 			 bool_t truncategenpr );
 
 /* tree_sync - synchronizes with an existing tree abstraction
@@ -50,7 +50,7 @@ extern bool_t tree_sync( char *hkdir,
  * a format 2 dump. the restore will fail unless the
  * original restore was told to use format 2 gen numbers.
  */
-extern bool_t tree_check_dump_format( u_int32_t dumpformat );
+extern bool_t tree_check_dump_format( uint32_t dumpformat );
 
 
 /* tree_begindir - begins application of dumped directory to tree.
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#10 lore raw

PATCH 5/8 cleanup: define a local xfs_ino_t

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

The xfs inode number size is never going to change - it's a uint64_t. We currently inherit this from xfsprogs headers, but it goes away in xfsprogs v4.2.0 as it's part of the platform definitions. Add our own local definition for this type.

---
 common/types.h | 2 ++
 1 file changed, 2 insertions(+)
common/types.h +2 -0
index 235f52a..0923897 100644
@@ -49,6 +49,8 @@ typedef unsigned long u_long_t;
 typedef size_t ix_t;
 typedef int32_t time32_t;
 
+typedef uint64_t xfs_ino_t;
+
 /* limits
  */
 #define	MKMAX( t, s )	( ( t )						\
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#11 lore raw

PATCH 6/8 cleanup: use system uuid.h headers

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Another bunch of support pulled in from the xfs headers, but would never have worked correctly on any platform other than Linux as dump doe snot use the abstractions that xfsprogs wraps around the uuid interfaces. Hence just make it work on Linux for now, as it's already relying on native support.

---
 common/fs.c           | 1 +
 common/global.c       | 1 +
 common/inventory.c    | 1 +
 dump/content.c        | 1 +
 dump/var.c            | 1 +
 inventory/inv_api.c   | 1 +
 inventory/inv_fstab.c | 1 +
 inventory/inv_mgr.c   | 1 +
 inventory/inv_stobj.c | 1 +
 inventory/testmain.c  | 1 +
 invutil/cmenu.c       | 1 +
 invutil/fstab.c       | 1 +
 invutil/invidx.c      | 1 +
 invutil/invutil.c     | 1 +
 invutil/list.c        | 1 +
 invutil/menu.c        | 1 +
 invutil/screen.c      | 1 +
 invutil/stobj.c       | 1 +
 restore/content.c     | 1 +
 19 files changed, 19 insertions(+)
common/fs.c +1 -0
index 184f08d..e600e38 100644
@@ -30,6 +30,7 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
common/global.c +1 -0
index ea7ad6d..ca11368 100644
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
common/inventory.c +1 -0
index 83e1ebb..d1b810c 100644
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <assert.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "inventory_priv.h"
dump/content.c +1 -0
index fcd7dd7..15fb357 100644
@@ -34,6 +34,7 @@
 #include <malloc.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #ifdef linux
 #include <xfs/xqm.h>
dump/var.c +1 -0
index d3fa3be..6dd6a70 100644
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <dirent.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
inventory/inv_api.c +1 -0
index 888c425..acca40b 100644
@@ -30,6 +30,7 @@
 #include <sys/stat.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
inventory/inv_fstab.c +1 -0
index 1c2bf3d..56d6b8f 100644
@@ -29,6 +29,7 @@
 #include <sys/dir.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
inventory/inv_mgr.c +1 -0
index e521f24..79d4bb1 100644
@@ -27,6 +27,7 @@
 #include <sys/dir.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
inventory/inv_stobj.c +1 -0
index 0763d0b..9619476 100644
@@ -30,6 +30,7 @@
 #include <sys/mman.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
inventory/testmain.c +1 -0
index 3f742e4..ecddf54 100644
@@ -24,6 +24,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
invutil/cmenu.c +1 -0
index ce23d28..e60fd22 100644
@@ -25,6 +25,7 @@
 #include <signal.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/fstab.c +1 -0
index ac8f775..4284cd1 100644
@@ -25,6 +25,7 @@
 #include <ncurses.h>
 #include <sys/mman.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/invidx.c +1 -0
index 44c5e7f..67efdf7 100644
@@ -26,6 +26,7 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/invutil.c +1 -0
index e1c8868..06bdeda 100644
@@ -28,6 +28,7 @@
 #include <sys/mman.h>
 #include <string.h>
 #include <libgen.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "mlog.h"
invutil/list.c +1 -0
index 0157102..ae5d9b7 100644
@@ -19,6 +19,7 @@
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>
 #include <ncurses.h>
+#include <uuid/uuid.h>
 
 #include "list.h"
 #include "cmenu.h"
invutil/menu.c +1 -0
index a0d2d0e..c050359 100644
@@ -20,6 +20,7 @@
 #include <xfs/jdm.h>
 #include <ncurses.h>
 #include <ctype.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "cmenu.h"
invutil/screen.c +1 -0
index c4b79d8..6e913a7 100644
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ncurses.h>
+#include <uuid/uuid.h>
 
 #include "cmenu.h"
 
invutil/stobj.c +1 -0
index eb04385..f389c53 100644
@@ -25,6 +25,7 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "types.h"
 #include "mlog.h"
restore/content.c +1 -0
index 5e6e88e..d4fe350 100644
@@ -38,6 +38,7 @@
 #include <pthread.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#12 lore raw

PATCH 7/8 cleanup: move fold_t out of util.h

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Many files just want the fold_t type, but pulling in util.h requires all the XFS and JDM headers to be pulled in, too. Move fold_t to mlog.[ch] as it tends to be common with log output. Similarly, move the PREEMPT_* definitions to common/types.h to remove that dependency on util.h as well.

---
 common/mlog.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
 common/mlog.h  |  6 ++++++
 common/types.h |  5 +++++
 common/util.c  | 45 ---------------------------------------------
 common/util.h  | 11 -----------
 5 files changed, 56 insertions(+), 56 deletions(-)
common/mlog.c +45 -0
index fd21c18..c8b3129 100644
@@ -802,3 +802,48 @@ mlog_sym_lookup( char *sym )
 
 	return -1;
 }
+
+void
+fold_init( fold_t fold, char *infostr, char c )
+{
+	size_t infolen;
+	size_t dashlen;
+	size_t predashlen;
+	size_t postdashlen;
+	char *p;
+	char *endp;
+	ix_t cnt;
+
+	assert( sizeof( fold_t ) == FOLD_LEN + 1 );
+
+	infolen = strlen( infostr );
+	if ( infolen > FOLD_LEN - 4 ) {
+		infolen = FOLD_LEN - 4;
+	}
+	dashlen = FOLD_LEN - infolen - 3;
+	predashlen = dashlen / 2;
+	postdashlen = dashlen - predashlen;
+
+	p = &fold[ 0 ];
+	endp = &fold[ sizeof( fold_t ) - 1 ];
+
+	assert( p < endp );
+	*p++ = ' ';
+	for ( cnt = 0 ; cnt < predashlen && p < endp ; cnt++, p++ ) {
+		*p = c;
+	}
+	assert( p < endp );
+	*p++ = ' ';
+	assert( p < endp );
+	assert( p + infolen < endp );
+	strcpy( p, infostr );
+	p += infolen;
+	assert( p < endp );
+	*p++ = ' ';
+	assert( p < endp );
+	for ( cnt = 0 ; cnt < postdashlen && p < endp ; cnt++, p++ ) {
+		*p = c;
+	}
+	assert( p <= endp );
+	*p = 0;
+}
common/mlog.h +6 -0
index d7bbfce..e080f9e 100644
@@ -123,4 +123,10 @@ extern void mlog_exit_flush( void );
 extern void mlog_lock( void );
 extern void mlog_unlock( void );
 
+/* fold_t - a character string made to look like a "fold here"
+ */
+#define FOLD_LEN	79
+typedef char fold_t[ FOLD_LEN + 1 ];
+extern void fold_init( fold_t fold, char *infostr, char c );
+
 #endif /* MLOG_H */
common/types.h +5 -0
index 0923897..f902828 100644
@@ -136,4 +136,9 @@ typedef struct stat64 stat64_t;
 typedef struct getbmapx getbmapx_t;
 typedef struct fsdmidata fsdmidata_t;
 
+/* flg definitions for preemptchk 
+ */
+#define PREEMPT_FULL		0
+#define PREEMPT_PROGRESSONLY	1
+
 #endif /* TYPES_H */
common/util.c +0 -45

48 lines not on this page · raw message

common/util.h +0 -11
index 5284811..558bf7e 100644
@@ -143,22 +143,11 @@ extern int diriter( jdm_fshandle_t *fshandlep,
 			 size_t usrgdsz );
 
 
-/* fold_t - a character string made to look like a "fold here"
- */
-#define FOLD_LEN	79
-typedef char fold_t[ FOLD_LEN + 1 ];
-extern void fold_init( fold_t fold, char *infostr, char c );
-
 
 /* macro to copy uuid structures
  */
 #define COPY_LABEL( lab1, lab2) ( bcopy( lab1, lab2, GLOBAL_HDR_STRING_SZ) )
 
-/* flg definitions for preemptchk 
- */
-#define PREEMPT_FULL		0
-#define PREEMPT_PROGRESSONLY	1
-
 /*
  * Align pointer up to alignment
  */
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#13 lore raw

PATCH 8/8 cleanup: Kill unnecessary xfs includes

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Remove all the unneccessary xfsprogs header includes by replacing them with explicit includes and platform specific definitions in config.h.in.

---
 common/arch_xlate.c     |  7 +++----
 common/arch_xlate.h     |  3 ---
 common/cldmgr.c         |  3 ---
 common/content_common.c |  6 ++----
 common/dlog.c           |  4 +---
 common/drive.c          |  7 +++----
 common/drive_minrmt.c   |  6 ++----
 common/drive_scsitape.c |  6 ++----
 common/drive_simple.c   |  6 +++++-
 common/fs.c             |  3 +--
 common/global.c         |  7 +++----
 common/hsmapi.c         | 13 +++++++++++--
 common/hsmapi.h         | 12 ++++++------
 common/lock.c           |  4 +---
 common/main.c           |  7 +++----
 common/media.c          |  3 ---
 common/mlog.c           |  6 ++----
 common/openutil.c       |  3 +--
 common/path.c           |  2 --
 common/qlock.c          |  4 +---
 common/ring.c           |  3 ---
 common/stream.c         |  3 ---
 common/types.h          |  9 +++++++++
 common/util.c           |  6 ++----
 dump/content.c          |  5 ++---
 dump/inomap.c           |  6 ++----
 dump/inomap.h           |  5 +++--
 dump/var.c              |  3 ---
 include/config.h.in     |  4 ++++
 inventory/inv_files.c   |  3 ---
 invutil/list.c          |  3 +--
 invutil/menu.c          |  3 +--
 restore/bag.c           |  3 ---
 restore/content.c       |  7 +++----
 restore/mmap.c          |  1 -
 restore/tree.c          |  9 +++++----
 restore/win.c           |  3 ---
 37 files changed, 79 insertions(+), 109 deletions(-)
common/arch_xlate.c +3 -4
index f8aa50f..1b8e687 100644
@@ -16,11 +16,10 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-#include <assert.h>
-
+#include <sys/param.h>
 #include <strings.h>
+#include <assert.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
common/arch_xlate.h +0 -3
index fa201cd..80e847f 100644
@@ -19,9 +19,6 @@
 #ifndef ARCH_XLATE_H
 #define ARCH_XLATE_H
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <strings.h>
 #include "types.h"
 #include "global.h"
common/cldmgr.c +0 -3
index 624da62..2890092 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/ipc.h>
common/content_common.c +2 -4
index 99b1a4b..8f84e56 100644
@@ -16,9 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdio.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -27,11 +25,11 @@
 #include <signal.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
 #include "mlog.h"
 #include "dlog.h"
 #include "cldmgr.h"
common/dlog.c +1 -3
index cb5c11a..032e6f7 100644
@@ -16,9 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
common/drive.c +3 -4
index 9fb0bb7..5fe6867 100644
@@ -16,18 +16,17 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdio.h>
+#include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
 #include "mlog.h"
 #include "dlog.h"
 #include "path.h"
common/drive_minrmt.c +2 -4
index 848d794..32dc404 100644
@@ -16,12 +16,10 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 #include <sys/prctl.h>
@@ -33,11 +31,11 @@
 #include <sched.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
 #include "qlock.h"
 #include "cldmgr.h"
 #include "mlog.h"
common/drive_scsitape.c +2 -4
index 06ba2f4..56b8c2d 100644
@@ -16,12 +16,10 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 #include <sys/prctl.h>
@@ -33,11 +31,11 @@
 #include <sched.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
 #include "qlock.h"
 #include "cldmgr.h"
 #include "mlog.h"
common/drive_simple.c +5 -1
index 45bc28c..b4e41da 100644
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <fcntl.h>
 #include <time.h>
 #include <errno.h>
@@ -29,11 +30,14 @@
 #include <sched.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
+#include <xfs/xfs.h>
+#include <xfs/jdm.h>	/* needed only for util.h include */
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
+#include "util.h"	/* needed onyl for I/O routines */
 #include "stream.h"
 #include "mlog.h"
 #include "global.h"
common/fs.c +1 -2
index e600e38..60cf0fd 100644
@@ -16,8 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
 #include "config.h"
 
 #include <unistd.h>
@@ -31,6 +29,7 @@
 #include <assert.h>
 #include <string.h>
 #include <uuid/uuid.h>
+#include <xfs/xfs.h>
 
 #include "config.h"
 
common/global.c +3 -4
index ca11368..e70b8a0 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -26,11 +23,13 @@
 #include <assert.h>
 #include <string.h>
 #include <uuid/uuid.h>
+#include <xfs/xfs.h>
+#include <xfs/jdm.h> /* only for util.h include */
 
 #include "config.h"
 
 #include "types.h"
-#include "util.h"
+#include "util.h" /* only for strncpyterm */
 #include "mlog.h"
 #include "dlog.h"
 #include "global.h"
common/hsmapi.c +11 -2
index 489223d..6054773 100644
@@ -16,15 +16,24 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <uuid/uuid.h>
 #include <attr/attributes.h>
+#include <xfs/xfs.h>
 #include <xfs/jdm.h>
-#include <assert.h>
 
 #include <string.h>
 
 #include "config.h"
 
+#include "types.h"
 #include "hsmapi.h"
 #include "mlog.h"
 
common/hsmapi.h +6 -6
index b6d035d..63933af 100644
@@ -19,13 +19,13 @@
 #ifndef HSMAPI_H
 #define HSMAPI_H
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
 #include "types.h"
 #include "global.h"
 #include "content.h"
 #include "content_inode.h"
 
+struct xfs_bstat;
+
 #define	HSM_API_VERSION_1	1	/* only version supported so far */
 
 typedef	void	hsm_fs_ctxt_t;		/* opaque HSM filesystem context */
@@ -94,7 +94,7 @@ extern int
 HsmEstimateFileSpace(
 	hsm_fs_ctxt_t	*fscontextp,
 	hsm_f_ctxt_t	*fcontextp,
-const	xfs_bstat_t	*statp,
+const	struct xfs_bstat	*statp,
 	off64_t		*bytes,
 	int		accurate);
 
@@ -117,7 +117,7 @@ const	xfs_bstat_t	*statp,
 extern int
 HsmEstimateFileOffset(
 	hsm_fs_ctxt_t	*contextp,
-const	xfs_bstat_t	*statp,
+const	struct xfs_bstat	*statp,
 	off64_t		bytecount,
 	off64_t		*byteoffset);
 
@@ -181,7 +181,7 @@ HsmDeleteFileContext(
 extern int
 HsmInitFileContext(
 	hsm_f_ctxt_t	*contextp,
-const	xfs_bstat_t	*statp);
+const	struct xfs_bstat	*statp);
 
 
 /******************************************************************************
@@ -201,7 +201,7 @@ const	xfs_bstat_t	*statp);
 extern int
 HsmModifyInode(
 	hsm_f_ctxt_t	*contextp,
-	xfs_bstat_t	*statp);
+	struct xfs_bstat	*statp);
 
 
 /******************************************************************************
common/lock.c +1 -3
index a237931..9826581 100644
@@ -15,10 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
 #include <assert.h>
+#include <sys/types.h>
 
 #include "config.h"
 
common/main.c +3 -4
index e381e85..3848499 100644
@@ -16,12 +16,11 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #include <sys/wait.h>
 #include <sys/prctl.h>
 #include <sys/resource.h>
@@ -37,6 +36,7 @@
 #include <pthread.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
@@ -44,7 +44,6 @@
 #include "types.h"
 #include "stream.h"
 #include "cldmgr.h"
-#include "util.h"
 #include "getopt.h"
 #include "mlog.h"
 #include "qlock.h"
common/media.c +0 -3
index fceb78d..02fde9c 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
common/mlog.c +2 -4
index c8b3129..b520131 100644
@@ -16,19 +16,18 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sys/types.h>
 #include <time.h>
 #include <getopt.h>
 #include <pthread.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
 
 #include "config.h"
 
@@ -39,7 +38,6 @@
 #include "cldmgr.h"
 #include "getopt.h"
 #include "exit.h"
-#include "util.h"
 #include "global.h"
 #include "drive.h"
 
common/openutil.c +1 -2
index 6cc0efa..fcb52fc 100644
@@ -15,9 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
 
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
common/path.c +0 -2
index b73121d..b234de1 100644
@@ -16,9 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
 #include <assert.h>
-
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
common/qlock.c +1 -3
index 0583a63..c770116 100644
@@ -16,9 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdlib.h>
 #include <pthread.h>
 #include <semaphore.h>
 #include <assert.h>
common/ring.c +0 -3
index bb90901..f5055ee 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <errno.h>
common/stream.c +0 -3
index 549bf59..3047886 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <pthread.h>
 #include <assert.h>
 #include <string.h>
common/types.h +9 -0
index f902828..ebdacdd 100644
@@ -23,6 +23,13 @@
  */
 #include <stdint.h>
 
+/*
+ * type macros that were naively put into xfs/jdm.h, then used in places that
+ * have nothing to do with file handle operations.
+ */
+#define sizeofmember( t, m )	sizeof( ( ( t * )0 )->m )
+#define offsetofmember( t, m )	( ( size_t )( char * )&( ( ( t * )0 )->m ) )
+
 #define XFSDUMP_DIRPATH	inv_basepath()
 
 /*
@@ -51,6 +58,8 @@ typedef int32_t time32_t;
 
 typedef uint64_t xfs_ino_t;
 
+#define constpp        char * const *
+
 /* limits
  */
 #define	MKMAX( t, s )	( ( t )						\
common/util.c +2 -4
index 0d49d5c..bbca758 100644
@@ -16,10 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-#include "config.h"
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -29,6 +25,8 @@
 #include <dirent.h>
 #include <assert.h>
 #include <string.h>
+#include <xfs/xfs.h>
+#include <xfs/jdm.h>
 
 #include "config.h"
 
dump/content.c +2 -3
index 15fb357..1e86292 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -36,6 +33,8 @@
 #include <string.h>
 #include <uuid/uuid.h>
 
+#include <xfs/xfs.h>
+#include <xfs/jdm.h>
 #ifdef linux
 #include <xfs/xqm.h>
 #endif
dump/inomap.c +2 -4
index 4e57a78..1dacf35 100644
@@ -16,10 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-#include <malloc.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
@@ -29,6 +25,8 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 #include <string.h>
+#include <xfs/xfs.h>
+#include <xfs/jdm.h>
 
 #include "config.h"
 
dump/inomap.h +3 -2
index f222642..fb9bbf7 100644
@@ -29,6 +29,7 @@
  * the 64 inos beginning with the starting ino. two bits are available
  * for each ino.
  */
+struct xfs_bstat;
 
 /* inomap_build - this function allocates and constructs an in-memory
  * representation of the bitmap. it prunes from the map inos of files not
@@ -46,9 +47,9 @@
  * fall at file boundaries. returns BOOL_FALSE if error encountered (should
  * abort the dump; else returns BOOL_TRUE.
  */
-extern bool_t inomap_build( jdm_fshandle_t *fshandlep,
+extern bool_t inomap_build( void *fshandlep,
 			    int fsfd,
-			    xfs_bstat_t *rootstatp,
+			    struct xfs_bstat *rootstatp,
 			    bool_t last,
 	      		    time32_t lasttime,
 			    bool_t resume,
dump/var.c +0 -3
index 6dd6a70..645caab 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/stat.h>
include/config.h.in +4 -0
index ef66ed9..3b35d83 100644
@@ -46,4 +46,8 @@ typedef unsigned short umode_t;
 #define max(a,b)	(((a)>(b))?(a):(b))
 #endif
 
+#ifndef NBBY
+#define NBBY 8
+#endif
+
 #endif	/* __CONFIG_H__ */
inventory/inv_files.c +0 -3
index 409ee0d..46f6b8f 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <time.h>
 #include <errno.h>
 #include <sys/stat.h>
invutil/list.c +1 -2
index ae5d9b7..46fb291 100644
@@ -16,8 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
+#include <stdlib.h>
 #include <ncurses.h>
 #include <uuid/uuid.h>
 
invutil/menu.c +1 -2
index c050359..f81f9b6 100644
@@ -16,8 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
+#include <errno.h>
 #include <ncurses.h>
 #include <ctype.h>
 #include <uuid/uuid.h>
restore/bag.c +0 -3
index 3927877..55bba73 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <sys/types.h>
 #include <stdlib.h>
 #include <memory.h>
restore/content.c +3 -4
index d4fe350..7c4a81f 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/socket.h>
@@ -39,12 +36,14 @@
 #include <assert.h>
 #include <string.h>
 #include <uuid/uuid.h>
+#include <xfs/xfs.h>
+#include <xfs/jdm.h>	/* only for util.h */
 
 #include "config.h"
 
 #include "types.h"
 #include "timeutil.h"
-#include "util.h"
+#include "util.h"	/* only for r/w routines, ALIGN_PTR */
 #include "cldmgr.h"
 #include "qlock.h"
 #include "lock.h"
restore/mmap.c +0 -1
index e8536c2..29dd3d7 100644
@@ -16,7 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
restore/tree.c +5 -4
index 363f0f1..0336e77 100644
@@ -16,13 +16,13 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
+#include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/mman.h>
 #include <sys/types.h>
+#include <sys/param.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
@@ -34,12 +34,13 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 #include <string.h>
+#include <uuid/uuid.h>
+#include <xfs/xfs.h>
 
 #include "config.h"
 
 #include "types.h"
 #include "exit.h"
-#include "util.h"
 #include "cldmgr.h"
 #include "path.h"
 #include "openutil.h"
restore/win.c +0 -3
index e6c0be3..e5bf708 100644
@@ -16,9 +16,6 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/xfs.h>
-#include <xfs/jdm.h>
-
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <time.h>
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#14 lore raw
In reply to Dave Chinner
Quoted 7 lines · Dave Chinner

Hi folks,

Turns out that changes to exported XFS headers in xfsprogs v4.2.0 broke the xfsdump build. the XFS dump build was implicitly including the platform definitions calculated for the xfsprogs build and so removing them from the xfsprogs headers made xfsdump very unhappy.

...

Quoted 8 lines

So, now the code base is a little bit cleaner, a lot less dependent on the xfsprogs header files, compiles cleanly on xfsprogs 3.2.x and 4.x releases, can easily have asserts build in or excluded (distro packages need to use "export DEBUG=-DNDEBUG" to exclude asserts), passes xfstests with asserts enabled and disabled, and best of all the source code is a little less eye-bleedy.

Quoted 9 lines

I really don't expect anyone to review this closely - it's *huge* chunk of boring search/replace change:

 94 files changed, 2929 insertions(+), 2652 deletions(-)

but I would like people to comment on/ack the approach I've taken here. If nobody objects/cares, I'll then do a 3.1.6 release early next week....

I sent some comments on patch 1, otherwise the rest looks reasonable to me on a quick pass through. The only thing I noticed is that the series introduced a handful of whitespace problems. I didn't go and track them into the individual patches, but here's the full output from my patch import:

Applying: cleanup: get rid of ASSERT /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:3725: space before tab in indent.

        assert( namebuf );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5656: trailing whitespace.
        assert ( ent != NULL );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5855: trailing whitespace.
        assert ( ent != NULL );

warning: 3 lines add whitespace errors.
Applying: build: don't rely on xfs/xfs.h to include necessary headers
Applying: cleanup: kill intgen_t /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:2018: trailing whitespace. static int
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:3295: space before tab in indent.
int fsfd,
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:6044: trailing whitespace.

                        int namebuflen;

warning: 3 lines add whitespace errors.
Applying: cleanup: kill u_int*_t types /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:255: trailing whitespace. static uint32_t erase_and_verify( drive_t *drivep ); /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:1372: trailing whitespace.
uint s_max_nstreams;/* number of media streams in
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:1461: trailing whitespace. DEBUG_displayallsessions( int fd, invt_seshdr_t *hdr, uint ref, /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:1816: trailing whitespace.

        uint16_t d_sum;

warning: 4 lines add whitespace errors.
Applying: cleanup: define a local xfs_ino_t
Applying: cleanup: use system uuid.h headers
Applying: cleanup: move fold_t out of util.h /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:85: trailing whitespace. /* flg definitions for preemptchk
warning: 1 line adds whitespace errors.
Applying: cleanup: Kill unnecessary xfs includes

Brian

Quoted 6 lines

-Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#15 lore raw
Quoted 27 lines · Brian Foster
Quoted 7 lines · Dave Chinner

Hi folks,

Turns out that changes to exported XFS headers in xfsprogs v4.2.0 broke the xfsdump build. the XFS dump build was implicitly including the platform definitions calculated for the xfsprogs build and so removing them from the xfsprogs headers made xfsdump very unhappy.

...

Quoted 8 lines

So, now the code base is a little bit cleaner, a lot less dependent on the xfsprogs header files, compiles cleanly on xfsprogs 3.2.x and 4.x releases, can easily have asserts build in or excluded (distro packages need to use "export DEBUG=-DNDEBUG" to exclude asserts), passes xfstests with asserts enabled and disabled, and best of all the source code is a little less eye-bleedy.

Quoted 9 lines

I really don't expect anyone to review this closely - it's *huge* chunk of boring search/replace change:

 94 files changed, 2929 insertions(+), 2652 deletions(-)

but I would like people to comment on/ack the approach I've taken here. If nobody objects/cares, I'll then do a 3.1.6 release early next week....

Quoted 5 lines

I sent some comments on patch 1, otherwise the rest looks reasonable to me on a quick pass through. The only thing I noticed is that the series introduced a handful of whitespace problems. I didn't go and track them into the individual patches, but here's the full output from my patch import:

it didn't add any whitespace problems...

Quoted 8 lines

Applying: cleanup: get rid of ASSERT /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:3725: space before tab in indent.

        assert( namebuf );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5656: trailing whitespace.
        assert ( ent != NULL );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5855: trailing whitespace.
        assert ( ent != NULL );

s/ASSERT/assert/ does not change any of the whitespace, but it will complain about it because the new line has whitespace problems because they existed in the old line...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#16 lore raw
Quoted 45 lines · Dave Chinner
Quoted 27 lines · Brian Foster
Quoted 7 lines · Dave Chinner

Hi folks,

Turns out that changes to exported XFS headers in xfsprogs v4.2.0 broke the xfsdump build. the XFS dump build was implicitly including the platform definitions calculated for the xfsprogs build and so removing them from the xfsprogs headers made xfsdump very unhappy.

...

Quoted 8 lines

So, now the code base is a little bit cleaner, a lot less dependent on the xfsprogs header files, compiles cleanly on xfsprogs 3.2.x and 4.x releases, can easily have asserts build in or excluded (distro packages need to use "export DEBUG=-DNDEBUG" to exclude asserts), passes xfstests with asserts enabled and disabled, and best of all the source code is a little less eye-bleedy.

Quoted 9 lines

I really don't expect anyone to review this closely - it's *huge* chunk of boring search/replace change:

 94 files changed, 2929 insertions(+), 2652 deletions(-)

but I would like people to comment on/ack the approach I've taken here. If nobody objects/cares, I'll then do a 3.1.6 release early next week....

Quoted 5 lines

I sent some comments on patch 1, otherwise the rest looks reasonable to me on a quick pass through. The only thing I noticed is that the series introduced a handful of whitespace problems. I didn't go and track them into the individual patches, but here's the full output from my patch import:

it didn't add any whitespace problems...

Quoted 8 lines

Applying: cleanup: get rid of ASSERT /home/bfoster/repos/xfsdump/.git/rebase-apply/patch:3725: space before tab in indent.

        assert( namebuf );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5656: trailing whitespace.
        assert ( ent != NULL );
/home/bfoster/repos/xfsdump/.git/rebase-apply/patch:5855: trailing whitespace.
        assert ( ent != NULL );
Quoted 4 lines

s/ASSERT/assert/ does not change any of the whitespace, but it will complain about it because the new line has whitespace problems because they existed in the old line...

Ok, I saw a few of them highlighted on the console after importing the patches and for whatever reason, git highlighted the error on line insertion but not on line removal. That made me think they were introduced... disregard.

Brian

Quoted 11 lines

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs