mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-10 04:54:24 +08:00
btrfs-progs: let test_issubvolume return the exact error
Return any error from stat, minor cleanups. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
33ac47b5fb
commit
7afde59e38
@ -223,20 +223,20 @@ out:
|
||||
}
|
||||
|
||||
/*
|
||||
* test if path is a subvolume:
|
||||
* this function return
|
||||
* 0-> path exists but it is not a subvolume
|
||||
* 1-> path exists and it is a subvolume
|
||||
* -1 -> path is unaccessible
|
||||
* Test if path is a subvolume
|
||||
* Returns:
|
||||
* 0 - path exists but it is not a subvolume
|
||||
* 1 - path exists and it is a subvolume
|
||||
* < 0 - error
|
||||
*/
|
||||
int test_issubvolume(char *path)
|
||||
int test_issubvolume(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
int res;
|
||||
|
||||
res = stat(path, &st);
|
||||
if(res < 0 )
|
||||
return -1;
|
||||
if (res < 0)
|
||||
return -errno;
|
||||
|
||||
return (st.st_ino == BTRFS_FIRST_FREE_OBJECTID)
|
||||
&& S_ISDIR(st.st_mode);
|
||||
|
@ -126,7 +126,7 @@ int cmd_debug_tree(int argc, char **argv);
|
||||
int cmd_rescue(int argc, char **argv);
|
||||
|
||||
/* subvolume exported functions */
|
||||
int test_issubvolume(char *path);
|
||||
int test_issubvolume(const char *path);
|
||||
|
||||
/* send.c */
|
||||
char *get_subvol_name(char *mnt, char *full_path);
|
||||
|
Loading…
Reference in New Issue
Block a user