-
Notifications
You must be signed in to change notification settings - Fork 42
[CTL] Add support for defaults #1216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
136dc39
Add function to get pool name
KFilipek 63c8f9e
[CTL] Add support for defaults
KFilipek 7427d25
Update test/ctl/ctl_api.cpp
KFilipek b30bcb8
Fixes after latest review
KFilipek 892c8d5
Drop prefix verification
KFilipek 7ac2d2c
Fix deadlock in default handler
KFilipek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| extern "C" { | ||
| #endif | ||
|
|
||
| struct ctl; | ||
| #define CTL_MAX_ENTRIES 100 | ||
|
|
||
| typedef struct ctl_index_utlist { | ||
| const char *name; | ||
|
|
@@ -46,7 +46,7 @@ typedef enum ctl_query_source { | |
| } umf_ctl_query_source_t; | ||
|
|
||
| typedef int (*node_callback)(void *ctx, umf_ctl_query_source_t type, void *arg, | ||
| umf_ctl_index_utlist_t *indexes, | ||
| size_t size, umf_ctl_index_utlist_t *indexes, | ||
| const char *extra_name, | ||
| umf_ctl_query_type_t query_type); | ||
|
|
||
|
|
@@ -98,8 +98,23 @@ typedef struct ctl_node { | |
| const struct ctl_node *children; | ||
| } umf_ctl_node_t; | ||
|
|
||
| /* | ||
| * This is the top level node of the ctl tree structure. Each node can contain | ||
| * children and leaf nodes. | ||
| * | ||
| * Internal nodes simply create a new path in the tree whereas child nodes are | ||
| * the ones providing the read/write functionality by the means of callbacks. | ||
| * | ||
| * Each tree node must be NULL-terminated, CTL_NODE_END macro is provided for | ||
| * convenience. | ||
| */ | ||
| struct ctl { | ||
| umf_ctl_node_t root[CTL_MAX_ENTRIES]; | ||
| int first_free; | ||
| }; | ||
|
|
||
| struct ctl *ctl_new(void); | ||
|
||
| void ctl_delete(struct ctl *stats); | ||
| void ctl_delete(struct ctl *c); | ||
|
|
||
| void initialize_global_ctl(void); | ||
|
|
||
|
|
@@ -138,7 +153,8 @@ int ctl_arg_string(const void *arg, void *dest, size_t dest_size); | |
| #define CTL_NODE(name, ...) ctl_node_##__VA_ARGS__##_##name | ||
|
|
||
| int ctl_query(struct ctl *ctl, void *ctx, umf_ctl_query_source_t source, | ||
| const char *name, umf_ctl_query_type_t type, void *arg); | ||
| const char *name, umf_ctl_query_type_t type, void *arg, | ||
| size_t size); | ||
|
|
||
| /* Declaration of a new child node */ | ||
| #define CTL_CHILD(name, ...) \ | ||
|
|
@@ -175,6 +191,18 @@ int ctl_query(struct ctl *ctl, void *ctx, umf_ctl_query_source_t source, | |
| NULL \ | ||
| } | ||
|
|
||
| /* | ||
| * Declaration of a new RW leaf. This type of RW leaf doesn't require parsing | ||
| * of the argument. The argument is passed directly to the read/write callback. | ||
| */ | ||
| #define CTL_LEAF_RW_no_arg(name, ...) \ | ||
| { \ | ||
| CTL_STR(name), CTL_NODE_LEAF, \ | ||
| {CTL_READ_HANDLER(name, __VA_ARGS__), \ | ||
| CTL_WRITE_HANDLER(name, __VA_ARGS__), NULL, NULL}, \ | ||
| NULL, NULL \ | ||
| } | ||
|
|
||
| /* | ||
| * Declaration of a new write-only leaf. If used the corresponding write | ||
| * function must be declared by CTL_WRITE_HANDLER macro. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.