libsysfs.h | libsysfs.h | |||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
#define SYSFS_DRIVERS_NAME "drivers" | #define SYSFS_DRIVERS_NAME "drivers" | |||
#define SYSFS_MODULE_NAME "module" | #define SYSFS_MODULE_NAME "module" | |||
#define SYSFS_NAME_ATTRIBUTE "name" | #define SYSFS_NAME_ATTRIBUTE "name" | |||
#define SYSFS_UNKNOWN "unknown" | #define SYSFS_UNKNOWN "unknown" | |||
#define SYSFS_PATH_ENV "SYSFS_PATH" | #define SYSFS_PATH_ENV "SYSFS_PATH" | |||
#define SYSFS_PATH_MAX 256 | #define SYSFS_PATH_MAX 256 | |||
#define SYSFS_NAME_LEN 64 | #define SYSFS_NAME_LEN 64 | |||
#define SYSFS_BUS_ID_SIZE 32 | #define SYSFS_BUS_ID_SIZE 32 | |||
/* mount path for sysfs, can be overridden by exporting SYSFS_PATH */ | ||||
#define SYSFS_MNT_PATH "/sys" | ||||
enum sysfs_attribute_method { | enum sysfs_attribute_method { | |||
SYSFS_METHOD_SHOW = 0x01, /* attr can be read by user */ | SYSFS_METHOD_SHOW = 0x01, /* attr can be read by user */ | |||
SYSFS_METHOD_STORE = 0x02, /* attr can be changed by user */ | SYSFS_METHOD_STORE = 0x02, /* attr can be changed by user */ | |||
}; | }; | |||
/* NOTE: statically define mnt path for sysfs */ | ||||
#define SYSFS_MNT_PATH "/sys" | ||||
/* | /* | |||
* NOTE: | * NOTE: | |||
* 1. We have the statically allocated "name" as the first element of all | * 1. We have the statically allocated "name" as the first element of all | |||
* the structures. This feature is used in the "sorter" function for dlists | * the structures. This feature is used in the "sorter" function for dlists | |||
* 2. As is the case with attrlist | * 2. As is the case with attrlist | |||
* 3. As is the case with path | * 3. As is the case with path | |||
*/ | */ | |||
struct sysfs_attribute { | struct sysfs_attribute { | |||
char name[SYSFS_NAME_LEN]; | char name[SYSFS_NAME_LEN]; | |||
char path[SYSFS_PATH_MAX]; | char path[SYSFS_PATH_MAX]; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
logging.h | logging.h | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
* | * | |||
* 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 LOGGING_H | #ifndef LOGGING_H | |||
#define LOGGING_H | #define LOGGING_H | |||
#define err(format, arg...) do { } while (0) | ||||
#define info(format, arg...) do { } while (0) | #define info(format, arg...) do { } while (0) | |||
#define dbg(format, arg...) do { } while (0) | #define dbg(format, arg...) do { } while (0) | |||
#define logging_init(foo) do { } while (0) | #define logging_init(foo) do { } while (0) | |||
#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 | ||||
#define err(format, arg...) | ||||
\ | ||||
do { | ||||
\ | ||||
log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## arg); | ||||
\ | ||||
} while (0) | ||||
#undef info | #undef info | |||
#define info(format, arg...) \ | #define info(format, arg...) \ | |||
do { \ | do { \ | |||
log_message(LOG_INFO , format , ## arg); \ | log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## 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__ , ## ar g); \ | log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ | |||
} while (0) | } while (0) | |||
#endif | #endif | |||
extern void log_message(int level, const char *format, ...) | extern void log_message(int priority, const char *format, ...) | |||
__attribute__ ((format (printf, 2, 3))); | __attribute__ ((format (printf, 2, 3))); | |||
#undef logging_init | #undef logging_init | |||
static inline void logging_init(const char *program_name) | static inline void logging_init(const char *program_name) | |||
{ | { | |||
openlog(program_name, LOG_PID, LOG_DAEMON); | openlog(program_name, LOG_PID, LOG_DAEMON); | |||
} | } | |||
#undef logging_close | #undef logging_close | |||
static inline void logging_close(void) | static inline void logging_close(void) | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 13 lines changed or added | |||
udev.h | udev.h | |||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
DEV_UNKNOWN, | DEV_UNKNOWN, | |||
DEV_CLASS, | DEV_CLASS, | |||
DEV_BLOCK, | DEV_BLOCK, | |||
DEV_NET, | DEV_NET, | |||
DEV_DEVICE, | DEV_DEVICE, | |||
}; | }; | |||
struct udevice { | struct udevice { | |||
char devpath[PATH_SIZE]; | char devpath[PATH_SIZE]; | |||
char subsystem[NAME_SIZE]; | char subsystem[NAME_SIZE]; | |||
char action[NAME_SIZE]; | ||||
enum device_type type; | enum device_type type; | |||
char name[PATH_SIZE]; | char name[PATH_SIZE]; | |||
char devname[PATH_SIZE]; | char devname[PATH_SIZE]; | |||
struct list_head symlink_list; | struct list_head symlink_list; | |||
char owner[USER_SIZE]; | char owner[USER_SIZE]; | |||
char group[USER_SIZE]; | char group[USER_SIZE]; | |||
mode_t mode; | mode_t mode; | |||
dev_t devt; | dev_t devt; | |||
struct list_head run_list; | ||||
char tmp_node[PATH_SIZE]; | char tmp_node[PATH_SIZE]; | |||
int partitions; | int partitions; | |||
int ignore_device; | ||||
int ignore_remove; | int ignore_remove; | |||
int config_line; | int config_line; | |||
char config_file[PATH_SIZE]; | char config_file[PATH_SIZE]; | |||
char bus_id[NAME_SIZE]; | char bus_id[NAME_SIZE]; | |||
char program_result[PATH_SIZE]; | char program_result[PATH_SIZE]; | |||
char kernel_number[NAME_SIZE]; | char kernel_number[NAME_SIZE]; | |||
char kernel_name[NAME_SIZE]; | char kernel_name[NAME_SIZE]; | |||
int test_run; | int test_run; | |||
}; | }; | |||
skipping to change at line 95 | skipping to change at line 98 | |||
extern void udev_init_config(void); | extern void udev_init_config(void); | |||
extern int udev_start(void); | extern int udev_start(void); | |||
extern void udev_multiplex_directory(struct udevice *udev, const char *base dir, const char *suffix); | extern void udev_multiplex_directory(struct udevice *udev, const char *base dir, const char *suffix); | |||
extern int udev_make_node(struct udevice *udev, const char *file, dev_t dev t, mode_t mode, uid_t uid, gid_t gid); | extern int udev_make_node(struct udevice *udev, const char *file, dev_t dev t, mode_t mode, uid_t uid, gid_t gid); | |||
extern char sysfs_path[PATH_SIZE]; | extern char sysfs_path[PATH_SIZE]; | |||
extern char udev_root[PATH_SIZE]; | extern char udev_root[PATH_SIZE]; | |||
extern char udev_db_path[PATH_SIZE]; | extern char udev_db_path[PATH_SIZE]; | |||
extern char udev_config_filename[PATH_SIZE]; | extern char udev_config_filename[PATH_SIZE]; | |||
extern char udev_rules_filename[PATH_SIZE]; | extern char udev_rules_filename[PATH_SIZE]; | |||
extern int udev_log; | extern int udev_log_priority; | |||
extern int udev_run; | ||||
extern int udev_dev_d; | extern int udev_dev_d; | |||
extern int udev_hotplug_d; | extern int udev_hotplug_d; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
udev_rules.h | udev_rules.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#ifndef UDEV_RULES_H | #ifndef UDEV_RULES_H | |||
#define UDEV_RULES_H | #define UDEV_RULES_H | |||
#include "libsysfs/sysfs/libsysfs.h" | #include "libsysfs/sysfs/libsysfs.h" | |||
#include "udev.h" | #include "udev.h" | |||
#include "list.h" | #include "list.h" | |||
#define KEY_KERNEL "KERNEL" | #define KEY_KERNEL "KERNEL" | |||
#define KEY_SUBSYSTEM "SUBSYSTEM" | #define KEY_SUBSYSTEM "SUBSYSTEM" | |||
#define KEY_ACTION "ACTION" | ||||
#define KEY_BUS "BUS" | #define KEY_BUS "BUS" | |||
#define KEY_ID "ID" | #define KEY_ID "ID" | |||
#define KEY_PROGRAM "PROGRAM" | #define KEY_PROGRAM "PROGRAM" | |||
#define KEY_RESULT "RESULT" | #define KEY_RESULT "RESULT" | |||
#define KEY_DRIVER "DRIVER" | #define KEY_DRIVER "DRIVER" | |||
#define KEY_SYSFS "SYSFS" | #define KEY_SYSFS "SYSFS" | |||
#define KEY_ENV "ENV" | #define KEY_ENV "ENV" | |||
#define KEY_NAME "NAME" | #define KEY_NAME "NAME" | |||
#define KEY_SYMLINK "SYMLINK" | #define KEY_SYMLINK "SYMLINK" | |||
#define KEY_OWNER "OWNER" | #define KEY_OWNER "OWNER" | |||
#define KEY_GROUP "GROUP" | #define KEY_GROUP "GROUP" | |||
#define KEY_MODE "MODE" | #define KEY_MODE "MODE" | |||
#define KEY_RUN "RUN" | ||||
#define KEY_OPTIONS "OPTIONS" | #define KEY_OPTIONS "OPTIONS" | |||
#define OPTION_LAST_RULE "last_rule" | #define OPTION_LAST_RULE "last_rule" | |||
#define OPTION_IGNORE_DEVICE "ignore_device" | #define OPTION_IGNORE_DEVICE "ignore_device" | |||
#define OPTION_IGNORE_REMOVE "ignore_remove" | #define OPTION_IGNORE_REMOVE "ignore_remove" | |||
#define OPTION_PARTITIONS "all_partitions" | #define OPTION_PARTITIONS "all_partitions" | |||
#define KEY_SYSFS_PAIRS_MAX 5 | #define KEY_SYSFS_PAIRS_MAX 5 | |||
#define KEY_ENV_PAIRS_MAX 5 | #define KEY_ENV_PAIRS_MAX 5 | |||
#define RULEFILE_SUFFIX ".rules" | #define RULEFILE_SUFFIX ".rules" | |||
enum key_operation { | enum key_operation { | |||
KEY_OP_UNKNOWN, | KEY_OP_UNSET, | |||
KEY_OP_MATCH, | KEY_OP_MATCH, | |||
KEY_OP_NOMATCH, | KEY_OP_NOMATCH, | |||
KEY_OP_ADD, | KEY_OP_ADD, | |||
KEY_OP_ASSIGN, | KEY_OP_ASSIGN, | |||
}; | }; | |||
struct key_pair { | struct key_pair { | |||
char name[NAME_SIZE]; | char name[NAME_SIZE]; | |||
char value[VALUE_SIZE]; | char value[VALUE_SIZE]; | |||
enum key_operation operation; | enum key_operation operation; | |||
}; | }; | |||
struct udev_rule { | struct udev_rule { | |||
struct list_head node; | struct list_head node; | |||
char kernel[NAME_SIZE]; | char kernel[NAME_SIZE]; | |||
enum key_operation kernel_operation; | enum key_operation kernel_operation; | |||
char subsystem[NAME_SIZE]; | char subsystem[NAME_SIZE]; | |||
enum key_operation subsystem_operation; | enum key_operation subsystem_operation; | |||
char action[NAME_SIZE]; | ||||
enum key_operation action_operation; | ||||
char bus[NAME_SIZE]; | char bus[NAME_SIZE]; | |||
enum key_operation bus_operation; | enum key_operation bus_operation; | |||
char id[NAME_SIZE]; | char id[NAME_SIZE]; | |||
enum key_operation id_operation; | enum key_operation id_operation; | |||
char driver[NAME_SIZE]; | char driver[NAME_SIZE]; | |||
enum key_operation driver_operation; | enum key_operation driver_operation; | |||
char program[PATH_SIZE]; | char program[PATH_SIZE]; | |||
enum key_operation program_operation; | enum key_operation program_operation; | |||
char result[PATH_SIZE]; | char result[PATH_SIZE]; | |||
enum key_operation result_operation; | enum key_operation result_operation; | |||
struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX]; | struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX]; | |||
int sysfs_pair_count; | int sysfs_pair_count; | |||
struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; | struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; | |||
int env_pair_count; | int env_pair_count; | |||
char name[PATH_SIZE]; | char name[PATH_SIZE]; | |||
char symlink[PATH_SIZE]; | char symlink[PATH_SIZE]; | |||
char owner[USER_SIZE]; | char owner[USER_SIZE]; | |||
char group[USER_SIZE]; | char group[USER_SIZE]; | |||
mode_t mode; | mode_t mode; | |||
char run[PATH_SIZE]; | ||||
int last_rule; | int last_rule; | |||
int ignore_device; | int ignore_device; | |||
int ignore_remove; | int ignore_remove; | |||
int partitions; | int partitions; | |||
char config_file[PATH_SIZE]; | char config_file[PATH_SIZE]; | |||
int config_line; | int config_line; | |||
}; | }; | |||
extern struct list_head udev_rule_list; | extern struct list_head udev_rule_list; | |||
extern int udev_rules_init(void); | extern int udev_rules_init(void); | |||
extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_dev ice *class_dev); | extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_dev ice *class_dev); | |||
extern int udev_rules_get_run(struct udevice *udev); | ||||
extern void udev_rules_close(void); | extern void udev_rules_close(void); | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
udev_utils.h | udev_utils.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#ifndef _UDEV_LIB_H_ | #ifndef _UDEV_LIB_H_ | |||
#define _UDEV_LIB_H_ | #define _UDEV_LIB_H_ | |||
#include "udev.h" | #include "udev.h" | |||
struct name_entry { | struct name_entry { | |||
struct list_head node; | struct list_head node; | |||
char name[PATH_SIZE]; | char name[PATH_SIZE]; | |||
}; | }; | |||
extern int udev_init_device(struct udevice *udev, const char* devpath, cons t char *subsystem); | extern int udev_init_device(struct udevice *udev, const char* devpath, cons t char *subsystem, const char *action); | |||
extern void udev_cleanup_device(struct udevice *udev); | extern void udev_cleanup_device(struct udevice *udev); | |||
extern int kernel_release_satisfactory(unsigned int version, unsigned int p atchlevel, unsigned int sublevel); | extern int kernel_release_satisfactory(unsigned int version, unsigned int p atchlevel, unsigned int sublevel); | |||
extern int create_path(const char *path); | extern int create_path(const char *path); | |||
extern int parse_get_pair(char **orig_string, char **left, char **right); | extern int parse_get_pair(char **orig_string, char **left, char **right); | |||
extern int unlink_secure(const char *filename); | extern int unlink_secure(const char *filename); | |||
extern int file_map(const char *filename, char **buf, size_t *bufsize); | extern int file_map(const char *filename, char **buf, size_t *bufsize); | |||
extern void file_unmap(char *buf, size_t bufsize); | extern void file_unmap(char *buf, size_t bufsize); | |||
extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); | extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); | |||
extern void no_trailing_slash(char *path); | extern void remove_trailing_char(char *path, char c); | |||
extern void replace_untrusted_chars(char *string); | ||||
extern int name_list_add(struct list_head *name_list, const char *name, int sort); | extern int name_list_add(struct list_head *name_list, const char *name, int sort); | |||
extern int add_matching_files(struct list_head *name_list, const char *dirn ame, const char *suffix); | extern int add_matching_files(struct list_head *name_list, const char *dirn ame, const char *suffix); | |||
extern int execute_command(const char *command, const char *subsystem); | ||||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added | |||
udev_version.h | udev_version.h | |||
---|---|---|---|---|
#define UDEV_VERSION "056" | #define UDEV_VERSION "057" | |||
#define UDEV_ROOT "/udev" | #define UDEV_ROOT "/udev" | |||
#define UDEV_DB "/udev/.udevdb" | #define UDEV_DB "/udev/.udevdb" | |||
#define UDEV_CONFIG_DIR "/etc/udev" | #define UDEV_CONFIG_DIR "/etc/udev" | |||
#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" | |||
#define UDEV_LOG_DEFAULT "yes" | ||||
#define UDEV_BIN "/sbin/udev" | #define UDEV_BIN "/sbin/udev" | |||
#define UDEVD_BIN "/sbin/udevd" | #define UDEVD_BIN "/sbin/udevd" | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||