カスタム カーネル モジュールでいくつかのdentry
オブジェクトを作成しています。securityfs
これが私がやっている方法です:
inst->output_file = securityfs_create_file("1",
S_IRUSR | S_IRGRP, uprp_dir, NULL,
&my_file_ops);
inst->output_file = securityfs_create_file("2",
S_IRUSR | S_IRGRP, uprp_dir, NULL,
&my_file_ops);
// and so on
に通常のシーケンス操作を実装しましたmy_file_ops
。ただし、問題は、次の関数がすべての dentry
オブジェクトに対して呼び出されることです。
static int ct_open(struct inode *inode, struct file *file)
次に使用します:
static void *my_seq_ops_start (struct seq_file *m, loff_t *pos)
問題は、(これらの関数のいずれかで) ユーザーが読みたい dentry オブジェクトをどのように把握するかということです。-- つまり、ファイル1
と2
.