* Patch: Allow options to be passed to btrfsck
[not found] <4B71B538.1040709@debian.org>
@ 2010-02-11 12:59 ` Sten Heinze
2010-02-11 13:09 ` Sten Heinze
0 siblings, 1 reply; 2+ messages in thread
From: Sten Heinze @ 2010-02-11 12:59 UTC (permalink / raw)
To: linux-btrfs; +Cc: 567681
This patch makes btrfsck ignore (for now) options passed to it. This makes
btrfsck runs on startup not failing. I was asked to post my patch here by the
Debian Maintainer of btrfs-tools.
Background: On Startup all filesystem (on a Debian system) are fsck'ed. A
option to allow non-interactive filesystem checks on startup is passed to fsck,
usually -a or -y.
Currently btrfsck expects the device as the only parameter and fails if run
with any option e.g. btrfsck -a /dev/hda1 (returns error code 1). My patch
fixes this by allowing options to be passed, although all options are ignored
at the moment. (The attached patch is slightly improved from the one I sent to
the Debian bug report [1] before.)
Please comment if this is acceptable for inclusion in btrfsck. If not, I would
be happy to improve the patch.
Thanks,
Sten
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567681
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch: Allow options to be passed to btrfsck
2010-02-11 12:59 ` Patch: Allow options to be passed to btrfsck Sten Heinze
@ 2010-02-11 13:09 ` Sten Heinze
0 siblings, 0 replies; 2+ messages in thread
From: Sten Heinze @ 2010-02-11 13:09 UTC (permalink / raw)
To: linux-btrfs; +Cc: 567681
[-- Attachment #1: Type: Text/Plain, Size: 1011 bytes --]
[This time with the patch attached.]
[Please CC: me, as I am not subscribed to the linux-btrfs mailing list.]
This patch makes btrfsck ignore (for now) options passed to it. This makes
btrfsck runs on startup not failing. I was asked to post my patch here by the
Debian Maintainer of btrfs-tools.
Background: On Startup all filesystem (on a Debian system) are fsck'ed. A
option to allow non-interactive filesystem checks on startup is passed to fsck,
usually -a or -y.
Currently btrfsck expects the device as the only parameter and fails if run
with any option e.g. btrfsck -a /dev/hda1 (returns error code 1). My patch
fixes this by allowing options to be passed, although all options are ignored
at the moment. (The attached patch is slightly improved from the one I sent to
the Debian bug report [1] before.)
Please comment if this is acceptable for inclusion in btrfsck. If not, I would
be happy to improve the patch.
Thanks,
Sten
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567681
[-- Attachment #2: 08-allow-fsck-options.patch --]
[-- Type: text/x-patch, Size: 920 bytes --]
Index: btrfs-tools/btrfsck.c
===================================================================
--- btrfs-tools.orig/btrfsck.c 2010-02-08 05:44:01.037134357 +0100
+++ btrfs-tools/btrfsck.c 2010-02-11 05:02:15.469358404 +0100
@@ -2807,7 +2807,7 @@
static void print_usage(void)
{
- fprintf(stderr, "usage: btrfsck dev\n");
+ fprintf(stderr, "usage: btrfsck [option] dev\n");
fprintf(stderr, "%s\n", BTRFS_BUILD_VERSION);
exit(1);
}
@@ -2821,9 +2821,24 @@
if (ac < 2)
print_usage();
+ char *file = av[ac - 1];
+ int pos;
+ for( pos = 1; pos < ac; ++pos)
+ {
+ /* ignore all options for now, stop at first device found */
+ if (av[pos][0] != '-')
+ {
+ file = av[pos];
+ break;
+ }
+ }
+
+ /* print device fsck'ed */
+ printf("%s: ", file);
+
radix_tree_init();
cache_tree_init(&root_cache);
- root = open_ctree(av[1], 0, 0);
+ root = open_ctree(file, 0, 0);
if (root == NULL)
return 1;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-11 13:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <4B71B538.1040709@debian.org>
2010-02-11 12:59 ` Patch: Allow options to be passed to btrfsck Sten Heinze
2010-02-11 13:09 ` Sten Heinze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).