1 Week 12 FAT32 Utility Operations Guide Classes COP4610 / CGS5765 Florida State University.

Slides:



Advertisements
Similar presentations
CS 450 Module R1. R1 Introduction In Module R1, you will implement a user interface (command handler). There are a couple of options: ▫Command Line: interface.
Advertisements

Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
1 Week 11 FAT32 Boot Sector, Locating Files and Dirs Classes COP4610 / CGS5765 Florida State University.
Chapter 10 Introduction to Arrays
Recap – Intro to Project 3 and FAT32
Ext2/Ext3 Linux File System Reporter: Po-Liang, Wu.
In this assignment you are going to read floppy disk. You can run ‘mdir’ Unix function to see what output your program should give. FAT-12 MS-DOS file.
When you log into unix you are in the root directory Root directory To create a new directory you must type: mkdir newdirectory This will create a new.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Lecture 10: The FAT, VFAT, and NTFS Filesystems 6/17/2003 CSCE 590 Summer 2003.
File Management System The way a user or application may access files Programmer does not need to develop file management software You take files for granted.
UNIX By Darcy Tatlock. 1. Successful Log Into Unix To actively manipulate your website you need to be logged in. Without being logged in you cannot enter.
 2007 Pearson Education, Inc. All rights reserved C Formatted Input/Output.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Week 10 Project 3: An Introduction to File Systems
Learning basic Unix command IT 325 operating system.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think that this is a coincidence.” Anonymous.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Distributed Computing Systems Project 1 – Dumpster Diving Due: Tuesday, March 25 th.
Notes Assignment #1 is due next Friday by 11:59 pm via Test #1 will be held Thursday February 18 at the start of class (one period long) Format:
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Kuali Budget Construction Training Catherine Maddaford KBC Administrator.
Ch 41 Program Files, Data Files, and Subdirectories.
SIMULATED UNIX FILE SYSTEM Implementation in C Tarek Youssef Bipanjit Sihra.
The UNIX development environment CS 400/600 – Data Structures.
1 Project 3: An Introduction to File Systems CS3430 Operating Systems University of Northern Iowa.
Getting Started Additional information. Important DOS Commands Getting Started dirlists disk directories verdisplays OS version clsclear command prompt.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Project 6 Unix File System. Administrative No Design Review – A design document instead 2-3 pages max No collaboration with peers – Piazza is for clarifications.
1 Lesson Four. 2 The Spelling Checker Searching for Text Menu shortcuts Printing a File Erasing a File.
1 Week 13 FAT32 Utility Operations Guide: rm and rmdir Classes COP4610 / CGS5765 Florida State University.
The Genome Analysis Centre Building Excellence in Genomics and Computational Bioscience.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
16. Python Files I/O Printing to the Screen: The simplest way to produce output is using the print statement where you can pass zero or more expressions,
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Basic DOS How to get some work done. It’s all a file Everything is a file: OS files, Application files, Data files and Game files Files have 8.3 names:
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Agenda The Linux File System (chapter 4 in text)
More Unix Naomi Altman. Directories Directory = folder mkdir - makes a new directory rmdir - removes an empty directory cd mydirectory - moves you into.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
Chapter 8 File Systems FAT 12/16/32. Defragmentation Defrag a hard drive – Control Panel  System and Security  Administration tools  Defrag hard drive.
Learning basic Unix command It 325 operating system.
Object Oriented Programming COP3330 / CGS5409.  Compiling with g++  Using Makefiles  Debugging.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
File System Design David E. Culler CS162 – Operating Systems and Systems Programming Lecture 23 October 22, 2014 Reading: A&D a HW 4 out Proj 2 out.
Buffer Overflow Walk-Through
C Formatted Input/Output
Module 11: File Structure
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Distributed Computing Systems
FAT32 Directory Entries and Operations Guide
FAT32 Directory Entries and Operations Guide
Project 3: An Introduction to File Systems
File Management.
Buffer Overflow Walk-Through
Project 3: An Introduction to File Systems
Modern PC operating systems
FAT32 Directory Entries and Operations Guide
Using Linux Command 3 Lab#6.
File I/O, Command Line Parameters, Endian-ness
Presentation transcript:

1 Week 12 FAT32 Utility Operations Guide Classes COP4610 / CGS5765 Florida State University

Outline Directory entries  Short-name and long-name entries Read-only project 3 operations Other non-read-only project 3 operations 2

Directory Entries 3

Lists names of files and directories in a directory Types  Short-name directory entry  Long-name directory entry 4

Short-name Directory Entry Limits name size to 8 bytes with additional 3 bytes after “.” Compatible with previous FAT versions 32 bytes total size Holds important information about file or dir:  Attributes, timestamp, last access date, first cluster number, size 5

Short-name Directory Entry If DIR_Name[0] == 0xE5, then the directory entry is free (no file or directory name in this entry) If DIR_Name[0] == 0x00, then the directory entry is free (same as for 0xE5), and there are no allocated directory entries after this one 6

Long-name Directory Entry Backwards-compatible way to allow longer names to be displayed Each long-name directory entry is 32 bytes  A long file name can cover a set of long-name directory entries Each set of long-name directory entries must correspond to a short-name directory entry  Long-name entries must immediately precede corresponding short-name entry 7

Long-name Directory Entry 8 Long-name part 1 Long-name part 2 Short-name Two long-name entries are needed to hold the file name

Long-name Directory Entry 9 Long-name part 1 Long-name part 2 Short-name Short name entry for the file must exist too

Long-name Directory Entry 10 Long-name part 1 Long-name part 2 Short-name Long-name entries for this file immediately precede short-name entry

Directory entries Long-name entry for “fatgen103.pdf" 11

Directory entries Short-name entry for “fatgen103.pdf" 12

Long-name Directory Entries You can ignore the long directory entries  Can just display the short names  This makes the project easier 13

“Dot” Entries All directories (except root directory of entire system) have “.” and “..” directory entries “.” means “this directory” “..” means “the parent directory” Why do you think the root directory does not have these entries? 14

Directory Entry Attributes Offset 11 in directory entry, 1 byte long Attributes of interest  ATTR_READ_ONLY0x01  ATTR_DIRECTORY0x10  ATTR_ARCHIVE0X20 Set by FAT drivers when file is created, renamed, or written to 15

Utility Operations 16

FAT32 Utility Oprations open close create rm size cd ls mkdir rmdir read write 17 Utility recognizes the following built-in commands:

A Few Definitions Read-Only Operations –can be completed without modifying file system image Write Operations – must modify file system image to complete Hint: Do the read-only operations first since they should not corrupt your image

FAT32 Utility Operations Classified Read-Only open close ls size cd read Write create rm** mkdir rmdir** write 19 **Will go over rm and rmdir next week

Read-Only Operations 20

Read-Only Precautions File or directory must exist before performing operations on it File must be open and flagged for reading before you attempt to read from it Be sure you are reading from the right location  Off by 1 byte can throw whole project off 21

Read-Only Operation: open 1. Check if the file is already open 2. Check that the mode-specifiers are valid (r, w, rw, or wr) 3. Check that the provided file name exists in the requested directory 4. If it exists, add the file to your open file table with mode-specifiers (at least)

open Use Cases Successful open /] open FATINFO.TXT rw /] Unsuccessful open /] open FATINFO.TXT rw Error: already open! /] 23

open Use Cases Unsuccessful open /] open NOTHERE.TXT rw Error: does not exist /] Unsuccessful open /] open DIRS rw Error: cannot open a directory /] 24

open Use Cases Unsuccessful open /] open FATINFO.TXT z Error: incorrect parameter /] 25

Read-Only Operation: close 1. Check that the file name provided exists in your open file table 2. If it does, remove that entry from your open file table

close Use Cases Successful close /] close FATINFO.TXT /] Unsuccessful close /] close NOTHERE.TXT Error: file not in open file table /] 27

Read-Only Operation: ls 1. Make sure that provided directory name is directory and exists in requested directory 2. Seek first data cluster 3. Iterate through and print each directory entry in the cluster 4. If more directory entries left than first cluster can hold, seek next cluster and repeat 3

ls Use Cases Successful ls /DIRS/] ls....ABCD /DIRS/] 29

Read-Only Operation: size 1. Check that provided file name exists in the requested directory Can be accomplished by seeking through the clusters of the requested directory 2. If it does, extract the size information Pay attention to endianness!

size Use Cases Successful size /FILES/] size CONST.TXT /FILES/] Unsuccessful size /FILES/] size NOTHERE.TXT Error: file does not exist /FILES/] 31

Read-Only Operation: cd 1. Check that provided directory name is a directory and exists 2. Alter your current working directory to reflect the change  For ease of debugging and use, you may want to alter your prompt to show current working directory

cd Use Cases Successful cd /] cd FILES /FILES/] Unsuccessful cd /] cd FATINFO.TXT Error: not a directory /] 33

cd Use Cases Unsuccessful cd /] cd NOTHERE Error: does not exist /] 34

Read-Only Operation: read 1. Make sure file name provided is in open-file table and flagged as read-capable 2. Check that the provided position is valid 3. Check that the requested number of bytes is valid 4. Seek to data cluster corresponding to the requested start position and begin reading 5. If more data to be read, seek the next clusters and repeat 4

read Use Cases Successful read /FILES/] read CONST.TXT 0 15 Provided by USC /FILES/] Unsuccessful read /FILES/] read EMPTY.TXT Error: attempt to read beyond EoF /FILES/] 36

Write Operations 37

Write Precautions File must be open and flagged fro writing before you attempt to write to it Make sure an entry name is not a directory before you try to write to it Check how much space is left in a cluster when writing a new string  Don’t want to overwrite other pre-existing data 38

Write Operations Many write operations may involve allocating a new cluster 39

Allocating a New Cluster 1. Search the FAT table for any free clusters  If none, return an out of space error! 2. Set the previous cluster to point to the new cluster number  Watch out, there may be more than one FAT to update 3. Set the new cluster to EoC (end of cluster chain)

Write Operations Many write operations involve creating a new directory entry 41

Creating a New Directory Entry Just create a short-name directory entry  All new directories will be of length 8 characters or less 42

Write Operation: write 1. Check that the parameters passed are valid (as for the read operation) 2. Seek the data cluster position requested by the operation 3. Write as much data as you can fit starting at the requested position up until the end of a given cluster 4. If a cluster fills up, allocate a new cluster 5. Repeat 3-4 until the write is complete

write Use Cases Successful write /FILES/] open EMPTY.TXT rw /FILES/] write EMPTY.TXT 0 10 “Not empty!” /FILES/] Unsuccessful write /FILES/] open EMPTY.TXT r /FILES/] write EMPTY.TXT 0 10 “Not empty!” Error: File is not open for writing /FILES/] 44

write Use Cases Unsuccessful write /FILES/] write EMPTY.TXT 0 10 “Not empty!” Error: File not found in open file table /FILES/] 45

Write Operation: create 1. Make sure the requested file name does NOT exist in the requested location 2. Create new directory entry for the file  If there is enough room in the current cluster, write it there  If there is not enough space left in the cluster, allocate a new cluster and write it in the new cluster

create Use Cases Successful create /FILES/] create HELLO.TXT /FILES/] ls... CONST.TXT EMPTY.TXT HELLO.TXT /FILES/] Unsuccessful create /FILES/] create EMPTY.TXT Error: File already exists /FILES/] 47

Write Operation: mkdir Similar to create, except give the directory entry the proper directory attribute

mkdir Use Cases Successful mkdir /DIRS/] mkdir NEW /DIRS/] ls... NEW A B C D /DIRS/] 49

mkdir Use Cases Unsuccessful mkdir /DIRS/] mkdir A Error: directory already exists /DIRS/] 50

Next Week Operations rm and rmdir Answering any more questions 51