diff options
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/libudev-device-private.c | 7 | ||||
-rw-r--r-- | libudev/libudev-device.c | 11 | ||||
-rw-r--r-- | libudev/libudev-private.h | 2 |
3 files changed, 20 insertions, 0 deletions
diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 6d72d328bd..ee9e297cea 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -134,6 +134,13 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; } + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + if (has_info) { size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index ccd4a70677..a141dadf0a 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -89,6 +89,7 @@ struct udev_device { bool uevent_loaded; bool is_initialized; bool sysattr_list_read; + bool db_persist; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -1774,3 +1775,13 @@ int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) udev_device_add_property(udev_device, "IFINDEX", num); return 0; } + +bool udev_device_get_db_persist(struct udev_device *udev_device) +{ + return udev_device->db_persist; +} + +void udev_device_set_db_persist(struct udev_device *udev_device) +{ + udev_device->db_persist = true; +} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f6137b5dc7..c57a89873c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -109,6 +109,8 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); int udev_device_get_ifindex(struct udev_device *udev_device); int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex); void udev_device_set_info_loaded(struct udev_device *device); +bool udev_device_get_db_persist(struct udev_device *udev_device); +void udev_device_set_db_persist(struct udev_device *udev_device); /* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); |