udev names partitions with the extension "-partN" (where N is a
partition number).
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
/* common stuff for fdisk, cfdisk, sfdisk */
+/* udev paths */
+#define PATH_DEV_BYID "/dev/disk/by-id"
+#define PATH_DEV_BYPATH "/dev/disk/by-path"
+
/* including <linux/fs.h> fails */
#include <sys/types.h>
#include <sys/ioctl.h>
p = "part";
}
+ /* udev names partitions by appending -partN
+ e.g. ata-SAMSUNG_SV8004H_0357J1FT712448-part1 */
+ if ((strncmp(dev, PATH_DEV_BYID, strlen(PATH_DEV_BYID)) == 0) ||
+ strncmp(dev, PATH_DEV_BYPATH, strlen(PATH_DEV_BYPATH)) == 0) {
+ p = "-part";
+ }
+
wp = strlen(p);
if (lth) {