Académique Documents
Professionnel Documents
Culture Documents
Cs609@vu.edu.pk
Lecture # 33
root
The DOS directory structure is a Tree like structure. The top most level of the tree being
the root directory. The root directory contains files and folders. Each folder can contains
more files and folders and so on it continues recursively as shown by the slide.
File
• Is logically viewed as an organization of Data.
• Physically it can be a collection of clusters or
blocks.
• O.S. needs to maintain information about the
cluster numbers of which a file may be comprised
of.
Control information about files are maintained in a data structure called the File control
block (FCB). The FCB for each file is created and stored in the disk.
The root directory consists of FCBs for all the files and folders stored on the root
directory. To obtains these FCBs, the portion on disk reserved for root directory can be
read.
Boot Block
-p
AX=3200 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=13AD ES=13AD SS=13AD CS=13AD IP=0102 NV UP EI PL NZ NA PO NC
13AD:0102 CD21 INT 21
-p
AX=3200 BX=13D2 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=00A7 ES=13AD SS=13AD CS=13AD IP=0104 NV UP EI PL NZ NA PO NC
13AD:0104 D3E3 SHL BX,CL
-d a7:13d2
00A7:13D0 00 00 00 02 00 00-01 00 02 E0 00 21 00 20 ...........!.
00A7:13E0 0B 09 00 13 00 56 34 12-00 F0 0A FF FF FF FF 00 .....V4.........
00A7:13F0 00 C8 06 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1400 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1410 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1420 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1430 00 00 00 00 00 00 00 0C-00 00 80 00 B7 13 10 00 ................
00A7:1440 DF 12 4D 5A 9A 00 29 00-00 00 20 00 C5 00 FF FF ..MZ..)... .....
00A7:1450 A7 05 ..
-q
-d 1000 2c00
In the above two slides first the contents of DPB are read to find the start of the root
directory. Using this block number the contents of root directory are read, as it can be
seen they contain number of FCBs each containing information about a file within the
directory.
The user data area is divided into clusters. The first cluster in user data area is numbered
2 in a FAT based systems. A cluster is not the same as block and also there are no system
calls available which use the cluster number. All the system calls use the LSN address. If
the cluster number is known it should be converted into LSN to access the blocks within
the cluster. Moreover all the information about file management uses the cluster number
rather than the LSN for simplicity and for the purpose of managing large disk space. So
here we devise a formula to convert the cluster number into LSN.
using the information the above slide the following formula can be devised as shown in
the slide below to convert the cluster number into LSN.
Sector No. =
(Clust_no – 2)* Blocks per Clust + First User
Block #
The following memory dump extracts the starting cluster number from the FCB of a file
and then converts the cluster number in sector to get its starting block.
-d 1000 2c00
File Contents =
File Cluster # = 4a
File Start Sector # = (4a – 2 )*1 + 21H = 69H
The contents of the blocks/cluster at the start of file are then examined by loading the
sectors within the first cluster to that file in the following slide. Here the contents of the
file can be seen on the right side column.
Cluster Dump
-l 1000 0 69 1
-d 1000
-p
AX=3200 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=13AD ES=13AD SS=13AD CS=13AD IP=0102 NV UP EI PL NZ NA PO NC
13AD:0102 CD21 INT 21
-p
AX=3200 BX=13D2 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=00A7 ES=13AD SS=13AD CS=13AD IP=0104 NV UP EI PL NZ NA PO NC
13AD:0104 D3E3 SHL BX,CL
-d a7:13d2
00A7:13D0 05 05 00 02 07 03-08 00 02 00 02 C0 01 B4 ..............
00A7:13E0 CB CC 00 A0 01 56 34 12-00 F8 0A FF FF FF FF 00 .....V4.........
00A7:13F0 00 98 CB 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1400 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1410 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1420 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
00A7:1430 00 00 00 00 00 00 00 0C-00 00 80 00 B7 13 10 00 ................
00A7:1440 DF 12 4D 5A 9A 00 29 00-00 00 20 00 C5 00 FF FF ..MZ..)... .....
00A7:1450 A7 05 ..
-q