udev.h revision bd284db142c1d3fb6e2a709678c8828c12c52466
b7ff1e47da4653d2ff1ec7b489e6067fed29d8c5Lennart Poettering * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
c904f64d84db8c4eebedf210ba10893f19ba05edLennart Poettering * Copyright (C) 2003-2008 Kay Sievers <kay.sievers@vrfy.org>
7d640cdf66a7c032c871ccfe0ee4ad56f7e3869bLennart Poettering * This program is free software: you can redistribute it and/or modify
62170515a17d0771aa38c8e7711a7a60c8d14d2fLennart Poettering * it under the terms of the GNU General Public License as published by
f80781eaf9f927d7b4d5e66116e3f3a4242e6fa1Lennart Poettering * the Free Software Foundation, either version 2 of the License, or
f80781eaf9f927d7b4d5e66116e3f3a4242e6fa1Lennart Poettering * (at your option) any later version.
222ae6a8d7e27dd36552cb9574e63cbdfdf2d264Lennart Poettering * This program is distributed in the hope that it will be useful,
222ae6a8d7e27dd36552cb9574e63cbdfdf2d264Lennart Poettering * but WITHOUT ANY WARRANTY; without even the implied warranty of
c904f64d84db8c4eebedf210ba10893f19ba05edLennart Poettering * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c904f64d84db8c4eebedf210ba10893f19ba05edLennart Poettering * GNU General Public License for more details.
cebe0d41e4d5b3fdd9d521116cc029bcb819c90dLennart Poettering * You should have received a copy of the GNU General Public License
099663ff8c117303af369a4d412dafed0c5614c2Lennart Poettering * along with this program. If not, see <http://www.gnu.org/licenses/>.
3d3961f26770b2949a30a72457e1660969bc17b8Lennart Poettering#define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd"
3d3961f26770b2949a30a72457e1660969bc17b8Lennart Poettering#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
73090dc815390f4fca4e3ed8a7e1d3806605daaaLennart Poetteringstatic inline void logging_init(const char *program_name)
7d76f312889d54dcfe6fdde6eb055e890e7a615bLennart Poettering openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON);
73090dc815390f4fca4e3ed8a7e1d3806605daaaLennart Poetteringstatic inline void logging_msg(struct udev *udev, int priority,
73090dc815390f4fca4e3ed8a7e1d3806605daaaLennart Poettering const char *file, int line, const char *fn,
abf96c874cd644cf6c66da95d376aa330382376eLennart Poetteringstatic inline void logging_close(void)
b9a2a36b519ccd79c4198e7dda4e657d597a14adLennart Poettering unsigned long long int delaying_seqnum;
619c2581a2aee8a148caa3b5bec1487fe1a868c6Kay Sieversextern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
619c2581a2aee8a148caa3b5bec1487fe1a868c6Kay Sieversextern void udev_rules_unref(struct udev_rules *rules);
619c2581a2aee8a148caa3b5bec1487fe1a868c6Kay Sieversextern int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event);
f9276855a1d270b6c3f857cdaf2c4b49920c2228Lennart Poetteringextern struct udev_event *udev_event_new(struct udev_device *dev);
260abb780a135e4cae8c10715c7e85675efc345aLennart Poetteringextern void udev_event_unref(struct udev_event *event);
260abb780a135e4cae8c10715c7e85675efc345aLennart Poetteringextern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules);
260abb780a135e4cae8c10715c7e85675efc345aLennart Poetteringextern int udev_event_execute_run(struct udev_event *event);
260abb780a135e4cae8c10715c7e85675efc345aLennart Poetteringextern void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize);
260abb780a135e4cae8c10715c7e85675efc345aLennart Poetteringextern int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
260abb780a135e4cae8c10715c7e85675efc345aLennart Poettering char *result, size_t maxsize, int read_value);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern void udev_watch_restore(struct udev *udev);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern void udev_watch_begin(struct udev *udev, struct udev_device *dev);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern void udev_watch_clear(struct udev *udev, struct udev_device *dev);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern void udev_watch_end(struct udev *udev, int wd);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern const char *udev_watch_lookup(struct udev *udev, int wd);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid);
7d9e57d2cf671f7173324942e0eb9de0d030c505Kay Sieversextern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
3f7a8c4e9f1d3ce48919e24eb2c9d56dd6fd88d8Kay Sieversextern int udev_node_remove(struct udev_device *dev);
2791a8f8dc8764a9247cdba3562bd4c04010f144Lennart Poetteringextern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);
a49408ec64063023524b964064d393c1fce36e4aKay Sieversextern int util_create_path(struct udev *udev, const char *path);
a49408ec64063023524b964064d393c1fce36e4aKay Sieversextern int util_delete_path(struct udev *udev, const char *path);
a8f11321c209830a35edd0357e8def5d4437d854Lennart Poetteringextern int util_unlink_secure(struct udev *udev, const char *filename);
a8f11321c209830a35edd0357e8def5d4437d854Lennart Poetteringextern uid_t util_lookup_user(struct udev *udev, const char *user);
e85138e67761beeb15967150109734b04862ae05Lennart Poetteringextern gid_t util_lookup_group(struct udev *udev, const char *group);
e85138e67761beeb15967150109734b04862ae05Lennart Poetteringextern int util_run_program(struct udev *udev, const char *command, char **envp,
81253930180bac6b6fb372a9c7bea724bd795c86Lennart Poettering char *result, size_t ressize, size_t *reslen);
7fc7012b8b54bdd6610d32649d4ee9c938a4843dLennart Poetteringextern int util_resolve_subsys_kernel(struct udev *udev, const char *string,
430c18ed7f576fd9041b0a02e7c4210bdd020a25Lennart Poettering char *result, size_t maxsize, int read_value);
a49408ec64063023524b964064d393c1fce36e4aKay Sieversstatic inline void udev_selinux_init(struct udev *udev) {}
3db48a7850d9ceb8e81ec4ad410520c05c008763Lennart Poetteringstatic inline void udev_selinux_exit(struct udev *udev) {}
3db48a7850d9ceb8e81ec4ad410520c05c008763Lennart Poetteringstatic inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
3db48a7850d9ceb8e81ec4ad410520c05c008763Lennart Poetteringstatic inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
2e0d98fa87a4e399763c8235abe56be4f8ac7fb8Lennart Poetteringstatic inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
62170515a17d0771aa38c8e7711a7a60c8d14d2fLennart Poetteringextern void udev_selinux_init(struct udev *udev);
a49408ec64063023524b964064d393c1fce36e4aKay Sieversextern void udev_selinux_exit(struct udev *udev);
62170515a17d0771aa38c8e7711a7a60c8d14d2fLennart Poetteringextern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
b5c6cf87342bedeb67fbbc4f3f512af1603a461cLennart Poetteringextern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
b5c6cf87342bedeb67fbbc4f3f512af1603a461cLennart Poetteringextern void udev_selinux_resetfscreatecon(struct udev *udev);
3185a36b05d53757a412f847d8c510978b9b00f0Lennart Poettering/* udevadm commands */
b8bb3e8f346468e61dcc7a6aba5e7ac9c623d964Lennart Poetteringextern int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
b8bb3e8f346468e61dcc7a6aba5e7ac9c623d964Lennart Poetteringextern int udevadm_info(struct udev *udev, int argc, char *argv[]);
f959c5e63a9080cbff42ac4160154f8a6b508e7aLennart Poetteringextern int udevadm_control(struct udev *udev, int argc, char *argv[]);
b9a2a36b519ccd79c4198e7dda4e657d597a14adLennart Poetteringextern int udevadm_trigger(struct udev *udev, int argc, char *argv[]);
7f6d613516020bf390d8de25bbbb2551ea8dade0Lennart Poetteringextern int udevadm_settle(struct udev *udev, int argc, char *argv[]);
c32e0c40f7e706e3ebcd101187d5ced96f083491Lennart Poetteringextern int udevadm_test(struct udev *udev, int argc, char *argv[]);