Project: File System Textbook: pages 501506 - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Project: File System Textbook: pages 501506

Description:

... info, parts of info, name only ... only one directory (root) regular file. described by the first descriptor. contains array of entries: symbolic file name ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 21
Provided by: dc7
Category:

less

Transcript and Presenter's Notes

Title: Project: File System Textbook: pages 501506


1
Project File System(Textbook pages 501-506)
  • ICS 145B
  • L. Bic

2
Assignment
  • Design and implement a simple file system using
    the disk driver from previous project
  • Overall organization

File System
I/O System (your driver)
user
3
I/O System
  • I/O system presents disk as a linear sequence of
    blocks
  • we will refer to logical disk as ldiskLB
  • L of logical blocks on disk
  • B block length (bytes)
  • I/O system interface provided by your driver
  • read_block(int i, char p)
  • write_block(int i, char p)
  • FS can access the emulated disk using only these
    functions

4
File System -- User Interface
  • create(symbolic_file_name) return ok/error
  • destroy(symbolic_file_name) return ok/error
  • open(symbolic_file_name) return index
  • close(index) return ok/error
  • read(index, mem_area, count) return bytes read
  • write(index, mem_area, count) return bytes
    written
  • lseek(index, pos) return ok/error
  • directory return ok/error

5
Review of concepts
  • directory structure
  • tree, DAG, graph, symbolic links, path names
  • this project single flat list of all files
  • organization of entries within directory
  • array of slots, linked list, hash table, B-tree
  • this project unsorted array of fixed-size slots
  • each directory entry contains
  • all descriptive info, parts of info, name only
  • this project symbolic name plus index of
    descriptor

6
Review of concepts
  • file descriptor contents
  • owner, file type, protection, length, disk map,
    access times
  • this project length (bytes), list of logical
    disk blocks
  • location of file descriptors
  • dedicated portion of disk, special files, in
    directories
  • this project first k disk blocks
    (ldisk0..k-1)

7
Review of concepts
  • disk blocks (physical organization)
  • contiguous, linked list, indexed, multi-level
  • this project
  • flat index (fixed list of disk blocks)
  • 1-level incremental (for groups of 3)
  • free storage management
  • linked lists, bit map
  • this project bit map

8
Organization of the file system
  • groups of 3 addl task 2, 1-level incremental
    index

9
The Directory
  • only one directory (root)
  • regular file
  • described by the first descriptor
  • contains array of entries
  • symbolic file name
  • index of the descriptor

10
Create a file
  • find a free file descriptor
  • find a free directory entry
  • fill both entries

i
11
Destroy a file
  • find file descriptor by searching directory
  • remove directory entry
  • update bit map
  • free file descriptor
  • return status

12
Open a file
OFT
fixed length array
current position
index
  • search directory to find index of file descriptor
  • allocate a free OFT entry
  • fill in current position (0) and file descriptor
    index
  • read in first file block into the buffer
    (read-ahead)
  • return OFT index (or error)

13
Close a file
  • write buffer to disk
  • update file length in descriptor
  • free OFT entry
  • return status

14
Read a file
  • compute position in the r/w buffer
  • copy from buffer to memory until
  • desired count or end of file is reached
  • update current pos, return status
  • end of buffer is reached
  • write the buffer to disk (if modified)
  • read the next block
  • continue copying

15
Write a file
  • write into buffer
  • when full, write buffer to disk
  • if block does not exist (file is expanding)
  • allocate new block
  • update file descriptor
  • update bit map
  • update file length in descriptor

16
Seek in a file
  • if the new position is not within the current
    block
  • write the buffer to disk
  • read the new block
  • set the current position to the new position
  • return status

17
List the directory
  • read directory file
  • for each entry
  • find file descriptor
  • print file name and file length

18
Presentation shell
  • develop presentation shell
  • repeatedly accept command (e.g. cr abc)
  • invoke corresponding FS function (e.g.
    create(abc))
  • display status/data on screen (e.g. file created
    or Error file exists)
  • project will be tested using an input file and an
    output file (similar to process/resource manager)

19
Shell commands
  • cr ltnamegt
  • de ltnamegt
  • op ltnamegt
  • cl ltindexgt
  • rd ltindexgt ltcountgt
  • wr ltindexgt ltchargt ltcountgt
  • sk ltindexgt ltposgt
  • dr
  • in ltno_cylgt ltno_surfgt ltno_sectgt ltsect_lengt
    ltdisk_contgt
  • sv ltdisk_contgt
  • q

20
Summary of tasks
  • design and implement FS using I/O system from
    previous project
  • develop test/presentation shell
  • submit code to Masterhit for testing turn in
    design document to Distribution Center
  • groups of 2
  • error checks on all commands
  • groups of 3
  • error checks on all commands
  • additional task 2 (pg 506) 1-level expanding
    index
Write a Comment
User Comments (0)
About PowerShow.com