summaryrefslogtreecommitdiff
path: root/rpmio/rpmio.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-14 16:10:08 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-14 16:10:08 +0300
commit63432905a413d33085061674e00d6c23c60056e4 (patch)
tree44ac9a5324ce520f4f1c0292b097a63b6711353f /rpmio/rpmio.c
parentf2e55c2ff8f6fba0cba61251027fe899ac2fdd1a (diff)
downloadrpm-63432905a413d33085061674e00d6c23c60056e4.tar.gz
rpm-63432905a413d33085061674e00d6c23c60056e4.tar.bz2
rpm-63432905a413d33085061674e00d6c23c60056e4.zip
Move pile of helpers from rpmio_internal.h to rpmio.c, remove unused stuff
- nothing outside rpmio.c needs these, make 'em static there - uninlining reveals quite a few completely unused helpers...
Diffstat (limited to 'rpmio/rpmio.c')
-rw-r--r--rpmio/rpmio.c67
1 files changed, 58 insertions, 9 deletions
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index 9ad154725..224842bcf 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -29,6 +29,64 @@ extern int h_errno;
#include "debug.h"
+static FDIO_t fdGetIo(FD_t fd)
+{
+ FDSANE(fd);
+ return fd->fps[fd->nfps].io;
+}
+
+static void fdSetIo(FD_t fd, FDIO_t io)
+{
+ FDSANE(fd);
+ fd->fps[fd->nfps].io = io;
+}
+
+static void * fdGetFp(FD_t fd)
+{
+ FDSANE(fd);
+ return fd->fps[fd->nfps].fp;
+}
+
+static void fdSetFp(FD_t fd, void * fp)
+{
+ FDSANE(fd);
+ fd->fps[fd->nfps].fp = fp;
+}
+
+static void fdSetFdno(FD_t fd, int fdno)
+{
+ FDSANE(fd);
+ fd->fps[fd->nfps].fdno = fdno;
+}
+
+static void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
+{
+ FDSANE(fd);
+ if (fd->nfps >= (sizeof(fd->fps)/sizeof(fd->fps[0]) - 1))
+ return;
+ fd->nfps++;
+ fdSetIo(fd, io);
+ fdSetFp(fd, fp);
+ fdSetFdno(fd, fdno);
+}
+
+static void fdPop(FD_t fd)
+{
+ FDSANE(fd);
+ if (fd->nfps < 0) return;
+ fdSetIo(fd, NULL);
+ fdSetFp(fd, NULL);
+ fdSetFdno(fd, -1);
+ fd->nfps--;
+}
+
+static FD_t c2f(void * cookie)
+{
+ FD_t fd = (FD_t) cookie;
+ FDSANE(fd);
+ return fd;
+}
+
#define FDNREFS(fd) (fd ? ((FD_t)fd)->nrefs : -9)
#define FDTO(fd) (fd ? ((FD_t)fd)->rd_timeoutsecs : -99)
#define FDCPIOPOS(fd) (fd ? ((FD_t)fd)->fd_cpioPos : -99)
@@ -647,15 +705,6 @@ static ssize_t ufdWrite(void * cookie, const char * buf, size_t count)
int bytesWritten;
int total = 0;
-#ifdef NOTYET
- if (fdGetIo(fd) == fdio) {
- struct stat sb;
- (void) fstat(fdGetFdno(fd), &sb);
- if (S_ISREG(sb.st_mode))
- return fdWrite(fd, buf, count);
- }
-#endif
-
UFDONLY(fd);
for (total = 0; total < count; total += bytesWritten) {