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

📄 fileio-mount-table.html

📁 ecos3.0 beta 的官方文档,html格式
💻 HTML
字号:
<!-- Copyright (C) 2009 Free Software Foundation, 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.               -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Mount Table</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
REL="UP"
TITLE="File System Support Infrastructure"
HREF="fileio.html"><LINK
REL="PREVIOUS"
TITLE="File System Table"
HREF="fileio-fstab.html"><LINK
REL="NEXT"
TITLE="File Table"
HREF="fileio-file-table.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>eCos Reference Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="fileio-fstab.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="fileio-file-table.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="FILEIO-MOUNT-TABLE"
></A
>Chapter 16. 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 other
components) may export static entries to the table using the
<TT
CLASS="LITERAL"
>MTAB_ENTRY()</TT
> macro. Alternatively, new entries may
be installed at run time using the <CODE
CLASS="FUNCTION"
>mount()</CODE
>
function. Both types of entry may be unmounted with the
<CODE
CLASS="FUNCTION"
>umount()</CODE
> function.</P
><P
>A mount table entry has the following structure:</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="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 <CODE
CLASS="STRUCTFIELD"
>name</CODE
> field identifies the mount
point. This is used to direct rooted filenames (filenames that
begin with &quot;/&quot;) to the correct filesystem. When a file
name that begins with &quot;/&quot; is submitted, it is matched
against the <CODE
CLASS="STRUCTFIELD"
>name</CODE
> fields of all valid mount
table entries. The entry that yields the longest match terminating
before a &quot;/&quot;, or end of string, wins and the appropriate
function from the filesystem table entry is then passed the remainder
of the file name together with a pointer to the table entry and the
value of the <CODE
CLASS="STRUCTFIELD"
>root</CODE
> field as the directory
pointer.</P
><P
>For example, consider a mount table that contains the following
entries:</P
><TABLE
BORDER="5"
BGCOLOR="#E0E0F0"
WIDTH="70%"
><TR
><TD
><PRE
CLASS="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 RAM
filesystem while an open of &quot;/bar/bundy&quot; would be directed
to the hard disc MSDOS filesystem. Opening &quot;/dev/tty0&quot; would
be directed to the device management filesystem for lookup in the
device table.</P
><P
>Unrooted file names (those that do not begin with a '/') are passed
straight to the filesystem that contains the current directory. The
current directory is represented by a pair consisting of a mount table
entry and a directory pointer.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>fsname</CODE
> field points to a string that
should match the <CODE
CLASS="STRUCTFIELD"
>name</CODE
> field of the
implementing filesystem. During initialization the mount table is
scanned and the <CODE
CLASS="STRUCTFIELD"
>fsname</CODE
> entries looked up in
the filesystem table. For each match, the filesystem's _mount_
function is called and if successful the mount table entry is marked
as valid and the <CODE
CLASS="STRUCTFIELD"
>fs</CODE
> pointer installed.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>devname</CODE
> field contains the name of the
device that this filesystem is to use. This may match an entry in the
device table (see later) or may be a string that is specific to the
filesystem if it has its own internal device drivers.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>data</CODE
> field is a private data value. This
may be installed either statically when the table entry is defined, or
may be installed during the <CODE
CLASS="FUNCTION"
>mount()</CODE
> operation.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>valid</CODE
> field indicates whether this mount
point has actually been mounted successfully. Entries with a false
<CODE
CLASS="STRUCTFIELD"
>valid</CODE
> field are ignored when searching for a
name match.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>fs</CODE
> field is installed after a successful
<CODE
CLASS="FUNCTION"
>mount()</CODE
> operation to point to the implementing
filesystem.</P
><P
>The <CODE
CLASS="STRUCTFIELD"
>root</CODE
> field contains a directory pointer
value that the filesystem can interpret as the root of its directory
tree. This is passed as the <CODE
CLASS="PARAMETER"
>dir</CODE
> argument of
filesystem functions that operate on rooted filenames. This field must
be initialized by the filesystem's <CODE
CLASS="FUNCTION"
>mount()</CODE
>
function.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="fileio-fstab.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ecos-ref.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="fileio-file-table.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>File System Table</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="fileio.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>File Table</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

⌨️ 快捷键说明

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