Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-file
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
libvmod-file
Commits
3c2e7f8d
Commit
3c2e7f8d
authored
Feb 28, 2021
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VRT_blob() to implement .id().
parent
ff058352
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
vmod_file.c
src/vmod_file.c
+4
-14
No files found.
src/vmod_file.c
View file @
3c2e7f8d
...
...
@@ -713,9 +713,7 @@ vmod_reader_id(VRT_CTX, struct VPFX(file_reader) *rdr)
uint32_t
nsecs
;
dev_t
dev
;
ino_t
ino
;
uintptr_t
snap
;
struct
vrt_blob
*
blob
;
char
*
data
;
unsigned
char
*
data
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
ws
,
WS_MAGIC
);
...
...
@@ -730,29 +728,21 @@ vmod_reader_id(VRT_CTX, struct VPFX(file_reader) *rdr)
ino
=
rdr
->
info
->
ino
;
AZ
(
pthread_rwlock_unlock
(
&
rdr
->
lock
));
snap
=
WS_Snapshot
(
ctx
->
ws
);
if
((
blob
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
*
blob
)))
==
NULL
)
{
VFAIL
(
ctx
,
"%s.id(): insufficient workspace for blob structure"
,
rdr
->
obj_name
);
return
NULL
;
}
if
((
data
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
secs
)
+
sizeof
(
nsecs
)
+
sizeof
(
dev
)
+
sizeof
(
ino
)))
==
NULL
)
{
WS_Reset
(
ctx
->
ws
,
snap
);
VFAIL
(
ctx
,
"%s.id(): insufficient workspace for blob data"
,
rdr
->
obj_name
);
return
NULL
;
}
blob
->
type
=
VMOD_FILE_ID_MAGIC
;
blob
->
len
=
sizeof
(
secs
)
+
sizeof
(
nsecs
)
+
sizeof
(
dev
)
+
sizeof
(
ino
);
blob
->
blob
=
data
;
memcpy
(
data
,
&
secs
,
sizeof
(
secs
));
memcpy
(
data
+
sizeof
(
secs
),
&
nsecs
,
sizeof
(
nsecs
));
memcpy
(
data
+
sizeof
(
secs
)
+
sizeof
(
nsecs
),
&
dev
,
sizeof
(
dev
));
memcpy
(
data
+
sizeof
(
secs
)
+
sizeof
(
nsecs
)
+
sizeof
(
dev
),
&
ino
,
sizeof
(
ino
));
return
(
blob
);
return
VRT_blob
(
ctx
,
"VMOD file id()"
,
data
,
sizeof
(
secs
)
+
sizeof
(
nsecs
)
+
sizeof
(
dev
)
+
sizeof
(
ino
),
VMOD_FILE_ID_MAGIC
);
}
VCL_BLOB
...
...
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