如何在内核模块中使用vfs_read读取整个文件?

时间:2017-07-11 09:20:27

标签: linux-kernel readfile kernel-module filesize vfs

我必须在内核模块内的缓冲区中读取整个文件。我开始按照here

编写

但是,我不清楚如何检索文件大小,为数组缓冲区分配内存。我找不到VFS功能的好文档。 (我正在研究3.2内核)。

怎么能实现呢?感谢

1 个答案:

答案 0 :(得分:0)

How do you get the size of a file in the linux kernel?

中使用MainActivity.this.runOnUiThread(new Runnable() { public void run() { TextView textView = (TextView) findViewById(R.id.editText); textView.setText(sentence); } }); vfs_stat()