BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C语言代写 | Assignment #5 – CMPSC311 mdadm Linear Device (Networking)

C语言代写 | Assignment #5 – CMPSC311 mdadm Linear Device (Networking)

本次北美代写主要为C语言 mdadm线性设备

Assignment #5 – mdadm Linear Device (Networking)
CMPSC311 – Introduction to Systems Programming

Protocol

The protocol defined by the JBOD vendor has two messages. The JBOD request message is sent from your
client program to the JBOD server and contains an opcode and a buffer when needed. The JBOD response
message is sent from the JBOD server to your client program and contains an opcode and a buffer when needed.
Both messages use the same format:

Bytes Field Description
0-1 length The size of the packet in bytes
2-5 opcode The opcode for the JBOD operation
6-7 return code Return code from the JBOD operation
8-263 block Where needed, a block of size JBOD BLOCK SIZE

Table 1: JBOD procotol packet format

Implementation

In addition to replacing all calls in mdadm.c, you will implement functions defined in net.h in the pro-
vided net.c file. Specifically, you will implement jbod_connect function, which will connect to JBOD –
SERVER at port JBOD PORT, both defined in net.h, and jbod_disconnect function, which will close
the connection to the JBOD server. Both of these functions will be called by the tester. The file net.c contains
some functions with empty bodies that can help with structuring your code, but you don’t have to implement
them. Other than implementing the functions in net.h, it is up to you how you structure your code.

Testing

Once you finish implementing your code, you can test it by running the provided jbod_server in one
terminal, which implements the server component of the protocol, and running the tester with the workload
file in another terminal. Below is a sample session from the server and the client:
Output from the jbod_serverterminal:

$ ./jbod_server
JBOD server listening on port 3333…
new client connection from 127.0.0.1 port 32402
client closed connection

Output from the tester terminal:

$ ./tester -w traces/simple-input >my-out
connected to the JBOD server at 127.0.0.1
Cost: 0
Hit rate: -nan%
closed connection to the JBOD server

You can also run the jbod_serverin verbose mode to print out every command that it receives from the
client. Below is sample output that was trimmed to fit the space.

$ ./jbod_server -v
JBOD server listening on port 3333…
new client connection from 127.0.0.1 port 38546
received cmd id = 0 (JBOD_MOUNT) [disk id = 0 block id = 0], result = 0
received cmd id = 2 (JBOD_SEEK_TO_DISK) [disk id = 0 block id = 0], result = 0
received cmd id = 5 (JBOD_WRITE_BLOCK) [disk id = 0 block id = 0], result = 0
block contents:
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Grading

There are not tests for this implementation. All of your 10 points will come from traces.

bestdaixie

评论已关闭。