Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Christoph Heiss <christoph@c8h4.io>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/7] btrfs-progs: implement json output for subvolume subcommands
Date: Thu, 17 Aug 2023 21:34:37 +0200	[thread overview]
Message-ID: <20230817193437.GU2420@twin.jikos.cz> (raw)
In-Reply-To: <20230813094555.106052-1-christoph@c8h4.io>

On Sun, Aug 13, 2023 at 11:44:55AM +0200, Christoph Heiss wrote:
> JSON as output format is already implement for some of the commands in
> btrfs-progs, which is a very useful feature to have for e.g. scripting.
> 
> This series adds the same for `btrfs subvolume list`, `btrfs subvolume
> get-default` and `btrfs subvolume show`.
> 
> #1-#3 are some small preparatory fixes & refactors, #4 introduces the
> `struct rowspec` containing all fields needed by the series.
> 
> The actual implementation of the JSON output is mostly pretty
> straight-forward, only cmd_subvolume_show() needed some refactoring
> first.
> 
> I probably will go about implementing the same for more commands, but
> wanted to get this out now to get some feedback.

Thanks. There are a few things regarding the json output that are still
to be figured out and to set examples to follow. The plain and json
output does not match 1:1 in the printed information, here the
'top level' does not need to be in the json output or there could be
more subvolume related info in the map. The textual output is
unfortunatelly parsed by many tools nowadays so we can't change the
format. With json it's easier to filter out the interesting data so
"more is better" in this case.

The formatter is designed in a way to allow plain text and json to be
printed by the same lines of code but this is namely for line oriented
output, like 'subvolume show'.

For the 'subvolume list' this may not be that easy so two separate
printing functions make more sense, like you did it in the series. So
that's fine.

I'll put some guidelines to the documentation, the key naming must be
unified, e.g. 'gen' or 'generation' but there's also 'transid' used in
some cases etc.

As the json format is also an ABI we need to get it finalized first so
I'll merge the series but put the actual support for --json option under
experimental build.

  parent reply	other threads:[~2023-08-17 19:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13  9:44 [PATCH 0/7] btrfs-progs: implement json output for subvolume subcommands Christoph Heiss
2023-08-13  9:44 ` [PATCH 1/7] btrfs-progs: common: document `time-long` output format Christoph Heiss
2023-08-13  9:44 ` [PATCH 2/7] btrfs-progs: subvol show: remove duplicated quotas error check Christoph Heiss
2023-08-13  9:44 ` [PATCH 3/7] btrfs-progs: subvol show: factor out text printing to own function Christoph Heiss
2023-08-13  9:44 ` [PATCH 4/7] btrfs-progs: subvol: introduce rowspec definition for json output Christoph Heiss
2023-08-13  9:45 ` [PATCH 5/7] btrfs-progs: subvol list: implement json format output Christoph Heiss
2023-08-17 19:59   ` David Sterba
2023-08-13  9:45 ` [PATCH 6/7] btrfs-progs: subvol get-default: " Christoph Heiss
2023-08-17 20:04   ` David Sterba
2023-08-18 18:49     ` Christoph Heiss
2023-08-13  9:45 ` [PATCH 7/7] btrfs-progs: subvol show: " Christoph Heiss
2023-08-17 20:02   ` David Sterba
2023-08-17 19:34 ` David Sterba [this message]
2023-08-18 18:39   ` [PATCH 0/7] btrfs-progs: implement json output for subvolume subcommands Christoph Heiss
2023-08-21 15:19     ` 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=20230817193437.GU2420@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=christoph@c8h4.io \
    --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