public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH][TRIVIAL] Improve the btrfsctl help
Date: Sun, 13 Dec 2009 12:38:58 +0100	[thread overview]
Message-ID: <200912131239.06192.kreijack@libero.it> (raw)
In-Reply-To: <9bd6b5360912130005m2bf7993ar7df5244945504534@mail.gmail.com>

[-- Attachment #1: Type: Text/Plain, Size: 3727 bytes --]

On Sunday 13 December 2009, sniper wrote:
> 2009/12/12 Goffredo Baroncelli <kreijack@gmail.com>:
> > Hi all,
[...]
> > +       printf("\t-D name dir: delete a snapshot or subvolume of dir\n");
> 
> Hi, should it be "delete a snapshot or subvolume _in_ dir"?
> 
Right,

Patch updated

BR
Goffredo

-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

---

 btrfsctl.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/btrfsctl.c b/btrfsctl.c
index 66c4e89..6f6e8e6 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -45,17 +45,18 @@ static inline int ioctl(int fd, int define, void *arg) { 
return 0; }
 
 static void print_usage(void)
 {
-	printf("usage: btrfsctl [ -d file|dir] [ -s snap_name subvol|tree ]\n");
-	printf("                [-r size] [-A device] [-a] [-c] [-D dir .]\n");
+	printf("usage: btrfsctl [-d file|dir] [-s snap_name subvol]\n");
+	printf("                [-S vol_name dir] [-a] [-r size subvol]\n");
+	printf("                [-A device] [-c subvol] [-D name subvol]\n");
 	printf("\t-d filename: defragments one file\n");
 	printf("\t-d directory: defragments the entire Btree\n");
-	printf("\t-s snap_name dir: creates a new snapshot of dir\n");
-	printf("\t-S subvol_name dir: creates a new subvolume\n");
-	printf("\t-r [+-]size[gkm]: resize the FS by size amount\n");
-	printf("\t-A device: scans the device file for a Btrfs filesystem\n");
+	printf("\t-s snap_name subvol: creates a new snapshot of subvol\n");
+	printf("\t-S subvol_name dir: creates a new subvolume in dir\n");
 	printf("\t-a: scans all devices for Btrfs filesystems\n");
-	printf("\t-c: forces a single FS sync\n");
-	printf("\t-D: delete snapshot\n");
+	printf("\t-r [+-]size[gkm] subvol: resize the FS by size amount\n");
+	printf("\t-A device: scans the device file for a Btrfs filesystem\n");
+	printf("\t-c subvol: forces a single FS sync\n");
+	printf("\t-D name dir: delete a snapshot or subvolume in dir\n");
 	printf("%s\n", BTRFS_BUILD_VERSION);
 	exit(1);
 }
@@ -110,7 +111,7 @@ int main(int ac, char **av)
 	for (i = 1; i < ac; i++) {
 		if (strcmp(av[i], "-s") == 0) {
 			if (i + 1 >= ac - 1) {
-				fprintf(stderr, "-s requires an arg");
+				fprintf(stderr, "-s requires two args\n");
 				print_usage();
 			}
 			fullpath = av[i + 1];
@@ -137,7 +138,7 @@ int main(int ac, char **av)
 			command = BTRFS_IOC_SNAP_CREATE;
 		} else if (strcmp(av[i], "-S") == 0) {
 			if (i + 1 >= ac - 1) {
-				fprintf(stderr, "-S requires an arg");
+				fprintf(stderr, "-S requires two args\n");
 				print_usage();
 			}
 			name = av[i + 1];
@@ -160,8 +161,8 @@ int main(int ac, char **av)
 			}
 			command = BTRFS_IOC_DEFRAG;
 		} else if (strcmp(av[i], "-D") == 0) {
-			if (i >= ac - 1) {
-				fprintf(stderr, "-D requires an arg\n");
+			if (i + 1 >= ac - 1) {
+				fprintf(stderr, "-D requires two args\n");
 				print_usage();
 			}
 			command = BTRFS_IOC_SNAP_DESTROY;
@@ -178,8 +179,8 @@ int main(int ac, char **av)
 			}
 			command = BTRFS_IOC_SCAN_DEV;
 		} else if (strcmp(av[i], "-r") == 0) {
-			if (i >= ac - 1) {
-				fprintf(stderr, "-r requires an arg\n");
+			if (i+1 >= ac - 1) {
+				fprintf(stderr, "-r requires two args\n");
 				print_usage();
 			}
 			name = av[i + 1];
@@ -190,6 +191,10 @@ int main(int ac, char **av)
 			}
 			command = BTRFS_IOC_RESIZE;
 		} else if (strcmp(av[i], "-c") == 0) {
+			if (i >= ac - 1) {
+				fprintf(stderr, "-c requires an arg\n");
+				print_usage();
+			}
 			command = BTRFS_IOC_SYNC;
 		}
 	}



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-12-13 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-12 15:39 [PATCH][TRIVIAL] Improve the btrfsctl help Goffredo Baroncelli
2009-12-13  8:05 ` sniper
2009-12-13 11:38   ` Goffredo Baroncelli [this message]
2009-12-13 18:50     ` [PATCH] " Goffredo Baroncelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200912131239.06192.kreijack@libero.it \
    --to=kreijack@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox