1 #ifndef H_RPMIO_INTERNAL 2 #define H_RPMIO_INTERNAL 13 #define _RPMPGP_INTERNAL 62 #define RPMIO_DEBUG_IO 0x40000000 63 #define RPMIO_DEBUG_REFS 0x20000000 65 #define FDMAGIC 0x04463138 106 #if defined(__LCLINT__) 113 #define FDSANE(fd) assert(fd != NULL && fd->magic == FDMAGIC) 115 #define DBG(_f, _m, _x) \ 117 if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x \ 120 #if defined(__LCLINT__XXX) 121 #define DBGIO(_f, _x) 122 #define DBGREFS(_f, _x) 124 #define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x) 125 #define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x) 158 int ftpCmd(
const char * cmd,
const char * url,
const char * arg2)
175 if (fd->
opath != NULL) {
176 free((
void *)fd->
opath);
362 if (fd->
nfps >= (
int)(
sizeof(fd->
fps)/
sizeof(fd->
fps[0]) - 1))
377 if (fd->
nfps < 0)
return;
392 if (fd != NULL && fd->
stats != NULL && (
int)opx >= 0 && opx <
FDSTAT_MAX)
393 op = fd->
stats->ops + opx;
404 if (fd == NULL)
return;
405 if (fd->
stats != NULL)
416 if (fd == NULL)
return;
428 if (fd->
stats != NULL)
439 static int usec_scale = (1000*1000);
442 if (fd == NULL || fd->
stats == NULL)
return;
443 for (opx = 0; opx < 4; opx++) {
445 if (op->
count <= 0)
continue;
448 if (msg != NULL) fprintf(fp,
"%s:", msg);
449 fprintf(fp,
"%8d reads, %8lu total bytes in %d.%06d secs\n",
451 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
454 if (msg != NULL) fprintf(fp,
"%s:", msg);
455 fprintf(fp,
"%8d writes, %8lu total bytes in %d.%06d secs\n",
457 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
563 if (fd->
ndigests > 0 && buf != NULL && buflen > 0) {
566 #pragma omp parallel for if (fd->ndigests > 1) 568 for (i = fd->
ndigests - 1; i >= 0; i--) {
592 for (i = fd->
ndigests - 1; i >= 0; i--) {
605 if (datap != NULL) *(
void **)datap = NULL;
606 if (lenp != NULL) *lenp = 0;
620 for (i = fd->
ndigests - 1; i >= 0; i--) {
625 assert(dig->md5ctx == NULL);
636 assert(dig->sha1ctx == NULL);
658 if (cookie == NULL)
return -2;
Structure(s)and methods for a XAR archive wrapper format.
rpmtime_t rpmswExit(rpmop op, ssize_t rc)
Exit timed operation.
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
static void fdstat_enter(FD_t fd, int opx)
static int fdGetFdno(FD_t fd)
static void * fdGetFp(FD_t fd)
static void fdSetFdno(FD_t fd, int fdno)
OpenPGP constants and structures from RFC-2440.
int fdFgets(FD_t fd, char *buf, size_t len)
char * xstrdup(const char *str)
DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
Initialize digest.
static const char * fdGetOPath(FD_t fd)
struct @6 * FDSTAT_t
Cumulative statistics for a descriptor.
enum pgpHashAlgo_e pgpHashAlgo
9.4.
static pgpDig fdGetDig(FD_t fd)
static mode_t fdGetOMode(FD_t fd)
static void fdPush(FD_t fd, FDIO_t io, void *fp, int fdno)
static void fdInitHmac(FD_t fd, const void *key, size_t keylen)
Attach digest to fd.
pgpDig pgpDigLink(pgpDig dig)
Reference a signature parameters instance.
enum rpmDigestFlags_e rpmDigestFlags
Bit(s) to control digest operation.
fdOpX_e
Identify per-desciptor I/O operation statistics.
static FDIO_t fdGetIo(FD_t fd)
static void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int _flags)
Attach digest to fd.
static void fdSetSyserrno(FD_t fd, int syserrno, const void *errcookie)
static rpmop fdstat_op(FD_t fd, fdOpX opx)
int rpmHmacInit(DIGEST_CTX ctx, const void *key, size_t keylen)
Compute key material and add to digest context.
static void fdUpdateDigests(FD_t fd, const unsigned char *buf, ssize_t buflen)
Update digest(s) attached to fd.
Yet Another syslog(3) API clone.
struct rpmop_s ops[FDSTAT_MAX]
int rpmDigestUpdate(DIGEST_CTX ctx, const void *data, size_t len)
Update context with next plain text buffer.
static void fdSetDig(FD_t fd, pgpDig dig)
static void fdstat_print(FD_t fd, const char *msg, FILE *fp)
int ftpCmd(const char *cmd, const char *url, const char *arg2)
static void fdPop(FD_t fd)
pgpHashAlgo rpmDigestAlgo(DIGEST_CTX ctx)
Return digest algorithm identifier.
static void fdSetOpen(FD_t fd, const char *path, int flags, mode_t mode)
static void fdSetXAR(FD_t fd, rpmxar xar)
int ftpReq(FD_t data, const char *ftpCmd, const char *ftpArg)
static int fdGetOFlags(FD_t fd)
struct _FDSTACK_s FDSTACK_t
The FD_t File Handle data structure.
static void fdFiniDigest(FD_t fd, pgpHashAlgo hashalgo, void *datap, size_t *lenp, int asAscii)
enum fdOpX_e fdOpX
Identify per-desciptor I/O operation statistics.
static unsigned long long fdGetCpioPos(FD_t fd)
int rpmswEnter(rpmop op, ssize_t rc)
Enter timed operation.
static int fdFileno(void *cookie)
Cumulative statistics for an operation.
static void fdSetCpioPos(FD_t fd, long int cpioPos)
const char * fdbg(FD_t fd)
static void fdSetIo(FD_t fd, FDIO_t io)
unsigned long long fd_cpioPos
FD_t ftpOpen(const char *url, int flags, mode_t mode, urlinfo *uret)
struct _FDDIGEST_s * FDDIGEST_t
int ufdClose(void *cookie)
const char * contentDisposition
static rpmxar fdGetXAR(FD_t fd)
static void fdSetContentLength(FD_t fd, ssize_t contentLength)
static FD_t c2f(void *cookie)
int rpmDigestFinal(DIGEST_CTX ctx, void *datap, size_t *lenp, int asAscii)
Return digest and destroy context.
static FILE * fdGetFILE(FD_t fd)
static void fdStealDigest(FD_t fd, pgpDig dig)
static void fdSetFp(FD_t fd, void *fp)
static void fdstat_exit(FD_t fd, int opx, ssize_t rc)
rpmxar rpmxarLink(rpmxar xar, const char *msg)
Reference a xar archive instance.
static int fdGetRdTimeoutSecs(FD_t fd)