X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libsysio%2Finclude%2Fsysio-cmn.h;h=abb6ddd807f6735bd358971c3b79fb0d002d7fe4;hb=7b6aaef15a6547550c99cdaa538ea8b1d4d87c88;hp=830f1878aa2b8cfab45cfd5895ae9e14e5839263;hpb=567285197e592000b7a713d65b66e27314a11c2f;p=fs%2Flustre-release.git diff --git a/libsysio/include/sysio-cmn.h b/libsysio/include/sysio-cmn.h index 830f187..abb6ddd 100644 --- a/libsysio/include/sysio-cmn.h +++ b/libsysio/include/sysio-cmn.h @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2004 Sandia Corporation. + * Cplant(TM) Copyright 1998-2006 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -51,17 +51,10 @@ #define __IS_UNUSED #endif -#ifndef _LARGEFILE64_SOURCE -/* - * Not glibc I guess. Define this ourselves. - */ -#define _LARGEFILE64_SOURCE 0 -#endif - /* * Define internal file-offset type and it's maximum value. */ -#if _LARGEFILE64_SOURCE +#ifdef _LARGEFILE64_SOURCE #define _SYSIO_OFF_T off64_t #ifdef LLONG_MAX #define _SYSIO_OFF_T_MAX (LLONG_MAX) @@ -80,7 +73,7 @@ * Internally, all file status is carried in the 64-bit capable * structure. */ -#if _LARGEFILE64_SOURCE +#ifdef _LARGEFILE64_SOURCE #define intnl_xtvec xtvec64 #else #define intnl_xtvec xtvec @@ -90,16 +83,24 @@ struct intnl_xtvec; struct iovec; /* + * Symbol composition. + */ +#define _PREPEND_HELPER(p, x) \ + p ## x +#define PREPEND(p, x) \ + _PREPEND_HELPER(p, x) + +/* * SYSIO name label macros */ -#define XPREPEND(p,x) p ## x -#define PREPEND(p,x) XPREPEND(p,x) -#define SYSIO_LABEL_NAMES 0 -#if SYSIO_LABEL_NAMES -#define SYSIO_INTERFACE_NAME(x) PREPEND(sysio__, x) +#ifndef SYSIO_INTERFACE_NAME +#ifdef SYSIO_LABEL_NAMES +#define SYSIO_INTERFACE_NAME(x) \ + PREPEND(SYSIO_LABEL_NAMES, x) #else #define SYSIO_INTERFACE_NAME(x) x -#endif +#endif /* SYSIO_LABEL_NAMES */ +#endif /* !SYSIO_INTERFACE_NAME */ /* for debugging */ #if 0 @@ -147,32 +148,48 @@ struct iovec; } while(0) /* Interface enter/leave hook functions */ -#if 0 -extern void _sysio_sysenter(); -extern void _sysio_sysleave(); - +#ifdef SYSIO_TRACING +extern void *_sysio_entry_trace_q; +extern void *_sysio_exit_trace_q; + +extern void *_sysio_register_trace(void *q, + void (*)(const char *file, + const char *func, + int line, + void *data), + void *data, + void (*destructor)(void *data)); +extern void _sysio_remove_trace(void *q, void *p); +extern void _sysio_run_trace_q(void *q, + const char *file, + const char *func, + int line); #define SYSIO_ENTER \ - do { \ - _sysio_sysenter(); \ - } while(0) + do { \ + _sysio_run_trace_q(_sysio_entry_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) + #define SYSIO_LEAVE \ - do { \ - _sysio_sysleave(); \ - } while(0) + do { \ + _sysio_run_trace_q(_sysio_exit_trace_q, \ + __FILE__, __func__, __LINE__); \ + } while (0) #else -#define SYSIO_ENTER -#define SYSIO_LEAVE - +#define SYSIO_ENTER \ + do { } while (0) +#define SYSIO_LEAVE \ + do { } while (0) #endif -/* accounting for IO stats read and write char count */ +/* Accounting for IO stats; Read and write character count. */ #if defined(REDSTORM) #define _SYSIO_UPDACCT(w, cc) \ do { \ if ((cc) < 0) \ break; \ - if (!w) \ + if (w) \ _add_iostats(0, (size_t )(cc)); \ else \ _add_iostats((size_t )(cc), 0); \