All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Jan Tulak <jtulak@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [proposal] making filesystem tools more machine friendly
Date: Tue, 4 Jul 2017 15:07:21 -0400	[thread overview]
Message-ID: <20170704190721.6kivmxgql7pzn7m5@thunk.org> (raw)
In-Reply-To: <CACj3i725QJGgjzwgw+ermwa_4P4rbKg6E4LGLK9s5ivPWdpFpQ@mail.gmail.com>

On Tue, Jul 04, 2017 at 03:57:38PM +0200, Jan Tulak wrote:
> 
> There are some similar values between filesystems, but they are really
> basic ones - blocks, inodes, and maybe few more other things, so I
> admit the usability of common names for these fields is questionable.
> What I really want is that I can run tune2fs or xfs_info, pass the
> output through a standard, common parser, and get a structure filled
> with data.

Can you make a list of what you might need?  The reason why I was
asking for "user stories" is because I was trying to get you to think
in more detail about exactly what functionality you really need.  Not
just something hand wavy like "tools that want to abstract most of the
differences between various file systems" by exactly what file
systems.  (e.g., create a file system, resize a file system, check a
file system --- what else?)

I think if you make a list of the functionality that you need to
abstract --- and thinking about "user stories" is a common way UI
designers try to get developers to think in terms of "what does the
user want to do", as opposed to the developer-centric "oh, I want an
abstract file system interface" answer.

In terms of what you might need, I'm guessing it won't be much more
than:

* Blocksize
* Number of blocks in the file system
* Number of free blocks in the file system
* Number of inodes in the file system (*)
* Number of free inodes in the file system (*)
* Volume label (**)
* UUID (**)

(*) It's not clear you even need the number of inodes / free inodes.
Try going through potential "user stories" and see what you find.

(**) Already available via libblkid and the blkid CLI.

I suspect you may be making this way more complicated that it needs to
be.  These fields are pretty basic, and have changed in decades.  I'm
pretty sure the original EVMS screen-scraping code that parsed the
output of "dumpe2fs -h" from 10+ years ago would still work today.  So
when you assert that the screen scraping is terrible because the tools
are constantly changing the output --- I'd like to gently challenge
that assertion.

These are also the fields which are *trivially* easy to extract via a
C interface, and which again, even if they were done without the
support of the file system developers would almost certainly be
stable.  The volume ID and UUID are extracted for the superblock of a
large number of file systems in libblkid, and most of the probe code
involved hasn't changed in decades.  Changes were only to support new
file systems, not because file systems are constantly changing the
superblock encoding for where to find the Volume label or UUID.  I
assure you the same would be tree for the fields listed above.

Doing something like libblkid's probe functions for the number of
block/inodes will almost certainly be less work than trying to get
JSON patches crammed into a large number of file system tools.  If you
did it in a standalone, libblkid-like library, it would also have the
benefit that you could query a file system for its basic statistics
even if the file system's userspace tools have been installed in the
distribution.

So perhaps that's something you should consider?

							- Ted

  reply	other threads:[~2017-07-04 19:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  8:17 [proposal] making filesystem tools more machine friendly Jan Tulak
2017-06-30 10:22 ` Arvin Schnell
2017-06-30 13:58 ` Emmanuel Florac
2017-06-30 15:29 ` Theodore Ts'o
2017-07-03 11:52   ` Jan Tulak
2017-07-03 15:07     ` Theodore Ts'o
2017-07-03 17:37       ` Darrick J. Wong
2017-07-04 13:57         ` Jan Tulak
2017-07-04 19:07           ` Theodore Ts'o [this message]
2017-07-12  8:42             ` Jan Tulak
2017-07-05 18:11 ` Christoph Hellwig
2017-07-12 13:00   ` Jan Tulak
2017-07-12 17:10 ` Richard W.M. Jones
2017-11-27 14:57 ` Andrew Price
2017-11-27 15:38   ` Jan Tulak
2017-11-27 16:24     ` Andrew Price
2017-11-27 16:42       ` Jan Tulak

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=20170704190721.6kivmxgql7pzn7m5@thunk.org \
    --to=tytso@mit.edu \
    --cc=darrick.wong@oracle.com \
    --cc=jtulak@redhat.com \
    --cc=linux-fsdevel@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 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.