rcore-os / rcore-fs

The file system module for rCore OS.
MIT License
49 stars 24 forks source link

Add char device to simple file system #5

Closed gaotianyu1350 closed 5 years ago

gaotianyu1350 commented 5 years ago

Add some functions and attributes to INodeImpl and SimpleFileSystem in rcore-fs-sfs to support char device.

gaotianyu1350 commented 5 years ago

LGTM. BTW, what's the usage of link_inodeimpl?

link_inodeimpl(device_file_name, inode_impl)

eg:

// add device to sfs
SFS.new_device_inode(1, STDIN.clone()) // STDIN is INode implementing stdin
// get a new INodeImpl of a device
let stdin_inodeimpl = SFS.new_inode_chardevice(1) // 1 is the device number
// link it to /dev
dev_inode_impl.link_inodeimpl("stdin", &stdin_inodeimpl) // dev_inode_impl is INodeImpl of "/dev"
jiegec commented 5 years ago

Okay, got it.