The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: wkt@tuhs.org (Warren Toomey)
Subject: [Unix-jun72] mkfs.c is now working
Date: Mon, 5 May 2008 00:33:43 +1000	[thread overview]
Message-ID: <20080504143343.GA39542@minnie.tuhs.org> (raw)

All, my mkfs.c $Revision: 1.17 $, $Date: 2008/05/04 14:20:12 $ now produces
mountable filesystem images, and it's now checked into the svn repository.
The problem was that the size of a directory is not the size of the blocks
allocated to it, but is in fact the number of bytes of the in-use directory
entries. For example, / was being allocated 1 block == 512 bytes. But 512
is not its size (as it would be in later UNIXes); in fact if / has entries

 41 sdrwr-  7 root     70 Jan  1 00:00:00 .
 41 sdrwr-  7 root     70 Jan  1 00:00:00 ..
 43 sdrwr-  2 root    570 Jan  1 00:00:00 bin
 42 sdrwr-  2 root    250 Jan  1 00:00:00 dev
 99 sdrwr-  2 root    100 Jan  1 00:00:00 etc
108 sdrwr-  2 root     70 Jan  1 00:00:00 tmp
114 sdrwr-  2 root     20 Jan  1 00:00:00 usr

then its size is 7 entries * 10 bytes each = 70 bytes.

Importantly, this also means that we can now make bootable root filesystems
without having to do a cold UNIX:

% tools/mkfs /usr/local/src/V1 rf0.dsk rf	# Make the / disk
% tools/mkfs /usr/local/src/V1 rk0.dsk rk	# Make the /usr disk, same stuff
% ./simh.cfg
PDP-11 simulator V3.7-3
./simh.cfg> #!tools/pdp11
Unknown command
Disabling CR
Disabling XQ
RF: buffering file in memory
TC0: 16b format, buffering file in memory
sim> g

:login: root
root
# /tmp/a.out
/dev/rk0# ls -l /usr/tmp
total    8
112 sxrwrw  1 root    156 Jan  1 00:00:00 a.out
110 sxrwrw  1 root   1664 Jan  1 00:00:00 etma
113 sxrwrw  1 root      6 Jan  1 00:00:00 hello
109 sxrwrw  1 root     26 Jan  1 00:00:00 ttmp
111 sxrwrw  1 root    142 Jan  1 00:00:00 utmp
# df
806+4602			# Number of free blocks on / and /usr

I added /usr/tmp/hello just to verify that I was getting files that
were not on the cold UNIX tape.

Cheers,
	Warren



             reply	other threads:[~2008-05-04 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04 14:33 Warren Toomey [this message]
2008-05-04 14:42 ` Warren Toomey

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=20080504143343.GA39542@minnie.tuhs.org \
    --to=wkt@tuhs.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;
as well as URLs for NNTP newsgroup(s).