mount.html 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. <body>
  12. <div class="para func">
  13. <h2>f_mount</h2>
  14. <p>The f_mount fucntion registers/unregisters file system object to the FatFs module.</p>
  15. <pre>
  16. FRESULT f_mount (
  17. FATFS* <span class="arg">fs</span>, <span class="c">/* [IN] File system object */</span>
  18. const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Logical drive number */</span>
  19. BYTE <span class="arg">opt</span> <span class="c">/* [IN] Initialization option */</span>
  20. );
  21. </pre>
  22. </div>
  23. <div class="para arg">
  24. <h4>Parameters</h4>
  25. <dl class="par">
  26. <dt>fs</dt>
  27. <dd>Pointer to the new file system object to be registered. Null pointer unregisters the registered file system object.</dd>
  28. <dt>path</dt>
  29. <dd>Pointer to the null-terminated string that specifies the <a href="filename.html">logical drive</a>. The string with no drive number means the default drive.</dd>
  30. <dt>opt</dt>
  31. <dd>Initialization option. 0: Do not mount now (to be mounted later), 1: Force mounted the volume to check if the FAT volume is available.</dd>
  32. </dl>
  33. </div>
  34. <div class="para ret">
  35. <h4>Return Values</h4>
  36. <p>
  37. <a href="rc.html#ok">FR_OK</a>,
  38. <a href="rc.html#id">FR_INVALID_DRIVE</a>,
  39. <a href="rc.html#de">FR_DISK_ERR</a>,
  40. <a href="rc.html#nr">FR_NOT_READY</a>,
  41. <a href="rc.html#ns">FR_NO_FILESYSTEM</a>
  42. </p>
  43. </div>
  44. <div class="para desc">
  45. <h4>Description</h4>
  46. <p>The <tt>f_mount()</tt> function registers/unregisters a file system object used for the logical drive to the FatFs module as follows:</p>
  47. <ol>
  48. <li>Determines the logical drive which specified by <tt class="arg">path</tt>.</li>
  49. <li>Clears and unregisters the regsitered work area of the drive.</li>
  50. <li>Clears and registers the new work area to the drive if <tt class="arg">fs</tt> is not NULL.</li>
  51. <li>Performs volume mount process to the drive if forced mount is specified.</li>
  52. </ol>
  53. <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 other file functions except for <tt>f_fdisk()</tt> function. To unregister a work area, specify a NULL to the <tt class="arg">fs</tt>, and then the work area can be discarded.</p>
  54. <p>If forced mount is not specified, this function always succeeds regardless of the physical drive status due to delayed mount feature. It only clears (de-initializes) the given work area and registers its address to the internal table. No activity of the physical drive in this function. It can also be used to force de-initialized the registered work area of a logical drive. 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>
  55. <ul>
  56. <li>File system object is not initialized. It is cleared by <tt>f_mount()</tt>.</li>
  57. <li>Physical drive is not initialized. It is de-initialized by system reset or media removal.</li>
  58. </ul>
  59. <p>If the function with forced mount failed, it means that the file system object has been registered successfully but the volume is currently not ready to use. Mount process will also be attempted in subsequent file access functions.</p>
  60. <p>If implementation of the disk I/O layer lacks media change detection, application program needs to perform a <tt>f_mount()</tt> after each media change to force cleared the file system object.</p>
  61. </div>
  62. <div class="para comp">
  63. <h4>QuickInfo</h4>
  64. <p>Always available.</p>
  65. </div>
  66. <div class="para ref">
  67. <h4>See Also</h4>
  68. <p><tt><a href="open.html">f_open</a></tt>, <tt><a href="sfatfs.html">FATFS</a></tt></p>
  69. </div>
  70. <p class="foot"><a href="../00index_e.html">Return</a></p>
  71. </body>
  72. </html>