summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-05-08 14:17:29 -0700
committerDimitri John Ledkov <xnox@ubuntu.com>2018-05-08 14:17:29 -0700
commitd00c9550da1801a0eaff5cedf4312e24691b31ea (patch)
tree3881ca1764ef792259e1b70f12c884a3ac0c0715 /cmds-filesystem.c
parentdab6d2181f1f194ec3a76d900cf2c6533379cbea (diff)
New upstream release.
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 467aff11..30a50bf5 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -28,6 +28,8 @@
#include <linux/limits.h>
#include <getopt.h>
+#include <btrfsutil.h>
+
#include "kerncompat.h"
#include "ctree.h"
#include "utils.h"
@@ -813,25 +815,16 @@ static const char * const cmd_filesystem_sync_usage[] = {
static int cmd_filesystem_sync(int argc, char **argv)
{
- int fd, res;
- char *path;
- DIR *dirstream = NULL;
+ enum btrfs_util_error err;
clean_args_no_options(argc, argv, cmd_filesystem_sync_usage);
if (check_argc_exact(argc - optind, 1))
usage(cmd_filesystem_sync_usage);
- path = argv[optind];
-
- fd = btrfs_open_dir(path, &dirstream, 1);
- if (fd < 0)
- return 1;
-
- res = ioctl(fd, BTRFS_IOC_SYNC);
- close_file_or_dir(fd, dirstream);
- if( res < 0 ){
- error("sync ioctl failed on '%s': %m", path);
+ err = btrfs_util_sync(argv[optind]);
+ if (err) {
+ error_btrfs_util(err);
return 1;
}
@@ -1093,7 +1086,7 @@ static int cmd_filesystem_resize(int argc, char **argv)
DIR *dirstream = NULL;
struct stat st;
- clean_args_no_options_relaxed(argc, argv, cmd_filesystem_resize_usage);
+ clean_args_no_options_relaxed(argc, argv);
if (check_argc_exact(argc - optind, 2))
usage(cmd_filesystem_resize_usage);