This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
global-plugins: mark placements #874
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6e03342
cachefilter plugin update
Namoshek ae86b04
global-plugins: mark placements
mpranj af34548
global plugins: make positions explicit (init, once, foreach, deinit)
mpranj eb1cab3
global plugins: introduce positions and subpositions
mpranj 2d208ec
global plugins: fixed call function
mpranj e964daf
global plugins: simplify call
mpranj 10b2564
global plugins: elektraGlobalGet
mpranj dff293f
global plugins: reformat code
mpranj 3e73055
WIP: compiles
mpranj 3a878e2
WIP: compiles
mpranj c7810cd
WIP: compiles
mpranj 90a9a99
WIP: compiles
mpranj 9af5dc8
WIP: compiles
mpranj 6cd5566
kdbglobal: fix warning
6b03cc5
dbus: free+log on problems
e7507a8
cmake: allow / in placements
03d12e1
dbus: reformat
70d0b5c
cachefilter: reformat
a601dcd
cachefilter: add logging
1d7d394
kdb: log problem
5da15b6
fix memproblems and invalid global spec config
mpranj a63e3d1
global-plugins: this really fixes the memleak
mpranj eaccfa5
global-plugins: fix use after free
mpranj b9cc18e
cachefilter: fix memleaks
mpranj 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 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 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* @file | ||
* | ||
* @brief Defines for global plugins | ||
* | ||
* @copyright BSD License (see doc/COPYING or http://www.libelektra.org) | ||
*/ | ||
|
||
#ifndef ELEKTRA_KDBGLOBAL_H | ||
#define ELEKTRA_KDBGLOBAL_H | ||
|
||
#include <kdb.h> | ||
#include <kdbconfig.h> | ||
#include <kdbplugin.h> | ||
|
||
/** | ||
* Helper for identifying global plugin positions | ||
*/ | ||
// clang-format off | ||
#define FOREACH_POSITION(POSITION) \ | ||
POSITION(PREROLLBACK) \ | ||
POSITION(ROLLBACK) \ | ||
POSITION(POSTROLLBACK) \ | ||
POSITION(GETRESOLVER) \ | ||
POSITION(PREGETSTORAGE) \ | ||
POSITION(GETSTORAGE) \ | ||
POSITION(POSTGETSTORAGE) \ | ||
POSITION(SETRESOLVER) \ | ||
POSITION(POSTGETCLEANUP) \ | ||
POSITION(PRESETSTORAGE) \ | ||
POSITION(SETSTORAGE) \ | ||
POSITION(PRESETCLEANUP) \ | ||
POSITION(PRECOMMIT) \ | ||
POSITION(COMMIT) \ | ||
POSITION(POSTCOMMIT) \ | ||
POSITION(NR_GLOBAL_POSITIONS) | ||
|
||
#define FOREACH_SUBPOSITION(SUBPOSITION) \ | ||
SUBPOSITION(INIT) \ | ||
SUBPOSITION(MAXONCE) \ | ||
SUBPOSITION(FOREACH) \ | ||
SUBPOSITION(DEINIT) \ | ||
SUBPOSITION(NR_GLOBAL_SUBPOSITIONS) | ||
|
||
#define GENERATE_ENUM(ENUM) ENUM, | ||
#define GENERATE_STRING(STRING) #STRING, | ||
// clang-format on | ||
|
||
typedef enum { FOREACH_POSITION (GENERATE_ENUM) } GlobalpluginPositions; | ||
|
||
typedef enum { FOREACH_SUBPOSITION (GENERATE_ENUM) } GlobalpluginSubPositions; | ||
|
||
static const char * GlobalpluginPositionsStr[] ELEKTRA_UNUSED = { FOREACH_POSITION (GENERATE_STRING) }; | ||
|
||
static const char * GlobalpluginSubPositionsStr[] ELEKTRA_UNUSED = { FOREACH_SUBPOSITION (GENERATE_STRING) }; | ||
|
||
#endif // ELEKTRA_KDBGLOBAL_H |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* @file | ||
* | ||
* @brief Helpers for global plugins | ||
* | ||
* @copyright BSD License (see doc/COPYING or http://www.libelektra.org) | ||
*/ | ||
|
||
#include <kdbglobal.h> | ||
#include <kdbprivate.h> | ||
|
||
/** | ||
* @internal | ||
* Helper functions to execute global plugins | ||
*/ | ||
|
||
void elektraGlobalGet (KDB * handle, KeySet * ks, Key * parentKey, int position, int subPosition) | ||
{ | ||
Plugin * plugin; | ||
if (handle && (plugin = handle->globalPlugins[position][subPosition])) | ||
{ | ||
plugin->kdbGet (plugin, ks, parentKey); | ||
} | ||
} | ||
|
||
void elektraGlobalSet (KDB * handle, KeySet * ks, Key * parentKey, int position, int subPosition) | ||
{ | ||
Plugin * plugin; | ||
if (handle && (plugin = handle->globalPlugins[position][subPosition])) | ||
{ | ||
plugin->kdbSet (plugin, ks, parentKey); | ||
} | ||
} | ||
|
||
void elektraGlobalError (KDB * handle, KeySet * ks, Key * parentKey, int position, int subPosition) | ||
{ | ||
Plugin * plugin; | ||
if (handle && (plugin = handle->globalPlugins[position][subPosition])) | ||
{ | ||
plugin->kdbError (plugin, ks, parentKey); | ||
} | ||
} |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for your information: elektraGetDoUpdatewithGlobalHooks gets called twice (thats why there's the
run
parameter)you've used if statements for the set placements but not here, so i'm not sure if you've thought of that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I did think of that since we discussed it in a meeting.
All of these are just rough markers where I thought the hooks could be placed.