Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
20b88b19
Commit
20b88b19
authored
Feb 08, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split .h material out from storage_persistent.c
parent
7a081be9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
1682 deletions
+2
-1682
Makefile.am
bin/varnishd/Makefile.am
+1
-0
storage_persistent.c
bin/varnishd/storage_persistent.c
+1
-139
storage_persistent.h
bin/varnishd/storage_persistent.h
+0
-1543
No files found.
bin/varnishd/Makefile.am
View file @
20b88b19
...
...
@@ -87,6 +87,7 @@ noinst_HEADERS = \
mgt_cli.h
\
steps.h
\
stevedore.h
\
storage_persistent.h
\
vparam.h
varnishd_CFLAGS
=
\
...
...
bin/varnishd/storage_persistent.c
View file @
20b88b19
...
...
@@ -56,142 +56,7 @@ SVNID("$Id$")
#include "cli_priv.h"
#include "persistent.h"
#ifndef MAP_NOCORE
#define MAP_NOCORE 0
/* XXX Linux */
#endif
#ifndef MAP_NOSYNC
#define MAP_NOSYNC 0
/* XXX Linux */
#endif
#define ASSERT_SILO_THREAD(sc) \
do {assert(pthread_self() == (sc)->thread);} while (0)
#define OC_F_NEEDFIXUP OC_F_PRIV
/*
* Context for a signature.
*
* A signature is a sequence of bytes in the silo, signed by a SHA256 hash
* which follows the bytes.
*
* The context structure allows us to append to a signature without
* recalculating the entire SHA256 hash.
*/
struct
smp_signctx
{
struct
smp_sign
*
ss
;
struct
SHA256Context
ctx
;
uint32_t
unique
;
const
char
*
id
;
};
struct
smp_sc
;
/* XXX: name confusion with on-media version ? */
struct
smp_seg
{
unsigned
magic
;
#define SMP_SEG_MAGIC 0x45c61895
struct
smp_sc
*
sc
;
struct
lru
*
lru
;
VTAILQ_ENTRY
(
smp_seg
)
list
;
/* on smp_sc.smp_segments */
struct
smp_segptr
p
;
unsigned
flags
;
#define SMP_SEG_MUSTLOAD (1 << 0)
#define SMP_SEG_LOADED (1 << 1)
uint32_t
nobj
;
/* Number of objects */
uint32_t
nalloc
;
/* Allocations */
uint32_t
nfixed
;
/* How many fixed objects */
/* Only for open segment */
struct
smp_object
*
objs
;
/* objdesc array */
struct
smp_signctx
ctx
[
1
];
};
VTAILQ_HEAD
(
smp_seghead
,
smp_seg
);
struct
smp_sc
{
unsigned
magic
;
#define SMP_SC_MAGIC 0x7b73af0a
struct
stevedore
*
parent
;
unsigned
flags
;
#define SMP_SC_LOADED (1 << 0)
const
struct
stevedore
*
stevedore
;
int
fd
;
const
char
*
filename
;
off_t
mediasize
;
uint64_t
align
;
/* 64b to avoid casts */
uint32_t
granularity
;
uint32_t
unique
;
uint8_t
*
base
;
struct
smp_ident
*
ident
;
struct
smp_seghead
segments
;
struct
smp_seg
*
cur_seg
;
uint64_t
next_bot
;
/* next alloc address bottom */
uint64_t
next_top
;
/* next alloc address top */
uint64_t
free_offset
;
pthread_t
thread
;
VTAILQ_ENTRY
(
smp_sc
)
list
;
struct
smp_signctx
idn
;
struct
smp_signctx
ban1
;
struct
smp_signctx
ban2
;
struct
smp_signctx
seg1
;
struct
smp_signctx
seg2
;
struct
ban
*
tailban
;
struct
lock
mtx
;
/* Cleaner metrics */
unsigned
min_nseg
;
unsigned
aim_nseg
;
unsigned
max_nseg
;
uint64_t
min_segl
;
uint64_t
aim_segl
;
uint64_t
max_segl
;
uint64_t
free_reserve
;
};
/*--------------------------------------------------------------------*/
/* Generic power-2 rounding */
#define PWR2(x) ((((x)-1)&(x))==0)
/* Is a power of two */
#define RDN2(x, y) ((x)&(~((y)-1)))
/* if y is powers of two */
#define RUP2(x, y) (((x)+((y)-1))&(~((y)-1)))
/* if y is powers of two */
/* Pointer round up/down & assert */
#define PRNDN(sc, x) ((void*)RDN2((uintptr_t)(x), sc->align))
#define PRNUP(sc, x) ((void*)RUP2((uintptr_t)(x), sc->align))
#define PASSERTALIGN(sc, x) assert(PRNDN(sc, x) == (x))
/* Integer round up/down & assert */
#define IRNDN(sc, x) RDN2(x, sc->align)
#define IRNUP(sc, x) RUP2(x, sc->align)
#define IASSERTALIGN(sc, x) assert(IRNDN(sc, x) == (x))
/*--------------------------------------------------------------------*/
#define ASSERT_PTR_IN_SILO(sc, ptr) \
assert((const void*)(ptr) >= (const void*)((sc)->base) && \
(const void*)(ptr) < (const void *)((sc)->base + (sc)->mediasize))
#include "storage_persistent.h"
/*--------------------------------------------------------------------*/
...
...
@@ -210,9 +75,6 @@ static VTAILQ_HEAD(,smp_sc) silos = VTAILQ_HEAD_INITIALIZER(silos);
* The signature is stored after the byte-range from step 2.
*/
#define SIGN_DATA(ctx) ((void *)((ctx)->ss + 1))
#define SIGN_END(ctx) ((void *)((int8_t *)SIGN_DATA(ctx) + (ctx)->ss->length))
/*--------------------------------------------------------------------
* Define a signature by location and identifier.
*/
...
...
bin/varnishd/storage_persistent.h
View file @
20b88b19
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment