X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/289f6a146c0b2087607d8d8659531ea90142779a..7aaec0f97677b451e024ef5d1cd2b675a914d440:/fatfs/documents/doc/fdisk.html 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 @@

The f_fdisk fucntion divides a physical drive.

 FRESULT f_fdisk (
-  BYTE  pdrv,        /* [IN] Physical drive number */
-  const DWORD* szt,  /* [IN] Partition map table */
-  void* work         /* [IN] Work area */
+  BYTE  pdrv,         /* [IN] Physical drive number */
+  const LBA_t ptbl[], /* [IN] Partition map table */
+  void* work          /* [IN] Work area */
 );
 
@@ -28,10 +28,10 @@ FRESULT f_fdisk (
pdrv
Specifies the physical drive to be divided. This is not the logical drive number but the drive identifier passed to the low level disk functions.
-
szt
-
Pointer to the first item of the partition map table.
+
ptbl
+
List of partition size to create on the drive. The data type LBA_t is an alias of DWORD or QWORD depends on the configuration option FF_LBA64.
work
-
Pointer to the function work area. The size must be at least FF_MAX_SS bytes. When a null pointer is given, the function allocates a memory block for the working buffer (at only FF_USE_LFN == 3).
+
Pointer to the function work area. The size must be at least FF_MAX_SS bytes. When a null pointer is given with FF_USE_LFN = 3, a memory block is obtained in this function for the working buffer.
@@ -49,7 +49,8 @@ FRESULT f_fdisk (

Description

-

The f_fdisk 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.

+

The f_fdisk 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.

+

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 (FF_LBA64 = 1) and the drive size is equal to or larger than FF_MIN_GPT sectors. It can create over ten partitions on a drive.

@@ -60,24 +61,26 @@ FRESULT f_fdisk (

Example

-    /* Volume management table defined by user (required when FF_MULTI_PARTITION == 1) */
+    /* Volume mapping table defined by user (required when FF_MULTI_PARTITION == 1) */
 
-    PARTITION VolToPart[] = {
-        {0, 1},    /* "0:" ==> Physical drive 0, 1st partition */
-        {0, 2},    /* "1:" ==> Physical drive 0, 2nd partition */
-        {1, 0}     /* "2:" ==> Physical drive 1, auto detection */
+    PARTITION VolToPart[FF_VOLUMES] = {
+        {0, 1},    /* "0:" ==> 1st partition in PD#0 */
+        {0, 2},    /* "1:" ==> 2nd partition in PD#0 */
+        {1, 0}     /* "2:" ==> PD#1 as removable drive */
     };
 
     /* Initialize a brand-new disk drive mapped to physical drive 0 */
 
-    DWORD plist[] = {50, 50, 0, 0};  /* Divide drive into two partitions */
-    BYTE work[FF_MAX_SS];
+    BYTE work[FF_MAX_SS];         /* Working buffer */
+    LBA_t plist[] = {50, 50, 0};  /* Divide the drive into two partitions */
+                 /* {0x10000000, 100}; 256M sectors for 1st partition and left all for 2nd partition */
+                 /* {20, 20, 20, 0}; 20% for 3 partitions each and remaing space is left not allocated */
 
     f_fdisk(0, plist, work);                    /* Divide physical drive 0 */
 
-    f_mkfs("0:", FM_ANY, work, sizeof work);    /* Create FAT volume on the logical drive 0 */
-    f_mkfs("1:", FM_ANY, work, sizeof work);    /* Create FAT volume on the logical drive 1 */
+    f_mkfs("0:", 0, work, sizeof work); /* Create FAT volume on the logical drive 0 */
+    f_mkfs("1:", 0, work, sizeof work); /* Create FAT volume on the logical drive 1 */