LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Include mass delete method into a kernel (http://www.linuxquestions.org/questions/linux-kernel-70/include-mass-delete-method-into-a-kernel-4175455337/)

detrist 03-24-2013 04:15 AM

Include mass delete method into a kernel
 
Hi there,

I would like to add a mass delete method to the Linux kernel, but I don't know how to go about it.
It would be grateful if you could send a relevant publication or other useful information about this.

I understand that many layers have to use to reach my goal.

If someone has any idea about this, I will be happy.

Thanks in advance.

linosaurusroot 03-24-2013 05:57 AM

It's best to not include unnecessary things in the kernel. Smart people are putting large amounts of stuff (even drivers and filesystems) outside the kernel these days.

detrist 03-24-2013 06:08 AM

I know, but I must use it because it is my project in the university. So I need to modify the VFS layer and the filesystem. Firstly I think the FAT filesystem is a good chance.

syg00 03-24-2013 07:47 AM

:banghead: - we've all had to conform to ivory-tower stupidity.
Right of passage.

jpollard 03-24-2013 07:51 AM

I thought the command "mkfs" was good for that...

Really, this is NOT a good project.


UNFORTUNATELY, the directory tree of files must be deleted from the leaf inwards - and the kernel doesn't have a large enough stack to allow that to be done very well, if at all. You might be able to get the dcache to emulate it... but that will cause a huge churn of buffers during the deletion.

Second, to implement it requires you to add an entry to the VFS... and then then decide what you are going to do when the directory tree you are "mass deleting" crosses a mount point...

And then there are the issues of changing security labels... The only way to decide whether to perform the action is to first walk the tree to see if you have permission... and then walk the tree again to carry out the deletion... Or to allow for partial deletions... in which case you have to abort on the first error... and not know what has or has not been deleted.

detrist 03-24-2013 09:23 AM

Hmm... It is a good advice.
Fortunately there is directory wich not include other directory. And yes. I use the VFS to help me wich will provide a new method for the mass deletion. The permission... have not recomended yet because the FAT is not manages the permission. But of course it is important for other filesystems and if it is a journaling file system.... so there are a lot of work to reach the finish.

But if you know, where is the vfs implementation in the kernel because i don't find it?

Thanks in advance.

jpollard 03-24-2013 09:45 AM

You can start with an overview...

http://www.tldp.org/LDP/khg/HyperNew...s/vfstour.html

VFS code is a bit spread out because it is only tied together via the vfs structure created at mount time (vfs_mount...). Much of the code is in the fs directory, but also note the include file linux/fs.h...

But I haven't written a kernel level filesystem, and especially have not done extensions to the VFS itself.

detrist 03-24-2013 10:31 AM

No problem, thank you the answers and the advices.


All times are GMT -5. The time now is 04:29 PM.