1 /* 2 * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2022-09-21 13 * Description: 文件系统vfs层 14 */ 15 16 #ifndef VFS_MOUNT_H 17 #define VFS_MOUNT_H 18 19 #include "sys/statfs.h" 20 #include "prt_fs.h" 21 22 struct TagFsMap; 23 struct TagMountPoint; 24 25 struct TagMountOps { 26 S32 (*mount)(struct TagMountPoint *mp, uintptr_t mountflags, const void *data); 27 S32 (*umount)(struct TagMountPoint *mp); 28 S32 (*umount2)(struct TagMountPoint *mp, S32 flag); 29 S32 (*statfs)(const char *path, struct statfs *buf); 30 }; 31 32 struct TagMountPoint { 33 struct TagFsMap *mFs; /* 系统文件系统信息 */ 34 struct TagMountPoint *mNext; /* 指向下一个mount节点 */ 35 const char *mPath; /* 挂载的路径 */ 36 const char *mDev; /* 设备名, "emmc0p0", "emmc0p1", etc. */ 37 U32 mRefs; /* 挂载节点的引用计数 */ 38 void *mData; /* 挂载节点的私有数据 */ 39 bool mWriteEnable; /* 是否允许写 */ 40 }; 41 42 S32 OsVfsMount(const char *source, const char *target, 43 const char *filesystemtype, uintptr_t mountflags, 44 const void *data); 45 S32 OsVfsUmount(const char *target); 46 S32 OsVfsUmount2(const char *target, S32 flag); 47 struct TagMountPoint *OsVfsFindMp(const char *path, const char **pathInMp); 48 S32 OsVfsFindMountPoint(const char *fsType); 49 #endif /* VFS_MOUNT_H */ 50