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:   24-Mar-2009 20:30:22
  Branch: HEAD                             Handle: 2009032419302101

  Modified files:
    rpm                     CHANGES
    rpm/lib                 poptALL.c
    rpm/rpmdb               librpmdb.vers rpmwf.c rpmwf.h

  Log:
    - yarn: convert rpmwf refcount to usage mutex.

  Summary:
    Revision    Changes     Path
    1.2869      +1  -0      rpm/CHANGES
    2.116       +2  -0      rpm/lib/poptALL.c
    1.60        +1  -0      rpm/rpmdb/librpmdb.vers
    1.27        +26 -46     rpm/rpmdb/rpmwf.c
    1.13        +7  -18     rpm/rpmdb/rpmwf.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2868 -r1.2869 CHANGES
  --- rpm/CHANGES       24 Mar 2009 19:00:59 -0000      1.2868
  +++ rpm/CHANGES       24 Mar 2009 19:30:21 -0000      1.2869
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +    - jbj: yarn: convert rpmwf refcount to usage mutex.
       - jbj: rpmdb: don't bother with the silly structure assignment 
initialize.
       - jbj: yarn: wire up rpmdsFini, mark rpmdsFree for destruction.
       - jbj: yarn: wire up rpmtsFini, mark rpmtsFree for destruction.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  ============================================================================
  $ cvs diff -u -r2.115 -r2.116 poptALL.c
  --- rpm/lib/poptALL.c 20 Mar 2009 14:47:12 -0000      2.115
  +++ rpm/lib/poptALL.c 24 Mar 2009 19:30:22 -0000      2.116
  @@ -469,6 +469,7 @@
       extern rpmioPool _rpmmiPool;
   #endif
       extern rpmioPool _rpmdbPool;
  +    extern rpmioPool _rpmwfPool;
   
       _rpmgiPool = rpmioFreePool(_rpmgiPool);
   
  @@ -486,6 +487,7 @@
   #ifdef       NOTYET
       _rpmmiPool = rpmioFreePool(_rpmmiPool);
   #endif
  +    _rpmwfPool = rpmioFreePool(_rpmwfPool);
       _rpmdbPool = rpmioFreePool(_rpmdbPool);
       _headerPool = rpmioFreePool(_headerPool);
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/librpmdb.vers
  ============================================================================
  $ cvs diff -u -r1.59 -r1.60 librpmdb.vers
  --- rpm/rpmdb/librpmdb.vers   24 Mar 2009 15:17:13 -0000      1.59
  +++ rpm/rpmdb/librpmdb.vers   24 Mar 2009 19:30:22 -0000      1.60
  @@ -172,6 +172,7 @@
       rdXAR;
       wrRPM;
       wrXAR;
  +    _rpmwfPool;
       rpmwfFree;
       rpmwfNextXAR;
       rpmwfPullXAR;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmwf.c
  ============================================================================
  $ cvs diff -u -r1.26 -r1.27 rpmwf.c
  --- rpm/rpmdb/rpmwf.c 21 Mar 2009 15:25:12 -0000      1.26
  +++ rpm/rpmdb/rpmwf.c 24 Mar 2009 19:30:22 -0000      1.27
  @@ -185,60 +185,40 @@
       return RPMRC_OK;
   }
   
  -rpmwf XrpmwfUnlink(rpmwf wf, const char * msg, const char * fn, unsigned ln)
  +static void rpmwfScrub(void *_wf)
  +     /*...@modifies *_wf @*/
   {
  -    if (wf == NULL) return NULL;
  -/*...@-modfilesys@*/
  -if (_rpmwf_debug && msg != NULL)
  -fprintf(stderr, "-->  wf %p -- %d %s at %s:%u\n", wf, wf->nrefs, msg, fn, 
ln);
  -/*...@=modfilesys@*/
  -    wf->nrefs--;
  -    return NULL;
  -}
  +    rpmwf wf = _wf;
   
  -rpmwf XrpmwfLink(rpmwf wf, const char * msg, const char * fn, unsigned ln)
  -{
  -    if (wf == NULL) return NULL;
  -    wf->nrefs++;
  +    if (wf->b == NULL) {
  +/*...@-dependenttrans@*/     /* rpm needs dependent, xar needs only */
  +     wf->l = _free(wf->l);
  +     wf->s = _free(wf->s);
  +     wf->h = _free(wf->h);
  +     wf->p = _free(wf->p);
  +/*...@=dependenttrans@*/
  +    }
   
  -/*...@-modfilesys@*/
  -if (_rpmwf_debug && msg != NULL)
  -fprintf(stderr, "-->  wf %p ++ %d %s at %s:%u\n", wf, wf->nrefs, msg, fn, 
ln);
  -/*...@=modfilesys@*/
  +    wf->xar = rpmxarFree(wf->xar, "rpmwfFree");
  +    (void) rpmwfFini(wf);
   
  -    /*...@-refcounttrans@*/ return wf; /*...@=refcounttrans@*/
  +    wf->fn = _free(wf->fn);
   }
   
  -rpmwf rpmwfFree(rpmwf wf)
  -{
  -    if (wf) {
  -
  -/*...@-onlytrans@*/
  -     if (wf->nrefs > 1)
  -         return rpmwfUnlink(wf, "rpmwfFree");
  -
  -     if (wf->b == NULL) {
  -/*...@-dependenttrans@*/     /* rpm needs dependent, xar needs only */
  -         wf->l = _free(wf->l);
  -         wf->s = _free(wf->s);
  -         wf->h = _free(wf->h);
  -         wf->p = _free(wf->p);
  -/*...@=dependenttrans@*/
  -     }
  +/*...@unchecked@*/ /*...@null@*/
  +rpmioPool _rpmwfPool;
   
  -     wf->xar = rpmxarFree(wf->xar, "rpmwfFree");
  -     (void) rpmwfFini(wf);
  -
  -     wf->fn = _free(wf->fn);
  +static rpmwf rpmwfGetPool(/*...@null@*/ rpmioPool pool)
  +     /*...@modifies pool @*/
  +{
  +    rpmwf wf;
   
  -     (void) rpmwfUnlink(wf, "rpmwfFree");
  -/*...@=onlytrans@*/
  -     /*...@-refcounttrans -userelea...@*/
  -     memset(wf, 0, sizeof(*wf));         /* XXX trash and burn */
  -     wf = _free(wf);
  -     /*...@=refcounttrans =userelea...@*/
  +    if (_rpmwfPool == NULL) {
  +     _rpmwfPool = rpmioNewPool("wf", sizeof(*wf), -1, _rpmwf_debug,
  +                     NULL, NULL, rpmwfScrub);
  +     pool = _rpmwfPool;
       }
  -    return NULL;
  +    return (rpmwf) rpmioGetPool(pool, sizeof(*wf));
   }
   
   rpmwf rpmwfNew(const char * fn)
  @@ -251,7 +231,7 @@
       if ((xx = Stat(fn, st)) < 0)
        return NULL;
   /*...@=globs@*/
  -    wf = xcalloc(1, sizeof(*wf));
  +    wf = rpmwfGetPool(_rpmwfPool);
       wf->fn = xstrdup(fn);
       wf->nb = st->st_size;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmwf.h
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 rpmwf.h
  --- rpm/rpmdb/rpmwf.h 11 Dec 2008 23:31:57 -0000      1.12
  +++ rpm/rpmdb/rpmwf.h 24 Mar 2009 19:30:22 -0000      1.13
  @@ -17,6 +17,7 @@
   
   #ifdef       _RPMWF_INTERNAL
   struct rpmwf_s {
  +    struct rpmioItem_s _item;        /*!< usage mutex and pool identifier. */
   /*...@relnull@*/
       const char * fn;
   /*...@relnull@*/
  @@ -38,8 +39,6 @@
       size_t np;
   /*...@relnull@*/ /*...@refcounted@*/
       rpmxar xar;
  -/*...@refs@*/
  -    int nrefs;                       /*!< Reference count. */
   };
   #endif
   
  @@ -78,15 +77,8 @@
   rpmwf rpmwfUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmwf wf,
                /*...@null@*/ const char * msg)
        /*...@modifies wf @*/;
  -
  -/** @todo Remove debugging entry from the ABI. */
  -/*...@-exportlocal@*/
  -/*...@null@*/
  -rpmwf XrpmwfUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmwf wf,
  -             /*...@null@*/ const char * msg, const char * fn, unsigned ln)
  -     /*...@modifies wf @*/;
  -/*...@=exportlocal@*/
  -#define      rpmwfUnlink(_wf, _msg)  XrpmwfUnlink(_wf, _msg, __FILE__, 
__LINE__)
  +#define      rpmwfUnlink(_wf, _msg)  \
  +    ((rpmwf)rpmioUnlinkPoolItem((rpmioItem)(_wf), _msg, __FILE__, __LINE__))
   
   /**
    * Reference a wrapper format instance.
  @@ -97,18 +89,15 @@
   /*...@unused@*/ /*...@newref@*/ /*...@null@*/
   rpmwf rpmwfLink (/*...@null@*/ rpmwf wf, /*...@null@*/ const char * msg)
        /*...@modifies wf @*/;
  -
  -/** @todo Remove debugging entry from the ABI. */
  -/*...@newref@*/ /*...@null@*/
  -rpmwf XrpmwfLink (/*...@null@*/ rpmwf wf, /*...@null@*/ const char * msg,
  -             const char * fn, unsigned ln)
  -        /*...@modifies wf @*/;
  -#define      rpmwfLink(_wf, _msg)    XrpmwfLink(_wf, _msg, __FILE__, 
__LINE__)
  +#define      rpmwfLink(_wf, _msg)    \
  +    ((rpmwf)rpmioLinkPoolItem((rpmioItem)(_wf), _msg, __FILE__, __LINE__))
   
   /*...@null@*/
   rpmwf rpmwfFree(/*...@only@*/ rpmwf wf)
        /*...@globals fileSystem, internalState @*/
        /*...@modifies wf, fileSystem, internalState @*/;
  +#define      rpmwfFree(_wf)  \
  +    ((rpmwf)rpmioFreePoolItem((rpmioItem)(_wf), __FUNCTION__, __FILE__, 
__LINE__))
   
   /*...@relnull@*/
   rpmwf rpmwfNew(const char * fn)
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to