Review of the uniX File system D Basic definition DUNIX defines a file to consist of a sequence of bytes DUNIX files can grow dynamically D UNIX numbers the bytes in a file starting at zero D The size of a file is defined to be the number of bytes D Permit random access to any file
11 Review of the UNIX File System Basic definition UNIX defines a file to consist of a sequence of bytes UNIX files can grow dynamically UNIX numbers the bytes in a file starting at zero The size of a file is defined to be the number of bytes Permit random access to any file
Review: a Byte sequence Without record boundaries UnIX does not have notions of record boundaries, record blocking, indexedfiles or typedfiles found in other systems O The point is that the file system itself does not understand the file contents applications that use a file must agree on the format
12 Review: A Byte Sequence Without Record Boundaries UNIX does not have notions of record boundaries, record blocking, indexed files, or typed files found in other systems The point is that the file system itself does not understand the file contents: applications that use a file must agree on the format
Review:a file's owner and Group Identifier D Each file has a single owner. represented by the numeric identifier of the user who created the file )Ownership information is stored with the e file ASsign a subset of users a numeric group identifier D The system compares the owner and grour identifiers stored with a file to the user and group identifiers of a particular application process to determine what operations that program can perform on the file
13 Review: A File’s Owner and Group Identifier Each file has a single owner, represented by the numeric identifier of the user who created the file Ownership information is stored with the file Assign a subset of users a numeric group identifier The system compares the owner and group identifiers stored with a file to the user and group identifiers of a particular application process to determine what operations that program can perform on the file
Review: protection and Access DFig. 1 shows that file access permissions (called file mode, protection mode, or file access mode) can viewed as matrix of protection bits )Fig. 2 illustrates how UNIX encodes file protection bits into 9 low-order bits of a file mode integer DUNIX defines additional bits of the mode integer to specify other properties of the file (e.g. mode bits specify whether the file is a regular file or a dictionary)
14 Review: Protection and Access Fig. 1 shows that file access permissions (called file mode, protection mode, or file access mode) can viewed as matrix of protection bits Fig. 2 illustrates how UNIX encodes file protection bits into 9 low-order bits of a file mode integer UNIX defines additional bits of the mode integer to specify other properties of the file (e.g., mode bits specify whether the file is a regular file or a dictionary)
Review: The Open-Read Write-Close Paradigm )Applications that run on system such as linux use the open-read-write-close paradigm D For example, ) fdes open(filename,O CrEAT O RDWR, 0644 DO CREATE: specifies that the file should be created if it does not already exist DO RDWR: specifies that the file should be created for both reading and writing
17 Review: The Open-ReadWrite-Close Paradigm Applications that run on system such as Linux use the open-read-write-close paradigm For example, fdesc = open(“filename”, O_CREAT | O_RDWR, 0644) O_CREATE: specifies that the file should be created if it does not already exist O_RDWR: specifies that the file should be created for both reading and writing