From: Daniel Golle Date: Fri, 23 Jul 2021 21:30:56 +0000 (+0100) Subject: Revert "block: resolve /dev/mapper/* name for /dev/dm-0 when hotplugging" X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9cc96af29362db4a9280d492925b0f0dd891dd0f;p=project%2Ffstools.git Revert "block: resolve /dev/mapper/* name for /dev/dm-0 when hotplugging" Turns out using the device nodes /dev/mapper/* turns out to be a bad idea to begin with. Will use /dev/dm-* instead. This reverts commit 2f42515977adef7c026eb380ed2423c533cf8f3d. Signed-off-by: Daniel Golle --- diff --git a/block.c b/block.c index 4416c91..5b0517e 100644 --- a/block.c +++ b/block.c @@ -1171,28 +1171,7 @@ static int mount_action(char *action, char *device, int type) static int main_hotplug(int argc, char **argv) { - char *devname = getenv("DEVNAME"); - - /* resolve device mapper name for dm-* if possible */ - if (devname && strlen(devname) >= 2 && !strncmp(devname, "dm-", 3)) { - char *dmdevnamep; - char dmname[256]; - - if (asprintf(&dmdevnamep, "/sys/%s/dm/name", getenv("DEVPATH")) == -1) - exit(ENOMEM); - - FILE *fp = fopen(dmdevnamep, "r"); - free(dmdevnamep); - - if (fp) { - if (fgets(dmname, sizeof(dmname), fp)) - devname = dmname; - - fclose(fp); - } - } - - return mount_action(getenv("ACTION"), devname, TYPE_HOTPLUG); + return mount_action(getenv("ACTION"), getenv("DEVNAME"), TYPE_HOTPLUG); } static int main_autofs(int argc, char **argv)