summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-11-23 12:00:22 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-11-23 12:00:22 +0200
commitdae44a0f38913fc34f55bb345c84d7cc3f6be722 (patch)
tree64647e86a32f7f154228df3a154a1beb0b5fe435 /rpmio
parentc10e5da8a0a724cb3cc9ed23124d83f44d384ac8 (diff)
downloadrpm-dae44a0f38913fc34f55bb345c84d7cc3f6be722.tar.gz
rpm-dae44a0f38913fc34f55bb345c84d7cc3f6be722.tar.bz2
rpm-dae44a0f38913fc34f55bb345c84d7cc3f6be722.zip
Export FD statistics enums + fdOp() method
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmio.c9
-rw-r--r--rpmio/rpmio.h19
-rw-r--r--rpmio/rpmio_internal.h28
3 files changed, 30 insertions, 26 deletions
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