首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
辅导CMPSC311、讲解Programming编程、讲解c++程序设计 讲解数据库SQL|辅导Web开发
项目预算:
开发周期:
发布时间:
要求地区:
Assignment #2 – mdadm Linear Device (Basic Functionality)
CMPSC311 - Introduction to Systems Programming
Checkpoint: February 26, 2021 (11:59 PM) EST
Due date: March 5, 2021 (11:59 PM) EST
Checkpoint 1: You should pass the first three tests, test mount unmount(), test read before mount(), and
test read invalid parameters(), by February 26, 11:59 PM EST. Otherwise you will get 50% penalty even if you
pass all tests by the due date.
You will need to install libssl-dev by running sudo apt install libssl-dev.
Today is the first day of your summer internship at a cryptocurrency startup. Before you join, the marketing
team decided that they want to differentiate their product by emphasizing on security. On the same day that
you join the company, the shipment of 16 military-grade, nuclear bomb-proof hard disks arrives. They are
supposed to replace the existing commercial-grade hard disks and will be used to store the most critical user
data—cryptocurrency wallets. However, the disk company focuses on physical security and doesn’t invest
much in software. They provide their disks as a JBOD (Just a Bunch of Disks), which is a storage architecture
consisting of numerous disks inside of a single storage enclosure. They also provide a user manual along with
the shipment:
Bits Width Field Description
26-31 6 Command This is the command to be executed by JBOD.
22-25 4 DiskID This is the ID of the disk to perform operation on
8-21 14 Reserved Unused bits (for now)
0-7 8 BlockID Block address within the disk
Table 1: JBOD operation format
Thank 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 × 256 = 65,536 bytes per disk. Since you bought 16 disks, the combined capacity is 16 ×
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.
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.
1
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 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.
More importantly, 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.
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. More importantly, 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. 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 an email from the manager of the team.
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. 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. 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. 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.
Good luck with your task!
2
Now you are all pumped up and ready to make an impact in the new company. You spend the afternoon
with your mentor, who goes through the directory structure and the development procedure with you:
1. jbod.h: The interface of JBOD. You will use the constants defined here in your implementation.
2. jbod.o: The object file containing the JBOD driver.
3. mdadm.h: A header file that lists the functions you should implement.
4. mdadm.c: Your implementation of mdadm functions.
5. tester.h: Tester header file.
6. tester.c: Unit tests for the functions that you will implement. This file will compile into an executable,
tester, which you will run to see if you pass the unit tests.
7. util.h: Utility functions used by JBOD implementation and the tester.
8. util.c: Implementation of utility functions.
9. Makefile: instructions for compiling and building tester used by the make utility.
You workflow will consist of (1) implementing functions by modifying mdadm.c, (2) typing make to build
the tester, and (3) running tester to see if you pass the unit tests, and repeating these three steps until you
pass all the tests. Although you only need to edit mdadm.c for successfully completing the assignment, you
can modify any file you want if it helps you in some way. When testing your submission, however, we will use
the original forms of all files except mdadm.c and mdadm.h.
3
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!