1
"n" 문자 장치가 하나의 커널 드라이버에 있습니다. 하나의 읽기 기능은 읽기 포인터를 나타냅니다.커널에서 문자 장치의 노드 이름 또는 경로를 얻는 방법
static struct file_operations fops;
fops.read = cd_read;
지금 내가 가는 사용자 공간에서 호출 읽을 때 참조하는 문자 장치 알아야합니다.
static ssize_t cd_read(struct file *filep, char *buffer, size_t len, loff_t *position)
{
filep->f_path;
}
나는 으로 그걸 얻기 위해 노력 filep-> f_path 이상을 인쇄 할 시도했지만 f_path 경로에 fs.h에
struct file {
...
struct path f_path;
...
}
dentry와 vfsmount에 경로를 구조체를 의미 in path.h은 2 개의 정의되지 않은 구조체를 참조합니다.
struct dentry;
struct vfsmount;
struct path {
struct vfsmount *mnt;
struct dentry *dentry;
};
여기에 고정되어 있습니다. 커널에서 캐릭터 장치의 노드 이름이나 경로를 얻으려면 어떻게해야합니까?