udev.h revision 225cb03bd851adc6d269b13bdf2b1bfded2b96b9
b3ae710c251d0ce5cf2cef63208e325497b5e323Zbigniew Jędrzejewski-Szmek * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
b3ae710c251d0ce5cf2cef63208e325497b5e323Zbigniew Jędrzejewski-Szmek * Copyright (C) 2003-2006 Kay Sievers <kay.sievers@vrfy.org>
cff452c7e974db5053cdbd0d7bbbab2e3b4c91b9Kay Sievers * This program is free software; you can redistribute it and/or modify it
cff452c7e974db5053cdbd0d7bbbab2e3b4c91b9Kay Sievers * under the terms of the GNU General Public License as published by the
cff452c7e974db5053cdbd0d7bbbab2e3b4c91b9Kay Sievers * Free Software Foundation version 2 of the License.
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * This program is distributed in the hope that it will be useful, but
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * WITHOUT ANY WARRANTY; without even the implied warranty of
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers * General Public License for more details.
20ffc4c4a9226b0e45cc02ad9c0108981626c0bbKay Sievers * You should have received a copy of the GNU General Public License along
04ac799283f517672a5424e7c5bf066cfa4ca020Zbigniew Jędrzejewski-Szmek * with this program; if not, write to the Free Software Foundation, Inc.,
04ac799283f517672a5424e7c5bf066cfa4ca020Zbigniew Jędrzejewski-Szmek * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
a2b135e3d8d5dfa103a87e304ed8a91b01fdbb02Lennart Poettering#define ALLOWED_CHARS_FILE ALLOWED_CHARS "/"
b107b705cc97d3033e37c44229deb37b5aa31df5Lennart Poettering#define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?,"
769918ecd30c0f7ee6e87b9aa6226d956bd2f530Lennart Poettering#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
726a6e963056a7238a512cfe6ce612af2c2d1419Lennart Poettering struct list_head node; /* for device cache */
7ba4fedb8048182fb765bd6ae5aa1e548389bef3Lennart Poettering struct sysfs_device *parent; /* already cached parent*/
23fae27185ddde98706faac0f45d77b11ecd66e6Lennart Poettering char subsystem[NAME_SIZE]; /* $class, $bus, drivers, module */
650264033f2f98f6319513958d94d59078654af8Lennart Poettering char kernel[NAME_SIZE]; /* device instance name */
650264033f2f98f6319513958d94d59078654af8Lennart Poettering char driver[NAME_SIZE]; /* device driver name */
650264033f2f98f6319513958d94d59078654af8Lennart Poettering /* device event */
650264033f2f98f6319513958d94d59078654af8Lennart Poettering struct sysfs_device *dev; /* points to dev_local by default */
650264033f2f98f6319513958d94d59078654af8Lennart Poettering struct sysfs_device *dev_parent; /* current parent device used for matching */
488ad3b32a7e2b5b1380abf4a15e5f65fa65f3feLennart Poettering /* event processing */
ef417cfd2211ae017a38b9796c6db29130133e63Zbigniew Jędrzejewski-Szmekextern char udev_root[PATH_SIZE];
ef417cfd2211ae017a38b9796c6db29130133e63Zbigniew Jędrzejewski-Szmekextern char udev_config_filename[PATH_SIZE];
3333d748facc15f49935b6b793490ba0824976e6Zbigniew Jędrzejewski-Szmekextern char udev_rules_dir[PATH_SIZE];
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern void udev_config_init(void);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern struct udevice *udev_device_init(struct udevice *udev);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern void udev_device_cleanup(struct udevice *udev);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern int udev_device_event(struct udev_rules *rules, struct udevice *udev);
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284Lennart Poetteringextern dev_t udev_device_get_devt(struct udevice *udev);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern int sysfs_init(void);
ebcf1f97de4f6b1580ae55eb56b1a3939fe6b602Lennart Poetteringextern void sysfs_cleanup(void);
47c94a96df29080f8b3a97e7362df4e9c6ba3265Lennart Poetteringextern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath,
47c94a96df29080f8b3a97e7362df4e9c6ba3265Lennart Poettering const char *subsystem, const char *driver);
718db96199eb307751264e4163555662c9a389faLennart Poetteringextern struct sysfs_device *sysfs_device_get(const char *devpath);
718db96199eb307751264e4163555662c9a389faLennart Poetteringextern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
718db96199eb307751264e4163555662c9a389faLennart Poetteringextern char *sysfs_attr_get_value(const char *devpath, const char *attr_name);
718db96199eb307751264e4163555662c9a389faLennart Poetteringextern int sysfs_resolve_link(char *path, size_t size);
718db96199eb307751264e4163555662c9a389faLennart Poetteringextern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id);
94676f3e9352cbf1f72e0a512ee0d2ed83ff676dLennart Poetteringextern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid);
6fd4d0209827e5c3e52fa8c7144852f550f8f95cLennart Poetteringextern void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old);
ced4d06784dbb19666688947901961f949f2aa6dLennart Poetteringextern int udev_node_add(struct udevice *udev);
ced4d06784dbb19666688947901961f949f2aa6dLennart Poetteringextern int udev_node_remove(struct udevice *udev);
416446221d905b6815175dc4d525d27f8ae43d1bLennart Poetteringextern int udev_db_add_device(struct udevice *dev);
416446221d905b6815175dc4d525d27f8ae43d1bLennart Poetteringextern int udev_db_delete_device(struct udevice *dev);
7f79cd7109a60810140a045cc725291fc5515264Lennart Poetteringextern int udev_db_rename(const char *devpath_old, const char *devpath);
0aafd43d235982510d1c40564079f7bcec0c7c19Lennart Poetteringextern int udev_db_get_device(struct udevice *udev, const char *devpath);
19aadacf92ad86967ffb678e37b2ff9e83cb9480Jan Engelhardtextern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list);
19aadacf92ad86967ffb678e37b2ff9e83cb9480Jan Engelhardtextern int udev_db_get_all_entries(struct list_head *name_list);
6aaa8c2f783cd1b3ac27c5ce40625d032e7e3d71Zbigniew Jędrzejewski-Szmekextern int log_priority(const char *priority);
c3bb87dbab8b79bb9253407cb5b7f3e6fe8db395Lennart Poetteringextern struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort);
e1b7e7ec9b34ae6ae54a4c8084395cbf2bfe9960Lennart Poetteringextern struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value);
18d4e7c26e7806ac363d19989df7144d5058ce41Lennart Poetteringextern int name_list_key_remove(struct list_head *name_list, const char *key);
bdeeb6b543a2a2d0a494f17b85f1498859cdfc2fLennart Poetteringextern void name_list_cleanup(struct list_head *name_list);
bdeeb6b543a2a2d0a494f17b85f1498859cdfc2fLennart Poetteringextern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix);
bdeeb6b543a2a2d0a494f17b85f1498859cdfc2fLennart Poetteringextern uid_t lookup_user(const char *user);
bdeeb6b543a2a2d0a494f17b85f1498859cdfc2fLennart Poetteringextern gid_t lookup_group(const char *group);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringextern int string_is_true(const char *str);
466784c8710e5cb0e0b86a16506d992d7ec5b619Kay Sieversextern void remove_trailing_chars(char *path, char c);
4e09014daf8f98584b3f15e64e93bed232e70a6bLennart Poetteringextern int utf8_encoded_valid_unichar(const char *str);
4e09014daf8f98584b3f15e64e93bed232e70a6bLennart Poetteringextern int replace_chars(char *str, const char *white);
7973ca1927e1f3bac9438f3529458c9ff868905dLennart Poetteringextern int file_map(const char *filename, char **buf, size_t *bufsize);
7973ca1927e1f3bac9438f3529458c9ff868905dLennart Poetteringextern void file_unmap(void *buf, size_t bufsize);
7973ca1927e1f3bac9438f3529458c9ff868905dLennart Poetteringextern int unlink_secure(const char *filename);
7973ca1927e1f3bac9438f3529458c9ff868905dLennart Poetteringextern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
7973ca1927e1f3bac9438f3529458c9ff868905dLennart Poettering/* udev commands */
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern int udevmonitor(int argc, char *argv[], char *envp[]);
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poetteringextern int udevinfo(int argc, char *argv[], char *envp[]);
80caea6cc72ebd311a311b1527cc6b87201c13bfLennart Poetteringextern int udevcontrol(int argc, char *argv[], char *envp[]);
ab9716c2489f9141ed13ec22dbb216b3e6fbd6b5Lennart Poetteringextern int udevtrigger(int argc, char *argv[], char *envp[]);
df98a87ba389bdfc0359beedf47557411f3af434Lennart Poetteringextern int udevsettle(int argc, char *argv[], char *envp[]);
df98a87ba389bdfc0359beedf47557411f3af434Lennart Poetteringextern int udevtest(int argc, char *argv[], char *envp[]);