1 / 10

File System – Unix baed

File System – Unix baed. An entry of Active File table: 1. Access Right: r/w/x 2. Process Count: no. of processes which are now referring to the file 3. Read Pointer/Write pointer: The starting points of next reading and writing, respectively.

larya
Télécharger la présentation

File System – Unix baed

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File System – Unix baed

  2. An entry of Active File table: • 1. Access Right: r/w/x • 2. Process Count: no. of processes which are now referring to the file • 3. Read Pointer/Write pointer: The starting points of next reading and writing, respectively. • 4. Active i-node table entry: pointer to an active i-node • …

  3. An entry of Active i-node table: • 1. Reference Count: no. of active file table entries that are pointing to this entry • 2. Device address: address of an I/O device • 3. Owner ID • 4. Group ID • 5. Last user who reads/writes: User ID of the user who perform the last read/write.

  4. System call open(): • 1. if U-ofile is full then return (-1) • 2. if (“file name” is not in Active i-node table) read the directory entry from the i-node in disk according to “file name”; • 3. if (“file name” does not exist in the i-node table in disk) return (-1); • 4. check access right – user ID and –rwxrwxrwx; • 5. if (access deny) then return (-1); • 6. allocate a free Active i-node table entry (AITE);

  5. 7. copy directory data of underlying file to this entry; • 8. allocate a free Active File table entry (AFTE); • 9. copy directory data of underlying file to this entry; • 10. allocate a free U-ofile entry (UOE) with the lowest fd in underlying user’s PCB; • 11. connect the path UOE – AFTE – AITE;

  6. system call write (): • 1. access the AFTE according to fd specified by the user. fd is one of the arguments of the system call; • 2. check the access right; • 3. if (access deny) return (-1); • 4. write the data specified in the buffer “buf” to the file according to write pointer recorded in the user’s corresponding AFTE;

  7. system call read (): • 1. access the AFTE according to fd specified by the user. fd is one of the arguments of the system call; • 2. check the access right; • 3. if (access deny) return (-1); • 4. read the data pointed to by the user’s read pointer to the buffer “buf” specified in the arguments of the system call;

  8. system call create (): • 1. allocate a free current directory entry; • 2. fill in some data, like file name, date, time, …; • 3. write the directory entry back to disk; • 4. system call open ();

  9. system call close (fd): • 1. follow the fd specified in the argument of this system call to access the corresponding AFTE from user’s U-ofile; • 2. if ((process count--) == 0) {disconnect the connection between the AFTE and its AITE; if ((reference count--) == 0) store AITE back to i-node table in disk;}

More Related