[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/lib/ poptALL.c rpmds.c rpmds.h rp...

2009-03-17 Thread Jeff Johnson
  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:   18-Mar-2009 01:00:11
  Branch: rpm-5_1  Handle: 200903180108

  Modified files:   (Branch: rpm-5_1)
rpm CHANGES
rpm/lib poptALL.c rpmds.c rpmds.h rpmfi.c rpmfi.h
rpm/rpmdb   header.c header_internal.h librpmdb.vers
rpm/rpmio   rpmio.c rpmio_internal.h rpmurl.h url.c

  Log:
- yarn: use the pool allocator.

  Summary:
RevisionChanges Path
1.2288.2.203+1  -0  rpm/CHANGES
2.90.2.6+11 -0  rpm/lib/poptALL.c
2.94.2.9+35 -30 rpm/lib/rpmds.c
2.66.2.5+2  -0  rpm/lib/rpmds.h
2.123.2.3   +71 -62 rpm/lib/rpmfi.c
2.54.2.6+3  -0  rpm/lib/rpmfi.h
1.153.2.6   +44 -36 rpm/rpmdb/header.c
1.40.2.5+4  -2  rpm/rpmdb/header_internal.h
1.43.2.7+1  -0  rpm/rpmdb/librpmdb.vers
1.127.2.8   +24 -7  rpm/rpmio/rpmio.c
2.102.2.3   +3  -0  rpm/rpmio/rpmio_internal.h
1.25.2.4+3  -0  rpm/rpmio/rpmurl.h
1.51.2.3+19 -8  rpm/rpmio/url.c
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2288.2.202 -r1.2288.2.203 CHANGES
  --- rpm/CHANGES   17 Mar 2009 22:49:22 -  1.2288.2.202
  +++ rpm/CHANGES   18 Mar 2009 00:00:01 -  1.2288.2.203
  @@ -1,4 +1,5 @@
   5.1.7 -> 5.1.8:
  +- jbj: yarn: use the pool allocator.
   - jbj: yarn: add a pool allocator.
   - jbj: yarn: convert rpmfi refcounts to usage mutexes.
   - jbj: yarn: convert rpmds refcounts to usage mutexes.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  
  $ cvs diff -u -r2.90.2.5 -r2.90.2.6 poptALL.c
  --- rpm/lib/poptALL.c 11 Jan 2009 15:50:51 -  2.90.2.5
  +++ rpm/lib/poptALL.c 18 Mar 2009 00:00:02 -  2.90.2.6
  @@ -78,6 +78,8 @@
   
   /*...@unchecked@*/
   extern int _rpmds_debug;
  +/*...@unchecked@*/
  +extern rpmioPool _rpmdsPool;
   
   /* XXX avoid -lrpmbuild linkage. */
   /*...@unchecked@*/
  @@ -85,6 +87,9 @@
   
   /*...@unchecked@*/
   extern int _rpmfi_debug;
  +/*...@unchecked@*/
  +extern rpmioPool _rpmfiPool;
  +
   
   /*...@unchecked@*/
   extern int _rpmgi_debug;
  @@ -432,6 +437,12 @@
/*...@globals keyids @*/
/*...@modifies keyids @*/
   {
  +extern rpmioPool _headerPool;
  +
  +_headerPool = rpmioFreePool(_headerPool);
  +_rpmdsPool = rpmioFreePool(_rpmdsPool);
  +_rpmfiPool = rpmioFreePool(_rpmfiPool);
  +
   /* XXX this should be done in the rpmioClean() wrapper. */
   /* keeps memory leak checkers quiet */
   rpmFreeMacros(NULL);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.94.2.8 -r2.94.2.9 rpmds.c
  --- rpm/lib/rpmds.c   17 Mar 2009 13:46:12 -  2.94.2.8
  +++ rpm/lib/rpmds.c   18 Mar 2009 00:00:02 -  2.94.2.9
  @@ -116,6 +116,21 @@
   int _rpmds_unspecified_epoch_noise = 0;
   /*...@=exportheadervar@*/
   
  +/*...@unchecked@*/ /*...@null@*/
  +rpmioPool _rpmdsPool;
  +
  +static rpmds rpmdsGetPool(/*...@null@*/ rpmioPool pool)
  + /*...@modifies pool @*/
  +{
  +rpmds ds;
  +
  +if (_rpmdsPool == NULL) {
  + _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1);
  + pool = _rpmdsPool;
  +}
  +return (rpmds) rpmioGetPool(pool, sizeof(*ds));
  +}
  +
   rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  @@ -186,36 +201,29 @@
   fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
ds->Type, __FILE__, __LINE__);
   /*...@=modfilesys@*/
   if (yarnPeekLock(ds->use) <= 1) {
  - yarnLock use = ds->use;
  -
   /*...@-modfilesys@*/
   if (_rpmds_debug < 0)
   fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
   /*...@=modfilesys@*/
   
  -if (ds->Count > 0) {
  - ds->N = _free(ds->N);
  - ds->EVR = _free(ds->EVR);
  - ds->Flags = _free(ds->Flags);
  - ds->h = headerFree(ds->h);
  -}
  + if (ds->Count > 0) {
  + ds->N = _free(ds->N);
  + ds->EVR = _free(ds->EVR);
  + ds->Flags = _free(ds->Flags);
  + ds->h = headerFree(ds->h);
  + }
  +
  + ds->DNEVR = _free(ds->DNEVR);
  + ds->ns.str = _free(ds->ns.str);
  + memset(&ds->ns, 0, sizeof(ds->ns));
  + ds->A = _free(ds->A);
  + ds->Color = _free(ds->Color);
  + 

[CVS] RPM: rpm/ CHANGES rpm/lib/ poptALL.c rpmds.c rpmds.h rpmfi.c rpm...

2009-03-17 Thread Jeff Johnson
  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:   18-Mar-2009 00:59:06
  Branch: HEAD Handle: 2009031723590104

  Modified files:
rpm CHANGES
rpm/lib poptALL.c rpmds.c rpmds.h rpmfi.c rpmfi.h
rpm/rpmdb   header.c header_internal.h librpmdb.vers
rpm/rpmio   rpmio.c rpmio_internal.h rpmurl.h url.c

  Log:
- yarn: use the pool allocator.

  Summary:
RevisionChanges Path
1.2830  +1  -0  rpm/CHANGES
2.106   +11 -0  rpm/lib/poptALL.c
2.130   +19 -14 rpm/lib/rpmds.c
2.76+3  -0  rpm/lib/rpmds.h
2.137   +18 -9  rpm/lib/rpmfi.c
2.69+3  -0  rpm/lib/rpmfi.h
1.170   +22 -13 rpm/rpmdb/header.c
1.49+4  -2  rpm/rpmdb/header_internal.h
1.56+1  -0  rpm/rpmdb/librpmdb.vers
1.165   +24 -7  rpm/rpmio/rpmio.c
2.111   +3  -0  rpm/rpmio/rpmio_internal.h
1.36+3  -0  rpm/rpmio/rpmurl.h
1.63+19 -8  rpm/rpmio/url.c
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2829 -r1.2830 CHANGES
  --- rpm/CHANGES   17 Mar 2009 22:48:55 -  1.2829
  +++ rpm/CHANGES   17 Mar 2009 23:59:01 -  1.2830
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +- jbj: yarn: use the pool allocator.
   - jbj: yarn: add a pool allocator.
   - devzero2000: add mkdtemp portability function to -lrpmmisc 
   - proyvind: do lazy mkdir of %_builddir, %_rpmdir & %_srcrpmdir when 
doing
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  
  $ cvs diff -u -r2.105 -r2.106 poptALL.c
  --- rpm/lib/poptALL.c 23 Feb 2009 22:31:02 -  2.105
  +++ rpm/lib/poptALL.c 17 Mar 2009 23:59:02 -  2.106
  @@ -90,6 +90,8 @@
   
   /*...@unchecked@*/
   extern int _rpmds_debug;
  +/*...@unchecked@*/
  +extern rpmioPool _rpmdsPool;
   
   /* XXX avoid -lrpmbuild linkage. */
   /*...@unchecked@*/
  @@ -97,6 +99,9 @@
   
   /*...@unchecked@*/
   extern int _rpmfi_debug;
  +/*...@unchecked@*/
  +extern rpmioPool _rpmfiPool;
  +
   
   /*...@unchecked@*/
   extern int _rpmgi_debug;
  @@ -446,6 +451,12 @@
/*...@globals keyids @*/
/*...@modifies keyids @*/
   {
  +extern rpmioPool _headerPool;
  +
  +_headerPool = rpmioFreePool(_headerPool);
  +_rpmdsPool = rpmioFreePool(_rpmdsPool);
  +_rpmfiPool = rpmioFreePool(_rpmfiPool);
  +
   /* XXX this should be done in the rpmioClean() wrapper. */
   /* keeps memory leak checkers quiet */
   rpmFreeMacros(NULL);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.129 -r2.130 rpmds.c
  --- rpm/lib/rpmds.c   17 Mar 2009 13:27:46 -  2.129
  +++ rpm/lib/rpmds.c   17 Mar 2009 23:59:02 -  2.130
  @@ -122,6 +122,21 @@
   int _rpmds_unspecified_epoch_noise = 0;
   /*...@=exportheadervar@*/
   
  +/*...@unchecked@*/ /*...@null@*/
  +rpmioPool _rpmdsPool;
  +
  +static rpmds rpmdsGetPool(/*...@null@*/ rpmioPool pool)
  + /*...@modifies pool @*/
  +{
  +rpmds ds;
  +
  +if (_rpmdsPool == NULL) {
  + _rpmdsPool = rpmioNewPool("ds", sizeof(*ds), -1);
  + pool = _rpmdsPool;
  +}
  +return (rpmds) rpmioGetPool(pool, sizeof(*ds));
  +}
  +
   rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  @@ -192,8 +207,6 @@
   fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
ds->Type, __FILE__, __LINE__);
   /*...@=modfilesys@*/
   if (yarnPeekLock(ds->use) <= 1) {
  - yarnLock use = ds->use;
  -
   /*...@-modfilesys@*/
   if (_rpmds_debug < 0)
   fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
  @@ -216,12 +229,7 @@
ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
ds->include = mireFreeAll(ds->include, ds->ninclude);
   
  - /*...@-refcounttrans -userelea...@*/
  - memset(ds, 0, sizeof(*ds)); /* XXX trash and burn */
  - ds = _free(ds);
  - /*...@=refcounttrans =userelea...@*/
  - yarnTwist(use, BY, -1);
  - use = yarnFreeLock(use);
  + ds = (rpmds) rpmioPutPool((rpmioItem)ds);
   } else
yarnTwist(ds->use, BY, -1);
   return NULL;
  @@ -328,8 +336,7 @@
   N = he->p.argv;
   Count = he->c;
   if (xx && N != NULL && Count > 0) {
  -  

[CVS] RPM: rpm/ devtool.conf

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 23:51:37
  Branch: HEAD Handle: 2009031722513700

  Modified files:
rpm devtool.conf

  Log:
- rearrange a stanza.

  Summary:
RevisionChanges Path
2.267   +1  -1  rpm/devtool.conf
  

  patch -p0 <<'@@ .'
  Index: rpm/devtool.conf
  
  $ cvs diff -u -r2.266 -r2.267 devtool.conf
  --- rpm/devtool.conf  13 Mar 2009 15:09:43 -  2.266
  +++ rpm/devtool.conf  17 Mar 2009 22:51:37 -  2.267
  @@ -71,6 +71,7 @@
   --with-db=internal \
   --with-db-tools-integrated \
   --with-zlib=external \
  +--with-bzip2=external \
   --with-xz=internal \
   --with-file=internal \
   --with-lua=internal \
  @@ -83,7 +84,6 @@
   --with-pcre=internal \
   --with-uuid=external \
   --with-xar=internal \
  ---with-bzip2=external \
   --with-popt=external \
   --with-keyutils=external \
   --with-pthreads \
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/rpmio/ librpmio.vers rpmio.h rpmm...

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 23:49:23
  Branch: rpm-5_1  Handle: 2009031722492201

  Modified files:   (Branch: rpm-5_1)
rpm CHANGES
rpm/rpmio   librpmio.vers rpmio.h rpmmalloc.c

  Log:
- yarn: add a pool allocator.

  Summary:
RevisionChanges Path
1.2288.2.202+1  -0  rpm/CHANGES
2.63.2.9+4  -0  rpm/rpmio/librpmio.vers
1.68.2.7+49 -0  rpm/rpmio/rpmio.h
1.13.4.2+121 -0 rpm/rpmio/rpmmalloc.c
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2288.2.201 -r1.2288.2.202 CHANGES
  --- rpm/CHANGES   17 Mar 2009 14:35:57 -  1.2288.2.201
  +++ rpm/CHANGES   17 Mar 2009 22:49:22 -  1.2288.2.202
  @@ -1,4 +1,5 @@
   5.1.7 -> 5.1.8:
  +- jbj: yarn: add a pool allocator.
   - jbj: yarn: convert rpmfi refcounts to usage mutexes.
   - jbj: yarn: convert rpmds refcounts to usage mutexes.
   - jbj: yarn: convert Header refcounts to usage mutexes.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  
  $ cvs diff -u -r2.63.2.8 -r2.63.2.9 librpmio.vers
  --- rpm/rpmio/librpmio.vers   16 Mar 2009 14:59:58 -  2.63.2.8
  +++ rpm/rpmio/librpmio.vers   17 Mar 2009 22:49:23 -  2.63.2.9
  @@ -295,11 +295,15 @@
   rpmioDigestHashAlgo;
   rpmioDigestPoptTable;
   rpmioFini;
  +rpmioFreePool;
   rpmioFtsOpts;
   rpmioFtsPoptTable;
  +rpmioGetPool;
   rpmioInit;
   rpmioMkpath;
  +rpmioNewPool;
   rpmioPipeOutput;
  +rpmioPutPool;
   rpmioRootDir;
   rpmioSlurp;
   _kuKeyring;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  
  $ cvs diff -u -r1.68.2.6 -r1.68.2.7 rpmio.h
  --- rpm/rpmio/rpmio.h 16 Mar 2009 17:27:23 -  1.68.2.6
  +++ rpm/rpmio/rpmio.h 17 Mar 2009 22:49:23 -  1.68.2.7
  @@ -809,6 +809,55 @@
/*...@globals internalState, fileSystem @*/
/*...@modifies internalState, fileSystem @*/;
   
  +/**
  + */
  +typedef  struct rpmioItem_s * rpmioItem;
  +struct rpmioItem_s {
  +yarnLock use;
  +void *pool;
  +};
  +
  +/**
  + */
  +typedef struct rpmioPool_s * rpmioPool;
  +
  +/**
  + * Reclaim memory pool items.
  + * @param pool   memory pool (NULL uses global rpmio pool)
  + * @return   NULL always
  + */
  +/*...@null@*/
  +rpmioPool rpmioFreePool(/*...@only@*//*...@null@*/ rpmioPool pool)
  + /*...@modifies pool @*/;
  +
  +/**
  + * Create a memory pool.
  + * @param name   pool name
  + * @param size   item size
  + * @param limit  no. of items permitted (-1 for unlimited)
  + * @return   memory pool
  + */
  +rpmioPool rpmioNewPool(const char * name, size_t size, int limit)
  +/*...@*/;
  +
  +/**
  + * Get unused item from pool, or alloc a new item.
  + * @param pool   memory pool (NULL will always alloc a new item)
  + * @param size   item size
  + * @return   new item
  + */
  +rpmioItem rpmioGetPool(/*...@null@*/ rpmioPool pool, size_t size)
  +/*...@modifies pool @*/;
  +
  +/**
  + * Put unused item into pool (or free).
  + * @param _item  unused item
  + * @return   NULL always
  + */
  +/*...@null@*/
  +rpmioItem rpmioPutPool(rpmioItem item)
  +/*...@modifies item @*/;
  +
   #ifdef __cplusplus
   }
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmmalloc.c
  
  $ cvs diff -u -r1.13.4.1 -r1.13.4.2 rpmmalloc.c
  --- rpm/rpmio/rpmmalloc.c 11 Jan 2009 03:18:33 -  1.13.4.1
  +++ rpm/rpmio/rpmmalloc.c 17 Mar 2009 22:49:23 -  1.13.4.2
  @@ -3,6 +3,8 @@
*/
   
   #include "system.h"
  +#include 
  +#include 
   #include "debug.h"
   
   #if defined(WITH_DMALLOC)
  @@ -28,6 +30,125 @@
   }
   /*...@=modfilesys@*/
   
  +/**
  + */
  +struct rpmioPool_s {
  +yarnLock have;   /*!< unused items available, lock for list */
  +void *pool;
  +/*...@relnull@*/
  +rpmioItem head;  /*!< linked list of available items */
  +rpmioItem * tail;
  +size_t size; /*!< size of items in this pool */
  +int limit;   /*!< number of new items allowed, or -1 
*/
  +int made;

[CVS] RPM: rpm/ CHANGES rpm/rpmio/ librpmio.vers rpmio.h rpmmalloc.c

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 23:48:56
  Branch: HEAD Handle: 2009031722485501

  Modified files:
rpm CHANGES
rpm/rpmio   librpmio.vers rpmio.h rpmmalloc.c

  Log:
- yarn: add a pool allocator.

  Summary:
RevisionChanges Path
1.2829  +1  -0  rpm/CHANGES
2.94+4  -0  rpm/rpmio/librpmio.vers
1.83+49 -0  rpm/rpmio/rpmio.h
1.15+122 -0 rpm/rpmio/rpmmalloc.c
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2828 -r1.2829 CHANGES
  --- rpm/CHANGES   17 Mar 2009 17:29:50 -  1.2828
  +++ rpm/CHANGES   17 Mar 2009 22:48:55 -  1.2829
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +- jbj: yarn: add a pool allocator.
   - devzero2000: add mkdtemp portability function to -lrpmmisc 
   - proyvind: do lazy mkdir of %_builddir, %_rpmdir & %_srcrpmdir when 
doing
--install for src.rpms as well.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  
  $ cvs diff -u -r2.93 -r2.94 librpmio.vers
  --- rpm/rpmio/librpmio.vers   16 Mar 2009 14:25:48 -  2.93
  +++ rpm/rpmio/librpmio.vers   17 Mar 2009 22:48:56 -  2.94
  @@ -306,15 +306,19 @@
   rpmioDigestHashAlgo;
   rpmioDigestPoptTable;
   rpmioFini;
  +rpmioFreePool;
   rpmioFtsOpts;
   rpmioFtsPoptTable;
  +rpmioGetPool;
   rpmioHttpAccept;
   rpmioHttpConnectTimeoutSecs;
   rpmioHttpReadTimeoutSecs;
   rpmioHttpUserAgent;
   rpmioInit;
   rpmioMkpath;
  +rpmioNewPool;
   rpmioPipeOutput;
  +rpmioPutPool;
   rpmioRootDir;
   rpmKeyringAddKey;
   rpmKeyringFindKeyid;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmio.h
  
  $ cvs diff -u -r1.82 -r1.83 rpmio.h
  --- rpm/rpmio/rpmio.h 12 Mar 2009 20:01:32 -  1.82
  +++ rpm/rpmio/rpmio.h 17 Mar 2009 22:48:56 -  1.83
  @@ -734,6 +734,55 @@
/*...@globals internalState, fileSystem @*/
/*...@modifies internalState, fileSystem @*/;
   
  +/**
  + */
  +typedef  struct rpmioItem_s * rpmioItem;
  +struct rpmioItem_s {
  +yarnLock use;
  +void *pool;
  +};
  +
  +/**
  + */
  +typedef struct rpmioPool_s * rpmioPool;
  +
  +/**
  + * Reclaim memory pool items.
  + * @param pool   memory pool (NULL uses global rpmio pool)
  + * @return   NULL always
  + */
  +/*...@null@*/
  +rpmioPool rpmioFreePool(/*...@only@*//*...@null@*/ rpmioPool pool)
  + /*...@modifies pool @*/;
  +
  +/**
  + * Create a memory pool.
  + * @param name   pool name
  + * @param size   item size
  + * @param limit  no. of items permitted (-1 for unlimited)
  + * @return   memory pool
  + */
  +rpmioPool rpmioNewPool(const char * name, size_t size, int limit)
  +/*...@*/;
  +
  +/**
  + * Get unused item from pool, or alloc a new item.
  + * @param pool   memory pool (NULL will always alloc a new item)
  + * @param size   item size
  + * @return   new item
  + */
  +rpmioItem rpmioGetPool(/*...@null@*/ rpmioPool pool, size_t size)
  +/*...@modifies pool @*/;
  +
  +/**
  + * Put unused item into pool (or free).
  + * @param _item  unused item
  + * @return   NULL always
  + */
  +/*...@null@*/
  +rpmioItem rpmioPutPool(rpmioItem item)
  +/*...@modifies item @*/;
  +
   #ifdef __cplusplus
   }
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmmalloc.c
  
  $ cvs diff -u -r1.14 -r1.15 rpmmalloc.c
  --- rpm/rpmio/rpmmalloc.c 11 Dec 2008 21:55:14 -  1.14
  +++ rpm/rpmio/rpmmalloc.c 17 Mar 2009 22:48:56 -  1.15
  @@ -3,6 +3,9 @@
*/
   
   #include "system.h"
  +#include 
  +#include 
  +#include 
   #include "debug.h"
   
   #if defined(WITH_DMALLOC)
  @@ -28,6 +31,125 @@
   }
   /*...@=modfilesys@*/
   
  +/**
  + */
  +struct rpmioPool_s {
  +yarnLock have;   /*!< unused items available, lock for list */
  +void *pool;
  +/*...@relnull@*/
  +rpmioItem head;  /*!< linked list of available items */
  +rpmioItem * tail;
  +size_t size; /*!< size of items in this pool */
  +int limit;   /*!< number of new items al

[CVS] RPM: rpm/ CHANGES

2009-03-17 Thread Pinto Elia
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Pinto Elia
  Root:   /v/rpm/cvs   Email:  devzero2...@rpm5.org
  Module: rpm  Date:   17-Mar-2009 18:29:50
  Branch: HEAD Handle: 2009031717295000

  Modified files:
rpm CHANGES

  Log:
Update CHANGES for Check-in Number:  11881

  Summary:
RevisionChanges Path
1.2828  +1  -0  rpm/CHANGES
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2827 -r1.2828 CHANGES
  --- rpm/CHANGES   17 Mar 2009 16:30:16 -  1.2827
  +++ rpm/CHANGES   17 Mar 2009 17:29:50 -  1.2828
  @@ -16,6 +16,7 @@
   - jbj: delete ancient header+payload RSA signatures too using GPG 
(#488953).
   - jbj: rpmio: install rpmzlog.h and yarn.h, carry with rpmio.h.
   - jbj: rpmio: don't include glob.h.
  +- devzero2000: fix --orphandirs port alias ; add --danglinglink popt 
alias
   - proyvind: add support for cpuinfo() probe through libcpuinfo.
   - proyvind: perl: make sure to link against all required libraries to fix
build with --no-undefined.
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/lib/ rpmrc.c

2009-03-17 Thread Per �yvind Karlsen
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs   Email:  pkarl...@rpm5.org
  Module: rpm  Date:   17-Mar-2009 17:32:16
  Branch: HEAD Handle: 2009031716321600

  Modified files:
rpm/lib rpmrc.c

  Log:
add amd64 for libcpuinfo

  Summary:
RevisionChanges Path
2.268   +3  -0  rpm/lib/rpmrc.c
  

  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmrc.c
  
  $ cvs diff -u -r2.267 -r2.268 rpmrc.c
  --- rpm/lib/rpmrc.c   16 Mar 2009 22:30:40 -  2.267
  +++ rpm/lib/rpmrc.c   17 Mar 2009 16:32:16 -  2.268
  @@ -527,7 +527,10 @@
   
   if(rpmCpuinfoMatch("cpuinfo([x86])", cpuinfo)) {
if(rpmCpuinfoMatch("cpuinfo(64bit)", cpuinfo) && strcmp(un.machine, 
"x86_64") == 0)
  + {
xx = mireAppend(RPMMIRE_REGEX, 0, "x86_64", NULL, &mi_re, &mi_nre);
  + xx = mireAppend(RPMMIRE_REGEX, 0, "amd64", NULL, &mi_re, &mi_nre);
  + }
if(rpmCpuinfoMatch("cpuinfo(cmov)", cpuinfo)) {
if(rpmCpuinfoMatch("cpuinfo(mmx)", cpuinfo)) {
if(rpmCpuinfoMatch("cpuinfo(sse)", cpuinfo)) {
  @@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org


[CVS] RPM: rpm/ CHANGES rpm/misc/ Makefile.am librpmmisc.c mkdtemp.c t...

2009-03-17 Thread Pinto Elia
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  

  Server: rpm5.org Name:   Pinto Elia
  Root:   /v/rpm/cvs   Email:  devzero2...@rpm5.org
  Module: rpm  Date:   17-Mar-2009 17:30:16
  Branch: HEAD Handle: 2009031716301600

  Added files:
rpm/miscmkdtemp.c tempname.h
  Modified files:
rpm CHANGES
rpm/miscMakefile.am librpmmisc.c

  Log:
add mkdtemp portability function to -lrpmmisc

  Summary:
RevisionChanges Path
1.2827  +1  -0  rpm/CHANGES
1.42+4  -2  rpm/misc/Makefile.am
1.4 +4  -0  rpm/misc/librpmmisc.c
1.1 +349 -0 rpm/misc/mkdtemp.c
1.1 +38 -0  rpm/misc/tempname.h
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2826 -r1.2827 CHANGES
  --- rpm/CHANGES   16 Mar 2009 22:30:39 -  1.2826
  +++ rpm/CHANGES   17 Mar 2009 16:30:16 -  1.2827
  @@ -1,5 +1,6 @@
   
   5.2a3 -> 5.2a4:
  +- devzero2000: add mkdtemp portability function to -lrpmmisc 
   - proyvind: do lazy mkdir of %_builddir, %_rpmdir & %_srcrpmdir when 
doing
--install for src.rpms as well.
   - jbj: yarn: convert Header refcount to usage mutex.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/Makefile.am
  
  $ cvs diff -u -r1.41 -r1.42 Makefile.am
  --- rpm/misc/Makefile.am  15 Feb 2009 13:55:32 -  1.41
  +++ rpm/misc/Makefile.am  17 Mar 2009 16:30:16 -  1.42
  @@ -15,10 +15,12 @@
setenv.cstpcpy.cstpncpy.c   \
strcspn.c   strdup.cstrerror.c  \
strftime.c  strcspn.c   strstr.cstrtol.c\
  - strtoul.c
  + strtoul.c \
  +tempname.h \
  +mkdtemp.c 
   
   noinst_HEADERS = \
  - asprintf.h  err.h   error.h
  + asprintf.h  err.h   error.h tempname.h
   
   usrlibdir = $(libdir)
   usrlib_LTLIBRARIES = librpmmisc.la
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/librpmmisc.c
  
  $ cvs diff -u -r1.3 -r1.4 librpmmisc.c
  --- rpm/misc/librpmmisc.c 31 Jul 2008 16:58:55 -  1.3
  +++ rpm/misc/librpmmisc.c 17 Mar 2009 16:30:16 -  1.4
  @@ -67,3 +67,7 @@
   #if !defined(HAVE_STRSTR)
   #include "strstr.c"
   #endif
  +
  +#if !defined(HAVE_MKDTEMP)
  +#include "mkdtemp.c"
  +#endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/misc/mkdtemp.c
  
  $ cvs diff -u -r0 -r1.1 mkdtemp.c
  --- /dev/null 2009-03-17 17:30:15 +0100
  +++ mkdtemp.c 2009-03-17 17:30:16 +0100
  @@ -0,0 +1,349 @@
  +/* Copyright (C) 1999, 2001-2003, 2006-2007 Free Software Foundation, Inc.
  +   This file is part of the GNU C Library.
  +
  +   This program is free software: you can redistribute it and/or modify
  +   it under the terms of the GNU General Public License as published by
  +   the Free Software Foundation; either version 3 of the License, or
  +   (at your option) any later version.
  +
  +   This program is distributed in the hope that it will be useful,
  +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  +   GNU General Public License for more details.
  +
  +   You should have received a copy of the GNU General Public License
  +   along with this program.  If not, see .  */
  +
  +/* Extracted from misc/mkdtemp.c.  */
  +#include "system.h"
  +
  +
  +/* tempname.c - generate the name of a temporary file.
  +
  +   Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
  +   2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,
  +   Inc.
  +
  +   This program is free software: you can redistribute it and/or modify
  +   it under the terms of the GNU General Public License as published by
  +   the Free Software Foundation; either version 3 of the License, or
  +   (at your option) any later version.
  +
  +   This program is distributed in the hope that it will be useful,
  +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  +   GNU General Public License for more details.
  +
  +   You should have received a copy of the GNU General Public License
  +   along with this program.  If not, see .  */
  +
  +/* Extracted from glibc sysde

[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/lib/ rpmfi.c rpmfi.h

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 15:35:58
  Branch: rpm-5_1  Handle: 2009031714355701

  Modified files:   (Branch: rpm-5_1)
rpm CHANGES
rpm/lib rpmfi.c rpmfi.h

  Log:
- yarn: convert rpmfi refcounts to usage mutexes.

  Summary:
RevisionChanges Path
1.2288.2.201+1  -0  rpm/CHANGES
2.123.2.2   +20 -7  rpm/lib/rpmfi.c
2.54.2.5+1  -2  rpm/lib/rpmfi.h
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2288.2.200 -r1.2288.2.201 CHANGES
  --- rpm/CHANGES   17 Mar 2009 13:46:12 -  1.2288.2.200
  +++ rpm/CHANGES   17 Mar 2009 14:35:57 -  1.2288.2.201
  @@ -1,4 +1,5 @@
   5.1.7 -> 5.1.8:
  +- jbj: yarn: convert rpmfi refcounts to usage mutexes.
   - jbj: yarn: convert rpmds refcounts to usage mutexes.
   - jbj: yarn: convert Header refcounts to usage mutexes.
   - jbj: yarn: convert urlInfo refcounts to usage mutexes.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.c
  
  $ cvs diff -u -r2.123.2.1 -r2.123.2.2 rpmfi.c
  --- rpm/lib/rpmfi.c   10 Dec 2008 20:48:45 -  2.123.2.1
  +++ rpm/lib/rpmfi.c   17 Mar 2009 14:35:58 -  2.123.2.2
  @@ -41,22 +41,24 @@
   rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
   {
   if (fi == NULL) return NULL;
  +yarnPossess(fi->use);
   /*...@-modfilesys@*/
   if (_rpmfi_debug && msg != NULL)
  -fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> fi %p -- %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use), 
msg, fn, ln);
   /*...@=modfilesys@*/
  -fi->nrefs--;
  +yarnTwist(fi->use, BY, -1);
   return NULL;
   }
   
   rpmfi XrpmfiLink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
   {
   if (fi == NULL) return NULL;
  -fi->nrefs++;
  +yarnPossess(fi->use);
   /*...@-modfilesys@*/
   if (_rpmfi_debug && msg != NULL)
  -fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> fi %p ++ %ld %s at %s:%u\n", fi, 
yarnPeekLock(fi->use)+1, msg, fn, ln);
   /*...@=modfilesys@*/
  +yarnTwist(fi->use, BY, 1);
   /*...@-refcounttrans@*/ return fi; /*...@=refcounttrans@*/
   }
   
  @@ -1201,8 +1203,14 @@
   {
   if (fi == NULL) return NULL;
   
  -if (fi->nrefs > 1)
  - return rpmfiUnlink(fi, fi->Type);
  +yarnPossess(fi->use);
  +/*...@-modfilesys@*/
  +if (_rpmfi_debug)
  +fprintf(stderr, "--> fi %p -- %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use), 
fi->Type, __FILE__, __LINE__);
  +/*...@=modfilesys@*/
  +
  +if (yarnPeekLock(fi->use) <= 1L) {
  + yarnLock use = fi->use;
   
   /*...@-modfilesys@*/
   if (_rpmfi_debug < 0)
  @@ -1269,10 +1277,13 @@
   fi->h = headerFree(fi->h);
   
   /*...@-nullstate -refcounttrans -userelea...@*/
  -(void) rpmfiUnlink(fi, fi->Type);
   memset(fi, 0, sizeof(*fi));  /* XXX trash and burn */
   fi = _free(fi);
   /*...@=nullstate =refcounttrans =userelea...@*/
  + yarnTwist(use, BY, -1);
  + use = yarnFreeLock(use);
  +   } else
  + yarnTwist(fi->use, BY, -1);
   
   return NULL;
   }
  @@ -1330,6 +1341,7 @@
   if (fi == NULL)  /* XXX can't happen */
goto exit;
   
  +fi->use = yarnNewLock(0);
   fi->magic = RPMFIMAGIC;
   fi->Type = Type;
   fi->i = -1;
  @@ -1338,6 +1350,7 @@
   fi->h = NULL;
   fi->isSource =
(headerIsEntry(h, RPMTAG_SOURCERPM) == 0 &&
  +  headerIsEntry(h, RPMTAG_RPMVERSION) != 0 &&
 headerIsEntry(h, RPMTAG_ARCH) != 0);
   
   if (fi->fsm == NULL)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.h
  
  $ cvs diff -u -r2.54.2.4 -r2.54.2.5 rpmfi.h
  --- rpm/lib/rpmfi.h   6 Mar 2009 22:54:13 -   2.54.2.4
  +++ rpm/lib/rpmfi.h   17 Mar 2009 14:35:58 -  2.54.2.5
  @@ -106,6 +106,7 @@
* A package filename set.
*/
   struct rpmfi_s {
  +yarnLock use;/*!< use count -- return to pool when zero */
   int i;   /*!< Current file index. */
   int j;   /*!< Current directory index. */
   
  @@ -255,8 +256,6 @@
   int magic;
   #define  RPMFIMAGIC  0x09697923
   /*=*/
  -
  -/*...@refs@*/ int nrefs; /*!< Reference count. */
   };
   
  

[CVS] RPM: rpm/lib/ rpmfi.c rpmfi.h

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 15:28:16
  Branch: HEAD Handle: 2009031714281600

  Modified files:
rpm/lib rpmfi.c rpmfi.h

  Log:
- yarn: convert rpmds refcounts to usage mutexes.

  Summary:
RevisionChanges Path
2.136   +73 -60 rpm/lib/rpmfi.c
2.68+1  -2  rpm/lib/rpmfi.h
  

  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.c
  
  $ cvs diff -u -r2.135 -r2.136 rpmfi.c
  --- rpm/lib/rpmfi.c   19 Dec 2008 02:49:41 -  2.135
  +++ rpm/lib/rpmfi.c   17 Mar 2009 14:28:16 -  2.136
  @@ -57,22 +57,24 @@
   rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
   {
   if (fi == NULL) return NULL;
  +yarnPossess(fi->use);
   /*...@-modfilesys@*/
   if (_rpmfi_debug && msg != NULL)
  -fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> fi %p -- %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use), 
msg, fn, ln);
   /*...@=modfilesys@*/
  -fi->nrefs--;
  +yarnTwist(fi->use, BY, -1);
   return NULL;
   }
   
   rpmfi XrpmfiLink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
   {
   if (fi == NULL) return NULL;
  -fi->nrefs++;
  +yarnPossess(fi->use);
   /*...@-modfilesys@*/
   if (_rpmfi_debug && msg != NULL)
  -fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> fi %p ++ %ld %s at %s:%u\n", fi, 
yarnPeekLock(fi->use)+1, msg, fn, ln);
   /*...@=modfilesys@*/
  +yarnTwist(fi->use, BY, 1);
   /*...@-refcounttrans@*/ return fi; /*...@=refcounttrans@*/
   }
   
  @@ -1218,80 +1220,89 @@
   {
   if (fi == NULL) return NULL;
   
  -if (fi->nrefs > 1)
  - return rpmfiUnlink(fi, fi->Type);
  +yarnPossess(fi->use);
  +/*...@-modfilesys@*/
  +if (_rpmfi_debug)
  +fprintf(stderr, "--> fi %p -- %ld %s at %s:%u\n", fi, yarnPeekLock(fi->use), 
fi->Type, __FILE__, __LINE__);
  +/*...@=modfilesys@*/
  +
  +if (yarnPeekLock(fi->use) <= 1L) {
  + yarnLock use = fi->use;
   
   /*...@-modfilesys@*/
   if (_rpmfi_debug < 0)
   fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, fi->Type, fi->fc);
   /*...@=modfilesys@*/
   
  -/* Free pre- and post-transaction script and interpreter strings. */
  -fi->pretrans = _free(fi->pretrans);
  -fi->pretransprog = _free(fi->pretransprog);
  -fi->posttrans = _free(fi->posttrans);
  -fi->posttransprog = _free(fi->posttransprog);
  -fi->verifyscript = _free(fi->verifyscript);
  -fi->verifyscriptprog = _free(fi->verifyscriptprog);
  -
  -if (fi->fc > 0) {
  - fi->bnl = _free(fi->bnl);
  - fi->dnl = _free(fi->dnl);
  -
  - fi->flinks = _free(fi->flinks);
  - fi->flangs = _free(fi->flangs);
  - fi->fdigests = _free(fi->fdigests);
  - fi->digests = _free(fi->digests);
  -
  - fi->cdict = _free(fi->cdict);
  -
  - fi->fuser = _free(fi->fuser);
  - fi->fgroup = _free(fi->fgroup);
  -
  - fi->fstates = _free(fi->fstates);
  -
  - fi->fmtimes = _free(fi->fmtimes);
  - fi->fmodes = _free(fi->fmodes);
  - fi->fflags = _free(fi->fflags);
  - fi->vflags = _free(fi->vflags);
  - fi->fsizes = _free(fi->fsizes);
  - fi->frdevs = _free(fi->frdevs);
  - fi->finodes = _free(fi->finodes);
  - fi->dil = _free(fi->dil);
  -
  - fi->fcolors = _free(fi->fcolors);
  - fi->fcdictx = _free(fi->fcdictx);
  - fi->ddict = _free(fi->ddict);
  - fi->fddictx = _free(fi->fddictx);
  - fi->fddictn = _free(fi->fddictn);
  -}
  + /* Free pre- and post-transaction script and interpreter strings. */
  + fi->pretrans = _free(fi->pretrans);
  + fi->pretransprog = _free(fi->pretransprog);
  + fi->posttrans = _free(fi->posttrans);
  + fi->posttransprog = _free(fi->posttransprog);
  + fi->verifyscript = _free(fi->verifyscript);
  + fi->verifyscriptprog = _free(fi->verifyscriptprog);
  +
  + if (fi->fc > 0) {
  + fi->bnl = _free(fi->bnl);
  + fi->dnl = _free(fi->dnl);
  +
  + fi->flinks = _free(fi->flinks);
  + fi->flangs = _free(fi->flangs);
  + fi->fdigests = _free(fi->fdigests);
  + fi->digests = _free(fi->digests);
  +
  + fi->cdict = _free(fi->cdict);
  +
  + fi->fuser = _free(fi->fuser);
  + fi->fgroup = _free(fi->fgroup);
  +
  + fi->fstates = _free(fi->fstates);
  +
  + fi->fmtimes = _free(fi->fmtimes);
  + fi->fmodes = _free(fi->fmodes);
  + fi->fflag

[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/lib/ rpmds.c rpmds.h

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 14:46:12
  Branch: rpm-5_1  Handle: 2009031713461200

  Modified files:   (Branch: rpm-5_1)
rpm CHANGES
rpm/lib rpmds.c rpmds.h

  Log:
- yarn: convert rpmds refcounts to usage mutexes.

  Summary:
RevisionChanges Path
1.2288.2.200+1  -0  rpm/CHANGES
2.94.2.8+21 -8  rpm/lib/rpmds.c
2.66.2.4+1  -2  rpm/lib/rpmds.h
  

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  
  $ cvs diff -u -r1.2288.2.199 -r1.2288.2.200 CHANGES
  --- rpm/CHANGES   16 Mar 2009 20:29:55 -  1.2288.2.199
  +++ rpm/CHANGES   17 Mar 2009 13:46:12 -  1.2288.2.200
  @@ -1,4 +1,5 @@
   5.1.7 -> 5.1.8:
  +- jbj: yarn: convert rpmds refcounts to usage mutexes.
   - jbj: yarn: convert Header refcounts to usage mutexes.
   - jbj: yarn: convert urlInfo refcounts to usage mutexes.
   - jbj: yarn: convert FD_t refcounts to usage mutexes.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.94.2.7 -r2.94.2.8 rpmds.c
  --- rpm/lib/rpmds.c   16 Mar 2009 10:32:04 -  2.94.2.7
  +++ rpm/lib/rpmds.c   17 Mar 2009 13:46:12 -  2.94.2.8
  @@ -119,23 +119,24 @@
   rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  +yarnPossess(ds->use);
   /*...@-modfilesys@*/
   if (_rpmds_debug && msg != NULL)
  -fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
msg, fn, ln);
   /*...@=modfilesys@*/
  -ds->nrefs--;
  +yarnTwist(ds->use, BY, -1);
   return NULL;
   }
   
   rpmds XrpmdsLink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  -ds->nrefs++;
  -
  +yarnPossess(ds->use);
   /*...@-modfilesys@*/
   if (_rpmds_debug && msg != NULL)
  -fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> ds %p ++ %ld %s at %s:%u\n", ds, 
yarnPeekLock(ds->use)+1, msg, fn, ln);
   /*...@=modfilesys@*/
  +yarnTwist(ds->use, BY, 1);
   
   /*...@-refcounttrans@*/ return ds; /*...@=refcounttrans@*/
   }
  @@ -179,8 +180,13 @@
   if (ds == NULL)
return NULL;
   
  -if (ds->nrefs > 1)
  - return rpmdsUnlink(ds, ds->Type);
  +yarnPossess(ds->use);
  +/*...@-modfilesys@*/
  +if (_rpmds_debug)
  +fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
ds->Type, __FILE__, __LINE__);
  +/*...@=modfilesys@*/
  +if (yarnPeekLock(ds->use) <= 1) {
  + yarnLock use = ds->use;
   
   /*...@-modfilesys@*/
   if (_rpmds_debug < 0)
  @@ -204,11 +210,14 @@
   ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
   ds->include = mireFreeAll(ds->include, ds->ninclude);
   
  -(void) rpmdsUnlink(ds, ds->Type);
   /*...@-refcounttrans -userelea...@*/
   memset(ds, 0, sizeof(*ds));  /* XXX trash and burn */
   ds = _free(ds);
   /*...@=refcounttrans =userelea...@*/
  + yarnTwist(use, BY, -1);
  + use = yarnFreeLock(use);
  +} else
  + yarnTwist(ds->use, BY, -1);
   return NULL;
   }
   
  @@ -314,6 +323,7 @@
   Count = he->c;
   if (xx && N != NULL && Count > 0) {
ds = xcalloc(1, sizeof(*ds));
  + ds->use = yarnNewLock(0);
ds->Type = Type;
ds->h = NULL;
ds->i = -1;
  @@ -564,6 +574,7 @@
   R = _free(R);
   
   ds = xcalloc(1, sizeof(*ds));
  +ds->use = yarnNewLock(0);
   ds->Type = Type;
   ds->tagN = tagN;
   ds->Count = 1;
  @@ -599,6 +610,7 @@
   Type = rpmdsTagName(tagN);
   
   ds = xcalloc(1, sizeof(*ds));
  +ds->use = yarnNewLock(0);
   ds->Type = Type;
   ds->tagN = tagN;
   ds->A = NULL;
  @@ -945,6 +957,7 @@
   size_t nb;
   
   ds->h = (ods->h != NULL ? headerLink(ods->h) : NULL);
  +ds->use = yarnNewLock(0);
   /*...@-assignexpose@*/
   ds->Type = ods->Type;
   /*...@=assignexpose@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.h
  
  $ cvs diff -u -r2.66.2.3 -r2.66.2.4 rpmds.h
  --- rpm/lib/rpmds.h   10 Dec 2008 19:56:51 -  2.66.2.3
  +++ rpm/lib/rpmds.h   17 Mar 2009 13:46:12 -  2.66.2.4
  @@ -37,6 +37,7 @@
* A dependency set.
 

[CVS] RPM: rpm/lib/ rpmds.c rpmds.h

2009-03-17 Thread Jeff Johnson
  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:   17-Mar-2009 14:27:47
  Branch: HEAD Handle: 2009031713274600

  Modified files:
rpm/lib rpmds.c rpmds.h

  Log:
- yarn: convert rpmds refcounts to usage mutexes.

  Summary:
RevisionChanges Path
2.129   +41 -28 rpm/lib/rpmds.c
2.75+1  -2  rpm/lib/rpmds.h
  

  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  
  $ cvs diff -u -r2.128 -r2.129 rpmds.c
  --- rpm/lib/rpmds.c   13 Mar 2009 18:35:53 -  2.128
  +++ rpm/lib/rpmds.c   17 Mar 2009 13:27:46 -  2.129
  @@ -125,23 +125,24 @@
   rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  +yarnPossess(ds->use);
   /*...@-modfilesys@*/
   if (_rpmds_debug && msg != NULL)
  -fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
msg, fn, ln);
   /*...@=modfilesys@*/
  -ds->nrefs--;
  +yarnTwist(ds->use, BY, -1);
   return NULL;
   }
   
   rpmds XrpmdsLink(rpmds ds, const char * msg, const char * fn, unsigned ln)
   {
   if (ds == NULL) return NULL;
  -ds->nrefs++;
  -
  +yarnPossess(ds->use);
   /*...@-modfilesys@*/
   if (_rpmds_debug && msg != NULL)
  -fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
  +fprintf(stderr, "--> ds %p ++ %ld %s at %s:%u\n", ds, 
yarnPeekLock(ds->use)+1, msg, fn, ln);
   /*...@=modfilesys@*/
  +yarnTwist(ds->use, BY, 1);
   
   /*...@-refcounttrans@*/ return ds; /*...@=refcounttrans@*/
   }
  @@ -185,36 +186,44 @@
   if (ds == NULL)
return NULL;
   
  -if (ds->nrefs > 1)
  - return rpmdsUnlink(ds, ds->Type);
  +yarnPossess(ds->use);
  +/*...@-modfilesys@*/
  +if (_rpmds_debug)
  +fprintf(stderr, "--> ds %p -- %ld %s at %s:%u\n", ds, yarnPeekLock(ds->use), 
ds->Type, __FILE__, __LINE__);
  +/*...@=modfilesys@*/
  +if (yarnPeekLock(ds->use) <= 1) {
  + yarnLock use = ds->use;
   
   /*...@-modfilesys@*/
   if (_rpmds_debug < 0)
   fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
   /*...@=modfilesys@*/
   
  -if (ds->Count > 0) {
  - ds->N = _free(ds->N);
  - ds->EVR = _free(ds->EVR);
  - ds->Flags = _free(ds->Flags);
  - ds->h = headerFree(ds->h);
  -}
  + if (ds->Count > 0) {
  + ds->N = _free(ds->N);
  + ds->EVR = _free(ds->EVR);
  + ds->Flags = _free(ds->Flags);
  + ds->h = headerFree(ds->h);
  + }
   
  -ds->DNEVR = _free(ds->DNEVR);
  -ds->ns.str = _free(ds->ns.str);
  -memset(&ds->ns, 0, sizeof(ds->ns));
  -ds->A = _free(ds->A);
  -ds->Color = _free(ds->Color);
  -ds->Refs = _free(ds->Refs);
  -ds->Result = _free(ds->Result);
  -ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
  -ds->include = mireFreeAll(ds->include, ds->ninclude);
  -
  -(void) rpmdsUnlink(ds, ds->Type);
  -/*...@-refcounttrans -userelea...@*/
  -memset(ds, 0, sizeof(*ds));  /* XXX trash and burn */
  -ds = _free(ds);
  -/*...@=refcounttrans =userelea...@*/
  + ds->DNEVR = _free(ds->DNEVR);
  + ds->ns.str = _free(ds->ns.str);
  + memset(&ds->ns, 0, sizeof(ds->ns));
  + ds->A = _free(ds->A);
  + ds->Color = _free(ds->Color);
  + ds->Refs = _free(ds->Refs);
  + ds->Result = _free(ds->Result);
  + ds->exclude = mireFreeAll(ds->exclude, ds->nexclude);
  + ds->include = mireFreeAll(ds->include, ds->ninclude);
  +
  + /*...@-refcounttrans -userelea...@*/
  + memset(ds, 0, sizeof(*ds)); /* XXX trash and burn */
  + ds = _free(ds);
  + /*...@=refcounttrans =userelea...@*/
  + yarnTwist(use, BY, -1);
  + use = yarnFreeLock(use);
  +} else
  + yarnTwist(ds->use, BY, -1);
   return NULL;
   }
   
  @@ -320,6 +329,7 @@
   Count = he->c;
   if (xx && N != NULL && Count > 0) {
ds = xcalloc(1, sizeof(*ds));
  + ds->use = yarnNewLock(0);
ds->Type = Type;
ds->h = NULL;
ds->i = -1;
  @@ -587,6 +597,7 @@
   R = _free(R);
   
   ds = xcalloc(1, sizeof(*ds));
  +ds->use = yarnNewLock(0);
   ds->Type = Type;
   ds->tagN = tagN;
   ds->Count = 1;
  @@ -622,6 +633,7 @@
   Type = rpmdsTagName(tagN);
   
   ds = xcalloc(1, sizeof(*ds));
  +ds->use = yarnNewLock(0);
   ds->Type = Type;
   ds->tagN = tagN;
   ds->A = NULL;
  @@ -968,6