Skip to contentSkip to conversation

New btrfs command pushed into the btrfs-progs subvol branch - commands

DISCUSSION Chris Mason 2 participants 6 messages Mar 11, 2010 – Mar 12, 2010 1 message not in the archive Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi everyone,

I've pushed Goffredo's new btrfs utility into the subvol branch of the btrfs-progs repo. I'm using it as my starting point for the subvol listing utility as well as my fancy new defrag range ioctl.

Goffredo, the new defrag ioctl takes a bunch of arguments, and I used getopt inside the command to do it. The tricky part is that getopt expects argv[0] to be the command name, so I had to hack things a bit.

Could you please send a patch that changes the commands to include the command name in argv[0]? That'll make it easier to be flexible.

-chris

#1 lore raw
Quoted 6 lines · Chris Mason

Hi everyone,

I've pushed Goffredo's new btrfs utility into the subvol branch of the btrfs-progs repo. I'm using it as my starting point for the subvol listing utility as well as my fancy new defrag range ioctl.

Quoted 7 lines

Goffredo, the new defrag ioctl takes a bunch of arguments, and I used getopt inside the command to do it. The tricky part is that getopt expects argv[0] to be the command name, so I had to hack things a bit.

Could you please send a patch that changes the commands to include the command name in argv[0]? That'll make it easier to be flexible.

I will start to work

Quoted 2 lines

-chris

Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
#3 lore raw
In reply to a message not in the archive

Hi Chris,

I updated my git repository. You can pull from

git pull http://cassiopea.homelinux.net/git/btrfs-command.git mlc-subvol

(branch mlc-subvol, commit e59135a27dc1fde6acc4fb198499be2b6cbd9f6f)

$ git diff remotes/origin/subvol | diffstat
 btrfs-list.c   |   15 +++--
 btrfs.c        |   56 +++++++++++++++++-
 btrfs_cmds.c   |   84 +++++++++++++++++-----------
 btrfs_cmds.h   |    1 
 man/btrfs.8.in |  150 +++++++++++++++++++++++++++++++++++++++++++++[...]
 5 files changed, 283 insertions(+), 43 deletions(-)

As you requested I update the parser in order set the argv[0] argument as the program name + the verb. For example if I do

	$ btrfs dev add

the argv[0] will be equal to "btrfs device add". I hope that is what you requested.

Due to this change I update all the commands in order to evaluate the arguments from argv[1] and not from argv[0] anymore. (I update also your do_defrag() function)

Also because I implemented that already the week ago:
- I made some small modification to btrfs-list.c in order to be more friendly in case of error (replace some "exit(2)" with "return -ERR")
- I implemented the command "btrf subvolume set-default"

Hoping that this can you help
Regards
G.Baroncelli

btrfs-list.c +2 -2
index 6305d3c..f2f119b 100644
@@ -66,7 +66,7 @@ struct root_info {
 	char name[];
 };
 
-void root_lookup_init(struct root_lookup *tree)
+static void root_lookup_init(struct root_lookup *tree)
 {
 	tree->root.rb_node = NULL;
 }
@@ -275,9 +275,9 @@ static int lookup_ino_path(int fd, struct root_info *ri)
 
 	ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args);
 	if (ret) {
-		fprintf(stderr, "Failed to lookup path for root %llu\n",
+		fprintf(stderr, "ERROR: Failed to lookup path for root 

%llu\n",
(unsigned long long)ri->ref_tree);
- exit(1);
+ return ret;
}

if (args.name[0]) {
@@ -346,8 +346,8 @@ int list_subvols(int fd)
while(1) {
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args); if (ret < 0) {
- perror("ioctl:");
- break;
+ fprintf(stderr, "ERROR: can't perform the search\n");
+ return ret;
}
/* the ioctl returns the number of item it found in nr_items
*/
if (sk->nr_items == 0)
@@ -398,8 +398,11 @@ int list_subvols(int fd)
n = rb_first(&root_lookup.root);
while (n) {
struct root_info *entry;
+ int ret;
entry = rb_entry(n, struct root_info, rb_node);
- lookup_ino_path(fd, entry);
+ ret = lookup_ino_path(fd, entry);
+ if(ret < 0)
+ return ret;
n = rb_next(n);
}

btrfs.c +0 -1
index 20f7413..58271f6 100644
@@ -60,10 +60,15 @@ static struct Command commands[] = {
 	{ do_subvol_list, 1, "subvolume list", "<path>\n"
 		"List the snapshot/subvolume of a filesystem."
 	},
-
 	{ do_defrag, -1,
 	  "filesystem defragment", "[-vcf] [-s start] [-l len] [-t size] 

<file>|<dir> [<file>|<dir>...]\n"
"Defragment a file or a directory."
+
+ },
+ { do_set_default_subvol, 2,
+ "subvolume set-default", "<id> <path>\n"
+ "Set the subvolume of the filesystem <path> which will be
mounted\n"
+ "as default."
},
{ do_fssync, 1,
"filesystem sync", "<path>\n"
@@ -88,11 +93,12 @@ static struct Command commands[] = {
"Scan all device for or the passed device for a btrfs\n" "filesystem."
},
- { do_add_volume, -1,
+
+ { do_add_volume, -2,
"device add", "<dev> [<dev>..] <path>\n"
"Add a device to a filesystem."
},
- { do_remove_volume, -1,
+ { do_remove_volume, -2,
"device delete", "<dev> [<dev>..] <path>\n"
"Remove a device from a filesystem."
},
@@ -208,6 +214,41 @@ static int check_ambiguity(struct Command *cmd, char **argv){
}

/*
+ * This function, compacts the program name and the command in the first
+ * element of the '*av' array
+ */
+static int prepare_args(int *ac, char ***av, char *prgname, struct Command *cmd ){
+
+ char **ret;
+ int i;
+ char *newname;
+
+ ret = (char **)malloc(sizeof(char*)*(*ac+1));
+ newname = (char*)malloc(strlen(prgname)+strlen(cmd->verb)+2);
+ if( !ret || !newname ){
+ free(ret);
+ free(newname);
+ return -1;
+ }
+
+ ret[0] = newname;
+ for(i=0; i < *ac ; i++ )
+ ret[i+1] = (*av)[i];
+
+ strcpy(newname, prgname);
+ strcat(newname, " ");
+ strcat(newname, cmd->verb);
+
+ (*ac)++;
+ *av = ret;
+
+ return 0;
+
+}
+
+
+
+/*

This function perform the following jobs:
- show the help if '--help' or 'help' or '-h' are passed
@@ -307,11 +348,18 @@ static int parse_args(int argc, char **argv,
matchcmd->verb, -matchcmd->nargs); return -2;
}
- if(matchcmd->nargs >= 0 && matchcmd->nargs != *nargs_ && matchcmd-

Quoted 1 line

nargs != 999 ){

+
+ if(matchcmd->nargs >= 0 && matchcmd->nargs != *nargs_ && matchcmd-

Quoted 1 line

nargs != 999){

fprintf(stderr, "ERROR: '%s' requires %d arg(s)\n",
matchcmd->verb, matchcmd->nargs); return -2;
}
+
+ if (prepare_args( nargs_, args_, prgname, matchcmd )){
+ fprintf(stderr, "ERROR: not enough memory\\n");
+ return -20;
+ }
+

return 1;
}

btrfs_cmds.c +0 -0
index 3a21be3..89f47c2 100644
@@ -59,7 +59,7 @@ static inline int ioctl(int fd, int define, void *arg) { 

return 0; }
static int test_issubvolume(char *path)
{

- struct stat st;
+ struct stat st;
int res;

res = stat(path, &st);
@@ -79,7 +79,7 @@ static int test_issubvolume(char *path)
*/
static int test_isdir(char *path)
{
- struct stat st;
+ struct stat st;
int res;

res = stat(path, &st);
@@ -142,7 +142,7 @@ static u64 parse_size(char *s)
return atoll(s) * mult;
}

-int do_defrag(int ac, char **avp)
+int do_defrag(int ac, char **av)
{
int fd;
int compress = 0;
@@ -156,17 +156,6 @@ int do_defrag(int ac, char **avp)
int verbose = 0;
int fancy_ioctl = 0;
struct btrfs_ioctl_defrag_range_args range;
- char **av;
-
- /*
- * getopt expects av[0] to be the program name and it seems
- * to get confused when this isn't the case
- */
- av = malloc((ac + 2) * sizeof(char *));
- av[0] = "defrag";
- av[ac + 1] = NULL;
- memcpy(av + 1, avp, ac * sizeof(char *));
- ac += 1;

optind = 1;
while(1) {
@@ -264,7 +253,7 @@ int do_subvol_list(int argc, char **argv)
int ret;
char *subvol;

- subvol = argv[0];
+ subvol = argv[1];

ret = test_issubvolume(subvol);
if (ret < 0) {
@@ -289,13 +278,13 @@ int do_subvol_list(int argc, char **argv)

int do_clone(int argc, char **argv)
{
- char *subvol, *dst;
+ char *subvol, *dst;
int res, fd, fddst, len;
char *newname;
char *dstdir;

- subvol = argv[0];
- dst = argv[1];
+ subvol = argv[1];
+ dst = argv[2];
struct btrfs_ioctl_vol_args args;

res = test_issubvolume(subvol);
@@ -375,7 +364,7 @@ int do_delete_subvolume(int argc, char **argv)
int res, fd, len;
struct btrfs_ioctl_vol_args args;
char *dname, *vname, *cpath;
- char *path = argv[0];
+ char *path = argv[1];

res = test_issubvolume(path);
if(res<0){
@@ -436,7 +425,7 @@ int do_create_subvol(int argc, char **argv)
char *newname;
char *dstdir;
struct btrfs_ioctl_vol_args args;
- char *dst = argv[0];
+ char *dst = argv[1];

res = test_isdir(dst);
if(res >= 0 ){
@@ -487,7 +476,7 @@ int do_create_subvol(int argc, char **argv)
int do_fssync(int argc, char **argv)
{
int fd, res;
- char *path = argv[0];
+ char *path = argv[1];

fd = open_file_or_dir(path);
if (fd < 0) {
@@ -506,10 +495,10 @@ int do_fssync(int argc, char **argv)
return 0;
}

-int do_scan(int nargs, char **argv)
+int do_scan(int argc, char **argv)
{
int i, fd;
- if(!nargs){
+ if(argc<=1){
int ret;

printf("Scanning for Btrfs filesystems\n");
@@ -527,8 +516,8 @@ int do_scan(int nargs, char **argv)
return 10;
}

- for( i = 0 ; i < nargs ; i++ ){
- struct btrfs_ioctl_vol_args args;
+ for( i = 1 ; i < argc ; i++ ){
+ struct btrfs_ioctl_vol_args args;
int ret;

printf("Scanning for Btrfs filesystems in '%s'\n", argv[i]);
@@ -558,8 +547,8 @@ int do_resize(int argc, char **argv)

struct btrfs_ioctl_vol_args args;
int fd, res, len;
- char *amount=argv[0], *path=argv[1];
-
+ char *amount=argv[1], *path=argv[2];
+
fd = open_file_or_dir(path);
if (fd < 0) {
fprintf(stderr, "ERROR: can't access to '%s'\n", path);
@@ -646,7 +635,7 @@ int do_show_filesystem(int argc, char **argv)
struct list_head *all_uuids;
struct btrfs_fs_devices *fs_devices;
struct list_head *cur_uuid;
- char *search = argv[0];
+ char *search = argv[1];
int ret;

ret = btrfs_scan_one_dir("/dev", 0);
@@ -680,8 +669,8 @@ int do_add_volume(int nargs, char **args)
return 12;
}

- for(i=0 ; i < (nargs-1) ; i++ ){
- struct btrfs_ioctl_vol_args ioctl_args;
+ for(i=1 ; i < (nargs-1) ; i++ ){
+ struct btrfs_ioctl_vol_args ioctl_args;
int devfd, res;
u64 dev_block_count = 0;
struct stat st;
@@ -737,8 +726,8 @@ int do_balance(int argc, char **argv)
{

int fdmnt, ret=0;
- char *path = argv[0];
struct btrfs_ioctl_vol_args args;
+ char *path = argv[1];

fdmnt = open_file_or_dir(path);
if (fdmnt < 0) {
@@ -768,8 +757,8 @@ int do_remove_volume(int nargs, char **args)
return 12;
}

- for(i=0 ; i < (nargs-1) ; i++ ){
- struct btrfs_ioctl_vol_args arg;
+ for(i=1 ; i < (nargs-1) ; i++ ){
+ struct btrfs_ioctl_vol_args arg;
int res;

strcpy(arg.name, args[i]);
@@ -786,3 +775,32 @@ int do_remove_volume(int nargs, char **args)
else
return 0;
}
+
+int do_set_default_subvol(int nargs, char **argv)
+{
+ int ret=0, fd;
+ u64 objectid;
+ char *path = argv[2];
+ char *subvolid = argv[1];
+
+ fd = open_file_or_dir(path);
+ if (fd < 0) {
+ fprintf(stderr, "ERROR: can't access to '%s'\n", path);
+ return 12;
+ }
+
+ objectid = (unsigned long long)strtoll(subvolid, NULL, 0);
+ if (errno == ERANGE) {
+ fprintf(stderr, "ERROR: invalid tree id (%s)\n",subvolid);
+ return 30;
+ }
+ ret = ioctl(fd, BTRFS_IOC_DEFAULT_SUBVOL, &objectid);
+ close(fd);
+ if( ret < 0 ){
+ fprintf(stderr, "ERROR: unable to set a new default
subvolume\n");
+ return 30;
+ }
+ return 0;
+
+}
+

btrfs_cmds.h +1 -0
index cfdbde2..c63baa9 100644
@@ -27,4 +27,5 @@ int do_remove_volume(int nargs, char **args);
 int do_scan(int nargs, char **argv);
 int do_resize(int nargs, char **argv);
 int do_subvol_list(int nargs, char **argv);
+int do_set_default_subvol(int nargs, char **argv);
 int list_subvols(int fd);

----

Quoted 28 lines · you (Chris Mason)

Thanks for all your work on btrfs!

-chris

Quoted 23 lines · Goffredo Baroncelli
Quoted 6 lines · Chris Mason

Hi everyone,

I've pushed Goffredo's new btrfs utility into the subvol branch of the btrfs-progs repo. I'm using it as my starting point for the subvol listing utility as well as my fancy new defrag range ioctl.

Quoted 7 lines

Goffredo, the new defrag ioctl takes a bunch of arguments, and I used getopt inside the command to do it. The tricky part is that getopt expects argv[0] to be the command name, so I had to hack things a bit.

Could you please send a patch that changes the commands to include the command name in argv[0]? That'll make it easier to be flexible.

I will start to work

Quoted 2 lines

-chris

Signature · 1 line
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) 

<[email protected]>

Quoted 6 lines
Quoted 5 lines

Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 --
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
#6 lore raw

[PATCH 2/2] Re: New btrfs command pushed into the btrfs-progs subvol branch - man pages

In reply to a message not in the archive

Hi Chris,

enclose you can find the man page for the btrfs command, with the new sub- command (subvolume list, subvolume set-default)..

You can pull from

git pull http://cassiopea.homelinux.net/git/btrfs-command.git mlc-subvol

(branch mlc-subvol, commit e59135a27dc1fde6acc4fb198499be2b6cbd9f6f)

$ git diff remotes/origin/subvol | diffstat
 btrfs-list.c   |   15 +++--
 btrfs.c        |   56 +++++++++++++++++-
 btrfs_cmds.c   |   84 +++++++++++++++++-----------
 btrfs_cmds.h   |    1 
 man/btrfs.8.in |  150 +++++++++++++++++++++++++++++++++++++++++++++[...]
 5 files changed, 283 insertions(+), 43 deletions(-)
man/btrfs.8.in new file +110 -0
new file mode 100644
index 0000000..26ef982
@@ -0,0 +1,170 @@
+.TH BTRFS 8 "" "btrfs" "btrfs"
+.\"
+.\" Man page written by Goffredo Baroncelli <[email protected]> (Feb 2010)
+.\"
+.SH NAME
+btrfs \- control a btrfs filesystem
+.SH SYNOPSIS
+\fBbtrfs\fP \fBsubvolume snapshot\fP\fI <source> [<dest>/]<name>\fP
+.PP
+\fBbtrfs\fP \fBsubvolume delete\fP\fI <subvolume>\fP
+.PP
+\fBbtrfs\fP \fBsubvolume create\fP\fI [<dest>/]<name>\fP
+.PP
+\fBbtrfs\fP \fBsubvolume list\fP\fI <path>\fP
+.PP
+\fBbtrfs\fP \fBsubvolume set-default\fP\fI <id> <path>\fP
+.PP
+\fBbtrfs\fP \fBfilesystem defrag\fP\fI <file>|<dir> [<file>|<dir>...]\fP
+.PP
+\fBbtrfs\fP \fBfilesystem sync\fP\fI <path> \fP
+.PP
+\fBbtrfs\fP \fBfilesystem resize\fP\fI [+/\-]<size>[gkm]|max <filesystem>\fP
+.PP
+\fBbtrfs\fP \fBdevice scan\fP\fI [<device> [<device>..]]\fP
+.PP
+\fBbtrfs\fP \fBdevice show\fP\fI <dev>|<label> [<dev>|<label>...]\fP
+.PP
+\fBbtrfs\fP \fBdevice balance\fP\fI <path> \fP
+.PP
+\fBbtrfs\fP \fBdevice add\fP\fI <dev> [<dev>..] <path> \fP
+.PP
+\fBbtrfs\fP \fBdevice delete\fP\fI <dev> [<dev>..] <path> \fP]
+
+.PP
+\fBbtrfs\fP \fBhelp|\-\-help|\-h \fP\fI\fP
+.PP
+.SH DESCRIPTION
+.B btrfs
+is used to control the filesystem and the files and directories stored. It is
+the tool to create or destroy a snapshot or a subvolume for the
+filesystem, to defrag a file or a directory, flush the data to the disk,
+to resize the filesystem, to scan the device.
+
+It is possible to abbreviate the commands unless the commands  are ambiguous.
+For example: it is possible to run
+.I btrfs sub snaps
+instead of
+.I btrfs subvolume snapshot.
+But
+.I btrfs dev s
+is not allowed, because
+.I dev s
+may be interpreted both as
+.I device show
+and as
+.I device scan.
+In this case
+.I btrfs
+returns an error.
+
+If a command is terminated by
+.I --help
+, the relevant help is showed. If the passed command matches more commands,
+the help of all the matched commands are showed. For example
+.I btrfs dev --help
+shows the help of all
+.I device*
+command.
+
+.SH COMMANDS
+.TP
+
+\fBsubvolume snapshot\fR\fI <source> [<dest>/]<name>\fR
+Create a writable snapshot of the subvolume \fI<source>\fR with the name
+\fI<name>\fR in the \fI<dest>\fR directory. If \fI<source>\fR is not a
+subvolume, \fBbtrfs\fR returns an error.
+.TP
+
+\fBsubvolume delete\fR\fI <subvolume>\fR
+Delete the subvolume \fI<subvolume>\fR. If \fI<subvolume>\fR is not a
+subvolume, \fBbtrfs\fR returns an error.
+.TP
+
+\fBsubvolume create\fR\fI [<dest>/]<name>\fR
+Create a subvolume in \fI<dest>\fR (or in the current directory if
+\fI<dest>\fR is omitted).
+.TP
+
+\fBsubvolume list\fR\fI <path>\fR
+List the subvolumes present in the filesystem \fI<path>\fR. For every
+subvolume is showed the subvolume ID (second column), 
+the ID of the \fItop level\fR 
+subvolume (fifth column), and the path (seventh column) relative to the
+\fItop level\fR subvolume.
+These <ID> may be used by the \fBsubvolume set-default\fR command, or at
+mount time via the \fIsubvol=\fR option.
+.TP
+
+\fBsubvolume set-default\fR\fI <id> <path>\fR
+Set the subvolume of the filesystem \fI<path>\fR which is mounted as 
+\fIdefault\fR. The subvolume is identified by \fB<id>\fR, which 
+is returned by the \fBsubvolume list\fR command.
+.TP
+
+\fBfilesystem defragment\fP\fI <file>|<dir> [<file>|<dir>...]\fR
+Defragment files and/or directories.
+.TP
+
+\fBdevice scan\fR \fI[<device> [<device>..]]\fR
+Scan devices for a btrfs filesystem. If no devices are passed, \fBbtrfs\fR 

scans
+all the block devices.
+.TP
+
+\fBfilesystem sync\fR\fI <path> \fR
+Force a sync for the filesystem identified by \fI<path>\fR.
+.TP
+
+.\"
+.\" Some wording are extracted by the resize2fs man page
+.\"
+
+\fBfilesystem resize\fR\fI [+/\-]<size>[gkm]|max <path>\fR +Resize a filesystem identified by \fI<path>\fR.
+The \fI<size>\fR parameter specifies the new size of the filesystem. +If the prefix \fI+\fR or \fI\-\fR is present the size is increased or decreased
+by the quantity \fI<size>\fR.
+If no units are specified, the unit of the \fI<size>\fR parameter defaults to +bytes. Optionally, the size parameter may be suffixed by one of the following +the units designators: 'K', 'M', or 'G', kilobytes, megabytes, or gigabytes, +respectively.
+
+If 'max' is passed, the filesystem will occupy all available space on the +volume(s).
+
+The \fBresize\fR command \fBdoes not\fR manipulate the size of underlying +partition. If you wish to enlarge/reduce a filesystem, you must make sure you
+can expand the partition before enlarging the filesystem and shrink the +partition after reducing the size of the filesystem.
+.TP
+
+\fBfilesystem show\fR [<uuid>|<label>]\fR
+Show the btrfs filesystem with some additional info. If no UUID or label is +passed, \fBbtrfs\fR show info of all the btrfs filesystem.
+.TP
+
+\fBdevice balance\fR \fI<path>\fR
+Balance the chunks of the filesystem identified by \fI<path>\fR +across the devices.
+.TP
+
+\fBdevice add\fR\fI <dev> [<dev>..] <path>\fR
+Add device(s) to the filesystem identified by \fI<path>\fR.
+.TP
+
+\fBdevice delete\fR\fI <dev> [<dev>..] <path>\fR
+Remove device(s) from a filesystem identified by \fI<path>\fR. +.PP
+
+.SH EXIT STATUS
+\fBbtrfs\fR returns a zero exist status if it succeeds. Non zero is returned in
+case of failure.
+
+.SH AVAILABILITY
+.B btrfs
+is part of btrfs-progs. Btrfs filesystem is currently under heavy development,
+and not suitable for any uses other than benchmarking and review. +Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for +further details.
+.SH SEE ALSO
+.BR mkfs.btrfs (8)

Quoted 28 lines · you (Chris Mason)

Thanks for all your work on btrfs!

-chris

Quoted 23 lines · Goffredo Baroncelli
Quoted 6 lines · Chris Mason

Hi everyone,

I've pushed Goffredo's new btrfs utility into the subvol branch of the btrfs-progs repo. I'm using it as my starting point for the subvol listing utility as well as my fancy new defrag range ioctl.

Quoted 7 lines

Goffredo, the new defrag ioctl takes a bunch of arguments, and I used getopt inside the command to do it. The tricky part is that getopt expects argv[0] to be the command name, so I had to hack things a bit.

Could you please send a patch that changes the commands to include the command name in argv[0]? That'll make it easier to be flexible.

I will start to work

Quoted 2 lines

-chris

Signature · 1 line
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) 

<[email protected]>

Quoted 6 lines
Quoted 5 lines

Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512 --
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
#4 lore raw
In reply to Goffredo Baroncelli
Quoted 17 lines · Goffredo Baroncelli

Hi Chris,

I updated my git repository. You can pull from

git pull http://cassiopea.homelinux.net/git/btrfs-command.git mlc-subvol

(branch mlc-subvol, commit e59135a27dc1fde6acc4fb198499be2b6cbd9f6f)

$ git diff remotes/origin/subvol | diffstat
 btrfs-list.c   |   15 +++--
 btrfs.c        |   56 +++++++++++++++++-
 btrfs_cmds.c   |   84 +++++++++++++++++-----------
 btrfs_cmds.h   |    1 
 man/btrfs.8.in |  150 +++++++++++++++++++++++++++++++++++++++++++++[...]
 5 files changed, 283 insertions(+), 43 deletions(-)
Quoted 7 lines

As you requested I update the parser in order set the argv[0] argument as the program name + the verb. For example if I do

	$ btrfs dev add

the argv[0] will be equal to "btrfs device add". I hope that is what you requested.

Great.

Quoted 9 lines

Due to this change I update all the commands in order to evaluate the arguments from argv[1] and not from argv[0] anymore. (I update also your do_defrag() function)

Also because I implemented that already the week ago:
- I made some small modification to btrfs-list.c in order to be more friendly in case of error (replace some "exit(2)" with "return -ERR")
- I implemented the command "btrf subvolume set-default"

Wonderful. I've rebased this and put it into the subvol branch. I think I got all the commits and differences. The big reason for the rebase is to avoid the small string of single liner fixup commits. If you have other work pending I'm happy to rebase it in, otherwise please try to work against my subvol branch.

Thanks again!

-chris

#5 lore raw
Quoted 4 lines · Chris Mason
Quoted 3 lines · Goffredo Baroncelli

Hi Chris,

I updated my git repository. You can pull from

[...]

Quoted 7 lines

Wonderful. I've rebased this and put it into the subvol branch. I think I got all the commits and differences.

The big reason for the
rebase is to avoid the small string of single liner fixup commits. If you have other work pending I'm happy to rebase it in, otherwise please try to work against my subvol branch.

Sorry; I am new on git, so some concepts for me are new. The next time I will rebase.

Quoted 6 lines

Thanks again!

-chris

Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512