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
2bba2a85
Commit
2bba2a85
authored
Aug 31, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: unify tdb1_store into tdb_store
Switch on the TDB_VERSION1 flag.
parent
acb26c9c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
6 deletions
+10
-6
ccan/tdb2/private.h
ccan/tdb2/private.h
+1
-0
ccan/tdb2/tdb.c
ccan/tdb2/tdb.c
+4
-0
ccan/tdb2/tdb1.h
ccan/tdb2/tdb1.h
+0
-2
ccan/tdb2/tdb1_tdb.c
ccan/tdb2/tdb1_tdb.c
+1
-0
ccan/tdb2/test/run-tdb1-nested-transactions.c
ccan/tdb2/test/run-tdb1-nested-transactions.c
+4
-4
No files found.
ccan/tdb2/private.h
View file @
2bba2a85
...
...
@@ -652,6 +652,7 @@ enum TDB_ERROR tdb1_fetch(struct tdb_context *tdb, TDB_DATA key,
TDB_DATA
*
data
);
int
tdb1_append
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
,
TDB_DATA
new_dbuf
);
int
tdb1_delete
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
);
int
tdb1_exists
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
);
/* tdb.c: */
enum
TDB_ERROR
COLD
tdb_logerr
(
struct
tdb_context
*
tdb
,
...
...
ccan/tdb2/tdb.c
View file @
2bba2a85
...
...
@@ -284,6 +284,10 @@ bool tdb_exists(struct tdb_context *tdb, TDB_DATA key)
struct
tdb_used_record
rec
;
struct
hash_info
h
;
if
(
tdb
->
flags
&
TDB_VERSION1
)
{
return
tdb1_exists
(
tdb
,
key
);
}
off
=
find_and_lock
(
tdb
,
key
,
F_RDLCK
,
&
h
,
&
rec
,
NULL
);
if
(
TDB_OFF_IS_ERR
(
off
))
{
tdb
->
last_error
=
off
;
...
...
ccan/tdb2/tdb1.h
View file @
2bba2a85
...
...
@@ -53,8 +53,6 @@ int tdb1_traverse(struct tdb_context *tdb, tdb1_traverse_func fn, void *private_
int
tdb1_traverse_read
(
struct
tdb_context
*
tdb
,
tdb1_traverse_func
fn
,
void
*
private_data
);
int
tdb1_exists
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
);
int
tdb1_lockall
(
struct
tdb_context
*
tdb
);
int
tdb1_unlockall
(
struct
tdb_context
*
tdb
);
...
...
ccan/tdb2/tdb1_tdb.c
View file @
2bba2a85
...
...
@@ -275,6 +275,7 @@ int tdb1_exists(struct tdb_context *tdb, TDB_DATA key)
uint32_t
hash
=
tdb_hash
(
tdb
,
key
.
dptr
,
key
.
dsize
);
int
ret
;
assert
(
tdb
->
flags
&
TDB_VERSION1
);
ret
=
tdb1_exists_hash
(
tdb
,
key
,
hash
);
return
ret
;
}
...
...
ccan/tdb2/test/run-tdb1-nested-transactions.c
View file @
2bba2a85
...
...
@@ -54,18 +54,18 @@ int main(int argc, char *argv[])
ok1
(
tdb1_transaction_start
(
tdb
)
==
0
);
ok1
(
tdb_delete
(
tdb
,
key
)
==
TDB_SUCCESS
);
ok1
(
tdb1_transaction_commit
(
tdb
)
==
0
);
ok1
(
!
tdb
1
_exists
(
tdb
,
key
));
ok1
(
!
tdb_exists
(
tdb
,
key
));
ok1
(
tdb1_transaction_cancel
(
tdb
)
==
0
);
/* Surprise! Kills inner "committed" transaction. */
ok1
(
tdb
1
_exists
(
tdb
,
key
));
ok1
(
tdb_exists
(
tdb
,
key
));
ok1
(
tdb1_transaction_start
(
tdb
)
==
0
);
ok1
(
tdb1_transaction_start
(
tdb
)
==
0
);
ok1
(
tdb_delete
(
tdb
,
key
)
==
TDB_SUCCESS
);
ok1
(
tdb1_transaction_commit
(
tdb
)
==
0
);
ok1
(
!
tdb
1
_exists
(
tdb
,
key
));
ok1
(
!
tdb_exists
(
tdb
,
key
));
ok1
(
tdb1_transaction_commit
(
tdb
)
==
0
);
ok1
(
!
tdb
1
_exists
(
tdb
,
key
));
ok1
(
!
tdb_exists
(
tdb
,
key
));
tdb_close
(
tdb
);
return
exit_status
();
...
...
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