diff options
author | Daniel Mack <zonque@gmail.com> | 2014-08-18 10:55:49 +0200 |
---|---|---|
committer | Daniel Mack <zonque@gmail.com> | 2014-08-18 12:37:20 +0200 |
commit | 43bde981ccc57c744f164a9d95d46c7ce8f21808 (patch) | |
tree | ac16b88a6564a43f572667ee004031a8888d164e /src | |
parent | 93bd9b2ecfdafcf0bd895336634c40d68b06d54e (diff) |
memfd: move code from public library to src/shared
Don't expose generic kernel API via libsystemd, but keep the code internal
for our own usage.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/libsystemd.sym.m4 | 14 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-zero-copy.c | 2 | ||||
-rw-r--r-- | src/shared/memfd.c (renamed from src/libsystemd/sd-bus/sd-memfd.c) | 28 | ||||
-rw-r--r-- | src/shared/memfd.h (renamed from src/systemd/sd-memfd.h) | 0 | ||||
-rw-r--r-- | src/systemd/sd-bus.h | 2 |
5 files changed, 16 insertions, 30 deletions
diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym.m4 index 1c24cad105..415d89afbe 100644 --- a/src/libsystemd/libsystemd.sym.m4 +++ b/src/libsystemd/libsystemd.sym.m4 @@ -359,20 +359,6 @@ global: sd_bus_track_first; sd_bus_track_next; - /* sd-memfd */ - sd_memfd_new; - sd_memfd_new_and_map; - sd_memfd_free; - sd_memfd_get_fd; - sd_memfd_get_file; - sd_memfd_dup_fd; - sd_memfd_map; - sd_memfd_set_sealed; - sd_memfd_get_sealed; - sd_memfd_get_size; - sd_memfd_set_size; - sd_memfd_get_name; - /* sd-event */ sd_event_default; sd_event_new; diff --git a/src/libsystemd/sd-bus/test-bus-zero-copy.c b/src/libsystemd/sd-bus/test-bus-zero-copy.c index 29e40aa0af..e4a87ab3c5 100644 --- a/src/libsystemd/sd-bus/test-bus-zero-copy.c +++ b/src/libsystemd/sd-bus/test-bus-zero-copy.c @@ -24,9 +24,9 @@ #include "util.h" #include "log.h" +#include "memfd.h" #include "sd-bus.h" -#include "sd-memfd.h" #include "bus-message.h" #include "bus-error.h" #include "bus-kernel.h" diff --git a/src/libsystemd/sd-bus/sd-memfd.c b/src/shared/memfd.c index 16d09e3e14..4dd70a2473 100644 --- a/src/libsystemd/sd-bus/sd-memfd.c +++ b/src/shared/memfd.c @@ -28,8 +28,8 @@ #include "util.h" #include "bus-label.h" #include "missing.h" +#include "memfd.h" -#include "sd-memfd.h" #include "sd-bus.h" struct sd_memfd { @@ -37,7 +37,7 @@ struct sd_memfd { FILE *f; }; -_public_ int sd_memfd_new(sd_memfd **m, const char *name) { +int sd_memfd_new(sd_memfd **m, const char *name) { _cleanup_close_ int kdbus = -1; _cleanup_free_ char *g = NULL; @@ -100,7 +100,7 @@ _public_ int sd_memfd_new(sd_memfd **m, const char *name) { return 0; } -_public_ int sd_memfd_new_from_fd(sd_memfd **m, int fd) { +int sd_memfd_new_from_fd(sd_memfd **m, int fd) { sd_memfd *n; assert_return(m, -EINVAL); @@ -120,7 +120,7 @@ _public_ int sd_memfd_new_from_fd(sd_memfd **m, int fd) { return 0; } -_public_ void sd_memfd_free(sd_memfd *m) { +void sd_memfd_free(sd_memfd *m) { if (!m) return; @@ -132,13 +132,13 @@ _public_ void sd_memfd_free(sd_memfd *m) { free(m); } -_public_ int sd_memfd_get_fd(sd_memfd *m) { +int sd_memfd_get_fd(sd_memfd *m) { assert_return(m, -EINVAL); return m->fd; } -_public_ int sd_memfd_get_file(sd_memfd *m, FILE **f) { +int sd_memfd_get_file(sd_memfd *m, FILE **f) { assert_return(m, -EINVAL); assert_return(f, -EINVAL); @@ -152,7 +152,7 @@ _public_ int sd_memfd_get_file(sd_memfd *m, FILE **f) { return 0; } -_public_ int sd_memfd_dup_fd(sd_memfd *m) { +int sd_memfd_dup_fd(sd_memfd *m) { int fd; assert_return(m, -EINVAL); @@ -164,7 +164,7 @@ _public_ int sd_memfd_dup_fd(sd_memfd *m) { return fd; } -_public_ int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) { +int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) { void *q; int sealed; @@ -184,7 +184,7 @@ _public_ int sd_memfd_map(sd_memfd *m, uint64_t offset, size_t size, void **p) { return 0; } -_public_ int sd_memfd_set_sealed(sd_memfd *m) { +int sd_memfd_set_sealed(sd_memfd *m) { int r; assert_return(m, -EINVAL); @@ -196,7 +196,7 @@ _public_ int sd_memfd_set_sealed(sd_memfd *m) { return 0; } -_public_ int sd_memfd_get_sealed(sd_memfd *m) { +int sd_memfd_get_sealed(sd_memfd *m) { int r; assert_return(m, -EINVAL); @@ -209,7 +209,7 @@ _public_ int sd_memfd_get_sealed(sd_memfd *m) { (F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE); } -_public_ int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) { +int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) { int r; struct stat stat; @@ -224,7 +224,7 @@ _public_ int sd_memfd_get_size(sd_memfd *m, uint64_t *sz) { return r; } -_public_ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) { +int sd_memfd_set_size(sd_memfd *m, uint64_t sz) { int r; assert_return(m, -EINVAL); @@ -236,7 +236,7 @@ _public_ int sd_memfd_set_size(sd_memfd *m, uint64_t sz) { return r; } -_public_ int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p) { +int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, void **p) { sd_memfd *n; int r; @@ -260,7 +260,7 @@ _public_ int sd_memfd_new_and_map(sd_memfd **m, const char *name, size_t sz, voi return 0; } -_public_ int sd_memfd_get_name(sd_memfd *m, char **name) { +int sd_memfd_get_name(sd_memfd *m, char **name) { char path[sizeof("/proc/self/fd/") + DECIMAL_STR_MAX(int)], buf[FILENAME_MAX+1], *e; const char *delim, *end; _cleanup_free_ char *n = NULL; diff --git a/src/systemd/sd-memfd.h b/src/shared/memfd.h index 6de045c1d7..6de045c1d7 100644 --- a/src/systemd/sd-memfd.h +++ b/src/shared/memfd.h diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 3eedb4450b..a69cafbe84 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -28,7 +28,7 @@ #include "sd-id128.h" #include "sd-event.h" -#include "sd-memfd.h" +#include "memfd.h" #include "_sd-common.h" _SD_BEGIN_DECLARATIONS; |