📄 fileio-fstab.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>File System 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="Introduction"HREF="fileio-intro.html"><LINKREL="NEXT"TITLE="Mount Table"HREF="fileio-mount-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-intro.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="fileio-mount-table.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="FILEIO-FSTAB">Chapter 20. File System Table</H1><P>The filesystem table is an array of entries that describe eachfilesystem implementation that is part of the system image. Eachresident filesystem should export an entry to this table using the<TTCLASS="LITERAL">FSTAB_ENTRY()</TT> macro.</P><DIVCLASS="NOTE"><BLOCKQUOTECLASS="NOTE"><P><B>Note: </B>At present we do not support dynamic addition or removal of tableentries. However, an API similar to <TTCLASS="FUNCTION">mount()</TT> wouldallow new entries to be added to the table.</P></BLOCKQUOTE></DIV><P>The table entries are described by the following structure:</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">struct cyg_fstab_entry{ const char *name; // filesystem name CYG_ADDRWORD data; // private data value cyg_uint32 syncmode; // synchronization mode int (*mount) ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ); int (*umount) ( cyg_mtab_entry *mte ); int (*open) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, int mode, cyg_file *fte ); int (*unlink) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); int (*mkdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); int (*rmdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); int (*rename) ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, cyg_dir dir2, const char *name2 ); int (*link) ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, cyg_dir dir2, const char *name2, int type ); int (*opendir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, cyg_file *fte ); int (*chdir) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, cyg_dir *dir_out ); int (*stat) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, struct stat *buf); int (*getinfo) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, int key, char *buf, int len ); int (*setinfo) ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, int key, char *buf, int len );};</PRE></TD></TR></TABLE><P>The <TTCLASS="STRUCTFIELD"><I>name</I></TT> field points to a string thatidentifies this filesystem implementation. Typical values might be"romfs", "msdos", "ext2" etc.</P><P>The <TTCLASS="STRUCTFIELD"><I>data</I></TT> field contains any private datathat the filesystem needs, perhaps the root of its data structures.</P><P>The <TTCLASS="STRUCTFIELD"><I>syncmode</I></TT> field contains a description ofthe locking protocol to be used when accessing this filesystem. Itwill be described in more detail in <AHREF="fileio-synchronization.html">Chapter 24</A>.</P><P>The remaining fields are pointers to functions that implementfilesystem operations that apply to files and directories as wholeobjects. The operation implemented by each function should be obviousfrom the names, with a few exceptions:</P><P>The <TTCLASS="FUNCTION">opendir()</TT> function pointer opens a directoryfor reading. See <AHREF="fileio-directories.html">Chapter 23</A> for details.</P><P>The <TTCLASS="FUNCTION">getinfo()</TT> and<TTCLASS="FUNCTION">setinfo()</TT> function pointers provide support forvarious minor control and information functions such as<TTCLASS="FUNCTION">pathconf()</TT> and <TTCLASS="FUNCTION">access()</TT>.</P><P>With the exception of the <TTCLASS="FUNCTION">mount()</TT> and<TTCLASS="FUNCTION">umount()</TT> functions, all of these functionstake three standard arguments, a pointer to a mount table entry (seelater) a directory pointer (also see later) and a file name relativeto the directory. These should be used by the filesystem to locate theobject of interest.</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-intro.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-mount-table.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Introduction</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="fileio.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Mount Table</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -