X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fudev%2Fudevd.c;h=0a3ab687fda0822a8a926dc11743cf512df69a5f;hp=92911efa90f86bc753542a6ab7801d3d7b0af802;hb=1d600df55bdba448b05d6f8293028d6b6702914b;hpb=a5c32cff1f56afe6f0c6c70d91a88a7a8238b2d7 diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 92911efa9..0a3ab687f 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -896,90 +896,6 @@ static int mem_size_mb(void) return memsize; } -static int convert_db(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - /* current database */ - if (access("/run/udev/data", F_OK) >= 0) - return 0; - - /* make sure we do not get here again */ - mkdir_p("/run/udev/data", 0755); - - /* old database */ - strscpyl(filename, sizeof(filename), "/dev/.udev/db", NULL); - if (access(filename, F_OK) < 0) - return 0; - - print_kmsg("converting old udev database\n"); - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - - /* try to find the old database for devices without a current one */ - if (udev_device_read_db(device, NULL) < 0) { - bool have_db; - const char *id; - struct stat stats; - char devpath[UTIL_PATH_SIZE]; - char from[UTIL_PATH_SIZE]; - - have_db = false; - - /* find database in old location */ - id = udev_device_get_id_filename(device); - strscpyl(from, sizeof(from), "/dev/.udev/db/", id, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with $subsys:$sysname name */ - strscpyl(from, sizeof(from), "/dev/.udev/db/", - udev_device_get_subsystem(device), ":", udev_device_get_sysname(device), NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with the encoded devpath name */ - util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - strscpyl(from, sizeof(from), "/dev/.udev/db/", devpath, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* write out new database */ - if (have_db) - udev_device_update_db(device); - } - udev_device_unref(device); - } - udev_enumerate_unref(udev_enumerate); - return 0; -} - static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) { int ctrl = -1, netlink = -1; @@ -1355,9 +1271,6 @@ int main(int argc, char *argv[]) goto exit; } - /* if needed, convert old database from earlier udev version */ - convert_db(udev); - if (children_max <= 0) { int memsize = mem_size_mb();