I bit the bullet and implemented "." in the filesystem. I've changed the proto
file to put the binaries in system. I added a few more checks to fsck, and I fixed a few bugs in src/other/wktls.s.
This commit is contained in:
+12
-12
@@ -19,22 +19,22 @@ dd drw-- -1 4
|
|||||||
ttyout irwr- -1 11
|
ttyout irwr- -1 11
|
||||||
display irwr- -1 12
|
display irwr- -1 12
|
||||||
pptout irwr- -1 13
|
pptout irwr- -1 13
|
||||||
|
as frwr- -1 ../bin/as
|
||||||
|
cat frwr- -1 ../bin/cat
|
||||||
|
chmod frwr- -1 ../bin/chmod
|
||||||
|
chown frwr- -1 ../bin/chown
|
||||||
|
chrm frwr- -1 ../bin/chrm
|
||||||
|
cp frwr- -1 ../bin/cp
|
||||||
|
date frwr- -1 ../bin/date
|
||||||
|
ds frwr- -1 ../bin/ds
|
||||||
init frwr- -1 ../bin/init
|
init frwr- -1 ../bin/init
|
||||||
|
ln frwr- -1 ../bin/ln
|
||||||
|
ls frwr- -1 ../bin/ls
|
||||||
|
mv frwr- -1 ../bin/mv
|
||||||
password frw-- -1 password
|
password frw-- -1 password
|
||||||
sh frwr- -1 ../bin/sh
|
sh frwr- -1 ../bin/sh
|
||||||
|
stat frwr- -1 ../bin/stat
|
||||||
$
|
$
|
||||||
as frwr- -1 ../bin/as
|
|
||||||
cat frwr- -1 ../bin/cat
|
|
||||||
chmod frwr- -1 ../bin/chmod
|
|
||||||
chown frwr- -1 ../bin/chown
|
|
||||||
chrm frwr- -1 ../bin/chrm
|
|
||||||
cp frwr- -1 ../bin/cp
|
|
||||||
date frwr- -1 ../bin/date
|
|
||||||
ds frwr- -1 ../bin/ds
|
|
||||||
ln frwr- -1 ../bin/ln
|
|
||||||
ls frwr- -1 ../bin/ls
|
|
||||||
mv frwr- -1 ../bin/mv
|
|
||||||
stat frwr- -1 ../bin/stat
|
|
||||||
ken drwr- 10
|
ken drwr- 10
|
||||||
system l---- 3
|
system l---- 3
|
||||||
$
|
$
|
||||||
|
|||||||
+5
-4
@@ -39,7 +39,7 @@ entryloop:
|
|||||||
sna
|
sna
|
||||||
jmp 1f " No, don't print out the inode number
|
jmp 1f " No, don't print out the inode number
|
||||||
|
|
||||||
lac bufptr " Print out the inode number as 5 digits
|
lac bufptr i " Print out the inode number as 5 digits
|
||||||
jms octal; -5
|
jms octal; -5
|
||||||
|
|
||||||
1: isz bufptr " Move up to the filename
|
1: isz bufptr " Move up to the filename
|
||||||
@@ -50,7 +50,7 @@ entryloop:
|
|||||||
lac bufptr
|
lac bufptr
|
||||||
dac statfile " Copy the pointer to the status call
|
dac statfile " Copy the pointer to the status call
|
||||||
lac statbufptr " Get the file's details into the statbuf
|
lac statbufptr " Get the file's details into the statbuf
|
||||||
sys status; statfile:0; 0
|
sys status; curdir; statfile:0
|
||||||
spa
|
spa
|
||||||
jms fileend
|
jms fileend
|
||||||
|
|
||||||
@@ -70,15 +70,16 @@ entryloop:
|
|||||||
sys write; l; 1 " Yes, print an l
|
sys write; l; 1 " Yes, print an l
|
||||||
jmp 2f
|
jmp 2f
|
||||||
1: lac fd1
|
1: lac fd1
|
||||||
sys write; minus; 1 " Not a dir, not large, print an s
|
sys write; s; 1 " Not a dir, not large, print an s
|
||||||
|
|
||||||
2: lac s.perm " Readable by owner?
|
2: lac s.perm " Readable by owner?
|
||||||
and ureadmask
|
and ureadmask
|
||||||
sna
|
sna
|
||||||
jmp 1f
|
jmp 1f
|
||||||
lac fd1
|
lac fd1
|
||||||
1: sys write; r; 1 " Yes, print an r
|
sys write; r; 1 " Yes, print an r
|
||||||
jmp 2f
|
jmp 2f
|
||||||
|
1: lac fd1
|
||||||
sys write; minus; 1 " No, print a - sign
|
sys write; minus; 1 " No, print a - sign
|
||||||
|
|
||||||
2: lac s.perm " Writable by owner?
|
2: lac s.perm " Writable by owner?
|
||||||
|
|||||||
+6
-1
@@ -97,6 +97,8 @@ sub get_inode_block_offset {
|
|||||||
# Mark a block as being in-use
|
# Mark a block as being in-use
|
||||||
sub mark_block_inuse {
|
sub mark_block_inuse {
|
||||||
my $usedblk = shift;
|
my $usedblk = shift;
|
||||||
|
die("bad usedblk $usedblk\n") if ($usedblk >= NUMBLOCKS);
|
||||||
|
|
||||||
dprint("Block $usedblk is in-use\n");
|
dprint("Block $usedblk is in-use\n");
|
||||||
print("Free block $usedblk is being used\n")
|
print("Free block $usedblk is being used\n")
|
||||||
if ( $Freelist[$usedblk] );
|
if ( $Freelist[$usedblk] );
|
||||||
@@ -143,8 +145,11 @@ sub get_inode {
|
|||||||
{
|
{
|
||||||
my $usedptr = $Block[$blocknum][$o];
|
my $usedptr = $Block[$blocknum][$o];
|
||||||
next if ( $usedptr == 0 );
|
next if ( $usedptr == 0 );
|
||||||
|
die("bad usedptr $usedptr in i-node $inode\n") if ($usedptr >= NUMBLOCKS);
|
||||||
|
|
||||||
mark_block_inuse($usedptr);
|
mark_block_inuse($usedptr);
|
||||||
foreach my $indo ( 0 .. WORDSPERBLK - 1 ) {
|
foreach my $indo ( 0 .. WORDSPERBLK - 1 ) {
|
||||||
|
|
||||||
my $usedblk = $Block[$usedptr][$indo];
|
my $usedblk = $Block[$usedptr][$indo];
|
||||||
next if ( $usedblk == 0 );
|
next if ( $usedblk == 0 );
|
||||||
push( @used, $usedblk );
|
push( @used, $usedblk );
|
||||||
@@ -187,7 +192,7 @@ sub print_direntry {
|
|||||||
my ( $inum, $name ) = @_;
|
my ( $inum, $name ) = @_;
|
||||||
my ( $flags, $uid, $links, $size, $uniq ) = get_inode( $inum, 0 );
|
my ( $flags, $uid, $links, $size, $uniq ) = get_inode( $inum, 0 );
|
||||||
if ( !defined($flags) ) {
|
if ( !defined($flags) ) {
|
||||||
printf( "%4d unallocated i-node\n", $inum );
|
printf( "%4d unallocated i-node in this dir named %s\n", $inum, $name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,6 +332,11 @@ sub make_dir {
|
|||||||
# the first entry in the Dirstack
|
# the first entry in the Dirstack
|
||||||
add_direntry( "dd", $Dirstack[0]->[2] );
|
add_direntry( "dd", $Dirstack[0]->[2] );
|
||||||
dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] );
|
dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] );
|
||||||
|
|
||||||
|
# Also add a "." entry to this directory
|
||||||
|
add_direntry( ".", $inum );
|
||||||
|
dprint("Added a . entry to ourselves\n");
|
||||||
|
|
||||||
dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n",
|
dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n",
|
||||||
$dirname, $perms, $uid, $inum );
|
$dirname, $perms, $uid, $inum );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user