All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: linux-btrfs@vger.kernel.org
Cc: ptoscano@redhat.com
Subject: RFE: 'btrfs' tools machine readable output
Date: Mon, 16 May 2016 13:14:56 +0100	[thread overview]
Message-ID: <20160516121456.GA16970@redhat.com> (raw)

I don't have time to implement this right now, so I'm just posting
this as a suggestion/request ...

It would be really helpful if the btrfs tools had a machine-readable
output.

Libguestfs parses btrfs tools output in a number of places, eg:
https://github.com/libguestfs/libguestfs/blob/master/daemon/btrfs.c
This is a massive PITA because each time a new release of btrfs-progs
comes along it changes the output slightly, and we end up having
to add all sorts of hacks.

With machine-readable output, there'd be a flag which would
change the output.  eg:

$ btrfs filesystem show
Label: 'ROOT'  uuid: af471cfc-421a-4d51-8811-ce969f76828a
        Total devices 1 FS bytes used 5.29MiB
        devid    1 size 767.97MiB used 92.00MiB path /dev/sda2

would become:

$ btrfs --json filesystem show
{
  "devices": {
     "Label": "ROOT",
     "uuid": "af471cfc-421a-4d51-8811-ce969f76828a",
     /// etc
  }
}

By this example I don't mean that JSON has to be the format -- in fact
it's a terrible format with all sorts of problems -- any format which
is parseable with C libraries would do for us.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

             reply	other threads:[~2016-05-16 12:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 12:14 Richard W.M. Jones [this message]
2016-05-16 12:21 ` RFE: 'btrfs' tools machine readable output Martin Steigerwald
2016-05-16 12:39   ` Richard W.M. Jones
2016-05-16 12:46   ` Pino Toscano
2016-05-16 12:39 ` Austin S. Hemmelgarn
2016-05-27 19:47   ` Nicholas D Steeves
2016-05-31 12:15     ` Austin S. Hemmelgarn
2016-05-17  9:33 ` David Sterba
2016-05-17 11:14   ` Austin S. Hemmelgarn
2016-05-17 12:23     ` David Sterba
2016-05-17 13:05       ` Austin S. Hemmelgarn
2016-05-17 13:32         ` Richard W.M. Jones
2016-05-17 15:04           ` David Sterba

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=20160516121456.GA16970@redhat.com \
    --to=rjones@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=ptoscano@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.