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
91ddc0b7
Commit
91ddc0b7
authored
Aug 11, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use _ convention everywhere: lock.c uses it already.
parent
aa83ea33
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
27 deletions
+27
-27
ccan/tdb/open.c
ccan/tdb/open.c
+1
-1
ccan/tdb/tdb.c
ccan/tdb/tdb.c
+5
-5
ccan/tdb/tdb_private.h
ccan/tdb/tdb_private.h
+1
-1
ccan/tdb/transaction.c
ccan/tdb/transaction.c
+15
-15
ccan/tdb/traverse.c
ccan/tdb/traverse.c
+5
-5
No files found.
ccan/tdb/open.c
View file @
91ddc0b7
...
...
@@ -393,7 +393,7 @@ int tdb_close(struct tdb_context *tdb)
tdb_trace
(
tdb
,
"tdb_close"
);
if
(
tdb
->
transaction
)
{
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
}
if
(
tdb
->
map_ptr
)
{
...
...
ccan/tdb/tdb.c
View file @
91ddc0b7
...
...
@@ -160,7 +160,7 @@ static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
* then the TDB_DATA will have zero length but
* a non-zero pointer
*/
static
TDB_DATA
do
_tdb_fetch
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
)
static
TDB_DATA
_tdb_fetch
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
)
{
tdb_off_t
rec_ptr
;
struct
list_struct
rec
;
...
...
@@ -181,7 +181,7 @@ static TDB_DATA do_tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
TDB_DATA
tdb_fetch
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
)
{
TDB_DATA
ret
=
do
_tdb_fetch
(
tdb
,
key
);
TDB_DATA
ret
=
_tdb_fetch
(
tdb
,
key
);
tdb_trace_1rec_retrec
(
tdb
,
"tdb_fetch"
,
key
,
ret
);
return
ret
;
...
...
@@ -446,8 +446,8 @@ static tdb_off_t tdb_find_dead(struct tdb_context *tdb, uint32_t hash,
return
0
;
}
static
int
_tdb_store
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
,
TDB_DATA
dbuf
,
int
flag
,
uint32_t
hash
)
static
int
_tdb_store
(
struct
tdb_context
*
tdb
,
TDB_DATA
key
,
TDB_DATA
dbuf
,
int
flag
,
uint32_t
hash
)
{
struct
list_struct
rec
;
tdb_off_t
rec_ptr
;
...
...
@@ -613,7 +613,7 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
if
(
tdb_lock
(
tdb
,
BUCKET
(
hash
),
F_WRLCK
)
==
-
1
)
return
-
1
;
dbuf
=
do
_tdb_fetch
(
tdb
,
key
);
dbuf
=
_tdb_fetch
(
tdb
,
key
);
if
(
dbuf
.
dptr
==
NULL
)
{
dbuf
.
dptr
=
(
unsigned
char
*
)
malloc
(
new_dbuf
.
dsize
);
...
...
ccan/tdb/tdb_private.h
View file @
91ddc0b7
...
...
@@ -250,7 +250,7 @@ int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int
tdb_ofs_write
(
struct
tdb_context
*
tdb
,
tdb_off_t
offset
,
tdb_off_t
*
d
);
int
tdb_lock_record
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
);
int
tdb_unlock_record
(
struct
tdb_context
*
tdb
,
tdb_off_t
off
);
int
tdb_transaction_cancel_interna
l
(
struct
tdb_context
*
tdb
);
int
_tdb_transaction_cance
l
(
struct
tdb_context
*
tdb
);
int
tdb_rec_read
(
struct
tdb_context
*
tdb
,
tdb_off_t
offset
,
struct
list_struct
*
rec
);
int
tdb_rec_write
(
struct
tdb_context
*
tdb
,
tdb_off_t
offset
,
struct
list_struct
*
rec
);
int
tdb_do_delete
(
struct
tdb_context
*
tdb
,
tdb_off_t
rec_ptr
,
struct
list_struct
*
rec
);
...
...
ccan/tdb/transaction.c
View file @
91ddc0b7
...
...
@@ -455,7 +455,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
return
0
;
}
int
tdb_transaction_cancel_interna
l
(
struct
tdb_context
*
tdb
)
int
_tdb_transaction_cance
l
(
struct
tdb_context
*
tdb
)
{
int
i
,
ret
=
0
;
...
...
@@ -636,7 +636,7 @@ fail:
int
tdb_transaction_cancel
(
struct
tdb_context
*
tdb
)
{
tdb_trace
(
tdb
,
"tdb_transaction_cancel"
);
return
tdb_transaction_cancel_interna
l
(
tdb
);
return
_tdb_transaction_cance
l
(
tdb
);
}
/*
...
...
@@ -885,7 +885,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
return
0
;
}
static
int
tdb_transaction_prepare_commit_internal
(
struct
tdb_context
*
tdb
)
static
int
_tdb_transaction_prepare_commit
(
struct
tdb_context
*
tdb
)
{
const
struct
tdb_methods
*
methods
;
...
...
@@ -896,14 +896,14 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if
(
tdb
->
transaction
->
prepared
)
{
tdb
->
ecode
=
TDB_ERR_EINVAL
;
tdb_transaction_cancel
(
tdb
);
_
tdb_transaction_cancel
(
tdb
);
TDB_LOG
((
tdb
,
TDB_DEBUG_ERROR
,
"tdb_transaction_prepare_commit: transaction already prepared
\n
"
));
return
-
1
;
}
if
(
tdb
->
transaction
->
transaction_error
)
{
tdb
->
ecode
=
TDB_ERR_IO
;
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
TDB_LOG
((
tdb
,
TDB_DEBUG_ERROR
,
"tdb_transaction_prepare_commit: transaction error pending
\n
"
));
return
-
1
;
}
...
...
@@ -931,7 +931,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if
(
tdb
->
num_locks
||
tdb
->
global_lock
.
count
)
{
tdb
->
ecode
=
TDB_ERR_LOCK
;
TDB_LOG
((
tdb
,
TDB_DEBUG_ERROR
,
"tdb_transaction_prepare_commit: locks pending on commit
\n
"
));
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
-
1
;
}
...
...
@@ -939,7 +939,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if
(
tdb_brlock_upgrade
(
tdb
,
FREELIST_TOP
,
0
)
==
-
1
)
{
TDB_LOG
((
tdb
,
TDB_DEBUG_ERROR
,
"tdb_transaction_prepare_commit: failed to upgrade hash locks
\n
"
));
tdb
->
ecode
=
TDB_ERR_LOCK
;
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
-
1
;
}
...
...
@@ -948,7 +948,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if
(
tdb_brlock
(
tdb
,
GLOBAL_LOCK
,
F_WRLCK
,
F_SETLKW
,
0
,
1
)
==
-
1
)
{
TDB_LOG
((
tdb
,
TDB_DEBUG_ERROR
,
"tdb_transaction_prepare_commit: failed to get global lock
\n
"
));
tdb
->
ecode
=
TDB_ERR_LOCK
;
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
-
1
;
}
...
...
@@ -957,7 +957,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if
(
transaction_setup_recovery
(
tdb
,
&
tdb
->
transaction
->
magic_offset
)
==
-
1
)
{
TDB_LOG
((
tdb
,
TDB_DEBUG_FATAL
,
"tdb_transaction_prepare_commit: failed to setup recovery data
\n
"
));
tdb_brlock
(
tdb
,
GLOBAL_LOCK
,
F_UNLCK
,
F_SETLKW
,
0
,
1
);
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
-
1
;
}
}
...
...
@@ -972,7 +972,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
tdb
->
ecode
=
TDB_ERR_IO
;
TDB_LOG
((
tdb
,
TDB_DEBUG_FATAL
,
"tdb_transaction_prepare_commit: expansion failed
\n
"
));
tdb_brlock
(
tdb
,
GLOBAL_LOCK
,
F_UNLCK
,
F_SETLKW
,
0
,
1
);
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
-
1
;
}
tdb
->
map_size
=
tdb
->
transaction
->
old_map_size
;
...
...
@@ -990,7 +990,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
int
tdb_transaction_prepare_commit
(
struct
tdb_context
*
tdb
)
{
tdb_trace
(
tdb
,
"tdb_transaction_prepare_commit"
);
return
tdb_transaction_prepare_commit_internal
(
tdb
);
return
_tdb_transaction_prepare_commit
(
tdb
);
}
/*
...
...
@@ -1030,12 +1030,12 @@ int tdb_transaction_commit(struct tdb_context *tdb)
/* check for a null transaction */
if
(
tdb
->
transaction
->
blocks
==
NULL
)
{
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
return
0
;
}
if
(
!
tdb
->
transaction
->
prepared
)
{
int
ret
=
tdb_transaction_prepare_commit_internal
(
tdb
);
int
ret
=
_tdb_transaction_prepare_commit
(
tdb
);
if
(
ret
)
return
ret
;
}
...
...
@@ -1066,7 +1066,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
tdb
->
methods
=
methods
;
tdb_transaction_recover
(
tdb
);
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
tdb_brlock
(
tdb
,
GLOBAL_LOCK
,
F_UNLCK
,
F_SETLKW
,
0
,
1
);
TDB_LOG
((
tdb
,
TDB_DEBUG_FATAL
,
"tdb_transaction_commit: write failed
\n
"
));
...
...
@@ -1104,7 +1104,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
/* use a transaction cancel to free memory and remove the
transaction locks */
tdb_transaction_cancel_interna
l
(
tdb
);
_tdb_transaction_cance
l
(
tdb
);
if
(
need_repack
)
{
return
tdb_repack
(
tdb
);
...
...
ccan/tdb/traverse.c
View file @
91ddc0b7
...
...
@@ -140,9 +140,9 @@ static tdb_off_t tdb_next_lock(struct tdb_context *tdb, struct tdb_traverse_lock
if fn is NULL then it is not called
a non-zero return value from fn() indicates that the traversal should stop
*/
static
int
tdb_traverse_internal
(
struct
tdb_context
*
tdb
,
tdb_traverse_func
fn
,
void
*
private_data
,
struct
tdb_traverse_lock
*
tl
)
static
int
_tdb_traverse
(
struct
tdb_context
*
tdb
,
tdb_traverse_func
fn
,
void
*
private_data
,
struct
tdb_traverse_lock
*
tl
)
{
TDB_DATA
key
,
dbuf
;
struct
list_struct
rec
;
...
...
@@ -226,7 +226,7 @@ int tdb_traverse_read(struct tdb_context *tdb,
tdb
->
traverse_read
++
;
tdb_trace
(
tdb
,
"tdb_traverse_read_start"
);
ret
=
tdb_traverse_internal
(
tdb
,
fn
,
private_data
,
&
tl
);
ret
=
_tdb_traverse
(
tdb
,
fn
,
private_data
,
&
tl
);
tdb
->
traverse_read
--
;
tdb_transaction_unlock
(
tdb
);
...
...
@@ -257,7 +257,7 @@ int tdb_traverse(struct tdb_context *tdb,
tdb
->
traverse_write
++
;
tdb_trace
(
tdb
,
"tdb_traverse_start"
);
ret
=
tdb_traverse_internal
(
tdb
,
fn
,
private_data
,
&
tl
);
ret
=
_tdb_traverse
(
tdb
,
fn
,
private_data
,
&
tl
);
tdb
->
traverse_write
--
;
tdb_transaction_unlock
(
tdb
);
...
...
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