#include "pb-discover.h"
#include "device-handler.h"
#include "cdrom.h"
+#include "devmapper.h"
/* We set a default monitor buffer size, as we may not process monitor
* events while performing device discvoery. systemd uses a 128M buffer, so
const char *name)
{
struct discover_device *ddev;
+ unsigned int i = 0;
const char *typestr;
const char *uuid;
const char *path;
const char *node;
const char *prop;
const char *type;
+ const char *devname;
+ const char *ignored_types[] = {
+ "linux_raid_member",
+ "swap",
+ "LVM2_member",
+ NULL,
+ };
bool cdrom;
typestr = udev_device_get_devtype(dev);
node = udev_device_get_devnode(dev);
path = udev_device_get_devpath(dev);
- if (path && (strstr(path, "virtual/block/loop")
- || strstr(path, "virtual/block/ram"))) {
+ if (path && strstr(path, "virtual/block/loop")) {
pb_log("SKIP: %s: ignored (path=%s)\n", name, path);
return 0;
}
+ if (path && strstr(path, "virtual/block/ram")) {
+ device_handler_add_ramdisk(udev->handler, node);
+ return 0;
+ }
+
cdrom = node && !!udev_device_get_property_value(dev, "ID_CDROM");
if (cdrom) {
/* CDROMs require a little initialisation, to get
}
}
+ /* If our environment's udev can recognise them explictly skip any
+ * device mapper devices we encounter */
+ devname = udev_device_get_property_value(dev, "DM_NAME");
+ if (devname) {
+ pb_debug("SKIP: dm-device %s\n", devname);
+ return 0;
+ }
+
type = udev_device_get_property_value(dev, "ID_FS_TYPE");
if (!type) {
pb_log("SKIP: %s: no ID_FS_TYPE property\n", name);
return 0;
}
+ while (ignored_types[i]) {
+ if (!strncmp(type, ignored_types[i], strlen(ignored_types[i]))) {
+ pb_log("SKIP: %s: ignore '%s' filesystem\n", name, type);
+ return 0;
+ }
+ i++;
+ }
+
/* We may see multipath devices; they'll have the same uuid as an
* existing device, so only parse the first. */
uuid = udev_device_get_property_value(dev, "ID_FS_UUID");
udev_setup_device_params(dev, ddev);
+ /* Create a snapshot for all disks, unless it is an assembled RAID array */
+ if (ddev->device->type == DEVICE_TYPE_DISK &&
+ !udev_device_get_property_value(dev, "MD_LEVEL"))
+ devmapper_init_snapshot(udev->handler, ddev);
+
device_handler_discover(udev->handler, ddev);
return 0;