@@ -42,25 +42,6 @@ static const char * const subvolume_cmd_group_usage[] = {
NULL
};
-/*
- * test if path is a directory
- * this function return
- * 0-> path exists but it is not a directory
- * 1-> path exists and it is a directory
- * -1 -> path is unaccessible
- */
-static int test_isdir(char *path)
-{
- struct stat st;
- int res;
-
- res = stat(path, &st);
- if(res < 0 )
- return -1;
-
- return S_ISDIR(st.st_mode);
-}
-
static const char * const cmd_subvol_create_usage[] = {
"btrfs subvolume create [-i <qgroupid>] [<dest>/]<name>",
"Create a subvolume",
@@ -2697,3 +2697,22 @@ int test_issubvolname(const char *name)
return name[0] != '\0' && !strchr(name, '/') &&
strcmp(name, ".") && strcmp(name, "..");
}
+
+/*
+ * test if path is a directory
+ * this function return
+ * 0-> path exists but it is not a directory
+ * 1-> path exists and it is a directory
+ * -1 -> path is unaccessible
+ */
+int test_isdir(const char *path)
+{
+ struct stat st;
+ int res;
+
+ res = stat(path, &st);
+ if(res < 0 )
+ return -1;
+
+ return S_ISDIR(st.st_mode);
+}
@@ -134,6 +134,7 @@ int fsid_to_mntpt(__u8 *fsid, char *mntpt, int *mnt_cnt);
int test_minimum_size(const char *file, u32 leafsize);
int test_issubvolname(const char *name);
+int test_isdir(const char *path);
/*
* Btrfs minimum size calculation is complicated, it should include at least: