1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 1988, 2002 On-Line Applications Research Corporation (OAR) |
---|
4 | |
---|
5 | Mounting and Unmounting Filesystems |
---|
6 | *********************************** |
---|
7 | |
---|
8 | Mount Points |
---|
9 | ============ |
---|
10 | |
---|
11 | The following is the list of the characteristics of a mount point: |
---|
12 | |
---|
13 | - The mount point must be a directory. It may have files and other directories |
---|
14 | under it. These files and directories will be hidden when the filesystem is |
---|
15 | mounted. |
---|
16 | |
---|
17 | - The task must have read/write/execute permissions to the mount point or the |
---|
18 | mount attempt will be rejected. |
---|
19 | |
---|
20 | - Only one filesystem can be mounted to a single mount point. |
---|
21 | |
---|
22 | - The Root of the mountable filesystem will be referenced by the name of the |
---|
23 | mount point after the mount is complete. |
---|
24 | |
---|
25 | Mount Table Chain |
---|
26 | ================= |
---|
27 | |
---|
28 | The mount table chain is a dynamic list of structures that describe mounted |
---|
29 | filesystems a specific points in the filesystem hierarchy. It is initialized to |
---|
30 | an empty state during the base filesystem initialization. The mount operation |
---|
31 | will add entries to the mount table chain. The un-mount operation will remove |
---|
32 | entries from the mount table chain. |
---|
33 | |
---|
34 | Each entry in the mount table chain is of the following type: |
---|
35 | |
---|
36 | .. code-block:: c |
---|
37 | |
---|
38 | struct rtems_filesystem_mount_table_entry_tt |
---|
39 | { |
---|
40 | Chain_Node Node; |
---|
41 | rtems_filesystem_location_info_t mt_point_node; |
---|
42 | rtems_filesystem_location_info_t mt_fs_root; |
---|
43 | int options; |
---|
44 | void *fs_info; |
---|
45 | rtems_filesystem_limits_and_options_t pathconf_limits_and_options; |
---|
46 | /* |
---|
47 | * When someone adds a mounted filesystem on a real device, |
---|
48 | * this will need to be used. |
---|
49 | * |
---|
50 | * The best option long term for this is probably an |
---|
51 | * open file descriptor. |
---|
52 | */ |
---|
53 | char *dev; |
---|
54 | }; |
---|
55 | |
---|
56 | *Node* |
---|
57 | The Node is used to produce a linked list of mount table entry nodes. |
---|
58 | |
---|
59 | *mt_point_node* |
---|
60 | The mt_point_node contains all information necessary to access the |
---|
61 | directory where a filesystem is mounted onto. This element may contain |
---|
62 | memory that is allocated during a path evaluation of the filesystem |
---|
63 | containing the mountpoint directory. The generic code allows this memory |
---|
64 | to be returned by unmount when the filesystem identified by mt_fs_root is |
---|
65 | unmounted. |
---|
66 | |
---|
67 | *mt_fs_root* |
---|
68 | The mt_fs_root contains all information necessary to identify the root of |
---|
69 | the mounted filesystem. The user is never allowed access to this node by |
---|
70 | the generic code, but it is used to identify to the mounted filesystem |
---|
71 | where to start evaluation of pathnames at. |
---|
72 | |
---|
73 | *options* |
---|
74 | XXX |
---|
75 | |
---|
76 | *fs_info* |
---|
77 | The fs_info element is a location available for use by the mounted file |
---|
78 | system to identify unique things applicable to this instance of the file |
---|
79 | system. For example the IMFS uses this space to provide node |
---|
80 | identification that is unique for each instance (mounting) of the |
---|
81 | filesystem. |
---|
82 | |
---|
83 | *pathconf_limits_and_options* |
---|
84 | XXX |
---|
85 | |
---|
86 | *dev* |
---|
87 | This character string represents the device where the filesystem will reside. |
---|
88 | |
---|
89 | Adding entries to the chain during mount |
---|
90 | ======================================== |
---|
91 | |
---|
92 | When a filesystem is mounted, its presence and location in the file system |
---|
93 | hierarchy is recorded in a dynamic list structure known as a chain. A unique |
---|
94 | rtems_filesystem_mount_table_entry_tt structure is logged for each filesystem |
---|
95 | that is mounted. This includes the base filesystem. |
---|
96 | |
---|
97 | Removing entries from the chain during unmount |
---|
98 | ============================================== |
---|
99 | |
---|
100 | When a filesystem is dismounted its entry in the mount table chain is extracted |
---|
101 | and the memory for this entry is freed. |
---|