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:
+6
-1
@@ -97,6 +97,8 @@ sub get_inode_block_offset {
|
||||
# Mark a block as being in-use
|
||||
sub mark_block_inuse {
|
||||
my $usedblk = shift;
|
||||
die("bad usedblk $usedblk\n") if ($usedblk >= NUMBLOCKS);
|
||||
|
||||
dprint("Block $usedblk is in-use\n");
|
||||
print("Free block $usedblk is being used\n")
|
||||
if ( $Freelist[$usedblk] );
|
||||
@@ -143,8 +145,11 @@ sub get_inode {
|
||||
{
|
||||
my $usedptr = $Block[$blocknum][$o];
|
||||
next if ( $usedptr == 0 );
|
||||
die("bad usedptr $usedptr in i-node $inode\n") if ($usedptr >= NUMBLOCKS);
|
||||
|
||||
mark_block_inuse($usedptr);
|
||||
foreach my $indo ( 0 .. WORDSPERBLK - 1 ) {
|
||||
|
||||
my $usedblk = $Block[$usedptr][$indo];
|
||||
next if ( $usedblk == 0 );
|
||||
push( @used, $usedblk );
|
||||
@@ -187,7 +192,7 @@ sub print_direntry {
|
||||
my ( $inum, $name ) = @_;
|
||||
my ( $flags, $uid, $links, $size, $uniq ) = get_inode( $inum, 0 );
|
||||
if ( !defined($flags) ) {
|
||||
printf( "%4d unallocated i-node\n", $inum );
|
||||
printf( "%4d unallocated i-node in this dir named %s\n", $inum, $name );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -332,6 +332,11 @@ sub make_dir {
|
||||
# the first entry in the Dirstack
|
||||
add_direntry( "dd", $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",
|
||||
$dirname, $perms, $uid, $inum );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user