OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [fileio-mount-table.html] - Blame information for rev 369

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- 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.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>Mount Table</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="File System Support Infrastructure"
23
HREF="fileio.html"><LINK
24
REL="PREVIOUS"
25
TITLE="File System Table"
26
HREF="fileio-fstab.html"><LINK
27
REL="NEXT"
28
TITLE="File Table"
29
HREF="fileio-file-table.html"></HEAD
30
><BODY
31
CLASS="CHAPTER"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="fileio-fstab.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
></TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="fileio-file-table.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="CHAPTER"
82
><H1
83
><A
84
NAME="FILEIO-MOUNT-TABLE">Chapter 21. Mount Table</H1
85
><P
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
88
><P
89
>There are two sources of mount table entries. Filesystems (or other
90
components) may export static entries to the table using the
91
<TT
92
CLASS="LITERAL"
93
>MTAB_ENTRY()</TT
94
> macro. Alternatively, new entries may
95
be installed at run time using the <TT
96
CLASS="FUNCTION"
97
>mount()</TT
98
>
99
function. Both types of entry may be unmounted with the
100
<TT
101
CLASS="FUNCTION"
102
>umount()</TT
103
> function.</P
104
><P
105
>A mount table entry has the following structure:</P
106
><TABLE
107
BORDER="5"
108
BGCOLOR="#E0E0F0"
109
WIDTH="70%"
110
><TR
111
><TD
112
><PRE
113
CLASS="PROGRAMLISTING"
114
>struct cyg_mtab_entry
115
{
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
123
};</PRE
124
></TD
125
></TR
126
></TABLE
127
><P
128
>The <TT
129
CLASS="STRUCTFIELD"
130
><I
131
>name</I
132
></TT
133
> field identifies the mount
134
point. This is used to direct rooted filenames (filenames that
135
begin with &quot;/&quot;) to the correct filesystem. When a file
136
name that begins with &quot;/&quot; is submitted, it is matched
137
against the <TT
138
CLASS="STRUCTFIELD"
139
><I
140
>name</I
141
></TT
142
> fields of all valid mount
143
table entries. The entry that yields the longest match terminating
144
before a &quot;/&quot;, 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
147
value of the <TT
148
CLASS="STRUCTFIELD"
149
><I
150
>root</I
151
></TT
152
> field as the directory
153
pointer.</P
154
><P
155
>For example, consider a mount table that contains the following
156
entries:</P
157
><TABLE
158
BORDER="5"
159
BGCOLOR="#E0E0F0"
160
WIDTH="70%"
161
><TR
162
><TD
163
><PRE
164
CLASS="PROGRAMLISTING"
165
>       { "/",    "msdos", "/dev/hd0", ... }
166
        { "/fd",  "msdos", "/dev/fd0", ... }
167
        { "/rom", "romfs", "", ... }
168
        { "/tmp", "ramfs", "", ... }
169
        { "/dev", "devfs", "", ... }</PRE
170
></TD
171
></TR
172
></TABLE
173
><P
174
>An attempt to open &quot;/tmp/foo&quot; would be directed to the RAM
175
filesystem while an open of &quot;/bar/bundy&quot; would be directed
176
to the hard disc MSDOS filesystem. Opening &quot;/dev/tty0&quot; would
177
be directed to the device management filesystem for lookup in the
178
device table.</P
179
><P
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
184
><P
185
>The <TT
186
CLASS="STRUCTFIELD"
187
><I
188
>fsname</I
189
></TT
190
> field points to a string that
191
should match the <TT
192
CLASS="STRUCTFIELD"
193
><I
194
>name</I
195
></TT
196
> field of the
197
implementing filesystem. During initialization the mount table is
198
scanned and the <TT
199
CLASS="STRUCTFIELD"
200
><I
201
>fsname</I
202
></TT
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
206
as valid and the <TT
207
CLASS="STRUCTFIELD"
208
><I
209
>fs</I
210
></TT
211
> pointer installed.</P
212
><P
213
>The <TT
214
CLASS="STRUCTFIELD"
215
><I
216
>devname</I
217
></TT
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
222
><P
223
>The <TT
224
CLASS="STRUCTFIELD"
225
><I
226
>data</I
227
></TT
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
231
CLASS="FUNCTION"
232
>mount()</TT
233
> operation.</P
234
><P
235
>The <TT
236
CLASS="STRUCTFIELD"
237
><I
238
>valid</I
239
></TT
240
> field indicates whether this mount
241
point has actually been mounted successfully. Entries with a false
242
<TT
243
CLASS="STRUCTFIELD"
244
><I
245
>valid</I
246
></TT
247
> field are ignored when searching for a
248
name match.</P
249
><P
250
>The <TT
251
CLASS="STRUCTFIELD"
252
><I
253
>fs</I
254
></TT
255
> field is installed after a successful
256
<TT
257
CLASS="FUNCTION"
258
>mount()</TT
259
> operation to point to the implementing
260
filesystem.</P
261
><P
262
>The <TT
263
CLASS="STRUCTFIELD"
264
><I
265
>root</I
266
></TT
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
270
CLASS="PARAMETER"
271
><I
272
>dir</I
273
></TT
274
> argument of
275
filesystem functions that operate on rooted filenames. This field must
276
be initialized by the filesystem's <TT
277
CLASS="FUNCTION"
278
>mount()</TT
279
>
280
function.</P
281
></DIV
282
><DIV
283
CLASS="NAVFOOTER"
284
><HR
285
ALIGN="LEFT"
286
WIDTH="100%"><TABLE
287
SUMMARY="Footer navigation table"
288
WIDTH="100%"
289
BORDER="0"
290
CELLPADDING="0"
291
CELLSPACING="0"
292
><TR
293
><TD
294
WIDTH="33%"
295
ALIGN="left"
296
VALIGN="top"
297
><A
298
HREF="fileio-fstab.html"
299
ACCESSKEY="P"
300
>Prev</A
301
></TD
302
><TD
303
WIDTH="34%"
304
ALIGN="center"
305
VALIGN="top"
306
><A
307
HREF="ecos-ref.html"
308
ACCESSKEY="H"
309
>Home</A
310
></TD
311
><TD
312
WIDTH="33%"
313
ALIGN="right"
314
VALIGN="top"
315
><A
316
HREF="fileio-file-table.html"
317
ACCESSKEY="N"
318
>Next</A
319
></TD
320
></TR
321
><TR
322
><TD
323
WIDTH="33%"
324
ALIGN="left"
325
VALIGN="top"
326
>File System Table</TD
327
><TD
328
WIDTH="34%"
329
ALIGN="center"
330
VALIGN="top"
331
><A
332
HREF="fileio.html"
333
ACCESSKEY="U"
334
>Up</A
335
></TD
336
><TD
337
WIDTH="33%"
338
ALIGN="right"
339
VALIGN="top"
340
>File Table</TD
341
></TR
342
></TABLE
343
></DIV
344
></BODY
345
></HTML
346
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.