Subject: toolchain/33924: feature request: makefs(8) should output blocks used by each file
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <tg@mirbsd.org>
List: netbsd-bugs
Date: 07/05/2006 22:20:00
>Number:         33924
>Category:       toolchain
>Synopsis:       feature request: makefs(8) should output blocks used by each file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 05 22:20:00 +0000 2006
>Originator:     Thorsten Glaser
>Release:        code from cvs -rHEAD
>Organization:
MirOS Project
>Environment:
MirBSD odem.66h.42h.de 9 Kv#9s81-stable-20060701 GENERIC#923 i386
>Description:
mkisofs has an option to output the blocks used by
each file during filesystem creation process. This
looks like that:

29 31 workdir/00-README
32 32 /TRANS.TBL
33 33 workdir/etc/boot.cfg
34 54 workdir/v9/i386/boot.iso
55 75 workdir/v9/i386/boot.liv
76 2182 workdir/v9/i386/bsd.rd
2183 2206 workdir/v9/i386/pxeboot

The numbers are: start sector(!) and end sector,
measured in media sectors (here 2048 bytes, on
any other media it would be 512 bytes). These are
sectors, not filesystem blocks.

This _also_ means (and THAT is important for MirOS)
that the file TRANS.TBL starts at offset 32*2048 in
the generated ISO and is (32-32+1)*2048 bytes long.
More importantly, the bootloader starts at 55*2048
and is (75-55+1)*2048 bytes long - that information
is used by our installboot(8). I know NetBSD(R) has
different bootloaders, but in my opinion even you
could use this kind of information somewhere.

While this format is useful for -t cd9660 option of
makefs(8) it does not make much sense for ffs because
files can be split there, as far as I understand that
filesystem. (If I'm wrong here, please ignore the fol-
lowing commentary and just fix makefs(8) to have an
option for output in the above format.)

If a file is split across several filesystem blocks,
say, blocks 8, 9 and 11, and we assume a fs block is
4096 bytes (8 sectors), the file then occupies the
sectors 64-71, 72-79, and 88-95. The optimal output
format would have them already concatenated, so it
would look like this:

path/to/ourfile X 64 79 88 95

The 'X' here is some kind of separator, in case the
filenames contain spaces. It should be user-selectable.
(Or do you guys have a better idea?)

An alternate format, a little harder to parse:

2 64 79 88 95 path/to/ourfile

This might even be the better choice.

I would have attached a patch, but reading the code,
I am unable to write it myself because it looks sort
of messy... (historical ballast and sharing code with
the kernel, probably). I would be glad if someone who
actually knows what he's doing would look into this.

Unrelated footnote: mkisofs 2 has -boot-info-table
option which we need for bootable ISOs. To implement
that would be the next thing. I haven't yet looked
if I can do it myself (I probably can, I think) but
if someone is working on it or wants to work on it,
please do so, because I have an entire operating sy-
stem to take care of ;)

Thanks in advance for any help.

Please Cc: me (tg@mirbsd.org) or our general discus-
sion list (miros-discuss@mirbsd.org) on any followup
if possible. Thanks for your co-operation.
>How-To-Repeat:
this is a feature request
>Fix:
hack in some -v or -T (trace) or whatever option.
Maybe even hide it in -d (debug) if you want.