Export FD statistics enums + fdOp() method
This commit is contained in:
parent
c10e5da8a0
commit
dae44a0f38
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -22,18 +22,6 @@ typedef struct _FDSTACK_s {
|
|||
int fdno;
|
||||
} 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.
|
||||
*/
|
||||
|
@ -339,18 +327,6 @@ void fdPop(FD_t fd)
|
|||
fd->nfps--;
|
||||
}
|
||||
|
||||
/** \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
|
||||
|
@ -358,7 +334,7 @@ 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
|
||||
|
|
Loading…
Reference in New Issue