Review for Exam #2
		 Date: 4-20 in class

1. Mailman's algorithm:
---------------------------------------------------------
Write code for
tst_bit(int ibuf[256], int bit)
---------------------------------------------------------


In a diskimage:
     BLKSIZE                    = 1024;
     inode_size (s_inode_size)  = 256

How many INODEs in a disk block? ______________________________
		 
inodes_start_block = 20: where do you get this value____________________

Given: ino = 16;

which disk block contain this INODE? blk  = _______________
which INODE in blk is ino=16?      offset = _______________

Write Code to load this INODE into MINODE *mip, which points at a minode


		 
		 
2. MINODE *iget(dev, ino) returns pointer to a minode=[dev, ino]

How do you try to find needed minode in cacheList?
What if it's NOT in cacheList?
 
cacheList is a queue created by enqueue(MINODE **queue, MINODE *p), but
its elements may be out-of-order.
Write code to re-order cacheList________________________________________


3. iput(MINODE *mip) dispose of a mip
   How do you decide whether to write mip->INODE back to disk?________________
   Write code to write mip->INODE back to disk:


4. Given: MINODE *mip points at a minode, whose INODE is a DIRectory 
          char *cp, buf[BLKSIZE];
	  DIR *dp;
   Write code to print the inode number of all files in this INODE

		 
5. ls dirname:

   pip = path2inode(dirname);
   write code to get [ino, name] in pip->INODE's i_block[0] (Similar to 4 above)

   for each [ino, name]:
       get its MINODE pointer mip;
       call ls_file(MINODE *mip, char *name)

6. mkdir pathname:
   check conditions: _________________
   allocate ino, bno
   creat INODE and write INODE to disk
   create data block with . .. write to bno on disk
          what are the inode numbers of . and ..?

   enter_child(): what's NEED_LEN?
                         IDEAL_LEN of each entry?
	          where to enter child entry?

6. rmdir pathname:
   how to check DIR is empty?
   rm_child():
      how to remove child entry in parent's data block?

7. link oldfile newfile
   What does it do?

8. unlink pathname:
   What does it do?

9. symlink old new
   How to creat new as a symlink to old?

10. Draw a diagram to show what does  open filename 0(READ)  do