]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/mitkrb-1.12.1-db2_fix-1.patch
pakfire: use correct tree on x86_64.
[ipfire-2.x.git] / src / patches / mitkrb-1.12.1-db2_fix-1.patch
CommitLineData
cfba7c56
MT
1Submitted By: Pierre Labastie <pierre dot labastie at eamil dot fr>
2Date: 2014-03-04
3Initial Package Version: 1.12.1
4Upstream Status: In upstream GIT
5Origin: Upstream
6Description: Fixes http://krbdev.mit.edu/rt/Ticket/Display.html?id=7860
7
8--- a/src/plugins/kdb/db2/libdb2/mpool/mpool.c
9+++ b/src/plugins/kdb/db2/libdb2/mpool/mpool.c
10@@ -81,9 +81,9 @@ mpool_open(key, fd, pagesize, maxcache)
11 /* Allocate and initialize the MPOOL cookie. */
12 if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
13 return (NULL);
14- CIRCLEQ_INIT(&mp->lqh);
15+ TAILQ_INIT(&mp->lqh);
16 for (entry = 0; entry < HASHSIZE; ++entry)
17- CIRCLEQ_INIT(&mp->hqh[entry]);
18+ TAILQ_INIT(&mp->hqh[entry]);
19 mp->maxcache = maxcache;
20 mp->npages = sb.st_size / pagesize;
21 mp->pagesize = pagesize;
22@@ -143,8 +143,8 @@ mpool_new(mp, pgnoaddr, flags)
23 bp->flags = MPOOL_PINNED | MPOOL_INUSE;
24
25 head = &mp->hqh[HASHKEY(bp->pgno)];
26- CIRCLEQ_INSERT_HEAD(head, bp, hq);
27- CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
28+ TAILQ_INSERT_HEAD(head, bp, hq);
29+ TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
30 return (bp->page);
31 }
32
33@@ -168,8 +168,8 @@ mpool_delete(mp, page)
34
35 /* Remove from the hash and lru queues. */
36 head = &mp->hqh[HASHKEY(bp->pgno)];
37- CIRCLEQ_REMOVE(head, bp, hq);
38- CIRCLEQ_REMOVE(&mp->lqh, bp, q);
39+ TAILQ_REMOVE(head, bp, hq);
40+ TAILQ_REMOVE(&mp->lqh, bp, q);
41
42 free(bp);
43 return (RET_SUCCESS);
44@@ -208,10 +208,10 @@ mpool_get(mp, pgno, flags)
45 * of the lru chain.
46 */
47 head = &mp->hqh[HASHKEY(bp->pgno)];
48- CIRCLEQ_REMOVE(head, bp, hq);
49- CIRCLEQ_INSERT_HEAD(head, bp, hq);
50- CIRCLEQ_REMOVE(&mp->lqh, bp, q);
51- CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
52+ TAILQ_REMOVE(head, bp, hq);
53+ TAILQ_INSERT_HEAD(head, bp, hq);
54+ TAILQ_REMOVE(&mp->lqh, bp, q);
55+ TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
56
57 /* Return a pinned page. */
58 bp->flags |= MPOOL_PINNED;
59@@ -261,8 +261,8 @@ mpool_get(mp, pgno, flags)
60 * of the lru chain.
61 */
62 head = &mp->hqh[HASHKEY(bp->pgno)];
63- CIRCLEQ_INSERT_HEAD(head, bp, hq);
64- CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
65+ TAILQ_INSERT_HEAD(head, bp, hq);
66+ TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
67
68 /* Run through the user's filter. */
69 if (mp->pgin != NULL)
70@@ -311,8 +311,8 @@ mpool_close(mp)
71 BKT *bp;
72
73 /* Free up any space allocated to the lru pages. */
74- while ((bp = mp->lqh.cqh_first) != (void *)&mp->lqh) {
75- CIRCLEQ_REMOVE(&mp->lqh, mp->lqh.cqh_first, q);
76+ while ((bp = mp->lqh.tqh_first) != NULL) {
77+ TAILQ_REMOVE(&mp->lqh, mp->lqh.tqh_first, q);
78 free(bp);
79 }
80
81@@ -332,8 +332,7 @@ mpool_sync(mp)
82 BKT *bp;
83
84 /* Walk the lru chain, flushing any dirty pages to disk. */
85- for (bp = mp->lqh.cqh_first;
86- bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
87+ for (bp = mp->lqh.tqh_first; bp != NULL; bp = bp->q.tqe_next)
88 if (bp->flags & MPOOL_DIRTY &&
89 mpool_write(mp, bp) == RET_ERROR)
90 return (RET_ERROR);
91@@ -363,8 +362,7 @@ mpool_bkt(mp)
92 * off any lists. If we don't find anything we grow the cache anyway.
93 * The cache never shrinks.
94 */
95- for (bp = mp->lqh.cqh_first;
96- bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
97+ for (bp = mp->lqh.tqh_first; bp != NULL; bp = bp->q.tqe_next)
98 if (!(bp->flags & MPOOL_PINNED)) {
99 /* Flush if dirty. */
100 if (bp->flags & MPOOL_DIRTY &&
101@@ -375,8 +373,8 @@ mpool_bkt(mp)
102 #endif
103 /* Remove from the hash and lru queues. */
104 head = &mp->hqh[HASHKEY(bp->pgno)];
105- CIRCLEQ_REMOVE(head, bp, hq);
106- CIRCLEQ_REMOVE(&mp->lqh, bp, q);
107+ TAILQ_REMOVE(head, bp, hq);
108+ TAILQ_REMOVE(&mp->lqh, bp, q);
109 #if defined(DEBUG) && !defined(DEBUG_IDX0SPLIT)
110 { void *spage;
111 spage = bp->page;
112@@ -450,7 +448,7 @@ mpool_look(mp, pgno)
113 BKT *bp;
114
115 head = &mp->hqh[HASHKEY(pgno)];
116- for (bp = head->cqh_first; bp != (void *)head; bp = bp->hq.cqe_next)
117+ for (bp = head->tqh_first; bp != NULL; bp = bp->hq.tqe_next)
118 if ((bp->pgno == pgno) && (bp->flags & MPOOL_INUSE)) {
119 #ifdef STATISTICS
120 ++mp->cachehit;
121@@ -494,8 +492,7 @@ mpool_stat(mp)
122
123 sep = "";
124 cnt = 0;
125- for (bp = mp->lqh.cqh_first;
126- bp != (void *)&mp->lqh; bp = bp->q.cqe_next) {
127+ for (bp = mp->lqh.tqh_first; bp != NULL; bp = bp->q.tqe_next) {
128 (void)fprintf(stderr, "%s%d", sep, bp->pgno);
129 if (bp->flags & MPOOL_DIRTY)
130 (void)fprintf(stderr, "d");
131
132--- a/src/plugins/kdb/db2/libdb2/mpool/mpool.h
133+++ b/src/plugins/kdb/db2/libdb2/mpool/mpool.h
134@@ -47,8 +47,8 @@
135
136 /* The BKT structures are the elements of the queues. */
137 typedef struct _bkt {
138- CIRCLEQ_ENTRY(_bkt) hq; /* hash queue */
139- CIRCLEQ_ENTRY(_bkt) q; /* lru queue */
140+ TAILQ_ENTRY(_bkt) hq; /* hash queue */
141+ TAILQ_ENTRY(_bkt) q; /* lru queue */
142 void *page; /* page */
143 db_pgno_t pgno; /* page number */
144
145@@ -59,9 +59,9 @@ typedef struct _bkt {
146 } BKT;
147
148 typedef struct MPOOL {
149- CIRCLEQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */
150+ TAILQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */
151 /* hash queue array */
152- CIRCLEQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
153+ TAILQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
154 db_pgno_t curcache; /* current number of cached pages */
155 db_pgno_t maxcache; /* max number of cached pages */
156 db_pgno_t npages; /* number of pages in the file */
157
158--- a/src/plugins/kdb/db2/libdb2/test/run.test
159+++ b/src/plugins/kdb/db2/libdb2/test/run.test
160@@ -71,10 +71,11 @@ main()
161 }
162
163 getnwords() {
164- # Delete blank lines because the db code appears not to
165- # like empty keys. On Debian Linux, $DICT appears to contain
166- # some non-ASCII characters, and "rev" chokes on them.
167- sed -e '/^$/d' < $DICT | cat -v | sed -e ${1}q
168+ # Delete blank lines because the db code appears not to like
169+ # empty keys. Omit lines with non-alphanumeric characters to
170+ # avoid shell metacharacters and non-ASCII characters which
171+ # could cause 'rev' to choke.
172+ LC_ALL=C sed -e '/^$/d' -e '/[^A-Za-z]/d' < $DICT | sed -e ${1}q
173 }
174
175 # Take the first hundred entries in the dictionary, and make them