diff options
-rw-r--r-- | lib/fsm.c | 6 | ||||
-rw-r--r-- | lib/psm.c | 9 | ||||
-rw-r--r-- | rpmio/rpmio.c | 9 | ||||
-rw-r--r-- | rpmio/rpmio.h | 19 | ||||
-rw-r--r-- | rpmio/rpmio_internal.h | 28 |
5 files changed, 37 insertions, 34 deletions
@@ -5,7 +5,7 @@ #include "system.h" -#include "rpmio_internal.h" /* fdGet/SetCpioPos, fdInit/FiniDigest... */ +#include "rpmio_internal.h" /* fdGet/SetCpioPos, fdInit/FiniDigest */ #include <rpmlib.h> #include "cpio.h" @@ -2178,7 +2178,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (_fsm_debug && (stage & FSM_SYSCALL)) rpmlog(RPMLOG_DEBUG, " %8s (%p)\n", cur, fsm->rfd); (void) rpmswAdd(rpmtsOp(fsmGetTs(fsm), RPMTS_OP_DIGEST), - fdstat_op(fsm->rfd, FDSTAT_DIGEST)); + fdOp(fsm->rfd, FDSTAT_DIGEST)); (void) Fclose(fsm->rfd); errno = saveerrno; } @@ -2208,7 +2208,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break; if (_fsm_debug && (stage & FSM_SYSCALL)) rpmlog(RPMLOG_DEBUG, " %8s (%p)\n", cur, fsm->wfd); (void) rpmswAdd(rpmtsOp(fsmGetTs(fsm), RPMTS_OP_DIGEST), - fdstat_op(fsm->wfd, FDSTAT_DIGEST)); + fdOp(fsm->wfd, FDSTAT_DIGEST)); (void) Fclose(fsm->wfd); errno = saveerrno; } @@ -5,7 +5,6 @@ #include "system.h" -#include "rpmio_internal.h" /* FDSTAT_*, fdsta_op */ #include <rpmlib.h> #include <rpmmacro.h> #include <rpmurl.h> @@ -1577,9 +1576,9 @@ assert(psm->mi == NULL); rc = fsmSetup(fi->fsm, FSM_PKGINSTALL, ts, fi, psm->cfd, NULL, &psm->failedFile); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), - fdstat_op(psm->cfd, FDSTAT_READ)); + fdOp(psm->cfd, FDSTAT_READ)); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), - fdstat_op(psm->cfd, FDSTAT_DIGEST)); + fdOp(psm->cfd, FDSTAT_DIGEST)); xx = fsmTeardown(fi->fsm); saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ @@ -1664,9 +1663,9 @@ assert(psm->mi == NULL); rc = fsmSetup(fi->fsm, FSM_PKGBUILD, ts, fi, psm->cfd, NULL, &psm->failedFile); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_COMPRESS), - fdstat_op(psm->cfd, FDSTAT_WRITE)); + fdOp(psm->cfd, FDSTAT_WRITE)); (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), - fdstat_op(psm->cfd, FDSTAT_DIGEST)); + fdOp(psm->cfd, FDSTAT_DIGEST)); xx = fsmTeardown(fi->fsm); saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */ diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index fe399c2b1..33ddfa6a3 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -1687,6 +1687,15 @@ int Fcntl(FD_t fd, int op, void *lip) return fcntl(Fileno(fd), op, lip); } +rpmop fdOp(FD_t fd, fdOpX opx) +{ + rpmop op = NULL; + + if (fd != NULL && fd->stats != NULL && opx >= 0 && opx < FDSTAT_MAX) + op = fd->stats->ops + opx; + return op; +} + int rpmioSlurp(const char * fn, byte ** bp, ssize_t * blenp) { static ssize_t blenmax = (32 * BUFSIZ); diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h index d56d46ece..24dfe1176 100644 --- a/rpmio/rpmio.h +++ b/rpmio/rpmio.h @@ -14,6 +14,8 @@ #include <stdlib.h> #include <unistd.h> +#include <rpmsw.h> + #ifdef __cplusplus extern "C" { #endif @@ -282,6 +284,23 @@ int ufdGetFile( FD_t sfd, FD_t tfd); */ int timedRead(FD_t fd, void * bufptr, int length); +/** \ingroup rpmio + * Identify per-desciptor I/O operation statistics. + */ +typedef enum fdOpX_e { + FDSTAT_READ = 0, /*!< Read statistics index. */ + FDSTAT_WRITE = 1, /*!< Write statistics index. */ + FDSTAT_SEEK = 2, /*!< Seek statistics index. */ + FDSTAT_CLOSE = 3, /*!< Close statistics index */ + FDSTAT_DIGEST = 4, /*!< Digest statistics index. */ + FDSTAT_MAX = 5 +} fdOpX; + +/** \ingroup rpmio + * + */ +rpmop fdOp(FD_t fd, fdOpX opx); + #ifdef __cplusplus } #endif diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h index fafc01412..ba74cba81 100644 --- a/rpmio/rpmio_internal.h +++ b/rpmio/rpmio_internal.h @@ -23,18 +23,6 @@ typedef struct _FDSTACK_s { } FDSTACK_t; /** \ingroup rpmio - * Identify per-desciptor I/O operation statistics. - */ -typedef enum fdOpX_e { - FDSTAT_READ = 0, /*!< Read statistics index. */ - FDSTAT_WRITE = 1, /*!< Write statistics index. */ - FDSTAT_SEEK = 2, /*!< Seek statistics index. */ - FDSTAT_CLOSE = 3, /*!< Close statistics index */ - FDSTAT_DIGEST = 4, /*!< Digest statistics index. */ - FDSTAT_MAX = 5 -} fdOpX; - -/** \ingroup rpmio * Cumulative statistics for a descriptor. */ typedef struct { @@ -342,23 +330,11 @@ void fdPop(FD_t fd) /** \ingroup rpmio */ static inline -rpmop fdstat_op(FD_t fd, fdOpX opx) -{ - rpmop op = NULL; - - if (fd != NULL && fd->stats != NULL && opx >= 0 && opx < FDSTAT_MAX) - op = fd->stats->ops + opx; - return op; -} - -/** \ingroup rpmio - */ -static inline void fdstat_enter(FD_t fd, int opx) { if (fd == NULL) return; if (fd->stats != NULL) - (void) rpmswEnter(fdstat_op(fd, opx), 0); + (void) rpmswEnter(fdOp(fd, opx), 0); } /** \ingroup rpmio @@ -379,7 +355,7 @@ void fdstat_exit(FD_t fd, int opx, ssize_t rc) break; } if (fd->stats != NULL) - (void) rpmswExit(fdstat_op(fd, opx), rc); + (void) rpmswExit(fdOp(fd, opx), rc); } /** \ingroup rpmio |