1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="File System Support Infrastructure"
23 HREF="fileio.html"><LINK
25 TITLE="File System Table"
26 HREF="fileio-fstab.html"><LINK
29 HREF="fileio-file-table.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="fileio-fstab.html"
71 HREF="fileio-file-table.html"
84 NAME="FILEIO-MOUNT-TABLE">Chapter 21. Mount Table</H1
86 >The mount table records the filesystems that are actually active.
87 These can be seen as being analogous to mount points in Unix systems.</P
89 >There are two sources of mount table entries. Filesystems (or other
90 components) may export static entries to the table using the
94 > macro. Alternatively, new entries may
95 be installed at run time using the <TT
99 function. Both types of entry may be unmounted with the
105 >A mount table entry has the following structure:</P
113 CLASS="PROGRAMLISTING"
114 >struct cyg_mtab_entry
116 const char *name; // name of mount point
117 const char *fsname; // name of implementing filesystem
118 const char *devname; // name of hardware device
119 CYG_ADDRWORD data; // private data value
120 cyg_bool valid; // Valid entry?
121 cyg_fstab_entry *fs; // pointer to fstab entry
122 cyg_dir root; // root directory pointer
133 > field identifies the mount
134 point. This is used to direct rooted filenames (filenames that
135 begin with "/") to the correct filesystem. When a file
136 name that begins with "/" is submitted, it is matched
142 > fields of all valid mount
143 table entries. The entry that yields the longest match terminating
144 before a "/", or end of string, wins and the appropriate
145 function from the filesystem table entry is then passed the remainder
146 of the file name together with a pointer to the table entry and the
152 > field as the directory
155 >For example, consider a mount table that contains the following
164 CLASS="PROGRAMLISTING"
165 > { "/", "msdos", "/dev/hd0", ... }
166 { "/fd", "msdos", "/dev/fd0", ... }
167 { "/rom", "romfs", "", ... }
168 { "/tmp", "ramfs", "", ... }
169 { "/dev", "devfs", "", ... }</PRE
174 >An attempt to open "/tmp/foo" would be directed to the RAM
175 filesystem while an open of "/bar/bundy" would be directed
176 to the hard disc MSDOS filesystem. Opening "/dev/tty0" would
177 be directed to the device management filesystem for lookup in the
180 >Unrooted file names (those that do not begin with a '/') are passed
181 straight to the filesystem that contains the current directory. The
182 current directory is represented by a pair consisting of a mount table
183 entry and a directory pointer.</P
190 > field points to a string that
197 implementing filesystem. During initialization the mount table is
203 > entries looked up in
204 the filesystem table. For each match, the filesystem's _mount_
205 function is called and if successful the mount table entry is marked
211 > pointer installed.</P
218 > field contains the name of the
219 device that this filesystem is to use. This may match an entry in the
220 device table (see later) or may be a string that is specific to the
221 filesystem if it has its own internal device drivers.</P
228 > field is a private data value. This
229 may be installed either statically when the table entry is defined, or
230 may be installed during the <TT
240 > field indicates whether this mount
241 point has actually been mounted successfully. Entries with a false
247 > field are ignored when searching for a
255 > field is installed after a successful
259 > operation to point to the implementing
267 > field contains a directory pointer
268 value that the filesystem can interpret as the root of its directory
269 tree. This is passed as the <TT
275 filesystem functions that operate on rooted filenames. This field must
276 be initialized by the filesystem's <TT
287 SUMMARY="Footer navigation table"
298 HREF="fileio-fstab.html"
316 HREF="fileio-file-table.html"
326 >File System Table</TD