首页 » C语言代写 » C语言代写|HW8 Pantry

C语言代写|HW8 Pantry

这是一篇美国的文件系统C语言代写

 

Submission

As with previous assignments, we will be using GitHub to distribute skeleton code and collect submissions. Please refer to our Git Workflow guide for more details. Note that we will be using multiple tags for this assignment, for each deliverable part.

For students on ARM Mac computers (e.g. with M1 chip): if you want your submission to be built/tested for ARM, you must create and submit a file called .armpls in the toplevel directory of your repo; feel free to use the following one-liner:

cd “$(git rev-parse –show-toplevel)” && touch .armpls && git add .armpls &&

You should do this first so that this file is present in all parts.

Code Style

There is a script in the skeleton code named run_checkpatch.sh . It is a wrapper over linux/scripts/checkpatch.pl , which is a Perl script that comes with the linux kernel that checks if your code conforms to the kernel coding style.

Execute run_checkpatch.sh to see if your code conforms to the kernel style – it’ll let you know what changes you should make. You must make these changes before pushing a tag. Passing run_checkpatch.sh with no warnings and no errors is required for this assignment.

Part 0: Formatting and mounting disks

A loop device is a pseudo-device that makes a file accessible as a block device. Files of this kind are often used for CD ISO images. Mounting a file containing a file system via such a loop mount makes the files within that file system accessible.

Exploring ext2

  1. Create a loop device, build & mount an ext2 filesystem, and try creating directories and files. Below is a sample session you can follow that starts from my home directory. It goes without saying that you need to understand what’s going on at each step. Look at the man pages. Google stuff.

$ sudo su

# dd if=/dev/zero of=./ext2.img bs=1024 count=100

100+0 records in

100+0 records out

102400 bytes (102 kB, 100 KiB) copied, 0.000600037 s, 171 MB/s

# modprobe loop

# losetup –find –show ext2.img

/dev/loop0

# mkfs -t ext2 /dev/loop0

mke2fs 1.44.5 (15-Dec-2018)

Creating filesystem with 100 1k blocks and 16 inodes

Allocating group tables: done

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

# mkdir mnt

# mount /dev/loop0 ./mnt

# cd mnt

# ls -al

total 17

drwxr-xr-x 3 root root 1024 Apr 21 02:22 .

drwxr-xr-x 37 hans hans 4096 Apr 21 02:22 ..

drwx—— 2 root root 12288 Apr 21 02:22 lost+found

# mkdir sub2

# ls -al

total 18

drwxr-xr-x 4 root root 1024 Apr 21 02:23 .

drwxr-xr-x 37 hans hans 4096 Apr 21 02:22 ..4/29/22, 10:50 PM

Page 3 of 28

drwx—— 2 root root 12288 Apr 21 02:22 lost+found

drwxr-xr-x 2 root root 1024 Apr 21 02:23 sub2

# cd sub2

# ls -al

total 2

drwxr-xr-x 2 root root 1024 Apr 21 02:23 .

drwxr-xr-x 4 root root 1024 Apr 21 02:23 ..

# mkdir sub2.1

# ls -al

total 3

drwxr-xr-x 3 root root 1024 Apr 21 02:24 .

drwxr-xr-x 4 root root 1024 Apr 21 02:23 ..

drwxr-xr-x 2 root root 1024 Apr 21 02:24 sub2.1

# touch file2.1

# ls -al

total 3

drwxr-xr-x 3 root root 1024 Apr 21 02:24 .

drwxr-xr-x 4 root root 1024 Apr 21 02:23 ..

-rw-r–r– 1 root root 0 Apr 21 02:24 file2.1

drwxr-xr-x 2 root root 1024 Apr 21 02:24 sub2.1

# cd ../../

# umount mnt/

# losetup –find

/dev/loop1

# losetup –detach /dev/loop0

# losetup –find

/dev/loop0

# ls -al mnt/

total 8

drwxr-xr-x 2 root root 4096 Apr 21 02:22 .

drwxr-xr-x 37 hans hans 4096 Apr 21 02:22 ..

  1. In the sample session shown above, files and directories are created. Make sure you see the number of links each file or directory has, and make sure you understand why.

Also try creating some hard links and symlinks. Make sure you understand how they affect the link counts.

Preparing your module build environment

In this assignment, we provide a compiled reference implementation of PantryFS for you to test your implementation against.

We provide reference implementations ( ref/pantry-x86.ko and ref/pantryarm.ko ), compiled against the stock Debian 11 kernel ( 5.10.0-8-amd64 and 5.10.0-9-arm64 , respectively). You should boot into this kernel for the rest of this assignment.

If your kernel name is slightly differerent (e.g. 5.10.0-9-amd64 ), you may get a versioning error when you try to insert the reference implementation. In that case, you can try forcibly inserting the module with insmod -f .


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank