logging.h | logging.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#define logging_close(foo) do { } while (0) | #define logging_close(foo) do { } while (0) | |||
#ifdef USE_LOG | #ifdef USE_LOG | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <syslog.h> | #include <syslog.h> | |||
#undef err | #undef err | |||
#define err(format, arg...) \ | #define err(format, arg...) \ | |||
do { \ | do { \ | |||
log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ | log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ | |||
} while (0) | } while (0) | |||
#undef info | #undef info | |||
#define info(format, arg...) \ | #define info(format, arg...) \ | |||
do { \ | do { \ | |||
log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ | log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ | |||
} while (0) | } while (0) | |||
#ifdef DEBUG | #ifdef DEBUG | |||
#undef dbg | #undef dbg | |||
#define dbg(format, arg...) \ | #define dbg(format, arg...) \ | |||
do { \ | do { \ | |||
log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ | log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ | |||
} while (0) | } while (0) | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
udev.h | udev.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
* with this program; if not, write to the Free Software Foundation, In c., | * with this program; if not, write to the Free Software Foundation, In c., | |||
* 675 Mass Ave, Cambridge, MA 02139, USA. | * 675 Mass Ave, Cambridge, MA 02139, USA. | |||
* | * | |||
*/ | */ | |||
#ifndef _UDEV_H_ | #ifndef _UDEV_H_ | |||
#define _UDEV_H_ | #define _UDEV_H_ | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/param.h> | #include <sys/param.h> | |||
#include "libsysfs/sysfs/libsysfs.h" | ||||
#include "list.h" | #include "list.h" | |||
#include "logging.h" | ||||
#include "udev_libc_wrapper.h" | ||||
#include "udev_version.h" | ||||
#define COMMENT_CHARACTER '#' | #define COMMENT_CHARACTER '#' | |||
#define PATH_TO_NAME_CHAR '@' | #define PATH_TO_NAME_CHAR '@' | |||
#define LINE_SIZE 512 | #define LINE_SIZE 512 | |||
#define NAME_SIZE 128 | #define NAME_SIZE 128 | |||
#define PATH_SIZE 256 | #define PATH_SIZE 256 | |||
#define USER_SIZE 32 | #define USER_SIZE 32 | |||
#define SEQNUM_SIZE 32 | #define SEQNUM_SIZE 32 | |||
#define VALUE_SIZE 128 | #define VALUE_SIZE 128 | |||
#define DEFAULT_PARTITIONS_COUNT 15 | #define DEFAULT_PARTITIONS_COUNT 15 | |||
#define UDEV_ALARM_TIMEOUT 180 | #define UDEV_ALARM_TIMEOUT 180 | |||
#define DB_DIR ".udev/db" | #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) | |||
/* pipes */ | ||||
#define READ_END 0 | ||||
#define WRITE_END 1 | ||||
#define DB_DIR ".udev/db" | ||||
struct udev_rules; | struct udev_rules; | |||
enum device_type { | struct sysfs_device { | |||
DEV_UNKNOWN, | struct list_head node; /* for device cache */ | |||
DEV_CLASS, | struct sysfs_device *parent; /* already cached parent*/ | |||
DEV_BLOCK, | char devpath[PATH_SIZE]; | |||
DEV_NET, | char subsystem[NAME_SIZE]; /* $class/$bus/"drivers" */ | |||
DEV_DEVICE, | char kernel_name[NAME_SIZE]; /* device instance name */ | |||
char kernel_number[NAME_SIZE]; | ||||
char driver[NAME_SIZE]; /* device driver name */ | ||||
}; | }; | |||
struct udevice { | struct udevice { | |||
char devpath[PATH_SIZE]; | /* device event */ | |||
char subsystem[NAME_SIZE]; | struct sysfs_device *dev; /* points to dev_local by de | |||
fault */ | ||||
struct sysfs_device dev_local; | ||||
struct sysfs_device *dev_parent; /* current parent device use | ||||
d for matching */ | ||||
char action[NAME_SIZE]; | char action[NAME_SIZE]; | |||
enum device_type type; | /* node */ | |||
char name[PATH_SIZE]; | char name[PATH_SIZE]; | |||
struct list_head symlink_list; | struct list_head symlink_list; | |||
int symlink_final; | int symlink_final; | |||
char owner[USER_SIZE]; | char owner[USER_SIZE]; | |||
int owner_final; | int owner_final; | |||
char group[USER_SIZE]; | char group[USER_SIZE]; | |||
int group_final; | int group_final; | |||
mode_t mode; | mode_t mode; | |||
int mode_final; | int mode_final; | |||
dev_t devt; | dev_t devt; | |||
/* event processing */ | ||||
struct list_head run_list; | struct list_head run_list; | |||
int run_final; | int run_final; | |||
struct list_head env_list; | struct list_head env_list; | |||
char tmp_node[PATH_SIZE]; | char tmp_node[PATH_SIZE]; | |||
int partitions; | int partitions; | |||
int ignore_device; | int ignore_device; | |||
int ignore_remove; | int ignore_remove; | |||
char bus_id[NAME_SIZE]; | ||||
char program_result[PATH_SIZE]; | char program_result[PATH_SIZE]; | |||
char kernel_number[NAME_SIZE]; | ||||
char kernel_name[NAME_SIZE]; | ||||
int test_run; | int test_run; | |||
}; | }; | |||
extern int udev_init_device(struct udevice *udev, const char* devpath, cons | /* udev_config.c */ | |||
t char *subsystem, const char *action); | extern char udev_root[PATH_SIZE]; | |||
extern void udev_cleanup_device(struct udevice *udev); | extern char udev_config_filename[PATH_SIZE]; | |||
extern dev_t get_devt(struct sysfs_class_device *class_dev); | extern char udev_rules_filename[PATH_SIZE]; | |||
extern int udev_process_event(struct udev_rules *rules, struct udevice *ude | extern int udev_log_priority; | |||
v); | extern int udev_run; | |||
extern int udev_add_device(struct udevice *udev, struct sysfs_class_device | extern void udev_config_init(void); | |||
*class_dev); | ||||
extern int udev_remove_device(struct udevice *udev); | /* udev_device.c */ | |||
extern void udev_init_config(void); | extern struct udevice *udev_device_init(void); | |||
extern int udev_start(void); | extern void udev_device_cleanup(struct udevice *udev); | |||
extern int udev_make_node(struct udevice *udev, const char *file, dev_t dev | extern int udev_device_event(struct udev_rules *rules, struct udevice *udev | |||
t, mode_t mode, uid_t uid, gid_t gid); | ); | |||
extern dev_t udev_device_get_devt(struct udevice *udev); | ||||
/* udev_sysfs.c */ | ||||
extern char sysfs_path[PATH_SIZE]; | ||||
extern int sysfs_init(void); | ||||
extern void sysfs_cleanup(void); | ||||
extern void sysfs_device_set_values(struct sysfs_device *dev, const char *d | ||||
evpath, const char *subsystem); | ||||
extern struct sysfs_device *sysfs_device_get(const char *devpath); | ||||
extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *de | ||||
v); | ||||
extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct s | ||||
ysfs_device *dev, const char *subsystem); | ||||
extern char *sysfs_attr_get_value(const char *devpath, const char *attr_nam | ||||
e); | ||||
/* udev_node.c */ | ||||
extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t de | ||||
vt, mode_t mode, uid_t uid, gid_t gid); | ||||
extern int udev_node_add(struct udevice *udev, struct udevice *udev_old); | ||||
extern void udev_node_remove_symlinks(struct udevice *udev); | ||||
extern int udev_node_remove(struct udevice *udev); | ||||
/* udev_db.c */ | ||||
extern int udev_db_add_device(struct udevice *dev); | extern int udev_db_add_device(struct udevice *dev); | |||
extern int udev_db_delete_device(struct udevice *dev); | extern int udev_db_delete_device(struct udevice *dev); | |||
extern int udev_db_get_device(struct udevice *udev, const char *devpath); | extern int udev_db_get_device(struct udevice *udev, const char *devpath); | |||
extern int udev_db_lookup_name(const char *name, char *devpath, size_t len) ; | extern int udev_db_lookup_name(const char *name, char *devpath, size_t len) ; | |||
extern int udev_db_get_all_entries(struct list_head *name_list); | extern int udev_db_get_all_entries(struct list_head *name_list); | |||
extern char sysfs_path[PATH_SIZE]; | /* udev_utils.c */ | |||
extern char udev_root[PATH_SIZE]; | struct name_entry { | |||
extern char udev_config_filename[PATH_SIZE]; | struct list_head node; | |||
extern char udev_rules_filename[PATH_SIZE]; | char name[PATH_SIZE]; | |||
extern int udev_log_priority; | }; | |||
extern int udev_run; | extern int log_priority(const char *priority); | |||
extern char *name_list_add(struct list_head *name_list, const char *name, i | ||||
nt sort); | ||||
extern char *name_list_key_add(struct list_head *name_list, const char *key | ||||
, const char *value); | ||||
extern void name_list_cleanup(struct list_head *name_list); | ||||
extern int add_matching_files(struct list_head *name_list, const char *dirn | ||||
ame, const char *suffix); | ||||
/* udev_utils_string.c */ | ||||
extern int strcmp_pattern(const char *p, const char *s); | ||||
extern int string_is_true(const char *str); | ||||
extern void remove_trailing_chars(char *path, char c); | ||||
extern int utf8_encoded_valid_unichar(const char *str); | ||||
extern int replace_untrusted_chars(char *str); | ||||
/* udev_utils_file.c */ | ||||
extern int create_path(const char *path); | ||||
extern int delete_path(const char *path); | ||||
extern int file_map(const char *filename, char **buf, size_t *bufsize); | ||||
extern void file_unmap(void *buf, size_t bufsize); | ||||
extern int unlink_secure(const char *filename); | ||||
extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); | ||||
/* udev_utils_run.c */ | ||||
extern int pass_env_to_socket(const char *name, const char *devpath, const | ||||
char *action); | ||||
extern int run_program(const char *command, const char *subsystem, | ||||
char *result, size_t ressize, size_t *reslen, int log | ||||
); | ||||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
44 lines changed or deleted | 109 lines changed or added | |||
udev_libc_wrapper.h | udev_libc_wrapper.h | |||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
# define __NR_inotify_add_watch 152 | # define __NR_inotify_add_watch 152 | |||
# define __NR_inotify_rm_watch 156 | # define __NR_inotify_rm_watch 156 | |||
#elif defined (__arm__) | #elif defined (__arm__) | |||
# define __NR_inotify_init 316 | # define __NR_inotify_init 316 | |||
# define __NR_inotify_add_watch 317 | # define __NR_inotify_add_watch 317 | |||
# define __NR_inotify_rm_watch 318 | # define __NR_inotify_rm_watch 318 | |||
#elif defined (__sh__) | #elif defined (__sh__) | |||
# define __NR_inotify_init 290 | # define __NR_inotify_init 290 | |||
# define __NR_inotify_add_watch 291 | # define __NR_inotify_add_watch 291 | |||
# define __NR_inotify_rm_watch 292 | # define __NR_inotify_rm_watch 292 | |||
#elif defined (__hppa__) | ||||
# define __NR_inotify_init 269 | ||||
# define __NR_inotify_add_watch 270 | ||||
# define __NR_inotify_rm_watch 271 | ||||
#elif defined (__mips__) | ||||
# include <sgidefs.h> | ||||
# if _MIPS_SIM == _MIPS_SIM_ABI32 | ||||
# define __NR_Linux 4000 | ||||
# define __NR_inotify_init (__NR_Linux + 284) | ||||
# define __NR_inotify_add_watch (__NR_Linux + 285) | ||||
# define __NR_inotify_rm_watch (__NR_Linux + 286) | ||||
# elif _MIPS_SIM == _MIPS_SIM_ABI64 | ||||
# define __NR_Linux 5000 | ||||
# define __NR_inotify_init (__NR_Linux + 243) | ||||
# define __NR_inotify_add_watch (__NR_Linux + 244) | ||||
# define __NR_inotify_rm_watch (__NR_Linux + 245) | ||||
# elif _MIPS_SIM == _MIPS_SIM_NABI32 | ||||
# define __NR_Linux 6000 | ||||
# define __NR_inotify_init (__NR_Linux + 247) | ||||
# define __NR_inotify_add_watch (__NR_Linux + 248) | ||||
# define __NR_inotify_rm_watch (__NR_Linux + 249) | ||||
# endif | ||||
#else | #else | |||
#warning "inotify unsupported on this architecture!" | #warning "inotify unsupported on this architecture!" | |||
#endif | #endif | |||
#endif /* __NR_inotify_init */ | #endif /* __NR_inotify_init */ | |||
/* dummy if we don't have the syscalls defined */ | /* dummy if we don't have the syscalls defined */ | |||
#ifndef __NR_inotify_init | #ifndef __NR_inotify_init | |||
static inline int inotify_init(void) | static inline int inotify_init(void) | |||
{ | { | |||
return -1; | return -1; | |||
skipping to change at line 138 | skipping to change at line 160 | |||
#ifndef __FD_ZERO | #ifndef __FD_ZERO | |||
#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) | #define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) | |||
#endif | #endif | |||
/* missing in some lazy distros */ | /* missing in some lazy distros */ | |||
#ifndef NETLINK_KOBJECT_UEVENT | #ifndef NETLINK_KOBJECT_UEVENT | |||
#define NETLINK_KOBJECT_UEVENT 15 | #define NETLINK_KOBJECT_UEVENT 15 | |||
#endif | #endif | |||
#ifndef SO_RCVBUFFORCE | #ifndef SO_RCVBUFFORCE | |||
#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || define | ||||
d(__sparc_v9__) | ||||
#define SO_RCVBUFFORCE 0x100b | ||||
#else | ||||
#define SO_RCVBUFFORCE 33 | #define SO_RCVBUFFORCE 33 | |||
#endif | #endif | |||
#endif | ||||
extern uid_t lookup_user(const char *user); | extern uid_t lookup_user(const char *user); | |||
extern gid_t lookup_group(const char *group); | extern gid_t lookup_group(const char *group); | |||
extern size_t strlcpy(char *dst, const char *src, size_t size); | extern size_t strlcpy(char *dst, const char *src, size_t size); | |||
extern size_t strlcat(char *dst, const char *src, size_t size); | extern size_t strlcat(char *dst, const char *src, size_t size); | |||
#endif /* _UDEV_LIBC_WRAPPER_H_ */ | #endif /* _UDEV_LIBC_WRAPPER_H_ */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 27 lines changed or added | |||
udev_rules.h | udev_rules.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
* | * | |||
* You should have received a copy of the GNU General Public License al ong | * You should have received a copy of the GNU General Public License al ong | |||
* with this program; if not, write to the Free Software Foundation, In c., | * with this program; if not, write to the Free Software Foundation, In c., | |||
* 675 Mass Ave, Cambridge, MA 02139, USA. | * 675 Mass Ave, Cambridge, MA 02139, USA. | |||
* | * | |||
*/ | */ | |||
#ifndef UDEV_RULES_H | #ifndef UDEV_RULES_H | |||
#define UDEV_RULES_H | #define UDEV_RULES_H | |||
#include "libsysfs/sysfs/libsysfs.h" | ||||
#include "udev.h" | #include "udev.h" | |||
#include "list.h" | #include "list.h" | |||
#define PAIRS_MAX 5 | #define PAIRS_MAX 5 | |||
#define RULEFILE_SUFFIX ".rules" | #define RULEFILE_SUFFIX ".rules" | |||
enum key_operation { | enum key_operation { | |||
KEY_OP_UNSET, | KEY_OP_UNSET, | |||
KEY_OP_MATCH, | KEY_OP_MATCH, | |||
KEY_OP_NOMATCH, | KEY_OP_NOMATCH, | |||
skipping to change at line 107 | skipping to change at line 106 | |||
}; | }; | |||
struct udev_rules { | struct udev_rules { | |||
char *buf; | char *buf; | |||
size_t bufsize; | size_t bufsize; | |||
size_t current; | size_t current; | |||
int resolve_names; | int resolve_names; | |||
}; | }; | |||
extern int udev_rules_init(struct udev_rules *rules, int resolve_names); | extern int udev_rules_init(struct udev_rules *rules, int resolve_names); | |||
extern void udev_rules_close(struct udev_rules *rules); | extern void udev_rules_cleanup(struct udev_rules *rules); | |||
extern void udev_apply_format(struct udevice *udev, char *string, size_t ma | ||||
xsize, | ||||
struct sysfs_class_device *class_dev, struct s | ||||
ysfs_device *sysfs_device); | ||||
extern void udev_rules_iter_init(struct udev_rules *rules); | extern void udev_rules_iter_init(struct udev_rules *rules); | |||
extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); | extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); | |||
extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, co nst char *label); | extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, co nst char *label); | |||
extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *ud | extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *ud | |||
ev, | ev); | |||
struct sysfs_class_device *class_dev); | extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *ude | |||
extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *ude | v); | |||
v, | ||||
struct sysfs_class_device *class_dev, struct s | extern void udev_rules_apply_format(struct udevice *udev, char *string, siz | |||
ysfs_device *sysfs_dev); | e_t maxsize); | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
14 lines changed or deleted | 8 lines changed or added | |||
udev_version.h | udev_version.h | |||
---|---|---|---|---|
#define UDEV_VERSION "079" | /* Generated by make. */ | |||
#define UDEV_VERSION "092" | ||||
#define UDEV_ROOT "/dev" | #define UDEV_ROOT "/dev" | |||
#define UDEV_CONFIG_FILE "/etc/udev/udev.conf" | #define UDEV_CONFIG_FILE "/etc/udev/udev.conf" | |||
#define UDEV_RULES_FILE "/etc/udev/rules.d" | #define UDEV_RULES_FILE "/etc/udev/rules.d" | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
udevd.h | udevd.h | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
#define UDEV_MAGIC "udevd_" UDEV_VERSION | #define UDEV_MAGIC "udevd_" UDEV_VERSION | |||
#define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" | #define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" | |||
#define UDEVSEND_WAIT_MAX_SECONDS 3 | #define UDEVSEND_WAIT_MAX_SECONDS 3 | |||
#define UDEVSEND_WAIT_LOOP_PER_SECOND 10 | #define UDEVSEND_WAIT_LOOP_PER_SECOND 10 | |||
#define UDEVD_PRIORITY -4 | #define UDEVD_PRIORITY -4 | |||
#define UDEV_PRIORITY -2 | #define UDEV_PRIORITY -2 | |||
#define EVENT_QUEUE_DIR ".udev/queue" | #define EVENT_QUEUE_DIR ".udev/queue" | |||
#define EVENT_FAILED_DIR ".udev/failed" | #define EVENT_FAILED_DIR ".udev/failed" | |||
#define EVENT_SEQNUM ".udev/uevent_seqnum" | ||||
/* maximum limit of runnig childs */ | /* maximum limit of forked childs */ | |||
#define UDEVD_MAX_CHILDS 64 | #define UDEVD_MAX_CHILDS 64 | |||
/* start to throttle forking if maximum number of running childs in our ses sion is reached */ | /* start to throttle forking if maximum number of running childs in our ses sion is reached */ | |||
#define UDEVD_MAX_CHILDS_RUNNING 16 | #define UDEVD_MAX_CHILDS_RUNNING 16 | |||
/* environment buffer, should match the kernel's size in lib/kobject_uevent .h */ | /* environment buffer, should match the kernel's size in lib/kobject_uevent .h */ | |||
#define UEVENT_BUFFER_SIZE 1024 | #define UEVENT_BUFFER_SIZE 2048 | |||
#define UEVENT_NUM_ENVP 32 | #define UEVENT_NUM_ENVP 64 | |||
enum udevd_msg_type { | enum udevd_msg_type { | |||
UDEVD_UNKNOWN, | UDEVD_UNKNOWN, | |||
UDEVD_UEVENT_UDEVSEND, | UDEVD_UEVENT_UDEVSEND, | |||
UDEVD_UEVENT_INITSEND, | ||||
UDEVD_UEVENT_NETLINK, | UDEVD_UEVENT_NETLINK, | |||
UDEVD_STOP_EXEC_QUEUE, | UDEVD_STOP_EXEC_QUEUE, | |||
UDEVD_START_EXEC_QUEUE, | UDEVD_START_EXEC_QUEUE, | |||
UDEVD_SET_LOG_LEVEL, | UDEVD_SET_LOG_LEVEL, | |||
UDEVD_SET_MAX_CHILDS, | UDEVD_SET_MAX_CHILDS, | |||
UDEVD_RELOAD_RULES, | UDEVD_RELOAD_RULES, | |||
}; | }; | |||
struct udevd_msg { | struct udevd_msg { | |||
char magic[32]; | char magic[32]; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||