Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hank you for purchasing our military - grade, nuclear bomb - proof hard disks, built with patented NASA technologies. Each of the disks in front

hank you for purchasing our military-grade, nuclear bomb-proof hard disks, built with patented NASA
technologies. Each of the disks in front of you consists of 256 blocks, and each block has 256 bytes, coming
to a total of 256\times 256=65,536 bytes per disk. Since you bought 16 disks, the combined capacity is 16\times
65,536=1,048,576 bytes =1 MB. We provide you with a device driver with a single function that you can use
to control the disks.
int jbod_operation(uint32_t op, uint8_t *block);
This function returns 0 on success and -1 on failure. It accepts an operation through the op parameter,
the format of which is described in Table 1, and a pointer to a buffer. The command field can be one of the
following commands, which are declared as a C enum type in the header that we have provide to you:
1. JBOD_MOUNT: mount all disks in the JBOD and make them ready to serve commands. This is the first
command that should be called on the JBOD before issuing any other commands; all commands before
it will fail. When the command field of op is set to this command, all other fields in op are ignored by
the JBOD driver. Similarly, the block argument passed to jbod_operation can be NULL.
1
2. JBOD_UNMOUNT: unmount all disks in the JBOD. This is the last command that should be called on
the JBOD; all commands after it will fail. When the command field of op is set to this command, all
other fields in op are ignored by the JBOD driver. Similarly, the block argument passed to jbod_-
operation can be NULL.
3. JBOD_SEEK_TO_DISK: seeks to a specific disk. JBOD internally maintains an I/O position, a tuple
consisting of {CurrentDiskID, CurrentBlockID}, which determines where the next I/O operation will
happen. This command seeks to the beginning of disk specified by DiskID field in op. In other words, it
modifies I/O position: it sets CurrentDiskID to DiskID specified in op and it sets CurrentBlockID to 0.
When the command field of op is set to this command, the BlockID field in op is ignored by the JBOD
driver. Similarly, the block argument passed to jbod_operation can be NULL.
4. JBOD_SEEK_TO_BLOCK: seeks to a specific block in current disk. This command sets the CurrentBlockID in I/O position to the block specified in BlockID field in op. When the command field of op
is set to this command, the DiskID field in op is ignored by the JBOD driver. Similarly, the block
argument passed to jbod_operation can be NULL.
5. JBOD_READ_BLOCK: reads the block in current I/O position into the buffer specified by the block
argument to jbod_operation. The buffer pointed by block must be of block size, that is 256 bytes.
After this operation completes, the CurrentBlockID in I/O position is incremented by 1; that is, the next
I/O operation will happen on the next block of the current disk unless you specify a new DiskID or
BlockID. When the command field of op is set to this command, all other fields in op are ignored by the
JBOD driver.
6. JBOD_WRITE_BLOCK: writes the data in the block buffer into the block in the current I/O position.
The buffer pointed by block must be of block size, that is 256 bytes. After this operation completes,
the CurrentBlockID in I/O position is incremented by 1; that is, the next I/O operation will happen on the
next block of the current disk unless you specify a new DiskID or BlockID. When the command field of
op is set to this command, all other fields in op are ignored by the JBOD driver.
After you finished your onboarding session with HR and enjoyed the free lunch with your new colleagues,
you received the following email from the manager of the team.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Describe various competitive compensation policies.

Answered: 1 week ago