Wednesday, January 2, 2013

Files – User view part -3


We did finalise that file system be from the realm of platform sub systems and in this post we see how as users we can avail the services of the file system as a system service. Or in other words we look at the user level APIs, the platform designers must consider providing to the users. Also called as system calls relating to files.
  1. Create. The file is created with no data. The purpose of the call is to announce that the file is coming and to set some of the attributes.
  2. Delete. When the file is no longer needed, it must be deleted to free up space on the disk space.
  3. Open. Before using a file, a process must open it. The purpose of the call is to allow the file system to fetch the attributes and list of the disk addresses into main memory for rapid access on later calls.
  4. Close. When all the accesses are finished, the attributes and disk addresses are no longer needed, so the file should be closed to free up internal table space reserved for the file in the RAM and to leave the file complete with all the data until last set written on the secondary storage.
  5. Read. Data is read from file. The bytes are read from the current position. The caller must specify the number of bytes to be read the target buffer in the RAM.
  6. Write. Data is written on to the file. The current position matters here too. If the current position is the EOF(End Of File), the file size is increased. If the current position is in the middle, the data is over written.
  7. Append. This call is a restricted form of write. It can only add data to the end of the file. Systems that provide a minimal set of system calls do not support this but most of the systems do.
  8. Seek. For random access files, a method is needed to specify from where to take the data. One common approach is a system call seek, that repositions the file pointer to a specific place in the file. After this has completedm data can be read from, or written to, that position.
  9. Get Attributes. Quite often, processes' involve looking up of some file attributes. Example, Make too. The make tool will need to look at the timestamps of the source files to keep compilation restricted only to those which have been changed.
  10. Set Attributes. Some of the attributes are user settable and can be changed after creation. Example, protection mode attribute and file names.
  11. Rename. Special case of set attributes dedicated to changing of the name. Not a “must have” command. 

No comments:

Post a Comment