wince file systems. file system on embedded file system choice on embedded is important –file...

21
Wince File systems

Post on 21-Dec-2015

220 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Wince

File systems

Page 2: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

File system on embedded

• File system choice on embedded is important– File system size can be an issue– Different media are used – i.e. Flash– May not have users– May need special security – i.e. encryption– Requirements are likely to change

Page 3: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Microsoft file systems

• Generally Microsoft systems have 4 file system choices– CDFS

• For cd roms

– UDF• For dvds

– FAT12, FAT16 and FAT32– NTFS

Page 4: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Parts of a FAT32 Volume1. Boot Sector - first sector of partition

- contains file system info, pointers to other sections and boot loader code

2. FAT - two copies of File Allocation Table – show clusters (blocks) allocation

3. Root Folder - The root folder contains an entry for each file and folder at the root

4. Data - file and directory data

Page 5: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

FAT

• File Allocation Table contains entry for each cluster on the disk

• FAT12, FAT16, and FAT32 - refer to the number of bits used for the cluster entries in the table

• Number of entries in FAT is limited by number of bits used for describing the location of a cluster - FAT16 can only hold < 216 or 65,526 cluster entries

Page 6: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

The File Allocation Table

• Entry for each cluster on the partition – contains the:– address of the next cluster in chain– end of file (EOF) character that indicates

the end of a chain (0xFFFF)– character to mark bad cluster (0xFFF7)– character to mark reserved cluster– zero to note the cluster is unused

• FAT16 - 16 bits/FAT32 - 32 bits (28 Bits)

Page 7: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

File Allocation Tableone entry for each cluster

Page 8: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Slack

• Fixed number of clusters available• Cluster size increased in order to fill

the available space as disks get bigger

• FAT32 uses 16 KB clusters for 16-32 GB disks

• 20 KB file uses two 16 KB clusters - 32 KB of space –12K of slack

• 1 KB file uses 16 KB – 15K of slack

Page 9: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Folder Entry

• Set of 32-byte Folder Entries for each file and subfolder in the folder– Name (eight-plus-three characters) – Attribute byte (8 bits/archive, directory,

hidden, read-only, system and volume) – Create time (24 bits)/date (16 bits) – Last access date (16 bits) – Last modified time (16 bits)/date (16 bits) – Starting cluster in the FAT (16 bits) – File size (32 bits)

Page 10: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Creating a File

• No organization to FAT folder structure• Files are given the first available

location on the volume• Starting cluster number is the address

of the first cluster used by the file• Each cluster contains a pointer to the

next cluster in the file, or an indication (0xFFFF) that this cluster is the end of the file

Page 11: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

File Allocation Table

Figure 4-2 Example of File Allocation Table

                                                              

   

Page 12: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 12

Windows NTFS

• Hierarchical file system (similar to UNIX)

• Hard and symbolic links are supported

• Highly complex and sophisticated FS– Uses B+ trees– Has ACLs– Can encrypt

• Different from FAT file systems

Page 13: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Fundamental Concepts

• NFTS file – not just a linear sequence of bytes– File – consists of multiple streams– Multiple attributes, each represented by a

stream of bytes– Each stream has its own name foo:stream1;– Idea of multiple streams in a file – Apple

Macintosh• Used to allow Windows machines to read Apple files

04/18/23 13

Page 14: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 14

Principal Win32 APIs for File I/O

Page 15: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 15

Open File Issues• To create and open a file, one must use CreateFile• There is no FileOpen API• CreateFile system call has 7 parameters

1. Pointer to the name of the file to create or open2. Flags telling whether the file can be read, written, or both3. Flags telling whether multiple processes can open the file

at once4. A pointer to the security descriptor5. Flags telling what to do if the file exists/does not exist6. Flags dealing with attributes such as archiving,

compression,;7. Handle of a file whose attributes should be cloned for the

new file• Example:

– Inhandle=CreateFile(“data”, GENERIC_READ,0,NULL,OPEN_EXISTING, 0, NULL)

Page 16: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 16

NFTS Structure• NTFS is divided into volumes (aka partitions)

• Each NTFS includes files, directories, other data structures

• Each volume is organized as a linear sequence of blocks (block size between 512 and 4KB)

• Main data structure in each volume is Master File Table (MFT)

• Bitmap keeps track which MFT entries are free

Page 17: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 17

MFT for NTFS Organization

• Boot-block has information about the first block of MFT

Page 18: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

04/18/23 18

MFT Record (Example for 3-Run, 9-Block File)

Page 19: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Space

• NTFS supports disk quotas & file compression

• NTFS handles space management for partitions > 8G more efficiently than FAT32 - smaller cluster sizes and less disk space waste than FAT32

• FAT32 maximum partition size is 32GB

• NTFS maximum partition size is 16TB

Page 20: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Reliability

• FAT32 more susceptible to disk errors• NTFS has ability to recover from errors

better than similar FAT32 volumes• Log files are created under NTFS - can be

used for automatic file system repair• NTFS supports dynamic cluster remapping

for bad sectors and prevent them from being used in the future

Page 21: Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –

Security

• FAT32 - user with access to a drive using FAT32 has access to the files on that drive

• NTFS allows NTFS Permissions - folder and file access can be controlled individually - chance for error is greatly magnified

• Windows XP Professional supports file encryption