mirror of
https://github.com/DoctorWkt/pdp7-unix.git
synced 2026-01-13 15:27:39 +00:00
I added a way for a file to be given a specific i-number, needed for i-num 1.
This commit is contained in:
parent
42c7a240ed
commit
7fcf1d230c
@ -1,7 +1,7 @@
|
||||
# Prototype file for PDP-7 Unix filesystem layout
|
||||
#
|
||||
# Entries are one of:
|
||||
# filename f[r-][w-][r-][w-] uid local_file_to_insert
|
||||
# filename f[r-][w-][r-][w-] uid local_file_to_insert [inumber]
|
||||
# dirname d[r-][w-][r-][w-] uid [inumber]
|
||||
# device i[r-][w-][r-][w-] uid inumber
|
||||
# link l---- inumber
|
||||
@ -12,6 +12,7 @@
|
||||
# Format was inspired by 6th Edition mkfs
|
||||
#
|
||||
dd drwr- -1 4
|
||||
core frwrw -1 /dev/null 1
|
||||
system drwr- -1 3
|
||||
ttyin irwr- -1 6
|
||||
keyboard irwr- -1 7
|
||||
|
||||
26
tools/mkfs7
26
tools/mkfs7
@ -378,7 +378,7 @@ sub read_word {
|
||||
# filesystem. Add an entry to this file in the current directory on
|
||||
# the dirstack.
|
||||
sub add_file {
|
||||
my ( $name, $perms, $uid, $extfile ) = @_;
|
||||
my ( $name, $perms, $uid, $extfile, $inum ) = @_;
|
||||
dprintf( "Adding file %s perms %06o uid %d extfile %s\n",
|
||||
$name, $perms, $uid, $extfile );
|
||||
|
||||
@ -389,11 +389,11 @@ sub add_file {
|
||||
my $isbinary = 0;
|
||||
my $c = getc($IN);
|
||||
seek( $IN, 0, 0 );
|
||||
$isbinary = 1 if ( ( ord($c) & 0300 ) == 0200 );
|
||||
$isbinary = 1 if ($c && (( ord($c) & 0300 ) == 0200 ));
|
||||
|
||||
# Read the whole file into a buffer, converting from ASCII or sixbit encoding
|
||||
my @buf;
|
||||
my $size;
|
||||
my $size=0;
|
||||
|
||||
while (1) {
|
||||
if ($isbinary) {
|
||||
@ -418,13 +418,15 @@ sub add_file {
|
||||
|
||||
# Put the contents of the file into the blocks
|
||||
my ($blocknum, $offset)= ($blklist[0], 0);
|
||||
if ($blocknum) {
|
||||
dprint("Filling block $blocknum with content from $extfile\n");
|
||||
foreach my $i (0 .. $size-1) {
|
||||
$Block[$blocknum][$offset++]= $buf[$i];
|
||||
if ( $offset == WORDSPERBLK ) {
|
||||
$offset = 0;
|
||||
$blocknum++;
|
||||
dprint("Filling block $blocknum with content from $extfile\n");
|
||||
foreach my $i (0 .. $size-1) {
|
||||
$Block[$blocknum][$offset++]= $buf[$i];
|
||||
if ( $offset == WORDSPERBLK ) {
|
||||
$offset = 0;
|
||||
$blocknum++;
|
||||
dprint("Filling block $blocknum with content from $extfile\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -437,7 +439,7 @@ sub add_file {
|
||||
}
|
||||
|
||||
# Allocate and fill in the i-node
|
||||
my $inum = allocate_inode();
|
||||
$inum = allocate_inode($inum);
|
||||
if ($large) {
|
||||
fill_inode( $inum, $perms, I_FILE, $uid, $size, @indblocks );
|
||||
} else {
|
||||
@ -517,8 +519,8 @@ sub parse_proto_file {
|
||||
next;
|
||||
}
|
||||
if ( $type eq I_FILE ) {
|
||||
my ( $name, $permstr, $uid, $extfile ) = @words;
|
||||
add_file( $name, $perms, $uid, $extfile );
|
||||
my ( $name, $permstr, $uid, $extfile, $inum ) = @words;
|
||||
add_file( $name, $perms, $uid, $extfile, $inum );
|
||||
next;
|
||||
}
|
||||
if ( $type eq I_SPECIAL ) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user