以下内容将在用户空间中创建文件,但是如何创建目录?
struct file *filp = filp_open("/home/myuser/Desktop/newfile", O_CREAT, S_IRWXU);
The best way I know how is to use:
mkdir("your/directory", 0700);
David Heffernan's comment shows the specifics.
Edit: This page will show you the different mode parameters you can give for your directory and what they do.
http://osdir.com/ml/linux.c-programming/2002-06/msg00069.html
只需在filp_open
标志中设置O_DIRECTORY
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.