]> cloudbase.mooo.com Git - z180-stamp.git/blob - fatfs/doc/en/mount.html
Import fatfs R0.12b
[z180-stamp.git] / fatfs / doc / en / mount.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <link rel="up" title="FatFs" href="../00index_e.html">
7 <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/mount.html">
8 <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
9 <title>FatFs - f_mount</title>
10 </head>
11
12 <body>
13
14 <div class="para func">
15 <h2>f_mount</h2>
16 <p>The f_mount fucntion registers/unregisters file system object to the FatFs module.</p>
17 <pre>
18 FRESULT f_mount (
19 FATFS* <span class="arg">fs</span>, <span class="c">/* [IN] File system object */</span>
20 const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Logical drive number */</span>
21 BYTE <span class="arg">opt</span> <span class="c">/* [IN] Initialization option */</span>
22 );
23 </pre>
24 </div>
25
26 <div class="para arg">
27 <h4>Parameters</h4>
28 <dl class="par">
29 <dt>fs</dt>
30 <dd>Pointer to the file system object to be registered and cleared. Null pointer unregisters the registered file system object.</dd>
31 <dt>path</dt>
32 <dd>Pointer to the null-terminated string that specifies the <a href="filename.html">logical drive</a>. The string without drive number means the default drive.</dd>
33 <dt>opt</dt>
34 <dd>Mounting option. 0: Do not mount now (to be mounted on the first access to the volume), 1: Force mounted the volume to check if it is ready to work.</dd>
35 </dl>
36 </div>
37
38 <div class="para ret">
39 <h4>Return Values</h4>
40 <p>
41 <a href="rc.html#ok">FR_OK</a>,
42 <a href="rc.html#id">FR_INVALID_DRIVE</a>,
43 <a href="rc.html#de">FR_DISK_ERR</a>,
44 <a href="rc.html#nr">FR_NOT_READY</a>,
45 <a href="rc.html#ns">FR_NO_FILESYSTEM</a>
46 </p>
47 </div>
48
49
50 <div class="para desc">
51 <h4>Description</h4>
52 <p>The <tt>f_mount</tt> function registers/unregisters a file system object used for the volume (logical drive) to the FatFs module as follows:</p>
53 <ol>
54 <li>Determines the logical drive which specified by <tt class="arg">path</tt>.</li>
55 <li>Clears and unregisters the regsitered work area of the drive if exist.</li>
56 <li>Clears and registers the new work area to the drive if <tt class="arg">fs</tt> is not NULL.</li>
57 <li>Performs volume mount process to the drive if forced mounting is specified.</li>
58 </ol>
59 <p>The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any API functions except for <tt>f_mkfs/f_fdisk</tt> function to the logical drive.</p>
60 <p>If forced mounting is not specified (<tt>opt = 0</tt>), this function always succeeds regardless of the physical drive status. It only clears (de-initializes) the given work area and registers its address to the internal table and no activity of the physical drive in this function. To unregister the work area, specify a NULL to the <tt class="arg">fs</tt>, and then the work area can be discarded. The volume mount processes, initialize the corresponding physical drive, find the FAT volume in it and initialize the work area, is performed in the subsequent file access functions when either or both of following condition is true.</p>
61 <ul>
62 <li>File system object has not been initialized. It is de-initialized by <tt>f_mount</tt> function.</li>
63 <li>Physical drive is not initialized. It is de-initialized by system reset or media removal.</li>
64 </ul>
65 <p>If the function with forced mounting (<tt>opt = 1</tt>) failed, it means that the file system object has been registered successfully but the volume is currently not ready to work. The volume mount process will be attempted at subsequent file access functions if the file system object is not initialized. (delayed mounting)</p>
66 <p>If implementation of the disk I/O layer lacks media change detection, application program needs to perform a <tt>f_mount</tt> function after each media change to force cleared the file system object.</p>
67 </div>
68
69
70 <div class="para comp">
71 <h4>QuickInfo</h4>
72 <p>Always available.</p>
73 </div>
74
75
76 <div class="para ref">
77 <h4>See Also</h4>
78 <p><tt><a href="open.html">f_open</a></tt>, <tt><a href="sfatfs.html">FATFS</a></tt></p>
79 </div>
80
81 <p class="foot"><a href="../00index_e.html">Return</a></p>
82 </body>
83 </html>