---
bcache.c | 22 +++++++++++++++-------
bcache.h | 3 ++-
lib.c | 15 ++++++++++-----
make.c | 8 ++++++--
show.c | 6 ++++--
5 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/bcache.c b/bcache.c
index 1c4cef9..62ed08d 100644
--- a/bcache.c
+++ b/bcache.c
@@ -199,7 +199,8 @@ int tree(void)
sprintf(out, "%s", begin);
list_for_each_entry_safe(devs, n, &head, dev_list) {
if ((devs->version == BCACHE_SB_VERSION_CDEV
- || devs->version == BCACHE_SB_VERSION_CDEV_WITH_UUID)
+ || devs->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || devs->version == BCACHE_SB_VERSION_CDEV_WITH_FEATURES)
&& strcmp(devs->state, BCACHE_BASIC_STATE_ACTIVE) == 0) {
sprintf(out + strlen(out), "%s\n", devs->name);
list_for_each_entry_safe(tmp, m, &head, dev_list) {
@@ -231,7 +232,8 @@ int attach_both(char *cdev, char *backdev)
if (ret != 0)
return ret;
if (type != BCACHE_SB_VERSION_BDEV
- && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET) {
+ && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ && type != BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
fprintf(stderr, "%s is not an backend device\n", backdev);
return 1;
}
@@ -244,7 +246,8 @@ int attach_both(char *cdev, char *backdev)
if (strlen(cdev) != 36) {
ret = detail_dev(cdev, &bd, &cd, NULL, &type);
if (type != BCACHE_SB_VERSION_CDEV
- && type != BCACHE_SB_VERSION_CDEV_WITH_UUID) {
+ && type != BCACHE_SB_VERSION_CDEV_WITH_UUID
+ && type != BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
fprintf(stderr, "%s is not an cache device\n", cdev);
return 1;
}
@@ -359,10 +362,13 @@ int main(int argc, char **argv)
ret = detail_dev(devname, &bd, &cd, NULL, &type);
if (ret != 0)
return ret;
- if (type == BCACHE_SB_VERSION_BDEV) {
+ if (type == BCACHE_SB_VERSION_BDEV
+ || type == BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ || type == BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
return stop_backdev(devname);
} else if (type == BCACHE_SB_VERSION_CDEV
- || type == BCACHE_SB_VERSION_CDEV_WITH_UUID) {
+ || type == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || type == BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
return unregister_cset(cd.base.cset);
}
return 1;
@@ -408,7 +414,8 @@ int main(int argc, char **argv)
return ret;
}
if (type != BCACHE_SB_VERSION_BDEV
- && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET) {
+ && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ && type != BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
fprintf(stderr,
"Only backend device is suppported\n");
return 1;
@@ -434,7 +441,8 @@ int main(int argc, char **argv)
return ret;
}
if (type != BCACHE_SB_VERSION_BDEV
- && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET) {
+ && type != BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ && type != BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
fprintf(stderr,
"Only backend device is suppported\n");
return 1;
diff --git a/bcache.h b/bcache.h
index 2ae25ee..b10d4c0 100644
--- a/bcache.h
+++ b/bcache.h
@@ -164,7 +164,8 @@ struct cache_sb {
static inline bool SB_IS_BDEV(const struct cache_sb *sb)
{
return sb->version == BCACHE_SB_VERSION_BDEV
- || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET;
+ || sb->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ || sb->version == BCACHE_SB_VERSION_BDEV_WITH_FEATURES;
}
BITMASK(CACHE_SYNC, struct cache_sb, flags, 0, 1);
diff --git a/lib.c b/lib.c
index 745dab6..ea1f18d 100644
--- a/lib.c
+++ b/lib.c
@@ -281,10 +281,12 @@ int get_dev_bname(char *devname, char *bname)
int get_bname(struct dev *dev, char *bname)
{
if (dev->version == BCACHE_SB_VERSION_CDEV
- || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID)
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_FEATURES)
strcpy(bname, BCACHE_NO_SUPPORT);
else if (dev->version == BCACHE_SB_VERSION_BDEV
- || dev->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET)
+ || dev->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ || dev->version == BCACHE_SB_VERSION_BDEV_WITH_FEATURES)
return get_dev_bname(dev->name, bname);
return 0;
}
@@ -317,10 +319,12 @@ int get_backdev_attachpoint(char *devname, char *point)
int get_point(struct dev *dev, char *point)
{
if (dev->version == BCACHE_SB_VERSION_CDEV
- || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID)
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_FEATURES)
strcpy(point, BCACHE_NO_SUPPORT);
else if (dev->version == BCACHE_SB_VERSION_BDEV
- || dev->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET)
+ || dev->version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ || dev->version == BCACHE_SB_VERSION_BDEV_WITH_FEATURES)
return get_backdev_attachpoint(dev->name, point);
return 0;
}
@@ -331,7 +335,8 @@ int cset_to_devname(struct list_head *head, char *cset, char *devname)
list_for_each_entry(dev, head, dev_list) {
if ((dev->version == BCACHE_SB_VERSION_CDEV
- || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID)
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || dev->version == BCACHE_SB_VERSION_CDEV_WITH_FEATURES)
&& strcmp(dev->cset, cset) == 0)
strcpy(devname, dev->name);
}
diff --git a/make.c b/make.c
index 39b381a..d3b4baa 100644
--- a/make.c
+++ b/make.c
@@ -272,10 +272,14 @@ static void write_sb(char *dev, struct sb_context *sbc, bool bdev, bool force)
ret = detail_dev(dev, &bd, &cd, NULL, &type);
if (ret != 0)
exit(EXIT_FAILURE);
- if (type == BCACHE_SB_VERSION_BDEV) {
+ if (type == BCACHE_SB_VERSION_BDEV
+ || type == BCACHE_SB_VERSION_BDEV_WITH_OFFSET
+ || type == BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
ret = stop_backdev(dev);
} else if (type == BCACHE_SB_VERSION_CDEV
- || type == BCACHE_SB_VERSION_CDEV_WITH_UUID) {
+ || type == BCACHE_SB_VERSION_CDEV_WITH_UUID
+ || type ==
+ BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
ret = unregister_cset(cd.base.cset);
} else {
fprintf(stderr,
diff --git a/show.c b/show.c
index 6175f3f..15cdb95 100644
--- a/show.c
+++ b/show.c
@@ -75,8 +75,9 @@ int show_bdevs_detail(void)
if (strlen(devs->attachuuid) == 36) {
cset_to_devname(&head, devs->cset, attachdev);
} else if (devs->version == BCACHE_SB_VERSION_CDEV
+ || devs->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
|| devs->version ==
- BCACHE_SB_VERSION_CDEV_WITH_UUID) {
+ BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
strcpy(attachdev, BCACHE_NO_SUPPORT);
} else {
strcpy(attachdev, BCACHE_ATTACH_ALONE);
@@ -135,8 +136,9 @@ int show_bdevs(void)
if (strlen(devs->attachuuid) == 36) {
cset_to_devname(&head, devs->cset, attachdev);
} else if (devs->version == BCACHE_SB_VERSION_CDEV
+ || devs->version == BCACHE_SB_VERSION_CDEV_WITH_UUID
|| devs->version ==
- BCACHE_SB_VERSION_CDEV_WITH_UUID) {
+ BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
strcpy(attachdev, BCACHE_NO_SUPPORT);
} else {
strcpy(attachdev, BCACHE_ATTACH_ALONE);