RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
dfs_fs.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2023, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2005-02-22 Bernard The first version.
9 * 2023-05-05 Bernard Change to dfs v2.0
10 */
11
12#ifndef __DFS_FS_H__
13#define __DFS_FS_H__
14
15#include <dfs.h>
16#include <dfs_file.h>
17
18#ifdef __cplusplus
19extern "C"
20{
21#endif
22
23#define MS_RDONLY 1
24#define MS_NOSUID 2
25#define MS_NODEV 4
26#define MS_NOEXEC 8
27#define MS_SYNCHRONOUS 16
28#define MS_REMOUNT 32
29#define MS_MANDLOCK 64
30#define MS_DIRSYNC 128
31#define MS_NOATIME 1024
32#define MS_NODIRATIME 2048
33#define MS_BIND 4096
34#define MS_MOVE 8192
35#define MS_REC 16384
36#define MS_SILENT 32768
37#define MS_POSIXACL (1<<16)
38#define MS_UNBINDABLE (1<<17)
39#define MS_PRIVATE (1<<18)
40#define MS_SLAVE (1<<19)
41#define MS_SHARED (1<<20)
42#define MS_RELATIME (1<<21)
43#define MS_KERNMOUNT (1<<22)
44#define MS_I_VERSION (1<<23)
45#define MS_STRICTATIME (1<<24)
46#define MS_LAZYTIME (1<<25)
47#define MS_NOREMOTELOCK (1<<27)
48#define MS_NOSEC (1<<28)
49#define MS_BORN (1<<29)
50#define MS_ACTIVE (1<<30)
51#define MS_NOUSER (1U<<31)
52
53#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
54
55/* file system partition table */
57{
58 uint8_t type; /* file system type */
59 off_t offset; /* partition start offset */
60 size_t size; /* partition size */
62};
63
65{
66 unsigned int ia_valid;
67 uid_t st_uid;
68 gid_t st_gid;
69 mode_t st_mode;
70 struct timespec ia_atime;
71 struct timespec ia_mtime;
72};
73
74struct dfs_mnt;
75struct dfs_dentry;
76struct dfs_vnode;
77
78struct statfs;
79
81{
82 const char *name;
83 uint32_t flags;
84#define FS_NEED_DEVICE 0x1
85
87
88 int (*mount)(struct dfs_mnt *mnt, unsigned long rwflag, const void *data);
89 int (*umount)(struct dfs_mnt *mnt);
90
91 int (*mkfs)(rt_device_t devid, const char *fs_name);
92
93 int (*readlink)(struct dfs_dentry *dentry, char *buf, int len);
94 int (*link)(struct dfs_dentry *src_dentry, struct dfs_dentry *dst_dentry); /*hard link interface */
95 int (*unlink)(struct dfs_dentry *dentry);
96 int (*symlink)(struct dfs_dentry *parent_dentry, const char *target, const char *newpath); /*soft link interface*/
97
98 int (*rename)(struct dfs_dentry *old_dentry, struct dfs_dentry *new_dentry);
99 int (*stat)(struct dfs_dentry *dentry, struct stat *buf);
100
101 int (*statfs)(struct dfs_mnt *mnt, struct statfs *buf);
102
103 int (*setattr) (struct dfs_dentry *dentry, struct dfs_attr *attr);
104
105 struct dfs_vnode* (*lookup)(struct dfs_dentry *dentry);
106
107 struct dfs_vnode* (*create_vnode)(struct dfs_dentry *dentry, int type, mode_t mode);
108 int (*free_vnode)(struct dfs_vnode* vnode);
109};
110
116
118int dfs_unregister(struct dfs_filesystem_type *fs);
119int dfs_register(struct dfs_filesystem_type *fs);
120const char *dfs_filesystem_get_mounted_path(struct rt_device *device);
121
122int dfs_remount(const char *path, rt_ubase_t flags, void *data);
123int dfs_mount(const char *device_name,
124 const char *path,
125 const char *filesystemtype,
126 unsigned long rwflag,
127 const void *data);
128int dfs_umount(const char *specialfile, int flags);
129int dfs_unmount(const char *specialfile);
130int dfs_is_mounted(struct dfs_mnt *mnt);
131int dfs_mkfs(const char *fs_name, const char *device_name);
132int dfs_statfs(const char *path, struct statfs *buffer);
134 uint8_t *buf,
135 uint32_t pindex);
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif
int dfs_statfs(const char *path, struct statfs *buffer)
int dfs_unregister(struct dfs_filesystem_type *fs)
int dfs_mkfs(const char *fs_name, const char *device_name)
int dfs_is_mounted(struct dfs_mnt *mnt)
int dfs_mount(const char *device_name, const char *path, const char *filesystemtype, unsigned long rwflag, const void *data)
const char * dfs_filesystem_get_mounted_path(struct rt_device *device)
int dfs_unmount(const char *specialfile)
int dfs_umount(const char *specialfile, int flags)
int dfs_register(struct dfs_filesystem_type *fs)
int dfs_filesystem_get_partition(struct dfs_partition *part, uint8_t *buf, uint32_t pindex)
struct dfs_filesystem_type * dfs_filesystems(void)
int dfs_remount(const char *path, rt_ubase_t flags, void *data)
struct rt_device * rt_device_t
int statfs(const char *path, struct statfs *buf)
struct rt_semaphore * rt_sem_t
rt_uint32_t rt_ubase_t
uid_t st_uid
mode_t st_mode
struct timespec ia_mtime
struct timespec ia_atime
gid_t st_gid
unsigned int ia_valid
int(* unlink)(struct dfs_dentry *dentry)
int(* mkfs)(rt_device_t devid, const char *fs_name)
int(* statfs)(struct dfs_mnt *mnt, struct statfs *buf)
int(* setattr)(struct dfs_dentry *dentry, struct dfs_attr *attr)
int(* umount)(struct dfs_mnt *mnt)
int(* rename)(struct dfs_dentry *old_dentry, struct dfs_dentry *new_dentry)
int(* stat)(struct dfs_dentry *dentry, struct stat *buf)
int(* symlink)(struct dfs_dentry *parent_dentry, const char *target, const char *newpath)
int(* link)(struct dfs_dentry *src_dentry, struct dfs_dentry *dst_dentry)
const struct dfs_file_ops * default_fops
int(* free_vnode)(struct dfs_vnode *vnode)
const char * name
int(* mount)(struct dfs_mnt *mnt, unsigned long rwflag, const void *data)
int(* readlink)(struct dfs_dentry *dentry, char *buf, int len)
const struct dfs_filesystem_ops * fs_ops
struct dfs_filesystem_type * next
rt_sem_t lock