[Libguestfs] [PATCH 2/5] New API: btrfs_check
Pino Toscano
ptoscano at redhat.com
Tue Jan 13 12:36:56 UTC 2015
On Monday 12 January 2015 09:37:36 Hu Tao wrote:
> On Wed, Jan 07, 2015 at 01:25:50PM +0100, Pino Toscano wrote:
> > In data venerdì 26 dicembre 2014 16:17:46, Hu Tao ha scritto:
> > > Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
> > > ---
> > > daemon/btrfs.c | 24 ++++++++++++++++++++++++
> > > generator/actions.ml | 14 ++++++++++++++
> > > src/MAX_PROC_NR | 2 +-
> > > 3 files changed, 39 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> > > index 79de539..de20bc3 100644
> > > --- a/daemon/btrfs.c
> > > +++ b/daemon/btrfs.c
> > > @@ -1375,3 +1375,27 @@ do_btrfs_scrub (const char *path)
> > >
> > > return 0;
> > > }
> > > +
> > > +int
> > > +do_btrfs_check (const char *device)
> > > +{
> > > + const size_t MAX_ARGS = 64;
> > > + const char *argv[MAX_ARGS];
> > > + size_t i = 0;
> > > + CLEANUP_FREE char *err = NULL;
> > > + CLEANUP_FREE char *out = NULL;
> > > + int r;
> > > +
> > > + ADD_ARG (argv, i, str_btrfs);
> > > + ADD_ARG (argv, i, "check");
> > > + ADD_ARG (argv, i, device);
> > > + ADD_ARG (argv, i, NULL);
> > > +
> > > + r = commandv (&out, &err, argv);
> > > + if (r == -1) {
> > > + reply_with_error ("%s: %s", device, err);
> > > + return -1;
> > > + }
> > > +
> > > + return 0;
> > > +}
> >
> > We do have already a "fsck" action; OTOH fsck.btrfs does nothing, so
> > I would rather call `btrfs check` there, instead of adding a new
> > btrfs-specific API.
> > Let's make our fsck useful on btrfs :)
>
> I found btrfs_fsck has been already implemented. Do you mean we should
> extend btrfs to support btrfs?
I guess you mean "... extend fsck to support btrfs", right? :)
That could be an idea, but given that "btrfs check" may usually need
additional parameter, then it might not be worth it.
--
Pino Toscano
More information about the Libguestfs
mailing list