- /* write a database file */
- strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL);
- mkdir_parents(filename_tmp, 0755);
- f = fopen(filename_tmp, "we");
- if (f == NULL)
- return log_debug_errno(errno, "unable to create temporary db file '%s': %m", filename_tmp);
-
- /*
- * 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) {
- struct udev_list_entry *list_entry;
-
- if (major(udev_device_get_devnum(udev_device)) > 0) {
- udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device))
- fprintf(f, "S:%s\n", udev_list_entry_get_name(list_entry) + strlen("/dev/"));
- if (udev_device_get_devlink_priority(udev_device) != 0)
- fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device));
- if (udev_device_get_watch_handle(udev_device) >= 0)
- fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device));
- }
-
- if (udev_device_get_usec_initialized(udev_device) > 0)
- fprintf(f, "I:"USEC_FMT"\n", udev_device_get_usec_initialized(udev_device));
-
- udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
- if (!udev_list_entry_get_num(list_entry))
- continue;
- fprintf(f, "E:%s=%s\n",
- udev_list_entry_get_name(list_entry),
- udev_list_entry_get_value(list_entry));
- }
-
- udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device))
- fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry));
+ return gid;
+}
+
+void udev_device_ensure_usec_initialized(struct udev_device *udev_device, struct udev_device *udev_device_old) {
+ sd_device *device_old = NULL;
+
+ assert(udev_device);
+
+ if (udev_device_old)
+ device_old = udev_device_old->device;
+
+ device_ensure_usec_initialized(udev_device->device, device_old);
+}
+
+char **udev_device_get_properties_envp(struct udev_device *udev_device) {
+ char **envp;
+ int r;
+
+ assert(udev_device);
+
+ r = device_get_properties_strv(udev_device->device, &envp);
+ if (r < 0) {
+ errno = -r;
+ return NULL;