【发布时间】:2015-02-04 13:25:14
【问题描述】:
我查找了有关 Linux 内核中挂载命名空间的各种信息来源,但我不得不说,我找不到太多关于它在底层如何工作的信息(结构的布局以及它们如何相互关联)。
我想做的是在进程 X 的挂载命名空间中获取给定路径,并在 init/root 进程命名空间中获取相同的文件路径。
例子:
block device A has a file as blah/whatever/fileX
In the init/root process mount namespace, this bdev A is mounted on folder /root making the path /root/blah/whatever/fileX
In the process X mount namespace, this bdev A is mounted on folder /myfolder making the path /myfolder/blah/whatever/fileX
当使用路径名进入内核的特定系统调用来自进程 X 的世界时,我想采用路径名 /myfolder/blah/whatever/fileX 并将其转换为 init/root 的世界路径名 /root/blah/whatever/fileX(如果文件不能通过 init/root 的任何挂载点访问,则为 NULL)
一些相关问题: Linux - understanding the mount namespace & clone CLONE_NEWNS flag
【问题讨论】:
标签: linux-kernel