RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES configure.ac rpm/lib/ rpmgi.c rpminstall.c rpm...

From: Jeff Johnson <jbj@rpm5.org>
Date: Wed 29 Sep 2010 - 16:54:31 CEST
Message-Id: <20100929145431.198418AA9D@rpm5.org>
  RPM Package Manager, CVS Repository
  /cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   29-Sep-2010 16:54:31
  Branch: HEAD                             Handle: 2010092914542901

  Modified files:
    rpm                     CHANGES configure.ac
    rpm/lib                 rpmgi.c rpminstall.c
    rpm/rpmio               iosm.c librpmio.vers rpmio.h rpmrpc.c

  Log:
    - add Fadvise wrapper for posix_dadvise(2).

  Summary:
    Revision    Changes     Path
    1.3458      +1  -0      rpm/CHANGES
    2.454       +4  -3      rpm/configure.ac
    2.74        +4  -0      rpm/lib/rpmgi.c
    1.228       +5  -2      rpm/lib/rpminstall.c
    1.43        +6  -0      rpm/rpmio/iosm.c
    2.198       +1  -0      rpm/rpmio/librpmio.vers
    1.97        +7  -0      rpm/rpmio/rpmio.h
    2.98        +55 -0      rpm/rpmio/rpmrpc.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3457 -r1.3458 CHANGES
  --- rpm/CHANGES	29 Sep 2010 02:30:15 -0000	1.3457
  +++ rpm/CHANGES	29 Sep 2010 14:54:29 -0000	1.3458
  @@ -1,4 +1,5 @@
   5.3.4 -> 5.4a1:
  +    - jbj: add Fadvise wrapper for posix_dadvise(2).
       - jbj: fix: eliminate dueling --noorder options.
       - jbj: solvedb's never need a chroot prefix.
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.453 -r2.454 configure.ac
  --- rpm/configure.ac	27 Sep 2010 21:27:34 -0000	2.453
  +++ rpm/configure.ac	29 Sep 2010 14:54:29 -0000	2.454
  @@ -790,9 +790,10 @@
       ftok getaddrinfo getattrlist getcwd getdelim getline getmode getnameinfo dnl
       getpassphrase getxattr getwd iconv inet_aton lchflags lchmod lchown dnl
       lgetxattr lsetxattr lutimes madvise mempcpy mkdtemp mkstemp mtrace dnl
  -    posix_fallocate putenv realpath regcomp __secure_getenv setattrlist dnl
  -    setenv setlocale setmode setproctitle setxattr sigaddset sigdelset dnl
  -    sigemptyset sighold sigrelse sigpause sigprocmask sigsuspend sigaction dnl
  +    posix_fadvise posix_fallocate putenv realpath regcomp __secure_getenv dnl
  +    setattrlist setenv setlocale setmode setproctitle setxattr dnl
  +    sigaddset sigdelset sigemptyset sighold sigrelse sigpause dnl
  +    sigprocmask sigsuspend sigaction dnl
       stpcpy stpncpy strcspn strdup strerror strmode strndup strspn strstr dnl
       strtol strtoul dnl
   ])
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmgi.c
  ============================================================================
  $ cvs diff -u -r2.73 -r2.74 rpmgi.c
  --- rpm/lib/rpmgi.c	12 Sep 2010 22:22:19 -0000	2.73
  +++ rpm/lib/rpmgi.c	29 Sep 2010 14:54:30 -0000	2.74
  @@ -107,6 +107,10 @@
       }
       fn = _free(fn);
   
  +#if defined(POSIX_FADV_WILLNEED)
  +    (void) Fadvise(fd, 0, 0, POSIX_FADV_WILLNEED);
  +#endif
  +
       return fd;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.227 -r1.228 rpminstall.c
  --- rpm/lib/rpminstall.c	13 Aug 2010 13:12:15 -0000	1.227
  +++ rpm/lib/rpminstall.c	29 Sep 2010 14:54:30 -0000	1.228
  @@ -140,7 +140,6 @@
   	    }
   	}
   
  -	/*@-type@*/ /* FIX: still necessary? */
   	if (fd == NULL || Ferror(fd)) {
   	    rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), filename,
   			Fstrerror(fd));
  @@ -150,7 +149,11 @@
   	    }
   	} else
   	    fd = fdLink(fd, "persist (showProgress)");
  -	/*@=type@*/
  +
  +#if defined(POSIX_FADV_WILLNEED)
  +	(void) Fadvise(fd, 0, 0, POSIX_FADV_WILLNEED);
  +#endif
  +
   /*@+voidabstract@*/
   	return (void *)fd;
   /*@=voidabstract@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/iosm.c
  ============================================================================
  $ cvs diff -u -r1.42 -r1.43 iosm.c
  --- rpm/rpmio/iosm.c	8 Mar 2010 22:17:51 -0000	1.42
  +++ rpm/rpmio/iosm.c	29 Sep 2010 14:54:30 -0000	1.43
  @@ -2596,6 +2596,9 @@
   	    rc = IOSMERR_OPEN_FAILED;
   	    break;
   	}
  +#if defined(POSIX_FADV_WILLNEED)
  +	(void) Fadvise(iosm->rfd, 0, 0, POSIX_FADV_WILLNEED);
  +#endif
   	if (iosm->debug && (stage & IOSM_SYSCALL))
   	    rpmlog(RPMLOG_DEBUG, " %8s (%s, \"r\") rfd %p rdbuf %p\n", cur,
   		iosm->path, iosm->rfd, iosm->rdbuf);
  @@ -2626,6 +2629,9 @@
   	    iosm->wfd = NULL;
   	    rc = IOSMERR_OPEN_FAILED;
   	}
  +#if defined(POSIX_FADV_DONTNEED)
  +	(void) Fadvise(iosm->wfd, 0, 0, POSIX_FADV_DONTNEED);
  +#endif
   	if (iosm->debug && (stage & IOSM_SYSCALL))
   	    rpmlog(RPMLOG_DEBUG, " %8s (%s, \"w\") wfd %p wrbuf %p\n", cur,
   		iosm->path, iosm->wfd, iosm->wrbuf);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.197 -r2.198 librpmio.vers
  --- rpm/rpmio/librpmio.vers	27 Sep 2010 17:01:32 -0000	2.197
  +++ rpm/rpmio/librpmio.vers	29 Sep 2010 14:54:30 -0000	2.198
  @@ -77,6 +77,7 @@
       delMacro;
       expandMacros;
       _fsmNext;
  +    Fadvise;
       Fallocate;
       Fchflags;
       _Fchflags;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.96 -r1.97 rpmio.h
  --- rpm/rpmio/rpmio.h	8 Mar 2010 22:24:07 -0000	1.96
  +++ rpm/rpmio/rpmio.h	29 Sep 2010 14:54:30 -0000	1.97
  @@ -304,6 +304,13 @@
   	/*@modifies *st, errno, fileSystem, internalState @*/;
   
   /**
  + * posix_fadvise(2) clone.
  + */
  +int Fadvise(FD_t fd, off_t offset, off_t length, int advice)
  +	/*@globals fileSystem, internalState @*/
  +	/*@modifies fileSystem, internalState @*/;
  +
  +/**
    * posix_fallocate(3)/fallocate(2) clone.
    */
   int Fallocate(FD_t fd, off_t offset, off_t length)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrpc.c
  ============================================================================
  $ cvs diff -u -r2.97 -r2.98 rpmrpc.c
  --- rpm/rpmio/rpmrpc.c	9 Jan 2010 22:03:33 -0000	2.97
  +++ rpm/rpmio/rpmrpc.c	29 Sep 2010 14:54:30 -0000	2.98
  @@ -263,6 +263,9 @@
   	    fdno = -1;
   	}
       }
  +#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_RANDOM)
  +    (void) posix_fadvise(fdno, 0, 0, POSIX_FADV_RANDOM);
  +#endif
   
   if (_rpmio_debug)
   fprintf(stderr, "<-- %s(%s, 0x%x, 0%o) prefix %s fdno %d\n", __FUNCTION__, path, flags, (unsigned)mode, _chroot_prefix, fdno);
  @@ -1473,6 +1476,58 @@
       return rc;
   }
   
  +int Fadvise(FD_t fd, off_t offset, off_t len, int advice)
  +{
  +    const char * path = fdGetOPath(fd);
  +    const char * lpath;
  +    int ut = urlPath(path, &lpath);
  +    int fdno = Fileno(fd);
  +    int rc;
  +
  +if (_rpmio_debug)
  +fprintf(stderr, "*** %s(%p,0x%x,0x%x,0x%x) fdno %d path %s\n", __FUNCTION__, fd, (unsigned)offset, (unsigned)len, advice, fdno, path);
  +
  +    /* XXX errno is not set by fallocate/posix_fallocate */
  +    if (fd == NULL || fdno < 0) {
  +	rc = EBADF;
  +	return rc;
  +    }
  +
  +    switch (ut) {
  +    case URL_IS_PATH:
  +    case URL_IS_UNKNOWN:
  +	break;
  +    default:
  +	rc = ENODEV;	
  +	return rc;
  +	/*@notreached@*/ break;
  +    }
  +
  +    switch (advice) {
  +#if defined(HAVE_POSIX_FADVISE)
  +    case POSIX_FADV_NORMAL:
  +    case POSIX_FADV_SEQUENTIAL:
  +    case POSIX_FADV_RANDOM:
  +    case POSIX_FADV_NOREUSE:
  +    case POSIX_FADV_WILLNEED:
  +    case POSIX_FADV_DONTNEED:
  +	rc = posix_fadvise(fdno, offset, len, advice);
  +#else
  +	rc = ENOSYS;
  +#endif
  +	break;
  +    default:
  +	rc = EINVAL;
  +	break;
  +    }
  +
  +    if (rc != 0)
  +	rpmlog(RPMLOG_DEBUG, _("%s(%d,0x%x,0x%x) failed: rc %d\n"),
  +		__FUNCTION__, fdno, (unsigned)offset, (unsigned)len, rc);
  +
  +    return rc;
  +}
  +
   #undef	HAVE_FALLOCATE	/* XXX hmmm, fallocate64 is AWOL in F11. */
   int Fallocate(FD_t fd, off_t offset, off_t len)
   {
  @@ .
Received on Wed Sep 29 16:54:31 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.