1 / 9

Sytem Call on File System

Sytem Call on File System. Open Close Read/Write. File System 용 시스템호출. 기존의 파일을 접근하는 시스템호출 open, read, write, close 새로운 파일을 생성하는 시스템호출 create, mknod Inode 를 조작하거나 파일 시스템 내부 참조용 시스템호출 chdir, chroot, chown, chmod, stat, fstat 기타 pipe, dup mount, umount link, unlink.

tulia
Download Presentation

Sytem Call on File System

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. Sytem Call on File System Open Close Read/Write

  2. File System용 시스템호출 • 기존의 파일을 접근하는 시스템호출 • open, read, write, close • 새로운 파일을 생성하는 시스템호출 • create, mknod • Inode를 조작하거나 파일 시스템 내부 참조용 시스템호출 • chdir, chroot, chown, chmod, stat, fstat • 기타 • pipe, dup • mount, umount • link, unlink SunMoon University

  3. File Descriptor Table • U_block 내의 open file table • 내용 : • user program이 파일을 open하는 순서에 따라 파일에 integer를 assign • called “File Descriptor” • 0,1,2, assigned for terminal(standard input/output/diagonistic) • FD returned by open, create system calls • Pointer to system file table SunMoon University

  4. System File Table(=File Table) • Frequently changed • Some process may share file offset • Ex.) % ls -al | grep ‘^d’ • Share same file(pipe) • But different offset • One entry for each open/create/pipe file SunMoon University

  5. Contents of S.F.T. • R/W/P(pipe) flag • Offset (next byte to R or W) • Counter(# of processes using this offset) • Pointer to inode table SunMoon University

  6. Mount Table • Device nimber(major and minor) • Pointer to buffer containing file system superblock • Pointer to in-core inode of directory where file system is being mounted • Pointer to in-core inode of root directory of new file system • Mount flags SunMoon University

  7. Open() • fd = open( pathname, flags, modes ) • 프로세스가 아래의 코드를 수행 • fd1 = open(“/etc/passwd”, O_RDONLY); • fd1 = open(“private”, O_RDONLY); • 각각의 open call이 user file descriptor table 및 kernel file table에 하나의 항을 설정함. • File Table 을 별도로 독립시킨 이유 : • 여러 사용자들이 offset pointer를 공유할 수 있게 함.(dup 및 fork가 사용) SunMoon University

  8. Algorithm of Open() • Fig 5-2 • namei  file name 을 inode로 변환 • check file permission • find in-core inode • allocate an file table entry  pointer to inode + byte /offset • allocate user filr tab;le entry • return( user file descriptor ) SunMoon University

  9. SunMoon University

More Related