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
3d10865d
Commit
3d10865d
authored
Oct 20, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tdb2: 64 bit fixes.
parent
3b9d55bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
ccan/tdb2/check.c
ccan/tdb2/check.c
+4
-3
ccan/tdb2/hash.c
ccan/tdb2/hash.c
+2
-2
ccan/tdb2/io.c
ccan/tdb2/io.c
+2
-1
ccan/tdb2/private.h
ccan/tdb2/private.h
+1
-4
No files found.
ccan/tdb2/check.c
View file @
3d10865d
...
...
@@ -45,14 +45,15 @@ static bool check_header(struct tdb_context *tdb)
if
(
hdr
.
hash_test
!=
hash_test
)
{
tdb
->
log
(
tdb
,
TDB_DEBUG_ERROR
,
tdb
->
log_priv
,
"check: hash test %llu should be %llu
\n
"
,
hdr
.
hash_test
,
hash_test
);
(
long
long
)
hdr
.
hash_test
,
(
long
long
)
hash_test
);
return
false
;
}
if
(
strcmp
(
hdr
.
magic_food
,
TDB_MAGIC_FOOD
)
!=
0
)
{
tdb
->
log
(
tdb
,
TDB_DEBUG_ERROR
,
tdb
->
log_priv
,
"check: bad magic '%.*s'
\n
"
,
sizeof
(
hdr
.
magic_food
),
hdr
.
magic_food
);
(
unsigned
)
sizeof
(
hdr
.
magic_food
),
hdr
.
magic_food
);
return
false
;
}
...
...
@@ -263,7 +264,7 @@ static bool check_hash(struct tdb_context *tdb,
if
(
!
check_hash_tree
(
tdb
,
offsetof
(
struct
tdb_header
,
hashtable
),
TDB_TOPLEVEL_HASH_BITS
-
TDB_HASH_GROUP_BITS
,
0
,
0
,
used
,
num_used
,
&
num_found
))
0
,
0
,
used
,
num_used
,
&
num_found
))
return
false
;
if
(
num_found
!=
num_used
)
{
...
...
ccan/tdb2/hash.c
View file @
3d10865d
...
...
@@ -537,7 +537,7 @@ again:
/* Return 1 if we find something, 0 if not, -1 on error. */
int
next_in_hash
(
struct
tdb_context
*
tdb
,
int
ltype
,
struct
traverse_info
*
tinfo
,
TDB_DATA
*
kbuf
,
unsigned
in
t
*
dlen
)
TDB_DATA
*
kbuf
,
size_
t
*
dlen
)
{
const
unsigned
group_bits
=
TDB_TOPLEVEL_HASH_BITS
-
TDB_HASH_GROUP_BITS
;
tdb_off_t
hlock_start
,
hlock_range
,
off
;
...
...
@@ -591,7 +591,7 @@ int next_in_hash(struct tdb_context *tdb, int ltype,
/* Return 1 if we find something, 0 if not, -1 on error. */
int
first_in_hash
(
struct
tdb_context
*
tdb
,
int
ltype
,
struct
traverse_info
*
tinfo
,
TDB_DATA
*
kbuf
,
unsigned
in
t
*
dlen
)
TDB_DATA
*
kbuf
,
size_
t
*
dlen
)
{
tinfo
->
prev
=
0
;
tinfo
->
toplevel_group
=
0
;
...
...
ccan/tdb2/io.c
View file @
3d10865d
...
...
@@ -311,7 +311,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
tdb
->
ecode
=
TDB_ERR_IO
;
tdb
->
log
(
tdb
,
TDB_DEBUG_FATAL
,
tdb
->
log_priv
,
"tdb_write failed at %llu len=%llu (%s)
\n
"
,
off
,
len
,
strerror
(
errno
));
(
long
long
)
off
,
(
long
long
)
len
,
strerror
(
errno
));
return
-
1
;
}
}
...
...
ccan/tdb2/private.h
View file @
3d10865d
...
...
@@ -23,6 +23,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <unistd.h>
...
...
@@ -60,10 +61,6 @@
typedef
uint64_t
tdb_len_t
;
typedef
uint64_t
tdb_off_t
;
#ifndef offsetof
#define offsetof(t,f) ((unsigned int)&((t *)0)->f)
#endif
#define TDB_MAGIC_FOOD "TDB file\n"
#define TDB_VERSION ((uint64_t)(0x26011967 + 7))
#define TDB_MAGIC ((uint64_t)0x1999)
...
...
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