Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
7366486e
Commit
7366486e
authored
Aug 31, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: unify tdb1_firstkey/tdb1_nextkey into tdb_firstkey/tdb_nextkey.
Switch on the TDB_VERSION1 flag.
parent
ef92843f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
ccan/tdb2/private.h
ccan/tdb2/private.h
+4
-0
ccan/tdb2/tdb1.h
ccan/tdb2/tdb1.h
+0
-4
ccan/tdb2/traverse.c
ccan/tdb2/traverse.c
+22
-0
No files found.
ccan/tdb2/private.h
View file @
7366486e
...
...
@@ -685,6 +685,10 @@ int tdb1_transaction_start(struct tdb_context *tdb);
int
tdb1_transaction_prepare_commit
(
struct
tdb_context
*
tdb
);
int
tdb1_transaction_commit
(
struct
tdb_context
*
tdb
);
/* tdb1_traverse.c: */
TDB_DATA
tdb1_firstkey
(
struct
tdb_context
*
tdb
);
TDB_DATA
tdb1_nextkey
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
);
/* tdb.c: */
enum
TDB_ERROR
COLD
tdb_logerr
(
struct
tdb_context
*
tdb
,
enum
TDB_ERROR
ecode
,
...
...
ccan/tdb2/tdb1.h
View file @
7366486e
...
...
@@ -38,10 +38,6 @@
void
tdb1_set_max_dead
(
struct
tdb_context
*
tdb
,
int
max_dead
);
TDB_DATA
tdb1_firstkey
(
struct
tdb_context
*
tdb
);
TDB_DATA
tdb1_nextkey
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
);
int
tdb1_get_seqnum
(
struct
tdb_context
*
tdb
);
void
tdb1_increment_seqnum_nonblock
(
struct
tdb_context
*
tdb
);
...
...
ccan/tdb2/traverse.c
View file @
7366486e
...
...
@@ -61,6 +61,16 @@ enum TDB_ERROR tdb_firstkey(struct tdb_context *tdb, struct tdb_data *key)
{
struct
traverse_info
tinfo
;
if
(
tdb
->
flags
&
TDB_VERSION1
)
{
tdb
->
last_error
=
TDB_SUCCESS
;
*
key
=
tdb1_firstkey
(
tdb
);
/* TDB1 didn't set error for last key. */
if
(
!
key
->
dptr
&&
tdb
->
last_error
==
TDB_SUCCESS
)
{
tdb
->
last_error
=
TDB_ERR_NOEXIST
;
}
return
tdb
->
last_error
;
}
return
tdb
->
last_error
=
first_in_hash
(
tdb
,
&
tinfo
,
key
,
NULL
);
}
...
...
@@ -71,6 +81,18 @@ enum TDB_ERROR tdb_nextkey(struct tdb_context *tdb, struct tdb_data *key)
struct
hash_info
h
;
struct
tdb_used_record
rec
;
if
(
tdb
->
flags
&
TDB_VERSION1
)
{
struct
tdb_data
last_key
=
*
key
;
tdb
->
last_error
=
TDB_SUCCESS
;
*
key
=
tdb1_nextkey
(
tdb
,
last_key
);
free
(
last_key
.
dptr
);
/* TDB1 didn't set error for last key. */
if
(
!
key
->
dptr
&&
tdb
->
last_error
==
TDB_SUCCESS
)
{
tdb
->
last_error
=
TDB_ERR_NOEXIST
;
}
return
tdb
->
last_error
;
}
tinfo
.
prev
=
find_and_lock
(
tdb
,
*
key
,
F_RDLCK
,
&
h
,
&
rec
,
&
tinfo
);
free
(
key
->
dptr
);
if
(
TDB_OFF_IS_ERR
(
tinfo
.
prev
))
{
...
...
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