Answered step by step
Verified Expert Solution
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 disks of size KB as a single MB disk. Your task is to implement an mdadm linear device, which will merge these 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 to To clarify, the mdadm linear device should map this linear address space to the disks sequentially. For instance, addresses to correspond to disk addresses to correspond to disk 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 mdadmmountvoid: Mount the linear device; now mdadm user can run read and operations on the linear address space that combines all disks. It should return on success and on failure. Calling this function the second time without calling mdadmunmount in between, should fail. int mdadmunmountvoid: Unmount the linear device; now all commands to the linear device should fail. It should return on success and on failure. Calling this function the second time without calling mdadmmount in between, should fail. int mdadmreaduintt addr, uintt len, uintt buf: Read len bytes into buf starting at addr. It returns on failure and actual length of read data in case of success. Read from an outofbound linear address should fail. A read larger than bytes should fail; in other words, len can be at most. There are a few more restrictions that you will find out as you try to pass the tests. Lab Assignment #mdadm Linear Device Writes and Testing CMPSC Introduction to Systems Programming Summer Prof. Suman Saha Due date: July : 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 mdadmwrite Your next job is to implement write functionality for mdadm and then thoroughly test your implementation. Specifically, you will implement the following function: int mdadmwrite uintt startaddr, uintt writelen, const uintt writebuf Recall that the command for writing is JBODWRITEBLOCK see ReadMeLabpdf from Lab As you can tell, it has an interface that is similar to that of the mdadmread function,which you have already implemented. Specifically, it writes writelen bytes from the usersupplied writebuf buffer to your storage system, starting at address startaddr. You may notice that the writebuf parameter now has a const specifier. We put the const there to emphasize that it is an in parameter; that is mdadmwrite 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 mdadmread, writing to an outofbound linear address should fail. Write larger than bytes should fail; in other words, writelen can be 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 mdadmwrite 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 mdadmwritepermissionvoid; int mdadmrevokewrite
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 disks of size KB as a single MB
disk.
Your task is to implement an mdadm linear device, which will merge these 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 to To clarify, the mdadm linear device should map this linear address space
to the disks sequentially. For instance, addresses to correspond to disk addresses to
correspond to disk 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 mdadmmountvoid: Mount the linear device; now mdadm user can run read and operations on the linear address space that combines all disks. It should return on success and on
failure. Calling this function the second time without calling mdadmunmount in between, should fail.
int mdadmunmountvoid: Unmount the linear device; now all commands to the linear
device should fail. It should return on success and on failure. Calling this function the second time
without calling mdadmmount in between, should fail.
int mdadmreaduintt addr, uintt len, uintt buf: Read len
bytes into buf starting at addr. It returns on failure and actual length of read data in case of success.
Read from an outofbound linear address should fail. A read larger than bytes should fail; in
other words, len can be at most. There are a few more restrictions that you will find out as you
try to pass the tests.
Lab Assignment #mdadm Linear Device Writes and Testing
CMPSC Introduction to Systems Programming
Summer Prof. Suman Saha
Due date: July : 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 mdadmwrite
Your next job is to implement write functionality for mdadm and then thoroughly
test your implementation. Specifically, you will implement the following function:
int mdadmwrite
uintt startaddr, uintt writelen, const uintt writebuf
Recall that the command for writing is JBODWRITEBLOCK see
ReadMeLabpdf from Lab
As you can tell, it has an interface that is similar to that of the mdadmread
function,which you have already implemented. Specifically, it writes
writelen bytes from the usersupplied writebuf buffer to your storage
system, starting at address startaddr. You may notice that the writebuf
parameter now has a const specifier. We put the const there to emphasize that it is
an in parameter; that is mdadmwrite 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 mdadmread, writing to an
outofbound linear address should fail. Write larger than bytes should fail; in
other words, writelen can be 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 mdadmwrite 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 mdadmwritepermissionvoid;
int mdadmrevokewrite
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started