我想知道是否可以读取文件指针的 private_data?还是真的“私人”?!
我在内核模块中!
struct file *intercepted_fp;
intercepted_fp = filp_open("/dev/snd/pcmC0D0p_bak", O_RDWR, (S_IRWXU | S_IRWXG | S_IRWXO));
if (intercepted_fp == NULL) {
LOGI("Cannot open intercepted device!");
return -ENODEV;
}
mm_segment_t old_fs = get_fs();
set_fs(get_ds());
LOGI("private data: %p", intercepted_fp->private_data); // -> prints "private data: ffffffff"
LOGI("buffer: %d", ((struct snd_pcm_file*) intercepted_fp->private_data)->substream->runtime->buffer_size); // -> Unable to handle kernel paging request at virtual address ffffffff
set_fs(old_fs);