OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [fileio-mounting.html] - Blame information for rev 765

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
>Initialization and Mounting</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="Synchronization"
26
HREF="fileio-synchronization.html"><LINK
27
REL="NEXT"
28
TITLE="Sockets"
29
HREF="fileio-sockets.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-synchronization.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-sockets.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-MOUNTING">Chapter 25. Initialization and Mounting</H1
85
><P
86
>As mentioned previously, mount table entries can be sourced from two
87
places. Static entries may be defined by using the
88
<TT
89
CLASS="LITERAL"
90
>MTAB_ENTRY()</TT
91
> macro. Such entries will be
92
automatically mounted on system startup.  For each entry in the mount
93
table that has a non-null <TT
94
CLASS="STRUCTFIELD"
95
><I
96
>name</I
97
></TT
98
> field the
99
filesystem table is searched for a match with the
100
<TT
101
CLASS="STRUCTFIELD"
102
><I
103
>fsname</I
104
></TT
105
> field. If a match is found the
106
filesystem's <TT
107
CLASS="STRUCTFIELD"
108
><I
109
>mount</I
110
></TT
111
> entry is called and if
112
successful the mount table entry marked valid and the
113
<TT
114
CLASS="STRUCTFIELD"
115
><I
116
>fs</I
117
></TT
118
> field initialized. The
119
<TT
120
CLASS="FUNCTION"
121
>mount()</TT
122
> function is responsible for initializing
123
the <TT
124
CLASS="STRUCTFIELD"
125
><I
126
>root</I
127
></TT
128
> field.</P
129
><P
130
>The size of the mount table is defined by the configuration value
131
<TT
132
CLASS="LITERAL"
133
>CYGNUM_FILEIO_MTAB_MAX</TT
134
>. Any entries that have not
135
been statically defined are available for use by dynamic mounts.</P
136
><P
137
>A filesystem may be mounted dynamically by calling <TT
138
CLASS="FUNCTION"
139
>mount()</TT
140
>. This
141
function has the following prototype:</P
142
><TABLE
143
BORDER="5"
144
BGCOLOR="#E0E0F0"
145
WIDTH="70%"
146
><TR
147
><TD
148
><PRE
149
CLASS="PROGRAMLISTING"
150
>int mount( const char *devname,
151
           const char *dir,
152
           const char *fsname);</PRE
153
></TD
154
></TR
155
></TABLE
156
><P
157
>The <TT
158
CLASS="PARAMETER"
159
><I
160
>devname</I
161
></TT
162
> argument identifies a device that
163
will be used by this filesystem and will be assigned to the
164
<TT
165
CLASS="STRUCTFIELD"
166
><I
167
>devname</I
168
></TT
169
> field of the mount table entry.</P
170
><P
171
>The <TT
172
CLASS="PARAMETER"
173
><I
174
>dir</I
175
></TT
176
> argument is the mount point name, it
177
will be assigned to the <TT
178
CLASS="STRUCTFIELD"
179
><I
180
>name</I
181
></TT
182
> field of the
183
mount table entry.</P
184
><P
185
>The <TT
186
CLASS="PARAMETER"
187
><I
188
>fsname</I
189
></TT
190
> argument is the name of the
191
implementing filesystem, it will be assigned to the
192
<TT
193
CLASS="STRUCTFIELD"
194
><I
195
>fsname</I
196
></TT
197
> entry of the mount table entry.</P
198
><P
199
>The process of mounting a filesystem dynamically is as follows. First
200
a search is made of the mount table for an entry with a NULL
201
<TT
202
CLASS="STRUCTFIELD"
203
><I
204
>name</I
205
></TT
206
> field to be used for the new mount
207
point. The filesystem table is then searched for an entry whose name
208
matches <TT
209
CLASS="STRUCTFIELD"
210
><I
211
>fsname</I
212
></TT
213
>. If this is successful then
214
the mount table entry is initialized and the filesystem's
215
<TT
216
CLASS="FUNCTION"
217
>mount()</TT
218
> operation called. If this is successful,
219
the mount table entry is marked valid and the
220
<TT
221
CLASS="STRUCTFIELD"
222
><I
223
>fs</I
224
></TT
225
> field initialized.</P
226
><P
227
>Unmounting a filesystem is done by the <TT
228
CLASS="FUNCTION"
229
>umount()</TT
230
>
231
function. This can unmount filesystems whether they were mounted
232
statically or dynamically.</P
233
><P
234
>The <TT
235
CLASS="FUNCTION"
236
>umount()</TT
237
> function has the following prototype:</P
238
><TABLE
239
BORDER="5"
240
BGCOLOR="#E0E0F0"
241
WIDTH="70%"
242
><TR
243
><TD
244
><PRE
245
CLASS="PROGRAMLISTING"
246
>int umount( const char *name );</PRE
247
></TD
248
></TR
249
></TABLE
250
><P
251
>The mount table is searched for a match between the
252
<TT
253
CLASS="PARAMETER"
254
><I
255
>name</I
256
></TT
257
> argument and the entry
258
<TT
259
CLASS="STRUCTFIELD"
260
><I
261
>name</I
262
></TT
263
> field. When a match is found the
264
filesystem's <TT
265
CLASS="FUNCTION"
266
>umount()</TT
267
> operation is called and if
268
successful, the mount table entry is invalidated by setting its
269
<TT
270
CLASS="STRUCTFIELD"
271
><I
272
>valid</I
273
></TT
274
> field false and the
275
<TT
276
CLASS="STRUCTFIELD"
277
><I
278
>name</I
279
></TT
280
> field to NULL.</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-synchronization.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-sockets.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
>Synchronization</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
>Sockets</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.