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
aee0b243
Commit
aee0b243
authored
Sep 15, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Methodify ObjGetSpace() and ObjExtend()
parent
6c9c80e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
cache_obj.c
bin/varnishd/cache/cache_obj.c
+22
-2
storage.h
bin/varnishd/storage/storage.h
+7
-1
No files found.
bin/varnishd/cache/cache_obj.c
View file @
aee0b243
...
...
@@ -242,7 +242,13 @@ objallocwithnuke(struct stevedore *stv, struct vsl_log *vsl, struct dstat *ds,
return
(
st
);
}
/*--------------------------------------------------------------------
/*====================================================================
* ObjGetSpace()
*
* This function returns a pointer and length of free space. If there
* is no free space, some will be added first.
*
* The "sz" argument is an input hint of how much space is desired.
*/
int
...
...
@@ -251,6 +257,10 @@ ObjGetSpace(struct objcore *oc, struct vsl_log *vsl, struct dstat *ds,
{
struct
object
*
o
;
struct
storage
*
st
;
const
struct
storeobj_methods
*
om
=
obj_getmethods
(
oc
);
if
(
om
->
objgetspace
!=
NULL
)
return
(
om
->
objgetspace
(
oc
,
vsl
,
ds
,
sz
,
ptr
));
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
AN
(
ds
);
...
...
@@ -286,7 +296,11 @@ ObjGetSpace(struct objcore *oc, struct vsl_log *vsl, struct dstat *ds,
return
(
1
);
}
/*--------------------------------------------------------------------
/*====================================================================
* ObjExtend()
*
* This function extends the used part of the object a number of bytes
* into the last space returned by ObjGetSpace()
*/
void
...
...
@@ -294,6 +308,12 @@ ObjExtend(struct objcore *oc, struct dstat *ds, ssize_t l)
{
struct
object
*
o
;
struct
storage
*
st
;
const
struct
storeobj_methods
*
om
=
obj_getmethods
(
oc
);
if
(
om
->
objextend
!=
NULL
)
{
om
->
objextend
(
oc
,
ds
,
l
);
return
;
}
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
o
=
obj_getobj
(
oc
,
ds
);
...
...
bin/varnishd/storage/storage.h
View file @
aee0b243
...
...
@@ -39,6 +39,7 @@ struct busyobj;
struct
objcore
;
struct
worker
;
struct
lru
;
struct
vsl_log
;
/* Storage -----------------------------------------------------------*/
...
...
@@ -98,7 +99,10 @@ typedef void *objiterbegin_f(struct objcore *oc, struct worker *wrk);
typedef
enum
objiter_status
objiter_f
(
struct
objcore
*
oc
,
void
*
oix
,
void
**
p
,
ssize_t
*
l
);
typedef
void
objiterend_f
(
struct
objcore
*
oc
,
void
**
oix
);
/* objgetspace */
typedef
int
objgetspace_f
(
struct
objcore
*
oc
,
struct
vsl_log
*
vsl
,
struct
dstat
*
ds
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
typedef
void
objextend_f
(
struct
objcore
*
oc
,
struct
dstat
*
ds
,
ssize_t
l
);
/* objtrimstore */
/* objslim */
/* objgetattr */
...
...
@@ -116,6 +120,8 @@ struct storeobj_methods {
objiterbegin_f
*
objiterbegin
;
objiter_f
*
objiter
;
objiterend_f
*
objiterend
;
objgetspace_f
*
objgetspace
;
objextend_f
*
objextend
;
};
/* Prototypes --------------------------------------------------------*/
...
...
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