As before, this is an individual or group project.
This project has two options. At your choice, you may deliver option 1 or option 2.
I want you to add a new ram disk device to your Minix system. This should be a disk of size 4,194,304 bytes (4MB, 4 * 1024 * 1024 bytes). This assumes you have much more than 4MB of memory in your system.
The project consists in creating such a device and making it work. It should be possible to mount(1) your device, which should be called /dev/mydisk -- you may or may not need to create this device with mknod(8) once you have completed your changes to memory.c. To convince yourself that your disk works, you should copy one or more source files to it and compile them, then execute the code.
I want you to add a new ram disk device to your Minix system. This new ramdisk should be called /dev/hex and should be a device similar to /dev/zero. Like /dev/zero, /dev/hex ignores anything written to it. The difference is that reads from /dev/hex return the infinitely repeated string "0123456789abcdef" (no spaces or newlines, just the 16 bytes repeated over and over again). For example, the following code:
int fd = open ("/dev/hex", O_RDONLY);
char buffer [21];
int n1 = read (fd, buffer, 20);
buffer [20] = '\0';
char b4 [5];
int n2 = read (fd, b4, 4);
b4 [4] = '\0';
printf ("/dev/hex returned %s and %s\n", buffer, b4);
should print:
/dev/hex returned 0123456789abcdef0123 and 4567Note that /dev/hex is similar to /dev/random and /dev/urandom on other systems, but produces output that is easier to verify. Also note that the sequence of bytes produced must be independent of any open and close operations -- the next read after the device has returned "3" will always produce "4".
Because the project is relatively simple, this project description gives few details. You are expected to figure out the details yourself. This includes, where appropriate, consulting with the instructor and using the mailing list to consult with your colleagues. The instructor plans to read email occasionally during spring break.
The project should be sent in by email. Please send me the following:
# define MY_DEV 7 /* minor device for /dev/mydisk */(HEX_DEV for option 2) and redefine
# define RAM_DEV_FIRST 8 /* first minor device for /dev/ram* */in include/minix/dmap.h, there is no need to include these details in the project submission.