mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
move common stuff from udev/ to private parts of libudev/
This commit is contained in:
parent
9060b066d9
commit
44b49d3736
@ -7,17 +7,17 @@ udevhome_PROGRAMS = \
|
||||
create_floppy_devices_SOURCES = \
|
||||
create_floppy_devices.c \
|
||||
../../libudev/libudev.h \
|
||||
../../libudev/libudev-private.h \
|
||||
../../libudev/libudev.c \
|
||||
../../libudev/libudev-list.c \
|
||||
../../libudev/libudev-util.c \
|
||||
../../libudev/libudev-util-private.c \
|
||||
../../libudev/libudev-device.c \
|
||||
../../libudev/libudev-enumerate.c \
|
||||
../../udev/udev.h \
|
||||
../../udev/udev-util.c
|
||||
../../libudev/libudev-enumerate.c
|
||||
|
||||
if USE_SELINUX
|
||||
create_floppy_devices_SOURCES += \
|
||||
../../udev/udev-selinux.c
|
||||
../../libudev/libudev-selinux-private.c
|
||||
create_floppy_devices_LDADD = \
|
||||
$(SELINUX_LIBS)
|
||||
endif
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "libudev.h"
|
||||
#include "libudev-private.h"
|
||||
#include "../../udev/udev.h"
|
||||
|
||||
static char *table[] = {
|
||||
"", "d360", "h1200", "u360", "u720", "h360", "h720",
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "udev.h"
|
||||
#include "libudev.h"
|
||||
#include "libudev-private.h"
|
||||
|
||||
static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len)
|
||||
{
|
||||
|
@ -16,6 +16,9 @@
|
||||
#include "libudev.h"
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define READ_END 0
|
||||
#define WRITE_END 1
|
||||
|
||||
static inline void __attribute__((always_inline, format(printf, 2, 3)))
|
||||
udev_log_null(struct udev *udev, const char *format, ...) {}
|
||||
@ -182,7 +185,7 @@ int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export,
|
||||
int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
|
||||
int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
|
||||
|
||||
/* libudev-utils.c */
|
||||
/* libudev-util.c */
|
||||
#define UTIL_PATH_SIZE 1024
|
||||
#define UTIL_LINE_SIZE 2048
|
||||
#define UTIL_NAME_SIZE 512
|
||||
@ -203,4 +206,30 @@ int udev_util_replace_chars(char *str, const char *white);
|
||||
int udev_util_encode_string(const char *str, char *str_enc, size_t len);
|
||||
void util_set_fd_cloexec(int fd);
|
||||
unsigned int util_string_hash32(const char *str);
|
||||
|
||||
/* libudev-util-private.c */
|
||||
int util_create_path(struct udev *udev, const char *path);
|
||||
int util_delete_path(struct udev *udev, const char *path);
|
||||
int util_unlink_secure(struct udev *udev, const char *filename);
|
||||
uid_t util_lookup_user(struct udev *udev, const char *user);
|
||||
gid_t util_lookup_group(struct udev *udev, const char *group);
|
||||
int util_run_program(struct udev *udev, const char *command, char **envp,
|
||||
char *result, size_t ressize, size_t *reslen);
|
||||
int util_resolve_subsys_kernel(struct udev *udev, const char *string,
|
||||
char *result, size_t maxsize, int read_value);
|
||||
|
||||
/* libudev-selinux-private.c */
|
||||
#ifndef USE_SELINUX
|
||||
static inline void udev_selinux_init(struct udev *udev) {}
|
||||
static inline void udev_selinux_exit(struct udev *udev) {}
|
||||
static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
|
||||
static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
|
||||
static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
|
||||
#else
|
||||
void udev_selinux_init(struct udev *udev);
|
||||
void udev_selinux_exit(struct udev *udev);
|
||||
void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
|
||||
void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
|
||||
void udev_selinux_resetfscreatecon(struct udev *udev);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -14,7 +14,6 @@
|
||||
* DISCLAIMER - The file format mentioned here is private to udev/libudev,
|
||||
* and may be changed without notice.
|
||||
*
|
||||
*
|
||||
* The udev event queue is exported as a binary log file.
|
||||
* Each log record consists of a sequence number followed by the device path.
|
||||
*
|
||||
@ -31,7 +30,6 @@
|
||||
* The queue does not grow indefinitely. It is periodically re-created
|
||||
* to remove finished events. Atomic rename() makes this transparent to readers.
|
||||
*
|
||||
*
|
||||
* The queue file starts with a single sequence number which specifies the
|
||||
* minimum sequence number in the log that follows. Any events prior to this
|
||||
* sequence number have already finished.
|
||||
@ -48,7 +46,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "udev.h"
|
||||
#include "libudev.h"
|
||||
#include "libudev-private.h"
|
||||
|
||||
static int rebuild_queue_file(struct udev_queue_export *udev_queue_export);
|
||||
|
||||
@ -108,7 +107,6 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export)
|
||||
unlink(filename);
|
||||
}
|
||||
|
||||
|
||||
static int skip_to(FILE *file, long offset)
|
||||
{
|
||||
long old_offset;
|
||||
@ -320,7 +318,6 @@ write_error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
enum device_state {
|
||||
DEVICE_QUEUED,
|
||||
DEVICE_FINISHED,
|
||||
|
@ -1,18 +1,12 @@
|
||||
/*
|
||||
* libudev - interface to udev device information
|
||||
*
|
||||
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -22,7 +16,8 @@
|
||||
#include <unistd.h>
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
#include "udev.h"
|
||||
#include "libudev.h"
|
||||
#include "libudev-private.h"
|
||||
|
||||
static int selinux_enabled;
|
||||
security_context_t selinux_prev_scontext;
|
@ -1,18 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
|
||||
* libudev - interface to udev device information
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* Copyright (C) 2004-2009 Kay Sievers <kay.sievers@vrfy.org>
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -27,7 +21,8 @@
|
||||
#include <grp.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "udev.h"
|
||||
#include "libudev.h"
|
||||
#include "libudev-private.h"
|
||||
|
||||
int util_create_path(struct udev *udev, const char *path)
|
||||
{
|
@ -15,12 +15,12 @@ common_files = \
|
||||
udev-watch.c \
|
||||
udev-node.c \
|
||||
udev-rules.c \
|
||||
udev-util.c \
|
||||
../libudev/libudev.h \
|
||||
../libudev/libudev-private.h \
|
||||
../libudev/libudev.c \
|
||||
../libudev/libudev-list.c \
|
||||
../libudev/libudev-util.c \
|
||||
../libudev/libudev-util-private.c \
|
||||
../libudev/libudev-device.c \
|
||||
../libudev/libudev-device-db-write.c \
|
||||
../libudev/libudev-monitor.c \
|
||||
@ -31,7 +31,7 @@ common_files = \
|
||||
|
||||
if USE_SELINUX
|
||||
common_files += \
|
||||
udev-selinux.c
|
||||
../libudev/libudev-selinux-private.c
|
||||
common_ldadd += \
|
||||
$(SELINUX_LIBS)
|
||||
endif
|
||||
|
30
udev/udev.h
30
udev/udev.h
@ -30,10 +30,6 @@
|
||||
|
||||
#define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd"
|
||||
|
||||
#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#define READ_END 0
|
||||
#define WRITE_END 1
|
||||
|
||||
struct udev_event {
|
||||
struct udev *udev;
|
||||
struct udev_device *dev;
|
||||
@ -89,32 +85,6 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
|
||||
int udev_node_remove(struct udev_device *dev);
|
||||
void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);
|
||||
|
||||
/* udev-util.c */
|
||||
int util_create_path(struct udev *udev, const char *path);
|
||||
int util_delete_path(struct udev *udev, const char *path);
|
||||
int util_unlink_secure(struct udev *udev, const char *filename);
|
||||
uid_t util_lookup_user(struct udev *udev, const char *user);
|
||||
gid_t util_lookup_group(struct udev *udev, const char *group);
|
||||
int util_run_program(struct udev *udev, const char *command, char **envp,
|
||||
char *result, size_t ressize, size_t *reslen);
|
||||
int util_resolve_subsys_kernel(struct udev *udev, const char *string,
|
||||
char *result, size_t maxsize, int read_value);
|
||||
|
||||
/* udev-selinux.c */
|
||||
#ifndef USE_SELINUX
|
||||
static inline void udev_selinux_init(struct udev *udev) {}
|
||||
static inline void udev_selinux_exit(struct udev *udev) {}
|
||||
static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
|
||||
static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
|
||||
static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
|
||||
#else
|
||||
void udev_selinux_init(struct udev *udev);
|
||||
void udev_selinux_exit(struct udev *udev);
|
||||
void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
|
||||
void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
|
||||
void udev_selinux_resetfscreatecon(struct udev *udev);
|
||||
#endif
|
||||
|
||||
/* udevadm commands */
|
||||
int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
|
||||
int udevadm_info(struct udev *udev, int argc, char *argv[]);
|
||||
|
Loading…
Reference in New Issue
Block a user