RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   20-Mar-2009 16:05:14
  Branch: HEAD                             Handle: 2009032015051202

  Modified files:
    rpm                     CHANGES
    rpm/lib                 psm.c rpmds.c rpmfi.c rpmgi.c rpmps.c rpmsx.c
                            rpmte.c rpmts.c
    rpm/rpmdb               header.c rpmdb.c
    rpm/rpmio               librpmio.vers rpmio.c rpmio.h rpmmalloc.c rpmpgp.c
                            rpmxar.c url.c

  Log:
    - yarn: stub in (*init)() and (*fini)() pool item methods.
    - yarn: add a (*dbg)() formatter to make fdLink() generic.

  Summary:
    Revision    Changes     Path
    1.2852      +2  -0      rpm/CHANGES
    2.347       +2  -1      rpm/lib/psm.c
    2.135       +2  -1      rpm/lib/rpmds.c
    2.139       +2  -1      rpm/lib/rpmfi.c
    2.58        +2  -1      rpm/lib/rpmgi.c
    2.31        +2  -1      rpm/lib/rpmps.c
    2.24        +2  -1      rpm/lib/rpmsx.c
    2.93        +4  -2      rpm/lib/rpmte.c
    2.160       +2  -1      rpm/lib/rpmts.c
    1.173       +2  -1      rpm/rpmdb/header.c
    1.280       +2  -1      rpm/rpmdb/rpmdb.c
    2.97        +0  -1      rpm/rpmio/librpmio.vers
    1.169       +4  -27     rpm/rpmio/rpmio.c
    1.85        +9  -7      rpm/rpmio/rpmio.h
    1.17        +20 -5      rpm/rpmio/rpmmalloc.c
    2.100       +2  -1      rpm/rpmio/rpmpgp.c
    2.19        +2  -1      rpm/rpmio/rpmxar.c
    1.65        +2  -1      rpm/rpmio/url.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2851 -r1.2852 CHANGES
  --- rpm/CHANGES       20 Mar 2009 14:47:11 -0000      1.2851
  +++ rpm/CHANGES       20 Mar 2009 15:05:12 -0000      1.2852
  @@ -1,5 +1,7 @@
   
   5.2a3 -> 5.2a4:
  +    - jbj: yarn: stub in (*init)() and (*fini)() pool item methods.
  +    - jbj: yarn: add a (*dbg)() formatter to make fdLink() generic.
       - jbj: yarn: stub-in rpmmi pool handling under NOTYET.
       - jbj: QNX: avoid conflicting db defines for __mutex_lock/__mutex_unlock.
       - jbj: yarn: convert rpmdb refcount to usage mutex.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.346 -r2.347 psm.c
  --- rpm/lib/psm.c     19 Mar 2009 18:22:03 -0000      2.346
  +++ rpm/lib/psm.c     20 Mar 2009 15:05:14 -0000      2.347
  @@ -70,7 +70,8 @@
       rpmpsm psm;
   
       if (_psmPool == NULL) {
  -     _psmPool = rpmioNewPool("psm", sizeof(*psm), -1, _psm_debug);
  +     _psmPool = rpmioNewPool("psm", sizeof(*psm), -1, _psm_debug,
  +                     NULL, NULL, NULL);
        pool = _psmPool;
       }
       return (rpmpsm) rpmioGetPool(pool, sizeof(*psm));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  ============================================================================
  $ cvs diff -u -r2.134 -r2.135 rpmds.c
  --- rpm/lib/rpmds.c   19 Mar 2009 20:35:07 -0000      2.134
  +++ rpm/lib/rpmds.c   20 Mar 2009 15:05:14 -0000      2.135
  @@ -131,7 +131,8 @@
       rpmds ds;
   
       if (_rpmdsPool == NULL) {
  -     _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1, _rpmds_debug);
  +     _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1, _rpmds_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmdsPool;
       }
       return (rpmds) rpmioGetPool(pool, sizeof(*ds));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.c
  ============================================================================
  $ cvs diff -u -r2.138 -r2.139 rpmfi.c
  --- rpm/lib/rpmfi.c   18 Mar 2009 18:36:38 -0000      2.138
  +++ rpm/lib/rpmfi.c   20 Mar 2009 15:05:14 -0000      2.139
  @@ -63,7 +63,8 @@
       rpmfi fi;
   
       if (_rpmfiPool == NULL) {
  -     _rpmfiPool = rpmioNewPool("fi", sizeof(*fi), -1, _rpmfi_debug);
  +     _rpmfiPool = rpmioNewPool("fi", sizeof(*fi), -1, _rpmfi_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmfiPool;
       }
       return (rpmfi) rpmioGetPool(pool, sizeof(*fi));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmgi.c
  ============================================================================
  $ cvs diff -u -r2.57 -r2.58 rpmgi.c
  --- rpm/lib/rpmgi.c   18 Mar 2009 19:59:50 -0000      2.57
  +++ rpm/lib/rpmgi.c   20 Mar 2009 15:05:14 -0000      2.58
  @@ -50,7 +50,8 @@
       rpmgi gi;
   
       if (_rpmgiPool == NULL) {
  -     _rpmgiPool = rpmioNewPool("gi", sizeof(*gi), -1, _rpmgi_debug);
  +     _rpmgiPool = rpmioNewPool("gi", sizeof(*gi), -1, _rpmgi_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmgiPool;
       }
       return (rpmgi) rpmioGetPool(pool, sizeof(*gi));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmps.c
  ============================================================================
  $ cvs diff -u -r2.30 -r2.31 rpmps.c
  --- rpm/lib/rpmps.c   19 Mar 2009 14:52:38 -0000      2.30
  +++ rpm/lib/rpmps.c   20 Mar 2009 15:05:14 -0000      2.31
  @@ -29,7 +29,8 @@
       rpmps ps;
   
       if (_rpmpsPool == NULL) {
  -     _rpmpsPool = rpmioNewPool("ps", sizeof(*ps), -1, _rpmps_debug);
  +     _rpmpsPool = rpmioNewPool("ps", sizeof(*ps), -1, _rpmps_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmpsPool;
       }
       return (rpmps) rpmioGetPool(pool, sizeof(*ps));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmsx.c
  ============================================================================
  $ cvs diff -u -r2.23 -r2.24 rpmsx.c
  --- rpm/lib/rpmsx.c   18 Mar 2009 22:58:33 -0000      2.23
  +++ rpm/lib/rpmsx.c   20 Mar 2009 15:05:14 -0000      2.24
  @@ -29,7 +29,8 @@
       rpmsx sx;
   
       if (_rpmsxPool == NULL) {
  -     _rpmsxPool = rpmioNewPool("sx", sizeof(*sx), -1, _rpmsx_debug);
  +     _rpmsxPool = rpmioNewPool("sx", sizeof(*sx), -1, _rpmsx_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmsxPool;
       }
       return (rpmsx) rpmioGetPool(pool, sizeof(*sx));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmte.c
  ============================================================================
  $ cvs diff -u -r2.92 -r2.93 rpmte.c
  --- rpm/lib/rpmte.c   18 Mar 2009 23:23:56 -0000      2.92
  +++ rpm/lib/rpmte.c   20 Mar 2009 15:05:14 -0000      2.93
  @@ -35,7 +35,8 @@
       rpmte te;
   
       if (_rpmtePool == NULL) {
  -     _rpmtePool = rpmioNewPool("te", sizeof(*te), -1, _rpmte_debug);
  +     _rpmtePool = rpmioNewPool("te", sizeof(*te), -1, _rpmte_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmtePool;
       }
       return (rpmte) rpmioGetPool(pool, sizeof(*te));
  @@ -51,7 +52,8 @@
       rpmtsi tsi;
   
       if (_rpmtsiPool == NULL) {
  -     _rpmtsiPool = rpmioNewPool("tsi", sizeof(*tsi), -1, _rpmte_debug);/* 
XXX _rpmtsi_debug? */
  +     _rpmtsiPool = rpmioNewPool("tsi", sizeof(*tsi), -1, _rpmte_debug,
  +                     NULL, NULL, NULL);/* XXX _rpmtsi_debug? */
        pool = _rpmtsiPool;
       }
       return (rpmtsi) rpmioGetPool(pool, sizeof(*tsi));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmts.c
  ============================================================================
  $ cvs diff -u -r2.159 -r2.160 rpmts.c
  --- rpm/lib/rpmts.c   19 Mar 2009 14:57:21 -0000      2.159
  +++ rpm/lib/rpmts.c   20 Mar 2009 15:05:14 -0000      2.160
  @@ -98,7 +98,8 @@
       rpmts ts;
   
       if (_rpmtsPool == NULL) {
  -     _rpmtsPool = rpmioNewPool("ts", sizeof(*ts), -1, _rpmts_debug);
  +     _rpmtsPool = rpmioNewPool("ts", sizeof(*ts), -1, _rpmts_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmtsPool;
       }
       return (rpmts) rpmioGetPool(pool, sizeof(*ts));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/header.c
  ============================================================================
  $ cvs diff -u -r1.172 -r1.173 header.c
  --- rpm/rpmdb/header.c        18 Mar 2009 21:54:05 -0000      1.172
  +++ rpm/rpmdb/header.c        20 Mar 2009 15:05:13 -0000      1.173
  @@ -101,7 +101,8 @@
       Header h;
   
       if (_headerPool == NULL) {
  -     _headerPool = rpmioNewPool("h", sizeof(*h), -1, _hdr_debug);
  +     _headerPool = rpmioNewPool("h", sizeof(*h), -1, _hdr_debug,
  +                     NULL, NULL, NULL);
        pool = _headerPool;
       }
       return (Header) rpmioGetPool(pool, sizeof(*h));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.279 -r1.280 rpmdb.c
  --- rpm/rpmdb/rpmdb.c 19 Mar 2009 19:49:20 -0000      1.279
  +++ rpm/rpmdb/rpmdb.c 20 Mar 2009 15:05:13 -0000      1.280
  @@ -944,7 +944,8 @@
       rpmdb db;
   
       if (_rpmdbPool == NULL) {
  -     _rpmdbPool = rpmioNewPool("db", sizeof(*db), -1, _rpmdb_debug);
  +     _rpmdbPool = rpmioNewPool("db", sizeof(*db), -1, _rpmdb_debug,
  +                     NULL, NULL, NULL);
        pool = _rpmdbPool;
       }
       return (rpmdb) rpmioGetPool(pool, sizeof(*db));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.96 -r2.97 librpmio.vers
  --- rpm/rpmio/librpmio.vers   19 Mar 2009 16:29:24 -0000      2.96
  +++ rpm/rpmio/librpmio.vers   20 Mar 2009 15:05:13 -0000      2.97
  @@ -502,7 +502,6 @@
       xstrncasecmp;
       xstrtolocale;
       XfdFree;
  -    XfdLink;
       XfdNew;
       XurlFree;
       XurlNew;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.c
  ============================================================================
  $ cvs diff -u -r1.168 -r1.169 rpmio.c
  --- rpm/rpmio/rpmio.c 19 Mar 2009 17:33:43 -0000      1.168
  +++ rpm/rpmio/rpmio.c 20 Mar 2009 15:05:13 -0000      1.169
  @@ -178,7 +178,8 @@
       FD_t fd;
   
       if (_fdPool == NULL) {
  -     _fdPool = rpmioNewPool("fd", sizeof(*fd), -1, _rpmio_debug);
  +     _fdPool = rpmioNewPool("fd", sizeof(*fd), -1, _rpmio_debug,
  +             (const char * (*)(void *))fdbg, NULL, NULL);
        pool = _fdPool;
       }
       return (FD_t) rpmioGetPool(pool, sizeof(*fd));
  @@ -283,30 +284,6 @@
   }
   
   /* =============================================================== */
  -/*...@-incondefs@*/
  -/*...@-mustmod@*/ /* FIX: cookie is modified */
  -/*...@null@*/
  -FD_t XfdLink(void * cookie, const char * msg,
  -             const char * fn, unsigned ln)
  -     /*...@modifies *cookie @*/
  -{
  -    FD_t fd;
  -#ifdef       NOTYET
  -assert(cookie != NULL);
  -#else
  -if (cookie == NULL)
  -DBGREFS(0, (stderr, "--> fd  %p ++ %ld %s at %s:%u\n", cookie, -9L, msg, fn, 
ln));
  -#endif
  -    fd = c2f(cookie);
  -    if (fd) {
  -     yarnPossess(fd->use);
  -DBGREFS(fd, (stderr, "--> fd  %p ++ %ld %s at %s:%u %s\n", fd, 
yarnPeekLock(fd->use)+1, msg, fn, ln, fdbg(fd)));
  -     yarnTwist(fd->use, BY, 1);
  -    }
  -    return fd;
  -}
  -/*...@=mustmod@*/
  -/*...@=incondefs@*/
   
   /*...@-incondefs@*/
   /*...@null@*/
  @@ -357,7 +334,7 @@
   
   /*...@-incondefs@*/
   /*...@null@*/
  -FD_t XfdNew(const char * msg, const char * fn, unsigned line)
  +FD_t XfdNew(const char * msg, const char * fn, unsigned ln)
   {
       FD_t fd = fdGetPool(_fdPool);
       if (fd == NULL) /* XXX xmalloc never returns NULL */
  @@ -395,7 +372,7 @@
       fd->ftpFileDoneNeeded = 0;
       fd->fd_cpioPos = 0;
   
  -    return XfdLink(fd, msg, fn, line);
  +    return (FD_t)rpmioLinkPoolItem((rpmioItem)fd, msg, fn, ln);
   }
   /*...@=incondefs@*/
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  ============================================================================
  $ cvs diff -u -r1.84 -r1.85 rpmio.h
  --- rpm/rpmio/rpmio.h 18 Mar 2009 16:47:00 -0000      1.84
  +++ rpm/rpmio/rpmio.h 20 Mar 2009 15:05:13 -0000      1.85
  @@ -541,12 +541,8 @@
   FD_t fdLink (/*...@only@*/ void * cookie, const char * msg)
        /*...@globals fileSystem @*/
        /*...@modifies *cookie, fileSystem @*/;
  -/*...@unused@*/
  -/*...@only@*/ /*...@null@*/
  -FD_t XfdLink (/*...@only@*/ void * cookie, const char * msg, const char * 
fn, unsigned ln)
  -     /*...@globals fileSystem @*/
  -     /*...@modifies *cookie, fileSystem @*/;
  -#define      fdLink(_fd, _msg)       XfdLink(_fd, _msg, __FILE__, __LINE__)
  +#define      fdLink(_fd, _msg)       \
  +     ((FD_t)rpmioLinkPoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))
   /*...@=incondefs@*/
   
   /*...@-incondefs @*/
  @@ -761,9 +757,15 @@
    * @param size               item size
    * @param limit              no. of items permitted (-1 for unlimited)
    * @param flags              debugging flags
  + * @param (*dbg)()   generate string for Unlink/Link/Free debugging
  + * @param (*init)()  create item contents
  + * @param (*fini)()  destroy item contents
    * @return           memory pool
    */
  -rpmioPool rpmioNewPool(const char * name, size_t size, int limit, int flags)
  +rpmioPool rpmioNewPool(const char * name, size_t size, int limit, int flags,
  +             /*...@null@*/ const char * (*dbg) (void *item), 
  +             /*...@null@*/ void (*init) (void *item),
  +             /*...@null@*/ void (*fini) (void *item))
           /*...@*/;
   
   /**
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmmalloc.c
  ============================================================================
  $ cvs diff -u -r1.16 -r1.17 rpmmalloc.c
  --- rpm/rpmio/rpmmalloc.c     18 Mar 2009 16:47:00 -0000      1.16
  +++ rpm/rpmio/rpmmalloc.c     20 Mar 2009 15:05:13 -0000      1.17
  @@ -42,6 +42,13 @@
       size_t size;             /*!< size of items in this pool */
       int limit;                       /*!< number of new items allowed, or -1 
*/
       int flags;
  +/*...@null@*/
  +    const char * (*dbg) (void *item)
  +     /*...@*/;                       /*!< generate string w Unlink/Link 
debugging */
  +    void (*init) (void *item)
  +     /*...@modifies *item @*/;       /*!< create item contents. */
  +    void (*fini) (void *item)
  +     /*...@modifies *item @*/;       /*!< destroy item contents. */
       int reused;                      /*!< number of items reused */
       int made;                        /*!< number of items made */
   /*...@observer@*/
  @@ -79,7 +86,10 @@
       return NULL;
   }
   
  -rpmioPool rpmioNewPool(const char * name, size_t size, int limit, int flags)
  +rpmioPool rpmioNewPool(const char * name, size_t size, int limit, int flags,
  +             const char * (*dbg) (void *item),
  +             void (*init) (void *item),
  +             void (*fini) (void *item))
        /*...@*/
   {
       rpmioPool pool = xcalloc(1, sizeof(*pool));
  @@ -90,6 +100,9 @@
       pool->size = size;
       pool->limit = limit;
       pool->flags = flags;
  +    pool->dbg = dbg;
  +    pool->init = init;
  +    pool->fini = fini;
       pool->reused = 0;
       pool->made = 0;
       pool->name = name;
  @@ -105,9 +118,10 @@
       if (item == NULL) return NULL;
       yarnPossess(item->use);
       if ((pool = item->pool) != NULL && pool->flags && msg != NULL) {
  +     const char * imsg = (pool->dbg ? (*pool->dbg)((void *)item) : "");
   /*...@-modfilesys@*/
  -     fprintf(stderr, "--> %s %p -- %ld %s at %s:%u\n", pool->name,
  -                     item, yarnPeekLock(item->use), msg, fn, ln);
  +     fprintf(stderr, "--> %s %p -- %ld %s at %s:%u%s\n", pool->name,
  +                     item, yarnPeekLock(item->use), msg, fn, ln, imsg);
   /*...@=modfilesys@*/
       }
       yarnTwist(item->use, BY, -1);
  @@ -121,9 +135,10 @@
       if (item == NULL) return NULL;
       yarnPossess(item->use);
       if ((pool = item->pool) != NULL && pool->flags && msg != NULL) {
  +     const char * imsg = (pool->dbg ? (*pool->dbg)((void *)item) : "");
   /*...@-modfilesys@*/
  -     fprintf(stderr, "--> %s %p ++ %ld %s at %s:%u\n", pool->name,
  -                     item, yarnPeekLock(item->use)+1, msg, fn, ln);
  +     fprintf(stderr, "--> %s %p ++ %ld %s at %s:%u%s\n", pool->name,
  +                     item, yarnPeekLock(item->use)+1, msg, fn, ln, imsg);
   /*...@=modfilesys@*/
       }
       yarnTwist(item->use, BY, 1);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmpgp.c
  ============================================================================
  $ cvs diff -u -r2.99 -r2.100 rpmpgp.c
  --- rpm/rpmio/rpmpgp.c        19 Mar 2009 16:29:24 -0000      2.99
  +++ rpm/rpmio/rpmpgp.c        20 Mar 2009 15:05:13 -0000      2.100
  @@ -1020,7 +1020,8 @@
       pgpDig dig;
   
       if (_digPool == NULL) {
  -     _digPool = rpmioNewPool("dig", sizeof(*dig), -1, _pgp_debug);
  +     _digPool = rpmioNewPool("dig", sizeof(*dig), -1, _pgp_debug,
  +                     NULL, NULL, NULL);
        pool = _digPool;
       }
       return (pgpDig) rpmioGetPool(pool, sizeof(*dig));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmxar.c
  ============================================================================
  $ cvs diff -u -r2.18 -r2.19 rpmxar.c
  --- rpm/rpmio/rpmxar.c        19 Mar 2009 17:33:43 -0000      2.18
  +++ rpm/rpmio/rpmxar.c        20 Mar 2009 15:05:13 -0000      2.19
  @@ -76,7 +76,8 @@
       rpmxar xar;
   
       if (_xarPool == NULL) {
  -     _xarPool = rpmioNewPool("xar", sizeof(*xar), -1, _xar_debug);
  +     _xarPool = rpmioNewPool("xar", sizeof(*xar), -1, _xar_debug,
  +                     NULL, NULL, NULL);
        pool = _xarPool;
       }
       return (rpmxar) rpmioGetPool(pool, sizeof(*xar));
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/url.c
  ============================================================================
  $ cvs diff -u -r1.64 -r1.65 url.c
  --- rpm/rpmio/url.c   18 Mar 2009 18:36:37 -0000      1.64
  +++ rpm/rpmio/url.c   20 Mar 2009 15:05:13 -0000      1.65
  @@ -78,7 +78,8 @@
       urlinfo u;
   
       if (_urlPool == NULL) {
  -     _urlPool = rpmioNewPool(" u", sizeof(*u), -1, _url_debug);
  +     _urlPool = rpmioNewPool(" u", sizeof(*u), -1, _url_debug,
  +                     NULL, NULL, NULL);
        pool = _urlPool;
       }
       return (urlinfo) rpmioGetPool(pool, sizeof(*u));
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to