fishinabarrel / linux-kernel-module-rust

Framework for writing Linux kernel modules in safe Rust
GNU General Public License v2.0
1.34k stars 119 forks source link

Add tests for filesystem::register #197

Closed luisgerhorst closed 5 years ago

luisgerhorst commented 5 years ago

Do so by checking whether loading the module makes the name of the filesystem (testfs) appear in /proc/filesystems.

Fixes https://github.com/fishinabarrel/linux-kernel-module-rust/issues/93.

If someone can make a suggestion on how to remove the two unsafe blocks I would be happy to implement it. I tried to find a way to remove the unsafe block for the CStr but I don't think it's possible. I'm very new to Rust thought, so prove me wrong. There exists a const_cstr crate that offers a const_cstr! macro, maybe do something similar?

alex commented 5 years ago

I went ahead and did #201 to make cstr!() usable in const contexts, that should solve the problems and get this PR ready for us to land!

alex commented 5 years ago

Ok, should be possible to use cstr!() from a const context now.

luisgerhorst commented 5 years ago

Thank's! I changed the code to use the new cstr! and rebased everything onto the current master. Should I squash everything into the first commit?

alex commented 5 years ago

No squash required, we can do that when we merge on github. Will review after I finish eating my 🌮s!

alex commented 5 years ago

Thanks for contributing these! We hope you'll stick around and keep contributing!