nachos.machine
Interface FileSystem

All Known Implementing Classes:
StubFileSystem

public interface FileSystem

A file system that allows the user to create, open, and delete files.


Method Summary
 OpenFile open(String name, boolean create)
          Atomically open a file, optionally creating it if it does not already exist.
 boolean remove(String name)
          Atomically remove an existing file.
 

Method Detail

open

OpenFile open(String name,
              boolean create)
Atomically open a file, optionally creating it if it does not already exist. If the file does not already exist and create is false, returns null. If the file does not already exist and create is true, creates the file with zero length. If the file already exists, opens the file without changing it in any way.

Parameters:
name - the name of the file to open.
create - true to create the file if it does not already exist.
Returns:
an OpenFile representing a new instance of the opened file, or null if the file could not be opened.

remove

boolean remove(String name)
Atomically remove an existing file. After a file is removed, it cannot be opened until it is created again with open. If the file is already open, it is up to the implementation to decide whether the file can still be accessed or if it is deleted immediately.

Parameters:
name - the name of the file to remove.
Returns:
true if the file was successfully removed.