Displaying 14 results from an estimated 14 matches for "open_file_or_dir".
2012 Nov 01
41
[Request for review] [RFC] Add label support for snapshots and subvols
...v1'' in ''/btrfs/snap1-sv1''
btrfs fi label -t /btrfs/snap1-sv1
btrfs fi label -t /btrfs/snap1-sv1 "Prod-DB-sand-box-testing"
btrfs fi label -t /btrfs/snap1-sv1
Prod-DB-sand-box-testing
----------------
Thanks, Anand
Anand Jain (2):
Btrfs-progs: move open_file_or_dir() to utils.c
Btrfs-progs: add feature to label subvol and snapshot
Makefile | 4 ++--
btrfsctl.c | 7 ++++---
btrfslabel.c | 40 ++++++++++++++++++++++++++++++++++++++++
btrfslabel.h | 4 +++-
cmds-balance.c | 1 +
cmds-filesystem.c | 34 ++++++++++++...
2009 Dec 21
0
[PATCH] btrfsctl: scan device and exit without using ioctl
...de 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -34,6 +34,8 @@
#include "transaction.h"
#include "utils.h"
#include "version.h"
+#include "disk-io.h"
+#include "volumes.h"
#ifdef __CHECKER__
#define BLKGETSIZE64 0
@@ -88,6 +90,30 @@ static int open_file_or_dir(const char *fname)
}
return fd;
}
+
+int btrfs_scan_file (const char *path)
+{
+ int ret = -1;
+ struct btrfs_fs_devices *fs_devices = NULL;
+ u64 dev_count = 0;
+ int fd = -1;
+
+ fd = open (path, O_RDONLY);
+ if (fd < 0) {
+ fprintf...
2012 Feb 29
15
[RFC] [PATCH] Add btrfs autosnap feature
From: anand jain <anand.jain@oracle.com>
Anand Jain (1):
[RFC] Add btrfs autosnap feature
Makefile | 6 +-
autosnap.c | 1553 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
autosnap.h | 81 +++
btrfs-list.c | 140 +++++-
btrfs.c | 46 ++-
btrfs_cmds.c | 186 +++++++-
btrfs_cmds.h | 3 +-
scrub.c | 1 +
8 files changed, 1982 insertions(+), 34
2013 Nov 16
16
[PATCH] BTRFS-PROG: recursively subvolume snapshot and delete
Hi All,
the following patches implement the recursively snapshotting and
deleting of a subvolume.
To snapshot recursively you must pass the -R switch:
# btrfs subvolume create sub1
Create subvolume ''./sub1''
# btrfs subvolume create sub1/sub2
Create subvolume ''sub1/sub2''
# btrfs subvolume snapshot -R sub1 sub1-snap
Create a snapshot of
2011 Jul 18
5
[PATCH v3 0/5] btrfs-progs: scrub interface
This is the next patch series for scrub userland tools.
Change log v1->v2:
- commands now reachable as "btrfs scrub ..." instead of "btrfs filesystem
scrub ..."
- ability to scrub a single device instead of a whole file system
- superfluous command line options removed
- resume is now a separate command ("scrub resume") instead of "scrub start -r"
-
2012 Feb 03
10
[PATCH 0/3] Btrfs-progs: restriper interface
Hello,
This is the userspace part of restriper, rebased onto the new progs
infrastructure. Restriper commands are located under ''balance'' prefix,
which is now the top level command group. However to not confuse
existing users ''balance'' prefix is also available under ''filesystem'':
btrfs [filesystem] balance start
btrfs [filesystem] balance
2011 Jul 07
5
[PATCH v1 0/2] Btrfs-progs: commands "resolve inode" and "resolve logical"
The kernel patch series just sent (Subject: "Btrfs: scrub: print path to
corrupted files and trigger nodatasum fixup") introduces two new ioctls to
do in-kernel filesystem path construction. This series provides the
corresponding userspace changes, adding two new commands to the btrfs utility:
--
btrfs resolve inode [-v] <inode> <path>
resolves an <inode> to all
2011 Jul 12
0
[PATCH]: Use a general way to get the default subvolume for btrfs
...ar *path)
+{
+
+ struct stat st;
+ int res;
+
+ res = stat(path, &st);
+ if(res < 0 )
+ return -1;
+
+ return (st.st_ino == 256) && S_ISDIR(st.st_mode);
+
+}
+
+/*
+ * Get file handle for a file or dir
+ */
+static int open_file_or_dir(const char *fname)
+{
+ int ret;
+ struct stat st;
+ DIR *dirstream;
+ int fd;
+
+ ret = stat(fname, &st);
+ if (ret < 0) {
+ return -1;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ dirstream = opendir(fname);
+...
2012 Nov 15
0
[PATCH] btrfs-progs: fix 32bit int/pointer cast warnings
...ipa.fspath = (uintptr_t)fspath;
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
if (ret) {
@@ -168,7 +169,7 @@ static int cmd_logical_resolve(int argc, char **argv)
loi.logical = atoll(argv[optind]);
loi.size = size;
- loi.inodes = (u64)inodes;
+ loi.inodes = (uintptr_t)inodes;
fd = open_file_or_dir(argv[optind+1]);
if (fd < 0) {
--
1.7.11.4
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
2012 Aug 31
0
[PATCH v3] Btrfs-progs: add options to change bufsize in logical to inode translation
...(check_argc_exact(argc - optind, 2))
usage(cmd_logical_resolve_usage);
- inodes = malloc(4096);
+ size = min(size, 64 * 1024);
+ inodes = malloc(size);
if (!inodes)
return 1;
loi.logical = atoll(argv[optind]);
- loi.size = 4096;
+ loi.size = size;
loi.inodes = (u64)inodes;
fd = open_file_or_dir(argv[optind+1]);
@@ -176,8 +186,9 @@ static int cmd_logical_resolve(int argc, char **argv)
}
if (verbose)
- printf("ioctl ret=%d, bytes_left=%lu, bytes_missing=%lu, "
- "cnt=%d, missed=%d\n", ret,
+ printf("ioctl ret=%d, total_size=%llu, bytes_left=%lu, "
+...
2010 Dec 11
1
[RFC] Improve btrfs subvolume find-new command
...et;
+
+ ret = test_issubvolume(subvol);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: error accessing ''%s''\n", subvol);
+ return 12;
+ }
+ if (!ret) {
+ fprintf(stderr, "ERROR: ''%s'' is not a subvolume\n", subvol);
+ return 13;
+ }
+
+ fd = open_file_or_dir(subvol);
+ if (fd < 0) {
+ fprintf(stderr, "ERROR: can''t access ''%s''\n", subvol);
+ return 12;
+ }
+ *max_found = find_root_gen(fd);
+ return 0;
+}
+
+
+int do_get_latest_gen(int argc, char **argv)
+{
+ int ret;
+ u64 max_found = 0;
+
+ ret = _get_latest_ge...
2012 Jun 29
12
[PATCH 1/3] Btrfs-progs: add support to set subvolume/snapshot readonly
...e ro",
+ NULL
+};
+
+static int cmd_subvol_set_ro(int argc, char **argv)
+{
+ int ret=0, fd, e;
+ char *path;
+ struct btrfs_ioctl_get_set_flags_args args;
+
+ if (check_argc_exact(argc, 2))
+ usage(cmd_subvol_set_ro_usage);
+
+ path = argv[1];
+
+ memset(&args, 0, sizeof(args));
+
+ fd = open_file_or_dir(path);
+ if (fd < 0) {
+ fprintf(stderr, "ERROR: can''t access to ''%s''\n", path);
+ return 12;
+ }
+
+ args.flags |= BTRFS_SUBVOL_RDONLY;
+ args.objectid = 0;
+ ret = ioctl(fd, BTRFS_IOC_SUBVOL_SETFLAGS, &args);
+ e = errno;
+ close(fd);
+ if( ret < 0...
2013 Oct 25
8
[PATCH] btrfs: add framework to read fs info from btrfs-control
This adds ioctl BTRFS_IOC_GET_FSIDS which reads the fs
info through the btrfs-control
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/super.c | 47 ++++++++++++++++++++++++++++++++++++++-----
fs/btrfs/volumes.c | 33 ++++++++++++++++++++++++++++++
fs/btrfs/volumes.h | 2 +
include/uapi/linux/btrfs.h | 19 +++++++++++++++++
4 files changed,
2012 Oct 04
8
[PATCH][BTRFS-PROGS][V3] btrfs filesystem df
Hi Chris,
this serie of patches updated the command "btrfs filesystem
df". I update this command because it is not so easy to get
the information about the disk usage from the command "fi df" and "fi show".
This patch was the result of some discussions on the btrfs
mailing list. Many thanks to all the contributors.
From the man page (see 2nd patch):
[...]
The