1 #ifndef H_RPMIO_INTERNAL
2 #define H_RPMIO_INTERNAL
13 #define _RPMPGP_INTERNAL
63 #define RPMIO_DEBUG_IO 0x40000000
64 #define RPMIO_DEBUG_REFS 0x20000000
66 #define FDMAGIC 0x04463138
99 #define FDDIGEST_MAX 32
109 #if defined(__LCLINT__)
116 #define FDSANE(fd) assert(fd != NULL && fd->magic == FDMAGIC)
138 #define DBG(_f, _m, _x) \
140 if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x \
143 #if defined(__LCLINT__XXX)
144 #define DBGIO(_f, _x)
145 #define DBGREFS(_f, _x)
147 #define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x)
148 #define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x)
181 int ftpCmd(
const char * cmd,
const char * url,
const char * arg2)
198 if (fd->
opath != NULL) {
199 free((
void *)fd->
opath);
385 if (fd->
nfps >= (
int)(
sizeof(fd->
fps)/
sizeof(fd->
fps[0]) - 1))
400 if (fd->
nfps < 0)
return;
415 if (fd != NULL && fd->
stats != NULL && (
int)opx >= 0 && opx <
FDSTAT_MAX)
416 op = fd->
stats->ops + opx;
427 if (fd == NULL)
return;
428 if (fd->
stats != NULL)
439 if (fd == NULL)
return;
451 if (fd->
stats != NULL)
462 static int usec_scale = (1000*1000);
465 if (fd == NULL || fd->
stats == NULL)
return;
466 for (opx = 0; opx < 4; opx++) {
468 if (op->
count <= 0)
continue;
471 if (msg != NULL) fprintf(fp,
"%s:", msg);
472 fprintf(fp,
"%8d reads, %8lu total bytes in %d.%06d secs\n",
474 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
477 if (msg != NULL) fprintf(fp,
"%s:", msg);
478 fprintf(fp,
"%8d writes, %8lu total bytes in %d.%06d secs\n",
480 (
int)(op->
usecs/usec_scale), (
int)(op->
usecs%usec_scale));
574 if (buf != NULL && buflen > 0)
575 for (i = fd->
ndigests - 1; i >= 0; i--) {
598 for (i = fd->
ndigests - 1; i >= 0; i--) {
602 if (i > imax) imax = i;
612 if (datap != NULL) *(
void **)datap = NULL;
613 if (lenp != NULL) *lenp = 0;
630 for (i = fd->
ndigests - 1; i >= 0; i--) {
635 assert(dig->md5ctx == NULL);
643 #if defined(HAVE_BEECRYPT_API_H)
648 assert(dig->sha1ctx == NULL);
670 if (cookie == NULL)
return -2;