DOC PREVIEW
UMD CMSC 412 - Filesystems: Interfaces

This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

11CMSC 412Filesystems: InterfacesAnnouncements• Reading– Today : Chapter 11– Next time : Chapter 1222File Abstraction• What is a file?– A named collection of information storedon secondary storage• Properties of a file– non-volatile (persistent)– can read, store, or update it– has meta-data to describe attributes ofthe file– May be structured or unstructuredFile Attributes• name: a way to describe the file• type: some information about what isstored in the file• location: how to find the file on disk• size: number of bytes• protection: access control– may be different for read, write, execute,append, etc.• time: access, modification, creation• version: how many times the file changed33File Operations• Files are an abstract data type (ADT)– Interface: what can I do with them?– Implementation: how do I implementthem?• Operations– Create, Open, Read, Write, Fsync, Seek,Delete, Truncate, Close, Read-Meta-Data,Write-Meta-DataCreate, Open• create– assign it a name– check permissions• open– check permissions– check that the file exists– lock the file (if we don’t what to permitother users a the same time)– may provide file pointer for access44Write• Indicate what file to write (eithername of handle)• Provide data to write• Specify where to write the data withinthe file– generally this is implicit (file pointer)– could be explicit (direct access)Read• Indicate what file to read (eithername or handle)• Provide place to put information read• Indicate how much to read• Specify where to write the data withinthe file– generally this is implicit (file pointer)– could be explicit (direct access)55Fsync, Close• fsync:– synchronize disk version with in-coreversion– ensures any previous writes to the fileare stored on disk• close– unlock the file (if locked when opened)– update meta data about time– free system resources (file descriptors,buffers)Seek, Delete, Truncate• seek– move the implicit file pointer to a newoffset in the file• delete– remove named file• truncate– remove the data in the file from thecurrent position to end66Read-MD, Write-MD• read meta data– get file size, time, owner, etc.• write meta data– change file size, time, owner, etc.Filesystems• Provides a namespace for files viadirectories• Can store files of variable size• Provides protection by restrictingaccess to files based on permissions77Directory• Collection of files• Operations– Search for a file– Create a file– Delete a file– List a directory– Rename a file– Traverse the file systemSingle Directory Structure• All files are in a single globalnamespace• Simple, but having all of the files inone name space is awkward– lots of files to sort through– different users would have to coordinatefile names– each file has to have a unique name88Two-level Directory Structure• Top level is users, second level is filesper user– Less awkward, but still not much controlsystem mwhuser1user2user3vi gdbonetwocc x ya bTree Directories• Create a tree of files– Each directory can contain files ordirectory entries– Thus, each non-leaf in the tree is adirectory• Each process has a current directory– can name files relative to that directory– can change current directory as needed99Tree Directoriesa bmwhuser1user2vi gdbonetocc x ysystem usersmailzAcylic Graph Directories• Users can share directories (and/orfiles)a bhollingsuser1user2vi gdbone toccx ysystem usersmailz1010Acylic Graph Issues• Same file may have several names– absolute path name differs, but file is the same– similar to memory aliases in prog. languages• Deletion– if one user deletes a file• It is deleted for all users, since the directory is shared– if one user “deletes” their shared directory• The directory stays until the last user deletes it• Maintains a reference count to determine this• Programs to walk the DAG need to be aware– disk usage utilities, backup utilitiesFile System Mounting• A file system must be mounted beforeit can be accessed• A unmounted file system is mountedat a mount point1111Mounted vs. UnmountedMount Point1212OS Awareness of File Contents• Needs to know about some types of files– Directories, executables• What about others?– Example: word processing file vs. spreadsheet– Advantages:• OS knows what application to run• Automatic make (tops-20)– if source changed, re-compile before running– Problems:• to add new type, may need to extend OS• OS vs. application features are blurred• what if a file is several types– consider a compressed postscript fileExample of File Types• Macintosh– has a file type that is part of file meta-data– also has an application associated with each filetype• Windows 95/NT– has a file type in the extension of the file name– has a table (per user) to map extensions toapplications• Unix– can use last part of filename like an extension– applications can decide what (if anything) to dowith it1313File Protection• File sharing implies need ofprotection:– How to give access to some users and notothers?• Access types:– read, write, execute, append, delete, list– rename: often based on protection ofdirectory– copy: usually the same as readAccess Policies• Access lists– list for each user for each file the permittedoperations• Groups– enumerate users in a list called a group– same protection to all members of the group– depending on system:• files may be in one or many groups• users may be in one or many groups• Per-file passwords– tedious and a security problem1414UNIX File Protection• Each file has three classifications– user: the user who owns the file– group: a named group of other users– world: all others• Each file has three access types:– read, write, execute• Three additional bits– Sticky bit• leave executable in memory after is done– Setuid, Setgid• run the program with the uid/gid of the file’s owner• used to provide extra privilege to some processes– example: passwd commandUNIX Directory Protection• Permissions interpreted differently– read: list the files– execute: see the attributes of the files– write: delete or create a file in thedirectory– sticky bit: can only modify directoryentries owned by yourself– setgid: new files will have this group id– setuid: new files will have this user id1515UNIX File Protection


View Full Document

UMD CMSC 412 - Filesystems: Interfaces

Documents in this Course
Security

Security

65 pages

Deadlocks

Deadlocks

22 pages

Set 2

Set 2

70 pages

Project 2

Project 2

21 pages

Load more
Download Filesystems: Interfaces
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Filesystems: Interfaces and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Filesystems: Interfaces 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?