CSC 306 Assignment 4: A Floppy Disk Dumper

Similar documents
bytes per disk block (a block is usually called sector in the disk drive literature), sectors in each track, read/write heads, and cylinders (tracks).

Visualization Of Hard Disk Geometry And Master Boot Record

Project 3: An Introduction to File Systems. COP4610 Florida State University

,879 B FAT #1 FAT #2 root directory data. Figure 1: Disk layout for a 1.44 Mb DOS diskette. B is the boot sector.

Understanding FAT12. Introduction to Computer Forensics. Kessler/Schirling

The FAT File System. 1. FAT Overview. 2. Boot Sector, FAT, Root Directory, and Files The FAT F 䤀耄 le System

Week 10 Project 3: An Introduction to File Systems. Classes COP4610 / CGS5765 Florida State University

Guide to Computer Forensics and Investigations Fourth Edition. Chapter 6 Working with Windows and DOS Systems

1. What is the difference between primary storage and secondary storage?

Project 3: An Introduction to File Systems. COP 4610 / CGS 5765 Principles of Operating Systems

Computer Systems. Assembly Language for x86 Processors 6th Edition, Kip Irvine

A+ Guide to Managing and Maintaining your PC, 6e. Chapter 8 Hard Drives

A+ Guide to Hardware, 4e. Chapter 7 Hard Drives

Hong Kong Polytechnic University Department of Electronic and Information Engineering. Experiment On DOS File system

Input & Output 1: File systems

WINDISK: A File and disk Editor

Disks, Memories & Buffer Management

Lesson 09: SD Card Interface

makes floppy bootable o next comes root directory file information ATTRIB command used to modify name

BLOCK DEVICES. Philipp Dollst

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

6.096 Introduction to C++ January (IAP) 2009

OPERATING SYSTEMS ASSIGNMENT 3 MEMORY MANAGEMENT

Operating Systems 2014 Assignment 4: File Systems

Chapter 12: File System Implementation

Project 4: File System Implementation 1

Operating Systems 2015 Assignment 4: File Systems

SWXD3-WE 4.29 GB 3.5-Inch 16-bit DiskDrive SBB

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Pointer Accesses to Memory and Bitwise Manipulation

Lecture 29. Friday, March 23 CS 470 Operating Systems - Lecture 29 1

RAID Option ROM. Product Implementation Guide. Version 1.8 Date: 08/19/2009. Copyright 2009, Promise Technology, Inc. All Rights Reserved

CSc Introduction to Computing

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18

Pointer Accesses to Memory and Bitwise Manipulation

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Operating Systems. Objective

6.24 Estimate the average time (in ms) to access a sector on the following disk:

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

File Systems Part 1. Operating Systems In Depth XIV 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

Review Questions on Computer Basics

Linux storage system basics

OPERATING SYSTEM. Chapter 12: File System Implementation

seg # page # offset

CS 140 Project 4 File Systems Review Session

File System Implementation. Sunu Wibirama

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

1. Overview This project will help you understand address spaces and virtual memory management.

DEPT OF ISE, NIT,RAICHUR Page 1

File System (Internals) Dave Eckhardt

Chapter 11: Implementing File Systems

CSC443 Winter 2018 Assignment 1. Part I: Disk access characteristics

CS 4284 Systems Capstone

Chapter 11: Implementing File

Linux SMR Support Status

Initial Bootloader. On power-up, when a computer is turned on, the following operations are performed:

Chapter 11: Implementing File Systems. Operating System Concepts 9 9h Edition

Midterm Exam #2 Solutions April 20, 2016 CS162 Operating Systems

Chapter 12: File System Implementation

CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm

Segmentation with Paging. Review. Segmentation with Page (MULTICS) Segmentation with Page (MULTICS) Segmentation with Page (MULTICS)

Programming in C++ 4. The lexical basis of C++

Data Storage. August 9, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 August 9, / 19

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

HARD DRIVE, FLOPPY DRIVE HOW DOES IT ALL FIT?

King Abdulaziz University Faculty of Computing and Information Technology Computer Science Department

File Management. Information Structure 11/5/2013. Why Programmers Need Files

Chapter 10: File System Implementation

Machine Language and System Programming

File Systems. What do we need to know?

CSCE Introduction to Computer Systems Spring 2019

OPERATING SYSTEMS II DPL. ING. CIPRIAN PUNGILĂ, PHD.

Chapter 12: File System Implementation. Operating System Concepts 9 th Edition

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

ENGR 3950U / CSCI 3020U (Operating Systems) Simulated UNIX File System Project Instructor: Dr. Kamran Sartipi

Chapter 12: File System Implementation

Operating Systems 2010/2011

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Introduction to Computer Systems. Exam 1. February 22, Model Solution fp

CS510 Operating System Foundations. Jonathan Walpole

The Device Driver Interface. Input/Output Devices. System Call Interface. Device Management Organization

libquadflash API 1 General Operations

1- Which of the following tasks is the operating system NOT responsible for? d) Coordinates communication between software applications and the CPU

Physical and Logical structure. Thursday, December 02, 2004

Data rate - The data rate is the number of bytes per second that the drive can deliver to the CPU.

Week 12: File System Implementation

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures

File Systems Management and Examples

b. How many bits are there in the physical address?

CS307: Operating Systems

File System: Interface and Implmentation

Pointer Accesses to Memory and Bitwise Manipulation

Introduction to Computer Systems. Exam 1. February 22, This is an open-book exam. Notes are permitted, but not computers.

A Frame Work for Virtual USB Devices under Linux Environment

CSE451 Winter 2012 Project #4 Out: February 8, 2012 Due: March 5, 2011 by 11:59 PM (late assignments will lose ½ grade point per day)

Operating Systems. Project #2: System Calls

Transcription:

CSC 306 Assignment 4: A Floppy Disk Dumper Project due date: 11:59pm CST, 11/18/10 Statement Windows and Linux systems allow a programmer to open the floppy disk and read/write its contents as if it were a sequential file. In this project you will exploit this capability to experiment with raw I/O operations. Outline You need to do your solution in the Windows platform. The Virtual Floppy Disk software allows you to create a virtual floppy disk that operates exactly like a real floppy disk as far as the OS is concerned (http://www.freewarereview.info/2006-03/virtual_floppy_drive_- _floppy_disk_imaging_and_virtualization_part_ii.html ). Part I: Write the following functions in a file called disk.c: Disk PhysicalDisk(char letter): Creates the Physical Disk Abstraction for the particular disk (identified by the letter input parameter, A or B). o Step 1: Find the device (read as file) that has to be opened and open it for reading. On Windows the corresponding files one has to open are \\\\.\\A: for floppy drive A and \\\\.\\B: for floppy drive B (Note: Escape all backslashes to suit C string literals). o Step 2: Get the geometry of the floppy disk There are two options here (Hard but Sure Way) Read the boot record (first sector logical sector 0) and get the geometry information by reading the values there. (Easy but learn ioctl ) Read the device s parameters by using the DeviceIOControl() function in Windows which will populate a DISK_GEOMETRY (address of such a structure passed as parameter) struct with all the details about the disk. o Step 3: Get the geometry results of steps 1 and 2 and put them in the Disk structure and return. The Disk structure contains the device handle and details about the disk gathered from the system or directly from the boot sector. typedef struct disk_type *Disk; struct disk_type { HANDLE floppydisk; /* Handle: returned from CreateFile() */ DISK_GEOMETRY geometry; /* Find this struct description in <winioctl.h> */ } Void sectordump(disk thedisk, unsigned logicalsectornumber): Dumps the contents of the requested logical sector onto the screen. Note that logical sectors are sequentially numbered from 0 onwards. Logical sector 0 corresponds to the physical sector at surface 0, track 0, sector 1 on the disk. This incidentally is the boot sector aka boot record. The next logical sector (#1) contains the File Allocation Table (called FAT1). There is a

copy of this for backup purposes on logical sector #10 (Called FAT2). How do you read the sector s contents? Just like reading a file, however the logicalsectornumber passed as parameter must be converted to the correct offset to read from. This can be achieved by multiplying the logicalsectornumber with the bytes/sector obtained and stored in the Disk structure from calling PhysicalDisk() function above. Look at geometry fields for what the bytes/sector details is called in Windows. The output of the sectordump() function must be formatted to show 16 bytes of the dump per line. Optional function: BOOL sectorread(disk thedisk, unsigned logicalsectornumber, char *buffer): This is an optional function to divide your work in sectordump into two parts the reading and the formatting+printing. The sectorread() function does the reading so sectordump() calls it and then formats and prints the returned buffer. Part II: Write a driver program (driver.c) to drive the code written in disk.c. The driver will be run with three arguments: Argument 1: letter for the floppy drive (A/B) Argument 2: first sector the contents of which need to be dumped Argument 3: last sector the contents of which need to be dumped Here is an example run and output: Run: driver b 0 2 Output: Opening diskette in drive name: \\.\B: Drive B Media Type 3.5, 1.44MB, 512 Bytes/Sector Cylinders 80, Tracks/cylinder 2, Sectors/track 18 Logical Sector: #0 (Boot Sector): 0: eb 3c 90 56 46 44 32 2e 31 20 20 0 2 1 1 0 10: 2 e0 0 40 b f0 9 0 12 0 2 0 0 0 0 0 20: 0 0 0 0 0 0 29 cc e5 d5 31 4e 4f 20 4e 41 30: 4d 45 20 20 20 20 46 41 54 31 32 20 20 20 0 0 40: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 60: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 70: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 80: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

e0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1f0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 aa Logical Sector: #1 (FAT1): 0: f0 ff ff 3 40 0 5 60 0 7 80 0 9 a0 0 b 10: c0 0 d e0 0 f 0 1 11 20 1 13 40 1 15 60 20: 1 17 80 1 19 a0 1 1b c0 1 1d e0 1 1f 0 2 30: 21 20 2 23 40 2 25 60 2 27 80 2 29 a0 2 2b 40: c0 2 2d e0 2 2f 0 3 31 20 3 33 40 3 35 60 50: 3 37 80 3 39 a0 3 3b c0 3 3d e0 3 3f 0 4 60: 41 20 4 43 40 4 45 60 4 47 80 4 49 a0 4 4b 70: c0 4 4d e0 4 4f 0 5 51 20 5 53 40 5 55 60 80: 5 57 80 5 59 a0 5 5b c0 5 5d e0 5 5f 0 6 90: 61 20 6 63 40 6 65 60 6 67 80 6 69 a0 6 6b a0: c0 6 6d e0 6 6f 0 7 71 20 7 73 40 7 75 60 b0: 7 77 80 7 79 a0 7 7b c0 7 7d f0 ff 0 0 0 e0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

1a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Logical Sector: #2 0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 40: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 60: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 70: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 80: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 e0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1a0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Your project solution on Windows may be written in C or C++ using VC++ or any other IDE of your choice. If you use existing code skeletons from the internet, be sure to cite it appropriately. Grading Criteria:

The grader will use the following criteria: 20 Reads and parses arguments of command line 40 Displays the disk geometry correctly 15 Opens the correct device/file 25 Gets the geometry/details of the disk 40 Dumps the sectors as specified 20 Reads the sector contents correctly (on sector boundaries) 15 Formats and prints sector as specified 5 Identifies boot sector and FAT1, FAT2 correctly Submission: Submit a single zip file containing all the files that make up your project. No executables, only sources (.cpp,.h). Send as an email attachment to preetam.ghosh@usm.edu