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
86c41caf
Commit
86c41caf
authored
Jul 16, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up traverse keyword handling.
parent
fadb7502
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
19 deletions
+22
-19
ccan/tdb/tools/keywords.c
ccan/tdb/tools/keywords.c
+3
-3
ccan/tdb/tools/keywords.gperf
ccan/tdb/tools/keywords.gperf
+3
-3
ccan/tdb/tools/replay_trace.c
ccan/tdb/tools/replay_trace.c
+16
-13
No files found.
ccan/tdb/tools/keywords.c
View file @
86c41caf
...
...
@@ -104,7 +104,7 @@ find_keyword (register const char *str, register unsigned int len)
{
{
""
},
{
""
},
{
""
},
{
""
},
{
""
},
{
""
},
{
""
},
{
""
},
#line 43 "keywords.gperf"
{
"traverse"
,
OP_TDB_TRAVERSE
,
op_add_
key_data
,},
{
"traverse"
,
OP_TDB_TRAVERSE
,
op_add_
traverse
,},
#line 33 "keywords.gperf"
{
"tdb_store"
,
OP_TDB_STORE
,
op_add_store
,},
#line 32 "keywords.gperf"
...
...
@@ -141,7 +141,7 @@ find_keyword (register const char *str, register unsigned int len)
#line 38 "keywords.gperf"
{
"tdb_transaction_cancel"
,
OP_TDB_TRANSACTION_CANCEL
,
op_analyze_transaction
,},
#line 41 "keywords.gperf"
{
"tdb_traverse_start"
,
OP_TDB_TRAVERSE_START
,
op_add_traverse
,},
{
"tdb_traverse_start"
,
OP_TDB_TRAVERSE_START
,
op_add_traverse
_start
,},
{
""
},
#line 34 "keywords.gperf"
{
"tdb_append"
,
OP_TDB_APPEND
,
op_add_append
,},
...
...
@@ -150,7 +150,7 @@ find_keyword (register const char *str, register unsigned int len)
#line 39 "keywords.gperf"
{
"tdb_transaction_commit"
,
OP_TDB_TRANSACTION_COMMIT
,
op_analyze_transaction
,},
#line 40 "keywords.gperf"
{
"tdb_traverse_read_start"
,
OP_TDB_TRAVERSE_READ_START
,
op_add_traverse
,},
{
"tdb_traverse_read_start"
,
OP_TDB_TRAVERSE_READ_START
,
op_add_traverse
_start
,},
{
""
},
{
""
},
#line 31 "keywords.gperf"
{
"tdb_parse_record"
,
OP_TDB_PARSE_RECORD
,
op_add_key_ret
,},
...
...
ccan/tdb/tools/keywords.gperf
View file @
86c41caf
...
...
@@ -37,10 +37,10 @@ tdb_wipe_all, OP_TDB_WIPE_ALL, op_add_nothing,
tdb_transaction_start, OP_TDB_TRANSACTION_START, op_add_transaction,
tdb_transaction_cancel, OP_TDB_TRANSACTION_CANCEL, op_analyze_transaction,
tdb_transaction_commit, OP_TDB_TRANSACTION_COMMIT, op_analyze_transaction,
tdb_traverse_read_start, OP_TDB_TRAVERSE_READ_START, op_add_traverse,
tdb_traverse_start, OP_TDB_TRAVERSE_START, op_add_traverse,
tdb_traverse_read_start, OP_TDB_TRAVERSE_READ_START, op_add_traverse
_start
,
tdb_traverse_start, OP_TDB_TRAVERSE_START, op_add_traverse
_start
,
tdb_traverse_end, OP_TDB_TRAVERSE_END, op_analyze_traverse,
traverse, OP_TDB_TRAVERSE, op_add_
key_data
,
traverse, OP_TDB_TRAVERSE, op_add_
traverse
,
tdb_firstkey, OP_TDB_FIRSTKEY, op_add_key,
tdb_nextkey, OP_TDB_NEXTKEY, op_add_key_data,
tdb_fetch, OP_TDB_FETCH, op_add_key_data,
...
...
ccan/tdb/tools/replay_trace.c
View file @
86c41caf
...
...
@@ -213,8 +213,7 @@ static void op_add_key(const char *filename,
fail
(
filename
,
op_num
+
1
,
"Expected just a key"
);
op
[
op_num
].
key
=
make_tdb_data
(
op
,
filename
,
op_num
+
1
,
words
[
2
]);
if
(
op
[
op_num
].
op
!=
OP_TDB_TRAVERSE
)
total_keys
++
;
total_keys
++
;
}
static
void
op_add_key_ret
(
const
char
*
filename
,
...
...
@@ -243,6 +242,16 @@ static void op_add_key_data(const char *filename,
total_keys
++
;
}
/* We don't record the keys or data for a traverse, as we don't use them. */
static
void
op_add_traverse
(
const
char
*
filename
,
struct
op
op
[],
unsigned
int
op_num
,
char
*
words
[])
{
if
(
!
words
[
2
]
||
!
words
[
3
]
||
!
words
[
4
]
||
words
[
5
]
||
!
streq
(
words
[
3
],
"="
))
fail
(
filename
,
op_num
+
1
,
"Expected <key> = <data>"
);
op
[
op_num
].
key
=
tdb_null
;
}
/* <serial> tdb_store <rec> <rec> <flag> = <ret> */
static
void
op_add_store
(
const
char
*
filename
,
struct
op
op
[],
unsigned
int
op_num
,
char
*
words
[])
...
...
@@ -290,8 +299,9 @@ static void op_add_seqnum(const char *filename,
op
[
op_num
].
ret
=
atoi
(
words
[
3
]);
}
static
void
op_add_traverse
(
const
char
*
filename
,
struct
op
op
[],
unsigned
int
op_num
,
char
*
words
[])
static
void
op_add_traverse_start
(
const
char
*
filename
,
struct
op
op
[],
unsigned
int
op_num
,
char
*
words
[])
{
if
(
words
[
2
])
fail
(
filename
,
op_num
+
1
,
"Expect no arguments"
);
...
...
@@ -913,8 +923,7 @@ static const TDB_DATA *gives(const TDB_DATA *key, const TDB_DATA *pre,
for
(
i
=
1
;
i
<
op
->
group_len
;
i
++
)
{
/* This skips nested transactions, too */
if
(
op
[
i
].
op
!=
OP_TDB_TRAVERSE
&&
key_eq
(
op
[
i
].
key
,
*
key
))
if
(
key_eq
(
op
[
i
].
key
,
*
key
))
pre
=
gives
(
key
,
pre
,
&
op
[
i
]);
}
return
pre
;
...
...
@@ -968,11 +977,6 @@ static struct keyinfo *hash_ops(struct op *op[], unsigned int num_ops[],
if
(
!
op
[
i
][
j
].
key
.
dptr
)
continue
;
/* We don't wait for traverse keys */
/* FIXME: We should, for trivial traversals. */
if
(
op
[
i
][
j
].
op
==
OP_TDB_TRAVERSE
)
continue
;
h
=
hash_key
(
&
op
[
i
][
j
].
key
)
%
(
total_keys
*
2
);
while
(
!
key_eq
(
hash
[
h
].
key
,
op
[
i
][
j
].
key
))
{
if
(
!
hash
[
h
].
key
.
dptr
)
{
...
...
@@ -1025,8 +1029,7 @@ static bool satisfies(const TDB_DATA *key, const TDB_DATA *data,
/* Look through for an op in this transaction which
* needs this key. */
for
(
i
=
1
;
i
<
op
->
group_len
;
i
++
)
{
if
(
op
[
i
].
op
!=
OP_TDB_TRAVERSE
&&
key_eq
(
op
[
i
].
key
,
*
key
))
{
if
(
key_eq
(
op
[
i
].
key
,
*
key
))
{
need
=
needs
(
&
op
[
i
]);
/* tdb_exists() is special: there might be
* something in the transaction with more
...
...
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