extern int sysfs_devno_to_wholedisk(dev_t dev, char *diskname,
size_t len, dev_t *diskdevno);
+extern int sysfs_devno_is_lvm_private(dev_t devno);
+
extern int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h,
int *c, int *t, int *l);
extern char *sysfs_scsi_host_strdup_attribute(struct sysfs_cxt *cxt,
return -1;
}
+/*
+ * Returns 1 if the device is private LVM device.
+ */
+int sysfs_devno_is_lvm_private(dev_t devno)
+{
+ struct sysfs_cxt cxt = UL_SYSFSCXT_EMPTY;
+ char *uuid = NULL;
+ int rc = 0;
+
+ if (sysfs_init(&cxt, devno, NULL) != 0)
+ return 0;
+
+ uuid = sysfs_strdup(&cxt, "dm/uuid");
+
+ /* Private LVM devices use "LVM-<uuid>-<name>" uuid format (important
+ * is the "LVM" prefix and "-<name>" postfix).
+ */
+ if (uuid && strncmp(uuid, "LVM-", 4) == 0) {
+ char *p = strrchr(uuid + 4, '-');
+
+ if (p && *(p + 1))
+ rc = 1;
+ }
+
+ sysfs_deinit(&cxt);
+ free(uuid);
+ return rc;
+}
int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h, int *c, int *t, int *l)
{
__attribute__((nonnull(1,4)));
extern int blkid_driver_has_major(const char *drvname, int major)
__attribute__((warn_unused_result));
-extern int blkid_lvm_private(dev_t devno);
/* lseek.c */
extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
return match;
}
-/*
- * Returns 1 if the device is private LVM device.
- */
-int blkid_lvm_private(dev_t devno)
-{
- struct sysfs_cxt cxt = UL_SYSFSCXT_EMPTY;
- char *uuid = NULL;
- int rc = 0;
-
- if (sysfs_init(&cxt, devno, NULL) != 0)
- return 0;
-
- uuid = sysfs_strdup(&cxt, "dm/uuid");
-
- /* Private LVM devices use "LVM-<uuid>-<name>" uuid format (important
- * is the "LVM" prefix and "-<name>" postfix).
- */
- if (uuid && strncmp(uuid, "LVM-", 4) == 0) {
- char *p = strrchr(uuid + 4, '-');
-
- if (p && *(p + 1))
- rc = 1;
- }
-
- sysfs_deinit(&cxt);
- free(uuid);
- return rc;
-}
-
#ifdef TEST_PROGRAM
int main(int argc, char** argv)
{
if (pr->size <= 1440 * 1024 && !S_ISCHR(sb.st_mode))
pr->flags |= BLKID_FL_TINY_DEV;
- if (S_ISBLK(sb.st_mode) && blkid_lvm_private(sb.st_rdev)) {
+ if (S_ISBLK(sb.st_mode) && sysfs_devno_is_lvm_private(sb.st_rdev)) {
DBG(LOWPROBE, ul_debug("ignore private LVM device"));
pr->flags |= BLKID_FL_NOSCAN_DEV;
}
(unsigned long)diff));
#endif
- if (blkid_lvm_private(st.st_rdev)) {
+ if (sysfs_devno_is_lvm_private(st.st_rdev)) {
blkid_free_dev(dev);
return NULL;
}