开发者

Debugfs file mode flags?

What flags do I use for debugfs_create_file_N(...)? All the resources I can find basically say 'set them as appropriate'.

I've tried 777, MAY_WRITE|MAY_READ, and FMODE_WRITE|FMODE_READ; but so far 开发者_高级运维cat'ing the file only gives me a '0'.


Didn't you hear, "777 is almost always wrong" :-) MAY_* and FMODE_* are not file modes either, but internal flags and file states.

Better:

debugfs_create_file(..., S_ISREG | S_IRUGO | S_IWUSR, ...);


For a world readable file, use S_IRUGO

validation@tb04:~> ls -l /sys/kernel/debug/spc0/registers
-r--r--r-- 1 root root 0 Feb 14  2011 /sys/kernel/debug/spc0/registers

Internally, this sets S_IRUSR|S_IRGRP|S_IROTH which set read mode for the user, group, and others. See include/stat.h in the kernel for other macro definitions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜