[Libsysio-commit] unification: libsysio/include inode.h sysio-cmn.h
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-04-10 21:25:38
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9556/include Modified Files: Tag: unification inode.h sysio-cmn.h Log Message: Modified tracing to support intrumentation of tracked formals. SYSIO_INTERFACE_ENTER additionally takes a tag and a variable number of arguments. SYSIO_INTERFACE_RETURN dditionally takes a tag and a variable number of arguments. Be aware, the return code and error number are implicitly passed. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.27.2.2 retrieving revision 1.27.2.3 diff -u -w -b -B -p -r1.27.2.2 -r1.27.2.3 --- inode.h 5 Feb 2007 16:25:24 -0000 1.27.2.2 +++ inode.h 10 Apr 2007 21:25:30 -0000 1.27.2.3 @@ -279,11 +279,15 @@ struct pnode { } while (0) /* - * Pnode meta-call. + * Path node meta-call. */ +#define PNOP_CALL(_f, ...) \ + ((*_f)(__VA_ARGS__)) +#define PNOP_FUNC(_pno, _fbase) \ + ((_pno)->p_base->pb_ino->i_ops.inop_##_fbase) #define _PNOP_MKCALL(_pno, _fbase, ...) \ ((_pno)->p_base->pb_ino ? \ - (*(_pno)->p_base->pb_ino->i_ops.inop_##_fbase)(__VA_ARGS__) : \ + PNOP_CALL(PNOP_FUNC(_pno, _fbase), __VA_ARGS__) : \ -ESTALE) /* @@ -572,5 +576,15 @@ extern int _sysio_ioctx_done(struct ioct extern ssize_t _sysio_ioctx_wait(struct ioctx *ioctx); extern void _sysio_ioctx_complete(struct ioctx *ioctx); extern int _sysio_open(struct pnode *pno, int flags, mode_t mode); +extern int _sysio_p_aread(struct pnode *pno, + _SYSIO_OFF_T off, + void *buf, + size_t count, + struct ioctx **ioctxp); +extern int _sysio_p_awrite(struct pnode *pno, + _SYSIO_OFF_T off, + void *buf, + size_t count, + struct ioctx **ioctxp); extern int _sysio_mkdir(struct pnode *where, mode_t mode); extern int _sysio_mknod(struct pnode *where, mode_t mode, dev_t dev); Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -w -b -B -p -r1.11 -r1.11.2.1 --- sysio-cmn.h 3 May 2006 22:34:46 -0000 1.11 +++ sysio-cmn.h 10 Apr 2007 21:25:30 -0000 1.11.2.1 @@ -140,20 +140,74 @@ struct iovec; */ #define SYSIO_INTERFACE_DISPLAY_BLOCK \ int _saved_errno; -#define SYSIO_INTERFACE_ENTER \ +#define SYSIO_INTERFACE_ENTER(tag, ...) \ do { \ _saved_errno = errno; \ - SYSIO_ENTER; \ + SYSIO_ENTER(tag, __VA_ARGS__); \ } while (0) -#define SYSIO_INTERFACE_RETURN(rtn, err) \ +#define SYSIO_INTERFACE_RETURN(rtn, err, tag, ...) \ do { \ - SYSIO_LEAVE; \ + SYSIO_LEAVE(tag, (rtn), (err), __VA_ARGS__); \ errno = (err) ? -(err) : _saved_errno; \ return (rtn); \ } while(0) /* Interface enter/leave hook functions */ #if SYSIO_TRACING + +#define _SYSIO_TTAG(name) \ + PREPEND(_SYSIO_TRACING_, name) + +/* + * Supported tracing tags. + */ +typedef enum { + _SYSIO_TTAG(unsupported) = -1, + _SYSIO_TTAG(access), + _SYSIO_TTAG(chdir), + _SYSIO_TTAG(getcwd), + _SYSIO_TTAG(chmod), + _SYSIO_TTAG(fchmod), + _SYSIO_TTAG(chown), + _SYSIO_TTAG(fchown), + _SYSIO_TTAG(dup2), + _SYSIO_TTAG(dup), + _SYSIO_TTAG(vfcntl), + _SYSIO_TTAG(fsync), + _SYSIO_TTAG(fdatasync), + _SYSIO_TTAG(getdirentries64), + _SYSIO_TTAG(getdirentries), + _SYSIO_TTAG(ioctl), + _SYSIO_TTAG(iodone), + _SYSIO_TTAG(iowait), + _SYSIO_TTAG(link), + _SYSIO_TTAG(lseek64), + _SYSIO_TTAG(lseek), + _SYSIO_TTAG(llseek), + _SYSIO_TTAG(mkdir), + _SYSIO_TTAG(xmknod), + _SYSIO_TTAG(mount), + _SYSIO_TTAG(umount), + _SYSIO_TTAG(open), + _SYSIO_TTAG(close), + _SYSIO_TTAG(ireadx), + _SYSIO_TTAG(iwritex), + _SYSIO_TTAG(ireadv), + _SYSIO_TTAG(iwritev), + _SYSIO_TTAG(rename), + _SYSIO_TTAG(rmdir), + _SYSIO_TTAG(xstatnd), + _SYSIO_TTAG(fxstat), + _SYSIO_TTAG(opendir), + _SYSIO_TTAG(closedir), + _SYSIO_TTAG(symlink), + _SYSIO_TTAG(readlink), + _SYSIO_TTAG(truncate), + _SYSIO_TTAG(ftruncate), + _SYSIO_TTAG(unlink), + _SYSIO_TTAG(utime), +} tracing_tag; + extern void *_sysio_entry_trace_q; extern void *_sysio_exit_trace_q; @@ -161,30 +215,39 @@ extern void *_sysio_register_trace(void void (*)(const char *file, const char *func, int line, - void *data), + void *data, + tracing_tag tag, + va_list ap), 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 \ + int line, + tracing_tag tag, + ...); + +#define SYSIO_ENTER(tag, ...) \ do { \ _sysio_run_trace_q(_sysio_entry_trace_q, \ - __FILE__, __func__, __LINE__); \ + __FILE__, __func__, __LINE__, \ + _SYSIO_TTAG(tag), \ + __VA_ARGS__); \ } while (0) -#define SYSIO_LEAVE \ +#define SYSIO_LEAVE(tag, ...) \ do { \ _sysio_run_trace_q(_sysio_exit_trace_q, \ - __FILE__, __func__, __LINE__); \ + __FILE__, __func__, __LINE__, \ + _SYSIO_TTAG(tag), \ + __VA_ARGS__); \ } while (0) #else -#define SYSIO_ENTER \ +#define SYSIO_ENTER(tag, ...) \ do { } while (0) -#define SYSIO_LEAVE \ +#define SYSIO_LEAVE(tag, ...) \ do { } while (0) #endif |