<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://xinu.cs.mu.edu/index.php?action=history&amp;feed=atom&amp;title=Assignment%3A_Ultra-Tiny_File_System</id>
	<title>Assignment: Ultra-Tiny File System - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://xinu.cs.mu.edu/index.php?action=history&amp;feed=atom&amp;title=Assignment%3A_Ultra-Tiny_File_System"/>
	<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Assignment:_Ultra-Tiny_File_System&amp;action=history"/>
	<updated>2026-06-15T16:09:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://xinu.cs.mu.edu/index.php?title=Assignment:_Ultra-Tiny_File_System&amp;diff=2945&amp;oldid=prev</id>
		<title>Akoehler: New page: Category:Student Built Xinu = Ultra-Tiny File System = This assignment is a Xinu assignment allowing the student to more firmly understand how an operating system works. This assig...</title>
		<link rel="alternate" type="text/html" href="https://xinu.cs.mu.edu/index.php?title=Assignment:_Ultra-Tiny_File_System&amp;diff=2945&amp;oldid=prev"/>
		<updated>2008-12-12T07:33:34Z</updated>

		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/index.php?title=Category:Student_Built_Xinu&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Category:Student Built Xinu (page does not exist)&quot;&gt;Category:Student Built Xinu&lt;/a&gt; = Ultra-Tiny File System = This assignment is a &lt;a href=&quot;/index.php/Xinu&quot; title=&quot;Xinu&quot;&gt;Xinu&lt;/a&gt; assignment allowing the student to more firmly understand how an operating system works. This assig...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Student Built Xinu]]&lt;br /&gt;
= Ultra-Tiny File System =&lt;br /&gt;
This assignment is a [[Xinu]] assignment allowing the student to more firmly understand how an operating system works. This assignment is part of the [[Student Built Xinu]] track for professors that are [[Teaching With Xinu]]. The entire working directory containing your Xinu operating system will be submission for this assignment.&lt;br /&gt;
== Preparation ==&lt;br /&gt;
First, make a fresh copy of your work thus far.&lt;br /&gt;
   cp -R &amp;lt;old Xinu directory&amp;gt; &amp;lt;new Xinu directory&amp;gt;&lt;br /&gt;
Untar the new project files on top of this new directory:&lt;br /&gt;
   tar xvzf &amp;lt;tar-ball directory&amp;gt;&lt;br /&gt;
You should now see the new project files in with your old files. Be certain to &amp;lt;code&amp;gt;make clean&amp;lt;/code&amp;gt; before compiling for the first time.&lt;br /&gt;
&lt;br /&gt;
== Non-blocking ttyRead() ==&lt;br /&gt;
To synchronize complex communications properly, it often helps to be able to &amp;quot;peek&amp;quot; at an I/O device without having to block. Add non-blocking read as an option to your TTY driver. Use the &amp;lt;code&amp;gt;iflags&amp;lt;/code&amp;gt; field (which should be fetched or set with the &amp;lt;code&amp;gt;ttyControl()&amp;lt;/code&amp;gt; function). Your &amp;lt;code&amp;gt;ttyRead()&amp;lt;/code&amp;gt; function should check the flags and the count of the input semaphore before each call to &amp;lt;code&amp;gt;wait()&amp;lt;/code&amp;gt;. If it looks like the call might block, return the current count of characters instead.&lt;br /&gt;
&lt;br /&gt;
== The Disk Driver ==&lt;br /&gt;
The project tarball equips Xinu with a block I/O device driver (running over the second serial port) that speaks to a &amp;lt;code&amp;gt;xinu-disk&amp;lt;/code&amp;gt; program running on your computer. The &amp;lt;code&amp;gt;xinu-disk&amp;lt;/code&amp;gt; process maps reading and writing requests from the backend to a locally-stored disk file. In this way, your O/S can behave as though it has a small (64K) disk attached, and the storage is really a file in your home directory.&lt;br /&gt;
&lt;br /&gt;
See below for additional details on the &amp;lt;code&amp;gt;xinu-disk&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
== The File System ==&lt;br /&gt;
The project tarball includes a partial implementation of a small file system. The first block of the &amp;quot;disk&amp;quot; is expected to contain a '''superblock''' which contains vital bookkeeping information about the file system, such as:&lt;br /&gt;
* A pointer to a list of free disk blocks,&lt;br /&gt;
* A pointer to a master directory index,&lt;br /&gt;
* Block size, disk size, etc., and&lt;br /&gt;
* A magic number, so that it can tell the difference between a blank disk and an initialized disk image.&lt;br /&gt;
The new header files &amp;lt;code&amp;gt;disk.h&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;file.h&amp;lt;/code&amp;gt; contain the necessary constants and structures to build the file system. Take a look at &amp;lt;code&amp;gt;disk/disk*.c&amp;lt;/code&amp;gt; (disk driver source code,) &amp;lt;code&amp;gt;file/file*.c&amp;lt;/code&amp;gt; (file source code,) and &amp;lt;code&amp;gt;file/sb*.c&amp;lt;/code&amp;gt; (superblock source code.)&lt;br /&gt;
&lt;br /&gt;
Our disk has 256 blocks of 256 bytes each. The free disk block list is dynamic, but our directory index is limited to a fixed number of files, with fixed length names, and fixed maximum sizes. (The problems and solutions associated with these limitations would each make excellent final exam questions, by the way.)&lt;br /&gt;
&lt;br /&gt;
You are to add file deletion (&amp;lt;code&amp;gt;fileDelete()&amp;lt;/code&amp;gt;) and free block removal (&amp;lt;code&amp;gt;sbFreeBlock()&amp;lt;/code&amp;gt;) into the system.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
Provide a main program that demonstrates that your &amp;lt;code&amp;gt;fileDelete()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;sbFreeBlock()&amp;lt;/code&amp;gt; calls are working properly.&lt;br /&gt;
&lt;br /&gt;
The command &amp;quot;&amp;lt;code&amp;gt;xinu-disk&amp;lt;/code&amp;gt;&amp;quot; starts up a disk daemon on the local server that can provide disk access to the selected backend machine via its second serial port. Build the disk daemon by running &amp;quot;&amp;lt;code&amp;gt;make xinu-disk&amp;lt;/code&amp;gt;&amp;quot; in your &amp;lt;code&amp;gt;compile/&amp;lt;/code&amp;gt; directory. For example, to test my file system on backend &amp;quot;Dask&amp;quot; using a local disk image called &amp;quot;foo.dat&amp;quot;, I would run the command &amp;quot;&amp;lt;code&amp;gt;mips-console dask&amp;lt;/code&amp;gt;&amp;quot; in one terminal, and then execute &amp;quot;&amp;lt;code&amp;gt;./xinu-disk foo.dat dask2&amp;lt;/code&amp;gt;&amp;quot; in a second terminal within the first ten seconds of my Xinu kernel booting.&lt;br /&gt;
&lt;br /&gt;
Xinu-disk's ability to synchronize with a &amp;quot;moving-target&amp;quot; backend is somewhat rudimentary -- you may occasionally see the handshake fail upon startup. Just close out the &amp;lt;code&amp;gt;mips-console&amp;lt;/code&amp;gt; session normally, close the &amp;lt;code&amp;gt;xinu-disk&amp;lt;/code&amp;gt; process with a &amp;quot;Control-C&amp;quot;, and try again.&lt;br /&gt;
&lt;br /&gt;
The command &amp;quot;&amp;lt;code&amp;gt;xinu-status&amp;lt;/code&amp;gt;&amp;quot; will list the users on each backend, and &amp;quot;&amp;lt;code&amp;gt;xinu-status -c uart&amp;lt;/code&amp;gt;&amp;quot; will list the users on each backend's second serial port. Also recall that a user can bump another user off of a specific backend after 10 minutes of activity.&lt;/div&gt;</summary>
		<author><name>Akoehler</name></author>
		
	</entry>
</feed>