⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileio-mount-table.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/).                           --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission is obtained from the copyright holder.               --><HTML><HEAD><TITLE>Mount Table</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="File System Support Infrastructure"HREF="fileio.html"><LINKREL="PREVIOUS"TITLE="File System Table"HREF="fileio-fstab.html"><LINKREL="NEXT"TITLE="File Table"HREF="fileio-file-table.html"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="fileio-fstab.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="fileio-file-table.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="FILEIO-MOUNT-TABLE">Chapter 21. Mount Table</H1><P>The mount table records the filesystems that are actually active.These can be seen as being analogous to mount points in Unix systems.</P><P>There are two sources of mount table entries. Filesystems (or othercomponents) may export static entries to the table using the<TTCLASS="LITERAL">MTAB_ENTRY()</TT> macro. Alternatively, new entries maybe installed at run time using the <TTCLASS="FUNCTION">mount()</TT>function. Both types of entry may be unmounted with the<TTCLASS="FUNCTION">umount()</TT> function.</P><P>A mount table entry has the following structure:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">struct cyg_mtab_entry{    const char          *name;          // name of mount point    const char          *fsname;        // name of implementing filesystem    const char          *devname;       // name of hardware device    CYG_ADDRWORD        data;           // private data value    cyg_bool            valid;          // Valid entry?    cyg_fstab_entry     *fs;            // pointer to fstab entry    cyg_dir             root;           // root directory pointer};</PRE></TD></TR></TABLE><P>The <TTCLASS="STRUCTFIELD"><I>name</I></TT> field identifies the mountpoint. This is used to direct rooted filenames (filenames thatbegin with &quot;/&quot;) to the correct filesystem. When a filename that begins with &quot;/&quot; is submitted, it is matchedagainst the <TTCLASS="STRUCTFIELD"><I>name</I></TT> fields of all valid mounttable entries. The entry that yields the longest match terminatingbefore a &quot;/&quot;, or end of string, wins and the appropriatefunction from the filesystem table entry is then passed the remainderof the file name together with a pointer to the table entry and thevalue of the <TTCLASS="STRUCTFIELD"><I>root</I></TT> field as the directorypointer.</P><P>For example, consider a mount table that contains the followingentries:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">	{ "/",    "msdos", "/dev/hd0", ... }	{ "/fd",  "msdos", "/dev/fd0", ... }	{ "/rom", "romfs", "", ... }	{ "/tmp", "ramfs", "", ... }	{ "/dev", "devfs", "", ... }</PRE></TD></TR></TABLE><P>An attempt to open &quot;/tmp/foo&quot; would be directed to the RAMfilesystem while an open of &quot;/bar/bundy&quot; would be directedto the hard disc MSDOS filesystem. Opening &quot;/dev/tty0&quot; wouldbe directed to the device management filesystem for lookup in thedevice table.</P><P>Unrooted file names (those that do not begin with a '/') are passedstraight to the filesystem that contains the current directory. Thecurrent directory is represented by a pair consisting of a mount tableentry and a directory pointer.</P><P>The <TTCLASS="STRUCTFIELD"><I>fsname</I></TT> field points to a string thatshould match the <TTCLASS="STRUCTFIELD"><I>name</I></TT> field of theimplementing filesystem. During initialization the mount table isscanned and the <TTCLASS="STRUCTFIELD"><I>fsname</I></TT> entries looked up inthe filesystem table. For each match, the filesystem's _mount_function is called and if successful the mount table entry is markedas valid and the <TTCLASS="STRUCTFIELD"><I>fs</I></TT> pointer installed.</P><P>The <TTCLASS="STRUCTFIELD"><I>devname</I></TT> field contains the name of thedevice that this filesystem is to use. This may match an entry in thedevice table (see later) or may be a string that is specific to thefilesystem if it has its own internal device drivers.</P><P>The <TTCLASS="STRUCTFIELD"><I>data</I></TT> field is a private data value. Thismay be installed either statically when the table entry is defined, ormay be installed during the <TTCLASS="FUNCTION">mount()</TT> operation.</P><P>The <TTCLASS="STRUCTFIELD"><I>valid</I></TT> field indicates whether this mountpoint has actually been mounted successfully. Entries with a false<TTCLASS="STRUCTFIELD"><I>valid</I></TT> field are ignored when searching for aname match.</P><P>The <TTCLASS="STRUCTFIELD"><I>fs</I></TT> field is installed after a successful<TTCLASS="FUNCTION">mount()</TT> operation to point to the implementingfilesystem.</P><P>The <TTCLASS="STRUCTFIELD"><I>root</I></TT> field contains a directory pointervalue that the filesystem can interpret as the root of its directorytree. This is passed as the <TTCLASS="PARAMETER"><I>dir</I></TT> argument offilesystem functions that operate on rooted filenames. This field mustbe initialized by the filesystem's <TTCLASS="FUNCTION">mount()</TT>function.</P></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="fileio-fstab.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="fileio-file-table.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">File System Table</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="fileio.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">File Table</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -