Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Welcome, to the team! Here s your task for the next two weeks. You will be working on integrating JBOD into our existing storage system.

Welcome, to the team! Heres your task for the next two weeks. You will be working on integrating
JBOD into our existing storage system. Specifically, you will implement one of the functionalities of
the mdadm utility in Linux. Mdadm stands for multiple disk and device administration, and it is a tool
for doing cool tricks with multiple disks. You will implement one of such tricks supported by mdadm,
called linear device. A linear device makes multiple disks appear as a one large disk to the operating
system. In our case, we will use your program to configure 16 disks of size 64 KB as a single 1 MB
disk.
Your task is to implement an mdadm linear device, which will merge these 16 disks into a single logical
disk with a linear address space. This linear address space allows for reading and writing bytes within
the range of 0 to 1,048,575. To clarify, the mdadm linear device should map this linear address space
to the disks sequentially. For instance, addresses 0 to 65,535 correspond to disk 0, addresses 65,536 to
131,071 correspond to disk 1, and so forth.
Note: Before implementing the functions, fill out correct values for JBOD NUM DISKS, JBOD -
DISK SIZE, JBOD BLOCK SIZE, JBOD NUM BLOCKS PER DISK in jbod.h file. It is required for
implementing below functions.
Below are the functions you need to implement.
int mdadm_mount(void): Mount the linear device; now mdadm user can run read and operations on the linear address space that combines all disks. It should return 1 on success and -1 on
failure. Calling this function the second time without calling mdadm_unmount in between, should fail.
int mdadm_unmount(void): Unmount the linear device; now all commands to the linear
device should fail. It should return 1 on success and -1 on failure. Calling this function the second time
without calling mdadm_mount in between, should fail.
int mdadm_read(uint32_t addr, uint32_t len, uint8_t *buf): Read len
bytes into buf starting at addr. It returns -1 on failure and actual length of read data in case of success.
Read from an out-of-bound linear address should fail. A read larger than 1,024 bytes should fail; in
other words, len can be 1,024 at most. There are a few more restrictions that you will find out as you
try to pass the tests.
Lab Assignment #3-mdadm Linear Device (Writes and Testing)
CMPSC311- Introduction to Systems Programming
Summer 2024- Prof. Suman Saha
Due date: July 05,2024(11:59 PM) EST
Like all lab assignments in this class, you are prohibited from copying any content
from the Internet including (discord or other group messaging apps) or discussing,
sharing ideas, code, configuration, text, or anything else or getting help from
anyone in or outside of the class. Failure to abide by this requirement will result in
penalty as described in our course syllabus.
Your internship is going great. You have gained experience with C programming,
you have experienced your first segmentation faults, and youve come out on top.
You are brimming with confidence and ready to handle your next challenge.
Implementing mdadm_write
Your next job is to implement write functionality for mdadm and then thoroughly
test your implementation. Specifically, you will implement the following function:
int mdadm_write
(uint32_t start_addr, uint32_t write_len, const uint8_t write_buf)
Recall that the command for writing is JBOD_WRITE_BLOCK (see
ReadMe_Lab2.pdf from Lab 2).
As you can tell, it has an interface that is similar to that of the mdadm_read
function,which you have already implemented. Specifically, it writes
write_len bytes from the user-supplied write_buf buffer to your storage
system, starting at address start_addr. You may notice that the write_buf
parameter now has a const specifier. We put the const there to emphasize that it is
an in parameter; that is, mdadm_write should only read from this parameter
and not modify it. It is a good practice to specify const specifier for your in
parameters that are arrays or structs. Similar to mdadm_read, writing to an
out-of-bound linear address should fail. Write larger than 1024 bytes should fail; in
other words, write_len can be 1024 at most. On success return the amount of
bytes written.
There are a few more restrictions that you will find out as you try to pass the tests.
Once you implement the above function, you have the basic functionality of your
storage system in place. We have expanded the tester to include new tests for the
write operations, in addition to existing read operations. You should try to pass
these write tests first.
Implementing mdadm_write permissions
The cryptocurrency startup that you are interning at is also very concerned about
the security of their storage systems. To ensure that data is written by the correct
people and at the correct times, you will also be required to write the following
functions to set the write permissions of the storage system:
int mdadm_write_permission(void);
int mdadm_revoke_write_

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions