@@ -298,7 +298,7 @@ what a given ioctl request number means, but the kernel does not interpret them). The supplied program send_iotcl can be used to send ioctls to your driver:
-$ ./send_iotcl mtn/.txn [request code] +$ ./send_iotcl mnt/.txn [request code]Request codes are defined in crashmod.h. The following request codes are provided:
So, for example, the following command sends a commit message to your FUSE driver:
-$ ./send_iotcl mtn/.txn 4000 # When this program returns, users +$ ./send_iotcl mnt/.txn 4000 # When this program returns, users # of the file system have a guarantee # that their changes have been committed.@@ -444,15 +444,29 @@ log during replay, versus the approach that you will take in Exercise 2.) It's important to make sure that your log works correctly before proceeding to the next exercises. Test log entries can be sent to your driver via ioctl request code 5003, and you can print log contents using request code 5002 (as described above). Below is sample -output under correct behavior: one terminal is running fsdriver with the -d flag, and another -terminal is issuing commands: - +output under correct behavior: on one terminal, run fsdriver with the -d flag:
# run fsdriver -d $ test/makeimage.bash # create a new image (with an empty log) +$ mkdir mnt # create directory mnt if you do not have mnt already $ build/fsdriver -d testfs.img mnt ++On a second terminal, issue the following commands: +
+# send commands +$ ./send_iotcl mnt/.txn 5003 +$ ./send_iotcl mnt/.txn 5003 +$ ./send_iotcl mnt/.txn 5002 +$ ./send_iotcl mnt/.txn 4000 +$ ./send_iotcl mnt/.txn 5003 +$ ./send_iotcl mnt/.txn 5003 +$ ./send_iotcl mnt/.txn 5002 ++ -# [ FUSE startup output and debug information has been omitted ] +If you are using one of the CIMS machines, the output from the first terminal should look similar to the following: +
+# [ FUSE startup output and debug information have been omitted ] ... @@ -506,15 +520,72 @@ entry 4: op: 0, txn_id: 2 entry 5: op: 0, txn_id: 2+If you are using the devbox, the output will be slightly different: FUSE will check the file system first, adding some additional entries to the log:
-# send commands -$ ./send_iotcl mnt/.txn 5003 -$ ./send_iotcl mnt/.txn 5003 -$ ./send_iotcl mnt/.txn 5002 -$ ./send_iotcl mnt/.txn 4000 -$ ./send_iotcl mnt/.txn 5003 -$ ./send_iotcl mnt/.txn 5003 -$ ./send_iotcl mnt/.txn 5002 +# [ FUSE startup output and debug information have been omitted ] + +... + +received ioctl: 5003 +adding entry... +done + +... + +received ioctl: 5003 +adding entry... +done + +... + +received ioctl: 5002 +dumping log... +nentries: 3 +entry 0: op: 0, txn_id: 0 +entry 1: op: 5, txn_id: 1 #[devbox only] Entries 1 to 44 are additional entries from FUSE: +entry 2: op: 5, txn_id: 1 #[devbox only] When testfs.img is mounted, the system will +entry 3: op: 5, txn_id: 1 #[devbox only] read from the mounted directory, generating +... #[devbox only] log entries. +entry 43: op: 5, txn_id: 1 #[devbox only] +entry 44: op: 5, txn_id: 1 #[devbox only] +entry 45: op: 0, txn_id: 1 +entry 46: op: 0, txn_id: 1 + +... + +received ioctl: 4000 +attempting to commit... +done: 0 + +... + +received ioctl: 5003 +adding entry... +done + +... + +received ioctl: 5003 +adding entry... +done + +... + +received ioctl: 5002 +dumping log... +nentries: 6 +entry 0: op: 0, txn_id: 0 +entry 1: op: 5, txn_id: 1 #[devbox only] Read entries from earlier. +entry 2: op: 5, txn_id: 1 #[devbox only] +entry 3: op: 5, txn_id: 1 #[devbox only] +... #[devbox only] +entry 43: op: 5, txn_id: 1 #[devbox only] +entry 44: op: 5, txn_id: 1 #[devbox only] +entry 45: op: 0, txn_id: 1 +entry 46: op: 0, txn_id: 1 +entry 47: op: 19, txn_id: 1 +entry 48: op: 0, txn_id: 2 +entry 49: op: 0, txn_id: 2
Each log entry has an opcode.