Commit Graph

28 Commits

Author SHA1 Message Date
Leon Chan 38a6b804e9 feat: page cache backed by vnode instead of filep
1, change the owner of page to vnode
2, save the file path in vnode

close: #I44TBS
Signed-off-by: Leon Chan <chenwei26@huawei.com>
2021-09-14 15:31:33 +08:00
Guangyao Ma f67c4dae51 feat: add sync() to vfs
新增sync方法,该方法每次调用,会遍历系统内所有的mount点,调用各个文件系统注册
的sync方法,完成对所有已挂载文件系统的sync操作。

close #I480HV

Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
Change-Id: I57ced9c3f7685a448defd17ae56c842796b5668f
2021-09-08 15:41:52 +08:00
mucor 2db80ecb38 feat: vfs support sdcard hotplug
close: #I44WH1
Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-17 14:56:41 +08:00
Guangyao Ma 27dca4d857 feat(vfs): vfs支持FD_CLOEXEC标记
首先,POSIX规范规定文件描述符需要支持close-on-exec属性,修改前的vfs不支持close-on-exec,当exec系列函数执行时,进程所有的文件将会被关闭(0,1,2也重新被打开)。但是,系统有些时候是不能在exec时关闭全部文件的,例如在执行exec之前,就需要重定向进程的某些文件描述符时(使用dup2),就希望该文件不被关闭,继续保持重定向属性,shell执行进程并重定向其标准输出到文件,这是我们经常做的事情。

BREAKING CHANGE:
执行exec类函数后,进程拥有的文件描述符情况发生变化:修改前,默认关闭所有的进程文件描述符,0,1,2重新打开;修改后,除非文件描述符拥有FD_CLOEXEC标记,否则该描述符不会被关闭。

re #I3U81W

Change-Id: I54e841ac88e9835ec23e97de0cbc906c4e11f5a4
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-08-11 15:35:46 +08:00
mucor 4c8a86ece7 fix: move nuttx head file back
close: #I4443Q
Signed-off-by: mucor <mucorwang@gmail.com>
2021-08-05 20:51:28 +08:00
x_xiny e4ff04586f fix:消除编译告警
【背景】
 消除编译告警

【修改方案】
 消除编译告警

 re #I3ZC1R

 Change-Id: I594d0f57e4cbbdb246a6bef1c978a38228123a34

 Signed-off-by: x-xiny <1301913191@qq.com>

Change-Id: I1d75cdcdcf9d06ec28e541cdfea77300da7c6bb1
2021-07-08 20:30:33 +08:00
chenjing 6860246cfa fix: 修改/proc/mounts显示格式
显示信息内容及格式修改为与posix标准一致,内容包括:
1、挂载设备名
2、挂载点路径
3、文件系统类型
4、挂载选项(此项暂不支持,打印())
5、dump频率(此项暂不支持,值为0)
6、fsck检查次序(此项暂不支持,值为0)

close #I3XGCS

Signed-off-by: chenjing <chenjing139@huawei.com>
Change-Id: I2a8cb093e7c5316feb55fb196bc1b4301d8d0249
2021-06-23 17:10:29 +08:00
mucor 73a777777e fix: remove redundant headfile
1.remove redundant headfile in kernel, such as:
  compiler.h;debug.h;automount.h;inode.h;syslog.h;net.h;
2.split fs.h to file.h and driver.h
3.move vnode.h and path_cache.h to vfs/include
4.remove redundant interface and defines

close: #I3RTNR

Signed-off-by: mucor <mucorwang@gmail.com>
2021-06-19 17:32:47 +08:00
chenjing 6eddc869d3 feat: support link/symlink/readlink
新增link/symlink/readlink接口的系统调用及内核实现,当前仅支持jffs2文件系统。具体接口说明如下:

一、hard link
接口原型:
int link(const char *oldpath, const char *newpath);
int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);

作用:
创建oldpath的硬链接,名为newpath。

功能说明:
1、newpath与oldpath必须在同一挂载分区内。
2、若newpath已存在,不会覆盖,错误码EEXIST。
3、oldpath必须为普通文件或者软链接文件。
4、如果oldpath是一个软链接文件,那么:
若调用link接口或者linkat(flags=0),创建出软链接文件的硬链接;
若调用linkat(flags = AT_SYMLINK_FOLLOW),创建出软链接所指向源文件的硬链接。
5、oldpath与newpath对应同一个文件,对oldpath与newpath任一名字的操作都是直接操作文件,没有“原始文件”的说法。
6、使用cp命令拷贝一个硬链接文件,生成文件的拷贝,新文件的nlink数为1。
7、删除oldpath或newpath,底层文件仍存在,可以通过另一个path访问。只有当两个path都删除之后,才会真正将文件删除,空间释放。

二、symbol link
接口原型:
int symlink(const char *target, const char *linkpath);
int symlinkat(const char *target, int newdirfd, const char *linkpath);

作用:
创建一个软链接文件linkpath,存储字符串target。

功能说明:
1、target可以为任意字符串(长度小于PATH_MAX)。
2、若linkpath文件名已存在,不会覆盖,错误码EEXIST。
3、用readlink函数可读取软链接的target内容。
4、软链接文件本身大小为target长度。
5、ls时软链接文件类型显示为 'l'。
6、symlink最大循环次数为CONFIG_FS_MAX_LNK_CNT(目前为40),超出则返回错误,错误码ELOOP。
7、使用cp命令拷贝一个软链接文件:
若target是一个文件:创建一个源文件的拷贝,类型为普通文件;
若target非文件:拷贝失败。

三、readlink
接口原型:
ssize_t readlink(const char *pathname, char *buf, size_t bufsiz);
ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);

作用:
读取软链接文件存放的的target内容。

功能说明:
1、pathname必须为软链接文件,否则错误码EINVAL。
2、如果bufsiz小于target长度,则截断target。

close #I3Q0OD

Change-Id: I3864d6069b627b705a369e8e32dc1eb922dc0157
Signed-off-by: chenjing <chenjing139@huawei.com>
2021-06-09 16:39:41 +08:00
chenwei 101a55d119 fix: codex
1,VFS代码中不修改参数增加const修饰
2,fs_file_mapping.c: 增加安全函数的判空
3,path_cache.c: sizeof改为使用类型
4,fs_syscall.c: 对NULL解引用
5,VnodeLookup:冗余的判空,及不正确的判空

close: I3UMWD
Signed-off-by: yansira <yansira@hotmail.com>
2021-06-07 22:45:40 +08:00
zhOu f76fa4a344 feature: support ipc copy fd to process 2021-05-11 14:56:09 +08:00
mucor 04bcb11c3c fix:add vnode destory for unregister dev node
Change-Id: I2205bbf42e7c2339f81443ace6924b12f4fa1c09
2021-04-30 15:31:03 +08:00
openharmony_ci 1d0a3f022b !186 将VnodeInUseIter和VnodeFreeAll函数改为非递归
Merge pull request !186 from Far/dev
2021-04-29 10:04:50 +08:00
Far 5f6656cb36 fix: VnodeInUseIter and VnodeFreeAll used to be recursive
Function VnodeInUseIter and VnodeFreeAll used to be recursive.
Now we traverse the current in-use vnode list to find the vnode in
1 filesystem

Close #I3NN3U
2021-04-28 14:35:29 +08:00
mucor aa34ffe7c7 fix:remove redundant code
Change-Id: I8662952ac9d7912aaf2e2e72f779b3def41d14c4
2021-04-28 09:57:32 +08:00
Caoruihong 7e73c929a2 remove __cplusplus guards in .c files
Change-Id: I052d930d54e63179b17b77f02c107a015f3cfc3f
2021-04-19 18:28:25 +08:00
Far 7e0e46828b Bugfix: add vnode iteration debug feature for a bug
buginfo: when try to umount a nfs node, it may casue stack overflow.

Change-Id: I7d96f74a770607c990ca5f51cb92fb2843a08d12
2021-04-16 11:00:38 +08:00
Far beca52b61b Feature: Fatfs scandir format and mmcblk read/write optimization
1. Bcache block with high mem address is after lower mem address in RCU list when initing bcache.
2. Format will clear the bcache before writing the FAT.
3. The fatfs_readdir use the bcache writing block to reduce the chance of data switching out
4. Add performance analysing macron switch

Change-Id: I8fbc48418509d2e660d725d2c265266e931c26f8
2021-04-15 14:49:43 +08:00
chenjing 7c3c92f87a /proc/mounts 2021-04-06 16:20:58 +08:00
chenjing c13366fd92 /proc/mounts 2021-04-06 15:21:29 +08:00
openharmony_ci e3ca50e8ad !92 fix bad code in fs codes
Merge pull request !92 from 野生毛霉君/master
2021-03-30 09:49:11 +08:00
li_zan 195172e655 change config for fs 2021-03-26 17:00:15 +08:00
mucor 1884fa0523 fix readdir, rename
Change-Id: Ic443742e125915f0e5332a338dedea5c40348928
2021-03-24 18:15:06 +08:00
wangchenyang d970750808 Description:vfs refactoring
Feature or Bugfix:Feature
Binary Source:Huawei
PrivateCode(Yes/No):Yes

Change-Id: I175d2648bc6f9078c34de2c0a5c93fda10b86c47
ChangeID:13306388
2021-03-19 13:22:46 +08:00
mamingshuai 73a7b66116 update openharmony 1.0.1 2021-03-11 18:43:57 +08:00
Zbigniew Bodek e0406e3df7 Fix various build problems when building for non-HiSi config
Mainly adding missing headers, removing redundant headers that
induce undefined symbols or rearranging existing headers
according to dependencies betheen them.
Also add missing include paths to makefiles and make configs.

Note: direct inclusion of pthread.h in disk.h is caused by the
latter being used almost everywhere, including third_party libraries.
Putting pthread.h there releases us from affecting more code.

Basically fixes build for anything that is not default HiSi
configuration.

Signed-off-by: Zbigniew Bodek <zbigniew.bodek@huawei.com>
Change-Id: Icdcb0874d9fed34d01fa282d33bd2e041c2ac436
2020-11-17 23:07:01 +08:00
Caoruihong 63bd69267a drop unnecessary executable file permission mode
Change-Id: Ia6c1f6302407a707b3ec9b805f4c92d8a7970b86
2020-10-13 16:37:25 +08:00
wenjun 6df931fc98 add OpenHarmony 1.0 baseline 2020-09-08 17:22:24 +08:00