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