Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
401ddc4e
Commit
401ddc4e
authored
Nov 20, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the VSM layout more hexdump friendly
parent
e4d1d360
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
common_vsm.c
bin/varnishd/common/common_vsm.c
+7
-7
vsm_int.h
include/vapi/vsm_int.h
+4
-4
No files found.
bin/varnishd/common/common_vsm.c
View file @
401ddc4e
...
@@ -137,7 +137,7 @@ VSM_common_new(void *p, ssize_t l)
...
@@ -137,7 +137,7 @@ VSM_common_new(void *p, ssize_t l)
sc
->
head
=
(
void
*
)
sc
->
b
;
sc
->
head
=
(
void
*
)
sc
->
b
;
/* This should not be necessary, but just in case...*/
/* This should not be necessary, but just in case...*/
memset
(
sc
->
head
,
0
,
sizeof
*
sc
->
head
);
memset
(
sc
->
head
,
0
,
sizeof
*
sc
->
head
);
sc
->
head
->
magic
=
VSM_HEAD_MAGIC
;
memcpy
(
sc
->
head
->
marker
,
VSM_HEAD_MARKER
,
sizeof
sc
->
head
->
marker
)
;
sc
->
head
->
hdrsize
=
sizeof
*
sc
->
head
;
sc
->
head
->
hdrsize
=
sizeof
*
sc
->
head
;
sc
->
head
->
shm_size
=
l
;
sc
->
head
->
shm_size
=
l
;
sc
->
head
->
alloc_seq
=
random
()
|
1
;
sc
->
head
->
alloc_seq
=
random
()
|
1
;
...
@@ -145,8 +145,8 @@ VSM_common_new(void *p, ssize_t l)
...
@@ -145,8 +145,8 @@ VSM_common_new(void *p, ssize_t l)
ALLOC_OBJ
(
vr
,
VSM_RANGE_MAGIC
);
ALLOC_OBJ
(
vr
,
VSM_RANGE_MAGIC
);
AN
(
vr
);
AN
(
vr
);
vr
->
off
=
PRNDUP
(
sizeof
(
*
sc
->
head
)
);
vr
->
off
=
RUP2
(
sizeof
(
*
sc
->
head
),
16
);
vr
->
len
=
l
-
vr
->
off
;
vr
->
len
=
RDN2
(
l
-
vr
->
off
,
16
)
;
VTAILQ_INSERT_TAIL
(
&
sc
->
r_free
,
vr
,
list
);
VTAILQ_INSERT_TAIL
(
&
sc
->
r_free
,
vr
,
list
);
return
(
sc
);
return
(
sc
);
}
}
...
@@ -182,9 +182,8 @@ VSM_common_alloc(struct vsm_sc *sc, ssize_t size,
...
@@ -182,9 +182,8 @@ VSM_common_alloc(struct vsm_sc *sc, ssize_t size,
vsm_common_insert_free
(
sc
,
vr
);
vsm_common_insert_free
(
sc
,
vr
);
}
}
size
=
PRNDUP
(
size
);
l1
=
RUP2
(
size
+
sizeof
(
struct
VSM_chunk
),
16
);
l1
=
size
+
sizeof
(
struct
VSM_chunk
);
l2
=
RUP2
(
size
+
2
*
sizeof
(
struct
VSM_chunk
),
16
);
l2
=
size
+
2
*
sizeof
(
struct
VSM_chunk
);
/* Find space in free-list */
/* Find space in free-list */
VTAILQ_FOREACH_SAFE
(
vr
,
&
sc
->
r_free
,
list
,
vr2
)
{
VTAILQ_FOREACH_SAFE
(
vr
,
&
sc
->
r_free
,
list
,
vr2
)
{
...
@@ -227,7 +226,8 @@ VSM_common_alloc(struct vsm_sc *sc, ssize_t size,
...
@@ -227,7 +226,8 @@ VSM_common_alloc(struct vsm_sc *sc, ssize_t size,
vr
->
chunk
=
(
void
*
)(
sc
->
b
+
vr
->
off
);
vr
->
chunk
=
(
void
*
)(
sc
->
b
+
vr
->
off
);
vr
->
ptr
=
(
vr
->
chunk
+
1
);
vr
->
ptr
=
(
vr
->
chunk
+
1
);
vr
->
chunk
->
magic
=
VSM_CHUNK_MAGIC
;
memcpy
(
vr
->
chunk
->
marker
,
VSM_CHUNK_MARKER
,
sizeof
vr
->
chunk
->
marker
);
vr
->
chunk
->
len
=
vr
->
len
;
strcpy
(
vr
->
chunk
->
class
,
class
);
strcpy
(
vr
->
chunk
->
class
,
class
);
strcpy
(
vr
->
chunk
->
type
,
type
);
strcpy
(
vr
->
chunk
->
type
,
type
);
strcpy
(
vr
->
chunk
->
ident
,
ident
);
strcpy
(
vr
->
chunk
->
ident
,
ident
);
...
...
include/vapi/vsm_int.h
View file @
401ddc4e
...
@@ -98,8 +98,8 @@
...
@@ -98,8 +98,8 @@
#define VSM_FILENAME "_.vsm"
#define VSM_FILENAME "_.vsm"
struct
VSM_chunk
{
struct
VSM_chunk
{
#define VSM_CHUNK_MA
GIC 0xa15712e5
/* From /dev/random */
#define VSM_CHUNK_MA
RKER "VSMCHUNK"
unsigned
magic
;
char
marker
[
8
]
;
ssize_t
len
;
/* Incl VSM_chunk */
ssize_t
len
;
/* Incl VSM_chunk */
ssize_t
next
;
/* Offset in shmem */
ssize_t
next
;
/* Offset in shmem */
char
class
[
8
];
char
class
[
8
];
...
@@ -108,8 +108,8 @@ struct VSM_chunk {
...
@@ -108,8 +108,8 @@ struct VSM_chunk {
};
};
struct
VSM_head
{
struct
VSM_head
{
#define VSM_HEAD_MA
GIC 0xe75f7e91
/* From /dev/random */
#define VSM_HEAD_MA
RKER "VSMHEAD0"
/* Incr. as version# *
unsigned
magic
;
char marker[8]
;
ssize_t hdrsize;
ssize_t hdrsize;
ssize_t shm_size;
ssize_t shm_size;
ssize_t first; /* Offset, first chunk */
ssize_t first; /* Offset, first chunk */
...
...
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