From: Dave Chinner <dchinner@xxxxxxxxxx> 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. Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> --- 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(-) diff --git a/common/mlog.c b/common/mlog.c index fd21c18..c8b3129 100644 --- a/common/mlog.c +++ b/common/mlog.c @@ -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; +} diff --git a/common/mlog.h b/common/mlog.h index d7bbfce..e080f9e 100644 --- a/common/mlog.h +++ b/common/mlog.h @@ -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 */ diff --git a/common/types.h b/common/types.h index 0923897..f902828 100644 --- a/common/types.h +++ b/common/types.h @@ -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 */ diff --git a/common/util.c b/common/util.c index 93dd9c8..0d49d5c 100644 --- a/common/util.c +++ b/common/util.c @@ -532,48 +532,3 @@ cvtnum( int blocksize, char *s ) return 1024 * 1024 * i; 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; -} diff --git a/common/util.h b/common/util.h index 5284811..558bf7e 100644 --- a/common/util.h +++ b/common/util.h @@ -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 */ -- 2.5.0 _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs