【发布时间】:2016-02-08 14:48:20
【问题描述】:
我正在尝试访问在 linux/fs.h 中定义的超级块对象。 但是如何初始化对象以便我们可以访问它的属性。 我发现alloc_super()是用来初始化super的,但是怎么调用呢?
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <linux/fs.h>
int main(){
printf("hello there");
struct super_block *sb;
return 0;
}
【问题讨论】:
-
super_block结构描述了挂载的文件系统。您需要获取对该文件系统中任何对象的引用:inode、file 或 dentry;对应的super_block可以通过该对象的字段访问。
标签: linux-kernel filesystems system-calls