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;