summaryrefslogtreecommitdiff
path: root/btrfsctl.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2013-01-28 13:22:30 +0800
committerDavid Sterba <dsterba@suse.cz>2013-01-30 00:40:35 +0100
commit46e3b8087b86ef555b13be6807c34c555171fc4a (patch)
tree0a12035e30f7661f11aee0f96ec61be6319b6e7e /btrfsctl.c
parent4a64455231d41b8c23c980cb20959242d2fbff78 (diff)
Btrfs-progs: move open_file_or_dir() to utils.c
The definition of the function open_file_or_dir() is moved from common.c to utils.c in order to be able to share some common code between scrub and the device stats in the following step. That common code uses open_file_or_dir(). Since open_file_or_dir() makes use of the function dirfd(3), the required XOPEN version was raised from 6 to 7. Signed-off-by: Anand Jain <anand.jain@oracle.com> Original-Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Diffstat (limited to 'btrfsctl.c')
-rw-r--r--btrfsctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/btrfsctl.c b/btrfsctl.c
index 518684c6..049a5f35 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -63,7 +63,7 @@ static void print_usage(void)
exit(1);
}
-static int open_file_or_dir(const char *fname)
+static int btrfsctl_open_file_or_dir(const char *fname)
{
int ret;
struct stat st;
@@ -91,6 +91,7 @@ static int open_file_or_dir(const char *fname)
}
return fd;
}
+
int main(int ac, char **av)
{
char *fname = NULL;
@@ -128,7 +129,7 @@ int main(int ac, char **av)
snap_location = strdup(fullpath);
snap_location = dirname(snap_location);
- snap_fd = open_file_or_dir(snap_location);
+ snap_fd = btrfsctl_open_file_or_dir(snap_location);
name = strdup(fullpath);
name = basename(name);
@@ -238,7 +239,7 @@ int main(int ac, char **av)
}
name = fname;
} else {
- fd = open_file_or_dir(fname);
+ fd = btrfsctl_open_file_or_dir(fname);
}
if (name) {