int btrfs_detect(const char *path) { struct stat st; int ret; if (!is_btrfs_fs(path)) return 0; // and make sure it's a subvolume. ret = stat(path, &st); if (ret < 0) return 0; if (st.st_ino == 256 && S_ISDIR(st.st_mode)) return 1; return 0; }
bool btrfs_detect(const char *path) { struct stat st; int ret; if (!strncmp(path, "btrfs:", 6)) return true; if (!is_btrfs_fs(path)) return false; /* make sure it's a subvolume */ ret = stat(path, &st); if (ret < 0) return false; if (st.st_ino == 256 && S_ISDIR(st.st_mode)) return true; return false; }