corrections on 03 and 08, 09 done
This commit is contained in:
41
09/rw.c
Normal file
41
09/rw.c
Normal file
@ -0,0 +1,41 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <linux/nsproxy.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/fs.h>
|
||||
#include <../fs/mount.h>
|
||||
|
||||
int list_mounts(struct seq_file *m, void *v);
|
||||
|
||||
int list_mounts(struct seq_file *m, void *v)
|
||||
{
|
||||
struct rb_node *cur;
|
||||
struct mount *mnt;
|
||||
char *buf;
|
||||
char *path;
|
||||
|
||||
cur = current->nsproxy->mnt_ns->mnt_first_node;
|
||||
|
||||
buf = kmalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
|
||||
while(cur)
|
||||
{
|
||||
mnt = rb_entry(cur, struct mount, mnt_node);
|
||||
|
||||
struct path p = {
|
||||
.mnt = &mnt->mnt,
|
||||
.dentry = mnt->mnt.mnt_root,
|
||||
};
|
||||
|
||||
path = d_path(&p, buf, PATH_MAX);
|
||||
if(IS_ERR(path))
|
||||
path = 0;
|
||||
seq_printf(m, "%-10s %s\n", mnt->mnt_devname, path);
|
||||
cur = rb_next(cur);
|
||||
}
|
||||
kfree(buf);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user