summaryrefslogtreecommitdiff
path: root/fatfs/documents/doc/fdisk.html
diff options
context:
space:
mode:
Diffstat (limited to 'fatfs/documents/doc/fdisk.html')
-rw-r--r--fatfs/documents/doc/fdisk.html35
1 files changed, 19 insertions, 16 deletions
diff --git a/fatfs/documents/doc/fdisk.html b/fatfs/documents/doc/fdisk.html
index 1c0c1e1..d8c40bd 100644
--- a/fatfs/documents/doc/fdisk.html
+++ b/fatfs/documents/doc/fdisk.html
@@ -16,9 +16,9 @@
<p>The f_fdisk fucntion divides a physical drive.</p>
<pre>
FRESULT f_fdisk (
- BYTE <span class="arg">pdrv</span>, <span class="c">/* [IN] Physical drive number */</span>
- const DWORD* <span class="arg">szt</span>, <span class="c">/* [IN] Partition map table */</span>
- void* <span class="arg">work</span> <span class="c">/* [IN] Work area */</span>
+ BYTE <span class="arg">pdrv</span>, <span class="c">/* [IN] Physical drive number */</span>
+ const LBA_t <span class="arg">ptbl[]</span>, <span class="c">/* [IN] Partition map table */</span>
+ void* <span class="arg">work</span> <span class="c">/* [IN] Work area */</span>
);
</pre>
</div>
@@ -28,10 +28,10 @@ FRESULT f_fdisk (
<dl class="par">
<dt>pdrv</dt>
<dd>Specifies the <em>physical drive</em> to be divided. This is not the logical drive number but the drive identifier passed to the low level disk functions.</dd>
-<dt>szt</dt>
-<dd>Pointer to the first item of the partition map table.</dd>
+<dt>ptbl</dt>
+<dd>List of partition size to create on the drive. The data type <tt>LBA_t</tt> is an alias of <tt>DWORD</tt> or <tt>QWORD</tt> depends on the configuration option <tt><a href="config.html#fs_lba64">FF_LBA64</a></tt>.</dd>
<dt>work</dt>
-<dd>Pointer to the function work area. The size must be at least <tt><a href="config.html#max_ss">FF_MAX_SS</a></tt> bytes. When a null pointer is given, the function allocates a memory block for the working buffer (at only <tt><a href="config.html#use_lfn">FF_USE_LFN</a> == 3</tt>).</dd>
+<dd>Pointer to the function work area. The size must be at least <tt><a href="config.html#max_ss">FF_MAX_SS</a></tt> bytes. When a null pointer is given with <tt><a href="config.html#use_lfn">FF_USE_LFN</a> = 3</tt>, a memory block is obtained in this function for the working buffer.</dd>
</dl>
</div>
@@ -49,7 +49,8 @@ FRESULT f_fdisk (
<div class="para desc">
<h4>Description</h4>
-<p>The <tt>f_fdisk</tt> function creates partitions on the physical drive. The partitioning format is in generic FDISK format, so that it can create upto four primary partitions. Logical volumes in the extended partition is not supported. The partition map table with four items specifies how to divide the physical drive. The first item specifies the size of first primary partition and fourth item specifies the fourth primary partition. If the value is less than or equal to 100, it specifies the partition size in percentage of the entire drive space. If it is larger than 100, it specifies the partition size in unit of sector. The partitions are located on the drive in order of from first item.</p>
+<p>The <tt>f_fdisk</tt> function creates partitions on the physical drive. The partitioning format can be in generic MBR or GPT. The partition map table specifies how to divide the physical drive. The first item specifies the size of the first partition and the partitions are located on the drive in order of from the first item. When the value of item is less than or equal to 100, it specifies the partition size in percentage of the entire drive space. When it is larger than 100, it specifies number of sectors. The partition map table is terminated by a zero, no space is remaining for next allocation or 4th partition is created in MBR format. If the specified size is larger than remaining space on the drive, the partition is truncated at end of the drive.</p>
+<p>By default, partitions are created in MBR format. It can create upto four primary partitions on a drive. GPT format is used to create the partitions when 64-bit LBA is enabled (<tt>FF_LBA64 = 1</tt>) and the drive size is equal to or larger than <tt><a href="config.html#fs_gptmin">FF_MIN_GPT</a></tt> sectors. It can create over ten partitions on a drive.</p>
</div>
<div class="para comp">
@@ -60,24 +61,26 @@ FRESULT f_fdisk (
<div class="para use">
<h4>Example</h4>
<pre>
- <span class="c">/* Volume management table defined by user (required when FF_MULTI_PARTITION == 1) */</span>
+ <span class="c">/* Volume mapping table defined by user (required when FF_MULTI_PARTITION == 1) */</span>
- PARTITION VolToPart[] = {
- {0, 1}, <span class="c">/* "0:" ==> Physical drive 0, 1st partition */</span>
- {0, 2}, <span class="c">/* "1:" ==> Physical drive 0, 2nd partition */</span>
- {1, 0} <span class="c">/* "2:" ==> Physical drive 1, auto detection */</span>
+ PARTITION VolToPart[FF_VOLUMES] = {
+ {0, 1}, <span class="c">/* "0:" ==> 1st partition in PD#0 */</span>
+ {0, 2}, <span class="c">/* "1:" ==> 2nd partition in PD#0 */</span>
+ {1, 0} <span class="c">/* "2:" ==> PD#1 as removable drive */</span>
};
</pre>
<pre>
<span class="c">/* Initialize a brand-new disk drive mapped to physical drive 0 */</span>
- DWORD plist[] = {50, 50, 0, 0}; <span class="c">/* Divide drive into two partitions */</span>
- BYTE work[FF_MAX_SS];
+ BYTE work[FF_MAX_SS]; <span class="c">/* Working buffer */</span>
+ LBA_t plist[] = {50, 50, 0}; <span class="c">/* Divide the drive into two partitions */</span>
+ <span class="c">/* {0x10000000, 100}; 256M sectors for 1st partition and left all for 2nd partition */</span>
+ <span class="c">/* {20, 20, 20, 0}; 20% for 3 partitions each and remaing space is left not allocated */</span>
<em>f_fdisk</em>(0, plist, work); <span class="c">/* Divide physical drive 0 */</span>
- f_mkfs("0:", FM_ANY, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 0 */</span>
- f_mkfs("1:", FM_ANY, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 1 */</span>
+ f_mkfs("0:", 0, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 0 */</span>
+ f_mkfs("1:", 0, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 1 */</span>
</pre>
</div>