1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00

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.
This commit is contained in:
Daniel Mack 2014-08-18 10:55:49 +02:00
parent 93bd9b2ecf
commit 43bde981cc
6 changed files with 18 additions and 33 deletions

View File

@ -860,6 +860,8 @@ libsystemd_shared_la_SOURCES = \
src/shared/copy.h \
src/shared/base-filesystem.c \
src/shared/base-filesystem.h \
src/shared/memfd.c \
src/shared/memfd.h \
src/shared/nss-util.h
nodist_libsystemd_shared_la_SOURCES = \
@ -2382,7 +2384,6 @@ libsystemd_internal_la_SOURCES = \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
src/systemd/sd-memfd.h \
src/systemd/sd-utf8.h \
src/systemd/sd-event.h \
src/systemd/sd-rtnl.h \
@ -2432,7 +2433,6 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-bus/bus-slot.h \
src/libsystemd/sd-bus/bus-protocol.h \
src/libsystemd/sd-bus/kdbus.h \
src/libsystemd/sd-bus/sd-memfd.c \
src/libsystemd/sd-utf8/sd-utf8.c \
src/libsystemd/sd-event/sd-event.c \
src/libsystemd/sd-event/event-util.h \
@ -2550,7 +2550,6 @@ pkginclude_HEADERS += \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
src/systemd/sd-memfd.h \
src/systemd/sd-utf8.h \
src/systemd/sd-event.h \
src/systemd/sd-rtnl.h \

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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;