Skip to content
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

mmapstorage: add import/export compatibility #2639

Merged
merged 27 commits into from Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ea87f92
mmapstorage: add mode for non-regular files using internal buffer
mpranj Apr 17, 2019
322caee
mmapstorage: add compatibility for non-regular files on kdbSet()
mpranj Apr 17, 2019
05dd0ef
mmapstorage: reformat source
mpranj Apr 17, 2019
2b07eb0
mmapstorage: update release notes
mpranj Apr 17, 2019
34d4883
mmapstorage: fix error on non existent file
mpranj Apr 17, 2019
e9a14a7
mmapstorage: fix open pipe test, since we now support it
mpranj Apr 17, 2019
99b8084
mmapstorage: fix creating new files on set
mpranj Apr 17, 2019
e0ee3de
mmapstorage: simplify & fix realpath on set
mpranj Apr 17, 2019
6ea57b2
mmapstorage: fix handling of non-regular files
mpranj Apr 19, 2019
cf180b2
log: undo changes
mpranj Apr 19, 2019
3003d5e
mmapstorage: add shelltests for kdb export
mpranj Apr 19, 2019
545c33e
mmapstorage: add regression shelltest for kdbGet on non-regular files
mpranj Apr 19, 2019
3308ec9
mmapstorage: add kdbGet compatibility for non-regular files by using …
mpranj Apr 19, 2019
6b65d12
mmapstorage: fix memleak
mpranj Apr 19, 2019
956b28a
mmapstorage: fix shelltest cleanup and docs
mpranj Apr 20, 2019
45dc6f6
mmapstorage: reformat source
mpranj Apr 20, 2019
3e188ad
mmapstorage: refactor anonymous file copying
mpranj Apr 20, 2019
d7b0045
mmapstorage: make file anonymous earlier
mpranj Apr 20, 2019
74fd76d
mmapstorage: use fstat
mpranj Apr 20, 2019
4b0b5e4
mmapstorage: use fstat where possible
mpranj Apr 20, 2019
f419443
mmapstorage: update docu
mpranj Apr 20, 2019
a523f9b
mmapstorage: update docs & release notes
mpranj Apr 20, 2019
88a2aac
mmapstorage: fix for BSDs
mpranj Apr 21, 2019
fc67948
mmapstorage: cleanup
mpranj Apr 21, 2019
ec3f46a
doc: update release notes
mpranj Apr 21, 2019
9fa389a
mmapstorage: remove unused function
mpranj Apr 21, 2019
9b3c6f4
mmapstorage: fix docu
mpranj Apr 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/news/_preparation_next_release.md
Expand Up @@ -253,6 +253,11 @@ The following section lists news about the [modules](https://www.libelektra.org/
- [cache](https://www.libelektra.org/plugins/cache) is a new global caching plugin. It uses [mmapstorage](https://www.libelektra.org/plugins/mmapstorage) as its storage backend and lazily stores keysets from previous ´kdbGet()´ calls. We added initial support for the default resolver and multifile resolver. _(Mihael Pranjić)_
- Add check of resolved filenames, fixes false cache hits. _(Mihael Pranjić)_

### mmapstorage

- [mmapstorage](https://www.libelektra.org/plugins/mmapstorage) is now able to persist the Global KeySet, which is used by the `cache` plugin. _(Mihael Pranjić)_
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done already, I forgot to mention it previously.

- Fixed support for `kdb import` and `kdb export`. _(Mihael Pranjić)_

## Libraries

The text below summarizes updates to the [C (and C++)-based libraries](https://www.libelektra.org/libraries/readme) of Elektra.
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/mmapstorage/README.md
Expand Up @@ -88,3 +88,8 @@ sudo kdb umount user/tests/mmapstorage
## Limitations

Mapped files shall not be altered, otherwise the behavior is undefined.

The `mmap()` system call only supports regular files and so does the mmapstorage
plugin with one notable exception: The plugin detects when it is called with the
files `/dev/stdin` and `/dev/stdout` and makes an internal copy. This makes the
plugin compatible with `kdb import` and `kdb export`.
11 changes: 10 additions & 1 deletion src/plugins/mmapstorage/internal.h
Expand Up @@ -37,9 +37,18 @@
/** Mmap format version */
#define ELEKTRA_MMAP_FORMAT_VERSION (1)

/** Mmap temp file template */
#define ELEKTRA_MMAP_TMP_NAME "/tmp/elektraMmapTmpXXXXXX"

/** Magic number used in mmap format */
#define ELEKTRA_MMAP_BUFSIZE (4096)

#define STDOUT_FILENAME ("/dev/stdout")
#define STDIN_FILENAME ("/dev/stdin")

/** Suppress warnings in cache mode to debug level */
#define ELEKTRA_MMAP_LOG_WARNING(...) \
if (mode == MODE_GLOBALCACHE) \
if (test_bit (mode, MODE_GLOBALCACHE)) \
{ \
ELEKTRA_LOG_DEBUG (__VA_ARGS__); \
} \
Expand Down