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

📄 fileio-mounting.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>Initialization and Mounting</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="Synchronization"HREF="fileio-synchronization.html"><LINKREL="NEXT"TITLE="Sockets"HREF="fileio-sockets.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-synchronization.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="fileio-sockets.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="FILEIO-MOUNTING">Chapter 25. Initialization and Mounting</H1><P>As mentioned previously, mount table entries can be sourced from twoplaces. Static entries may be defined by using the<TTCLASS="LITERAL">MTAB_ENTRY()</TT> macro. Such entries will beautomatically mounted on system startup.  For each entry in the mounttable that has a non-null <TTCLASS="STRUCTFIELD"><I>name</I></TT> field thefilesystem table is searched for a match with the<TTCLASS="STRUCTFIELD"><I>fsname</I></TT> field. If a match is found thefilesystem's <TTCLASS="STRUCTFIELD"><I>mount</I></TT> entry is called and ifsuccessful the mount table entry marked valid and the<TTCLASS="STRUCTFIELD"><I>fs</I></TT> field initialized. The<TTCLASS="FUNCTION">mount()</TT> function is responsible for initializingthe <TTCLASS="STRUCTFIELD"><I>root</I></TT> field.</P><P>The size of the mount table is defined by the configuration value<TTCLASS="LITERAL">CYGNUM_FILEIO_MTAB_MAX</TT>. Any entries that have notbeen statically defined are available for use by dynamic mounts.</P><P>A filesystem may be mounted dynamically by calling <TTCLASS="FUNCTION">mount()</TT>. Thisfunction has the following prototype:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">int mount( const char *devname,           const char *dir,	   const char *fsname);</PRE></TD></TR></TABLE><P>The <TTCLASS="PARAMETER"><I>devname</I></TT> argument identifies a device thatwill be used by this filesystem and will be assigned to the<TTCLASS="STRUCTFIELD"><I>devname</I></TT> field of the mount table entry.</P><P>The <TTCLASS="PARAMETER"><I>dir</I></TT> argument is the mount point name, itwill be assigned to the <TTCLASS="STRUCTFIELD"><I>name</I></TT> field of themount table entry.</P><P>The <TTCLASS="PARAMETER"><I>fsname</I></TT> argument is the name of theimplementing filesystem, it will be assigned to the<TTCLASS="STRUCTFIELD"><I>fsname</I></TT> entry of the mount table entry.</P><P>The process of mounting a filesystem dynamically is as follows. Firsta search is made of the mount table for an entry with a NULL<TTCLASS="STRUCTFIELD"><I>name</I></TT> field to be used for the new mountpoint. The filesystem table is then searched for an entry whose namematches <TTCLASS="STRUCTFIELD"><I>fsname</I></TT>. If this is successful thenthe mount table entry is initialized and the filesystem's<TTCLASS="FUNCTION">mount()</TT> operation called. If this is successful,the mount table entry is marked valid and the<TTCLASS="STRUCTFIELD"><I>fs</I></TT> field initialized.</P><P>Unmounting a filesystem is done by the <TTCLASS="FUNCTION">umount()</TT>function. This can unmount filesystems whether they were mountedstatically or dynamically.</P><P>The <TTCLASS="FUNCTION">umount()</TT> function has the following prototype:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">int umount( const char *name );</PRE></TD></TR></TABLE><P>The mount table is searched for a match between the<TTCLASS="PARAMETER"><I>name</I></TT> argument and the entry<TTCLASS="STRUCTFIELD"><I>name</I></TT> field. When a match is found thefilesystem's <TTCLASS="FUNCTION">umount()</TT> operation is called and ifsuccessful, the mount table entry is invalidated by setting its<TTCLASS="STRUCTFIELD"><I>valid</I></TT> field false and the<TTCLASS="STRUCTFIELD"><I>name</I></TT> field to NULL.</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-synchronization.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-sockets.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Synchronization</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="fileio.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Sockets</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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