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
39f55294
Commit
39f55294
authored
Aug 31, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: remove _PUBLIC_ in tdb1 functions.
They'll all be accessed via the tdb2 API.
parent
b929638e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
41 deletions
+36
-41
ccan/tdb2/tdb1_check.c
ccan/tdb2/tdb1_check.c
+1
-1
ccan/tdb2/tdb1_hash.c
ccan/tdb2/tdb1_hash.c
+1
-1
ccan/tdb2/tdb1_lock.c
ccan/tdb2/tdb1_lock.c
+8
-8
ccan/tdb2/tdb1_open.c
ccan/tdb2/tdb1_open.c
+4
-4
ccan/tdb2/tdb1_private.h
ccan/tdb2/tdb1_private.h
+0
-5
ccan/tdb2/tdb1_summary.c
ccan/tdb2/tdb1_summary.c
+1
-1
ccan/tdb2/tdb1_tdb.c
ccan/tdb2/tdb1_tdb.c
+13
-13
ccan/tdb2/tdb1_transaction.c
ccan/tdb2/tdb1_transaction.c
+4
-4
ccan/tdb2/tdb1_traverse.c
ccan/tdb2/tdb1_traverse.c
+4
-4
No files found.
ccan/tdb2/tdb1_check.c
View file @
39f55294
...
...
@@ -322,7 +322,7 @@ size_t tdb1_dead_space(struct tdb1_context *tdb, tdb1_off_t off)
return
len
;
}
_PUBLIC_
int
tdb1_check
(
struct
tdb1_context
*
tdb
,
int
tdb1_check
(
struct
tdb1_context
*
tdb
,
int
(
*
check
)(
TDB1_DATA
key
,
TDB1_DATA
data
,
void
*
private_data
),
void
*
private_data
)
{
...
...
ccan/tdb2/tdb1_hash.c
View file @
39f55294
...
...
@@ -339,7 +339,7 @@ static uint32_t hashlittle( const void *key, size_t length )
return
c
;
}
_PUBLIC_
unsigned
int
tdb1_jenkins_hash
(
TDB1_DATA
*
key
)
unsigned
int
tdb1_jenkins_hash
(
TDB1_DATA
*
key
)
{
return
hashlittle
(
key
->
dptr
,
key
->
dsize
);
}
ccan/tdb2/tdb1_lock.c
View file @
39f55294
...
...
@@ -626,50 +626,50 @@ int tdb1_allrecord_unlock(struct tdb1_context *tdb, int ltype, bool mark_lock)
}
/* lock entire database with write lock */
_PUBLIC_
int
tdb1_lockall
(
struct
tdb1_context
*
tdb
)
int
tdb1_lockall
(
struct
tdb1_context
*
tdb
)
{
return
tdb1_allrecord_lock
(
tdb
,
F_WRLCK
,
TDB1_LOCK_WAIT
,
false
);
}
/* unlock entire database with write lock */
_PUBLIC_
int
tdb1_unlockall
(
struct
tdb1_context
*
tdb
)
int
tdb1_unlockall
(
struct
tdb1_context
*
tdb
)
{
return
tdb1_allrecord_unlock
(
tdb
,
F_WRLCK
,
false
);
}
/* lock entire database with read lock */
_PUBLIC_
int
tdb1_lockall_read
(
struct
tdb1_context
*
tdb
)
int
tdb1_lockall_read
(
struct
tdb1_context
*
tdb
)
{
return
tdb1_allrecord_lock
(
tdb
,
F_RDLCK
,
TDB1_LOCK_WAIT
,
false
);
}
/* unlock entire database with read lock */
_PUBLIC_
int
tdb1_unlockall_read
(
struct
tdb1_context
*
tdb
)
int
tdb1_unlockall_read
(
struct
tdb1_context
*
tdb
)
{
return
tdb1_allrecord_unlock
(
tdb
,
F_RDLCK
,
false
);
}
/* lock/unlock one hash chain. This is meant to be used to reduce
contention - it cannot guarantee how many records will be locked */
_PUBLIC_
int
tdb1_chainlock
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_chainlock
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
int
ret
=
tdb1_lock
(
tdb
,
TDB1_BUCKET
(
tdb
->
hash_fn
(
&
key
)),
F_WRLCK
);
return
ret
;
}
_PUBLIC_
int
tdb1_chainunlock
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_chainunlock
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
return
tdb1_unlock
(
tdb
,
TDB1_BUCKET
(
tdb
->
hash_fn
(
&
key
)),
F_WRLCK
);
}
_PUBLIC_
int
tdb1_chainlock_read
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_chainlock_read
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
int
ret
;
ret
=
tdb1_lock
(
tdb
,
TDB1_BUCKET
(
tdb
->
hash_fn
(
&
key
)),
F_RDLCK
);
return
ret
;
}
_PUBLIC_
int
tdb1_chainunlock_read
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_chainunlock_read
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
return
tdb1_unlock
(
tdb
,
TDB1_BUCKET
(
tdb
->
hash_fn
(
&
key
)),
F_RDLCK
);
}
...
...
ccan/tdb2/tdb1_open.c
View file @
39f55294
...
...
@@ -129,7 +129,7 @@ static int tdb1_already_open(dev_t device,
try to call tdb1_error or tdb1_errname, just do strerror(errno).
@param name may be NULL for internal databases. */
_PUBLIC_
struct
tdb1_context
*
tdb1_open
(
const
char
*
name
,
int
hash_size
,
int
tdb1_flags
,
struct
tdb1_context
*
tdb1_open
(
const
char
*
name
,
int
hash_size
,
int
tdb1_flags
,
int
open_flags
,
mode_t
mode
)
{
return
tdb1_open_ex
(
name
,
hash_size
,
tdb1_flags
,
open_flags
,
mode
,
NULL
,
NULL
);
...
...
@@ -162,7 +162,7 @@ static bool check_header_hash(struct tdb1_context *tdb,
return
check_header_hash
(
tdb
,
false
,
m1
,
m2
);
}
_PUBLIC_
struct
tdb1_context
*
tdb1_open_ex
(
const
char
*
name
,
int
hash_size
,
int
tdb1_flags
,
struct
tdb1_context
*
tdb1_open_ex
(
const
char
*
name
,
int
hash_size
,
int
tdb1_flags
,
int
open_flags
,
mode_t
mode
,
const
struct
tdb1_logging_context
*
log_ctx
,
tdb1_hash_func
hash_fn
)
...
...
@@ -450,7 +450,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
* Set the maximum number of dead records per hash chain
*/
_PUBLIC_
void
tdb1_set_max_dead
(
struct
tdb1_context
*
tdb
,
int
max_dead
)
void
tdb1_set_max_dead
(
struct
tdb1_context
*
tdb
,
int
max_dead
)
{
tdb
->
max_dead_records
=
max_dead
;
}
...
...
@@ -460,7 +460,7 @@ _PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
*
* @returns -1 for error; 0 for success.
**/
_PUBLIC_
int
tdb1_close
(
struct
tdb1_context
*
tdb
)
int
tdb1_close
(
struct
tdb1_context
*
tdb
)
{
struct
tdb1_context
**
i
;
int
ret
=
0
;
...
...
ccan/tdb2/tdb1_private.h
View file @
39f55294
...
...
@@ -45,11 +45,6 @@
#include <limits.h>
#include <stdio.h>
#include <utime.h>
#ifndef _PUBLIC_
#define _PUBLIC_
#endif
#else
#include "replace.h"
#include "system/filesys.h"
...
...
ccan/tdb2/tdb1_summary.c
View file @
39f55294
...
...
@@ -84,7 +84,7 @@ static size_t get_hash_length(struct tdb1_context *tdb, unsigned int i)
return
count
;
}
_PUBLIC_
char
*
tdb1_summary
(
struct
tdb1_context
*
tdb
)
char
*
tdb1_summary
(
struct
tdb1_context
*
tdb
)
{
tdb1_off_t
off
,
rec_off
;
struct
tally
freet
,
keys
,
data
,
dead
,
extra
,
hash
,
uncoal
;
...
...
ccan/tdb2/tdb1_tdb.c
View file @
39f55294
...
...
@@ -27,13 +27,13 @@
#include "tdb1_private.h"
_PUBLIC_
TDB1_DATA
tdb1_null
;
TDB1_DATA
tdb1_null
;
/*
non-blocking increment of the tdb sequence number if the tdb has been opened using
the TDB1_SEQNUM flag
*/
_PUBLIC_
void
tdb1_increment_seqnum_nonblock
(
struct
tdb1_context
*
tdb
)
void
tdb1_increment_seqnum_nonblock
(
struct
tdb1_context
*
tdb
)
{
tdb1_off_t
seqnum
=
0
;
...
...
@@ -199,7 +199,7 @@ static TDB1_DATA _tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key)
return
ret
;
}
_PUBLIC_
TDB1_DATA
tdb1_fetch
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
TDB1_DATA
tdb1_fetch
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
TDB1_DATA
ret
=
_tdb1_fetch
(
tdb
,
key
);
...
...
@@ -224,7 +224,7 @@ _PUBLIC_ TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key)
* Return -1 if the record was not found.
*/
_PUBLIC_
int
tdb1_parse_record
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
int
tdb1_parse_record
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
int
(
*
parser
)(
TDB1_DATA
key
,
TDB1_DATA
data
,
void
*
private_data
),
void
*
private_data
)
...
...
@@ -267,7 +267,7 @@ static int tdb1_exists_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha
return
1
;
}
_PUBLIC_
int
tdb1_exists
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_exists
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
uint32_t
hash
=
tdb
->
hash_fn
(
&
key
);
int
ret
;
...
...
@@ -425,7 +425,7 @@ static int tdb1_delete_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha
return
ret
;
}
_PUBLIC_
int
tdb1_delete
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
int
tdb1_delete
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
)
{
uint32_t
hash
=
tdb
->
hash_fn
(
&
key
);
int
ret
;
...
...
@@ -594,7 +594,7 @@ static int _tdb1_store(struct tdb1_context *tdb, TDB1_DATA key,
return 0 on success, -1 on failure
*/
_PUBLIC_
int
tdb1_store
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
TDB1_DATA
dbuf
,
int
flag
)
int
tdb1_store
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
TDB1_DATA
dbuf
,
int
flag
)
{
uint32_t
hash
;
int
ret
;
...
...
@@ -615,7 +615,7 @@ _PUBLIC_ int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf,
}
/* Append to an entry. Create if not exist. */
_PUBLIC_
int
tdb1_append
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
TDB1_DATA
new_dbuf
)
int
tdb1_append
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
key
,
TDB1_DATA
new_dbuf
)
{
uint32_t
hash
;
TDB1_DATA
dbuf
;
...
...
@@ -665,7 +665,7 @@ failed:
return the current logging function
useful for external tdb routines that wish to log tdb errors
*/
_PUBLIC_
tdb1_log_func
tdb1_log_fn
(
struct
tdb1_context
*
tdb
)
tdb1_log_func
tdb1_log_fn
(
struct
tdb1_context
*
tdb
)
{
return
tdb
->
log
.
log_fn
;
}
...
...
@@ -681,7 +681,7 @@ _PUBLIC_ tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb)
The aim of this sequence number is to allow for a very lightweight
test of a possible tdb change.
*/
_PUBLIC_
int
tdb1_get_seqnum
(
struct
tdb1_context
*
tdb
)
int
tdb1_get_seqnum
(
struct
tdb1_context
*
tdb
)
{
tdb1_off_t
seqnum
=
0
;
...
...
@@ -689,7 +689,7 @@ _PUBLIC_ int tdb1_get_seqnum(struct tdb1_context *tdb)
return
seqnum
;
}
_PUBLIC_
int
tdb1_hash_size
(
struct
tdb1_context
*
tdb
)
int
tdb1_hash_size
(
struct
tdb1_context
*
tdb
)
{
return
tdb
->
header
.
hash_size
;
}
...
...
@@ -726,7 +726,7 @@ static int tdb1_free_region(struct tdb1_context *tdb, tdb1_off_t offset, ssize_t
This code carefully steps around the recovery area, leaving it alone
*/
_PUBLIC_
int
tdb1_wipe_all
(
struct
tdb1_context
*
tdb
)
int
tdb1_wipe_all
(
struct
tdb1_context
*
tdb
)
{
int
i
;
tdb1_off_t
offset
=
0
;
...
...
@@ -832,7 +832,7 @@ static int repack_traverse(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA da
/*
repack a tdb
*/
_PUBLIC_
int
tdb1_repack
(
struct
tdb1_context
*
tdb
)
int
tdb1_repack
(
struct
tdb1_context
*
tdb
)
{
struct
tdb1_context
*
tmp_db
;
struct
traverse_state
state
;
...
...
ccan/tdb2/tdb1_transaction.c
View file @
39f55294
...
...
@@ -527,7 +527,7 @@ fail_allrecord_lock:
return
-
1
;
}
_PUBLIC_
int
tdb1_transaction_start
(
struct
tdb1_context
*
tdb
)
int
tdb1_transaction_start
(
struct
tdb1_context
*
tdb
)
{
return
_tdb1_transaction_start
(
tdb
,
TDB1_LOCK_WAIT
);
}
...
...
@@ -618,7 +618,7 @@ static int _tdb1_transaction_cancel(struct tdb1_context *tdb)
/*
cancel the current transaction
*/
_PUBLIC_
int
tdb1_transaction_cancel
(
struct
tdb1_context
*
tdb
)
int
tdb1_transaction_cancel
(
struct
tdb1_context
*
tdb
)
{
return
_tdb1_transaction_cancel
(
tdb
);
}
...
...
@@ -983,7 +983,7 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
/*
prepare to commit the current transaction
*/
_PUBLIC_
int
tdb1_transaction_prepare_commit
(
struct
tdb1_context
*
tdb
)
int
tdb1_transaction_prepare_commit
(
struct
tdb1_context
*
tdb
)
{
return
_tdb1_transaction_prepare_commit
(
tdb
);
}
...
...
@@ -1013,7 +1013,7 @@ static bool repack_worthwhile(struct tdb1_context *tdb)
/*
commit the current transaction
*/
_PUBLIC_
int
tdb1_transaction_commit
(
struct
tdb1_context
*
tdb
)
int
tdb1_transaction_commit
(
struct
tdb1_context
*
tdb
)
{
const
struct
tdb1_methods
*
methods
;
int
i
;
...
...
ccan/tdb2/tdb1_traverse.c
View file @
39f55294
...
...
@@ -208,7 +208,7 @@ out:
/*
a write style traverse - temporarily marks the db read only
*/
_PUBLIC_
int
tdb1_traverse_read
(
struct
tdb1_context
*
tdb
,
int
tdb1_traverse_read
(
struct
tdb1_context
*
tdb
,
tdb1_traverse_func
fn
,
void
*
private_data
)
{
struct
tdb1_traverse_lock
tl
=
{
NULL
,
0
,
0
,
F_RDLCK
};
...
...
@@ -236,7 +236,7 @@ _PUBLIC_ int tdb1_traverse_read(struct tdb1_context *tdb,
WARNING: The data buffer given to the callback fn does NOT meet the
alignment restrictions malloc gives you.
*/
_PUBLIC_
int
tdb1_traverse
(
struct
tdb1_context
*
tdb
,
int
tdb1_traverse
(
struct
tdb1_context
*
tdb
,
tdb1_traverse_func
fn
,
void
*
private_data
)
{
struct
tdb1_traverse_lock
tl
=
{
NULL
,
0
,
0
,
F_WRLCK
};
...
...
@@ -261,7 +261,7 @@ _PUBLIC_ int tdb1_traverse(struct tdb1_context *tdb,
/* find the first entry in the database and return its key */
_PUBLIC_
TDB1_DATA
tdb1_firstkey
(
struct
tdb1_context
*
tdb
)
TDB1_DATA
tdb1_firstkey
(
struct
tdb1_context
*
tdb
)
{
TDB1_DATA
key
;
struct
tdb1_record
rec
;
...
...
@@ -289,7 +289,7 @@ _PUBLIC_ TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb)
}
/* find the next entry in the database, returning its key */
_PUBLIC_
TDB1_DATA
tdb1_nextkey
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
oldkey
)
TDB1_DATA
tdb1_nextkey
(
struct
tdb1_context
*
tdb
,
TDB1_DATA
oldkey
)
{
uint32_t
oldhash
;
TDB1_DATA
key
=
tdb1_null
;
...
...
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