block: avoid ubi{,block} duplicates
[project/fstools.git] / block.c
diff --git a/block.c b/block.c
index 397db0f..6c025fd 100644 (file)
--- a/block.c
+++ b/block.c
@@ -170,6 +170,10 @@ static const struct mount_flag mount_flags[] = {
        { "relatime",           MS_RELATIME     },
        { "norelatime",         ~MS_RELATIME    },
        { "strictatime",        MS_STRICTATIME  },
+       { "acl",                MS_POSIXACL     },
+       { "noacl",              ~MS_POSIXACL    },
+       { "nouser_xattr",       MS_NOUSER       },
+       { "user_xattr",         ~MS_NOUSER      },
 };
 
 static char *blobmsg_get_strdup(struct blob_attr *attr)
@@ -460,6 +464,16 @@ static int config_load(char *cfg)
 static struct blkid_struct_probe* _probe_path(char *path)
 {
        struct blkid_struct_probe *pr;
+       char tmppath[64];
+
+       /* skip ubi device if ubiblock device is present */
+       if (path[5] == 'u' && path[6] == 'b' && path[7] == 'i' &&
+           path[8] >= '0' && path[8] <= '9' ) {
+               snprintf(tmppath, sizeof(tmppath), "/dev/ubiblock%s", path + 8);
+               list_for_each_entry(pr, &devices, list)
+                       if (!strcasecmp(pr->dev, tmppath))
+                               return NULL;
+       }
 
        pr = malloc(sizeof(*pr));
 
@@ -502,7 +516,7 @@ static void cache_load(int mtd)
        if (mtd) {
                _cache_load("/dev/mtdblock*");
                _cache_load("/dev/ubiblock*");
-               _cache_load("/dev/ubi?*_?*");
+               _cache_load("/dev/ubi[0-9]*");
        }
        _cache_load("/dev/mmcblk*");
        _cache_load("/dev/sd*");