理解mount -t proc proc /proc

mount 命令的标准用法是你说的这样:

mount -t type device dir

对于 proc 文件系统来说,它没有设备,然后我查了一下内核代码,proc filesystem 根本没有处理 dev_name 这个参数,所以传什么都没有影响,只影响你的 mount 命令输出。好的实践应该将设备名指定为 nodev。

static struct dentry *proc_mount(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data)
{
        struct pid_namespace *ns;

        if (flags & MS_KERNMOUNT) {
                ns = data;
                data = NULL;
        } else {
                ns = task_active_pid_ns(current);
        }

        return mount_ns(fs_type, flags, data, ns, ns->user_ns, proc_fill_super);
}


posted @ 2021-07-15 17:08  不明白就去明白  阅读(2264)  评论(0编辑  收藏  举报