537 -- What to talk about?

Q: How to qualify for the extra two days?
A: (Almost) anyone can! Just send email. It will NOT affect 
   your grade to ask for two extra days.

Q: How often to check for corruption? 

Test 1: Reading (Most tests)
Corrupt 1 block of a file.
Open and read it --> should get correct data.

Implementation standpoint:
Could just check file on open and fix problems then,
(read other blocks and use parity, etc.)
and write correct version to file.

Test 2: still reading (a few tests)
Open a file.
File seems ok.
Still open.
Block gets corrupted.
Read from open file --> should get correct data?

Implementation standpoint:
Check checksums on every read(),
and if there is an error, correct 
(read other blocks and use parity, etc.)

Test 3: Won't be any tests of this flavor.
File is open for writing.
Sometime later gets corrupted.
Reads back a block.
(will post something to web page P4 today, and send mail)

Q: truncate() -- what should we do?
A: think about your meta-data --> how should it be updated?
   OK to be lazy about this (if you think so).

Q: can we assume programs that use library are "well behaved".
A: yes: will call close(), etc.

Q: Reading a file -- ?
   read(fd, buf, length);
   
   // simple case -- file is only 1 block in length
   assert(length == BLOCKSIZE);
   char ownBuffer[BLOCKSIZE];
   int rc = stable->read(fd, ownBuffer, length); 
   // check checksums -> OK
   memcpy(buf, ownBuffer, length);  
   return rc;

Q: Each file gets a line - bad idea!
A: Comma-delimited -- be careful!
   TEST 1: every printable is in data.

Q: fwrite() or write()
A: fwrite() isn't a system call -
   details ...
   ptrace() is a better way to do interposition

Q: assume that all calls to read() are multiples of 4k
A: yes, that is ok. I'm about less work!

Q: is (long long) 64?
A: depends -- try it and see.

Q: project solutions.
A: available saturday.

