From: Theodore Ts'o <tytso@mit.edu>
To: Darren Hart <dvhart@infradead.org>
Cc: Andreas Dilger <aedilger@gmail.com>,
Andreas Dilger <adilger@dilger.ca>,
linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [e2fsprogs] initdir: Writing inode after the initial write?
Date: Tue, 4 Dec 2012 15:36:34 -0500 [thread overview]
Message-ID: <20121204203634.GF7790@thunk.org> (raw)
In-Reply-To: <50BE58B8.6020909@infradead.org>
On Tue, Dec 04, 2012 at 12:10:32PM -0800, Darren Hart wrote:
> >
> >> [ ] Add meta-data mirroring
> >
> > Not sure what what you mean by meta-data mirroring?
>
> Sorry, just uid, gid, permissions... basically the inode. This could be
> done by updating the script to use the sif command, but having a -i or
> similar option to "write" (or maybe a new "copy" which did effectively
> the same thing) by reading stat and copying the data across would be a
> nice abstraction.
Oh, I see, grabbing the permissions from what's actually in the source
tree. You may want to talk to some of the people who will actually be
using your script to see what they want. I could easily imagine some
folks arguing that they don't want to use the mtimes from the source
code tree, but instead they want to set them all to some standard set
timestamp specified in some config file (in order to make the file
system image be stable across checkouts).
In addition, for setuid root programs, you won't be able to take the
uid/gid and permissions from the inode anyway --- so I had been
assuming that you would have some kind of control file, that would
perhaps be in the top-level of your initial_ directory, that would
list the default uid/gid/mod times to be used, and then exceptions on
a per-file basis. (This was the control file where I was suggesting
that you _not_ use XML for your encoding; if you want a flexible, but
easy-to-use config file parser, I'll suggest you take a look at
e2fsck/profile.c, which is used for parsing /etc/e2fsck.conf and
/etc/mke2fs.conf.)
> Agreed on the hard link. However, things like mknod and write from
> debugfs seem like good candidates to be moved into libext2fs, then
> other tools can make use of the code.
For write from debugfs, you do realize we have lib/ext2fs/fileio.c,
right? That's what debugfs uses already.
Maybe it would make sense to add a ext2fs_create_file() function which
takes a pathname, and it takes care of calling namei to get the target
directory, and then allocating the file, etc., and then leave it to
the calling application to fill in the inode structure with whatever
is neecessary to create a new regular file, or a new block/character
device, etc.
So that one new function would would kill multiple stones at once; it
would give you mknod, as well as refactoring most of what's in debugfs
today for writing a file to a filesystem that isn't in
lib/ext2fs/fileio.c.
The one gotcha with creating these convenience functions is that it
make may it much harder to properly report errors back to the user,
since a fundamental rule for functions in libext2fs is that they
should not use fprintf(stderr, ...) to report errors back to the user.
That's the other reason why I tended not push too much complexity into
libext2fs.
(In general use of stdio in libext2fs is strongly discouraged, since
that wouldn't be useful for an application written to uses gtk or even
ncurses, such as that old EVMS front end program that some former
colleagues of ours at IBM's LTC had written. :-) It's also
problematic for the ppcboot folks, since they are trying to write a
bootloader which would use libext2fs in a restricted environment that
doesn't even have stdio available to programs; that was actually a
problem for them caused by the recently merged mmp code, and I had to
help them with that.)
- Ted
next prev parent reply other threads:[~2012-12-04 20:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-01 2:13 [e2fsprogs] initdir: Writing inode after the initial write? Darren Hart
2012-12-01 4:23 ` Andreas Dilger
2012-12-01 5:08 ` Darren Hart
2012-12-01 19:31 ` Andreas Dilger
2012-12-03 19:46 ` Darren Hart
2012-12-04 10:45 ` Yongqiang Yang
2012-12-04 17:42 ` Darren Hart
2012-12-04 10:59 ` Andreas Dilger
2012-12-04 17:43 ` Darren Hart
2012-12-04 19:08 ` Theodore Ts'o
2012-12-04 19:40 ` Darren Hart
2012-12-04 20:00 ` Theodore Ts'o
2012-12-04 20:10 ` Darren Hart
2012-12-04 20:36 ` Theodore Ts'o [this message]
2012-12-04 15:22 ` Theodore Ts'o
2012-12-04 17:46 ` Darren Hart
2012-12-04 19:24 ` Theodore Ts'o
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=20121204203634.GF7790@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@dilger.ca \
--cc=aedilger@gmail.com \
--cc=dvhart@infradead.org \
--cc=linux-ext4@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