From 87a8054ae2be2af89c5519314732be9434bde545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 21 Jun 2020 10:24:52 +0200 Subject: [PATCH] module/removable: 'ignore' is now applied to partitions too This means you can now do either ignore: [/dev/sda] to ignore all partitions on /dev/sda, or ignore: [/dev/sda1] to ignore only the first partition on /dev/sda. --- modules/removables.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/removables.c b/modules/removables.c index 6798dcb..498824b 100644 --- a/modules/removables.c +++ b/modules/removables.c @@ -229,6 +229,7 @@ static struct partition * add_partition(struct module *mod, struct block_device *block, struct udev_device *dev) { + struct private *m = mod->private; const char *_size = udev_device_get_sysattr_value(dev, "size"); uint64_t size = 0; if (_size != NULL) @@ -241,6 +242,16 @@ add_partition(struct module *mod, struct block_device *block, } #endif + const char *devname = udev_device_get_property_value(dev, "DEVNAME"); + if (devname != NULL) { + tll_foreach(m->ignore, it) { + if (strcmp(it->item, devname) == 0) { + LOG_DBG("ignoring %s because it is on the ignore list", devname); + return NULL; + } + } + } + const char *label = udev_device_get_property_value(dev, "ID_FS_LABEL"); if (label == NULL) label = udev_device_get_property_value(dev, "ID_LABEL");