]> cloudbase.mooo.com Git - z180-stamp.git/blame - fatfs/documents/doc/fdisk.html
Merge branch 'chan-fatfs' into fatfs-integration
[z180-stamp.git] / fatfs / documents / doc / fdisk.html
CommitLineData
53668523
L
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
2<html lang="en">\r
3<head>\r
289f6a14 4<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
53668523
L
5<meta http-equiv="Content-Style-Type" content="text/css">\r
6<link rel="up" title="FatFs" href="../00index_e.html">\r
7<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/fdisk.html">\r
8<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r
9<title>FatFs - f_fdisk</title>\r
10</head>\r
11\r
12<body>\r
13\r
14<div class="para func">\r
15<h2>f_fdisk</h2>\r
16<p>The f_fdisk fucntion divides a physical drive.</p>\r
17<pre>\r
18FRESULT f_fdisk (\r
70702af1
L
19 BYTE <span class="arg">pdrv</span>, <span class="c">/* [IN] Physical drive number */</span>\r
20 const DWORD* <span class="arg">szt</span>, <span class="c">/* [IN] Partition map table */</span>\r
21 void* <span class="arg">work</span> <span class="c">/* [IN] Work area */</span>\r
53668523
L
22);\r
23</pre>\r
24</div>\r
25\r
26<div class="para arg">\r
27<h4>Parameters</h4>\r
28<dl class="par">\r
29<dt>pdrv</dt>\r
70702af1
L
30<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>\r
31<dt>szt</dt>\r
32<dd>Pointer to the first item of the partition map table.</dd>\r
53668523 33<dt>work</dt>\r
289f6a14 34<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>\r
53668523
L
35</dl>\r
36</div>\r
37\r
38<div class="para ret">\r
39<h4>Return Values</h4>\r
40<p>\r
41<a href="rc.html#ok">FR_OK</a>,\r
42<a href="rc.html#de">FR_DISK_ERR</a>,\r
43<a href="rc.html#nr">FR_NOT_READY</a>,\r
44<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,\r
289f6a14
L
45<a href="rc.html#ip">FR_INVALID_PARAMETER</a>,\r
46<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>\r
53668523
L
47</p>\r
48</div>\r
49\r
50<div class="para desc">\r
51<h4>Description</h4>\r
70702af1 52<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>\r
53668523
L
53</div>\r
54\r
55<div class="para comp">\r
56<h4>QuickInfo</h4>\r
289f6a14 57<p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READOLNY</a> == 0</tt>, <tt><a href="config.html#use_mkfs">FF_USE_MKFS</a> == 1</tt> and <tt><a href="config.html#multi_partition">FF_MULTI_PARTITION</a> == 1</tt>.</p>\r
53668523
L
58</div>\r
59\r
60<div class="para use">\r
61<h4>Example</h4>\r
62<pre>\r
289f6a14 63 <span class="c">/* Volume management table defined by user (required when FF_MULTI_PARTITION == 1) */</span>\r
53668523
L
64\r
65 PARTITION VolToPart[] = {\r
289f6a14
L
66 {0, 1}, <span class="c">/* "0:" ==> Physical drive 0, 1st partition */</span>\r
67 {0, 2}, <span class="c">/* "1:" ==> Physical drive 0, 2nd partition */</span>\r
68 {1, 0} <span class="c">/* "2:" ==> Physical drive 1, auto detection */</span>\r
53668523
L
69 };\r
70</pre>\r
71<pre>\r
72 <span class="c">/* Initialize a brand-new disk drive mapped to physical drive 0 */</span>\r
73\r
53668523 74 DWORD plist[] = {50, 50, 0, 0}; <span class="c">/* Divide drive into two partitions */</span>\r
289f6a14 75 BYTE work[FF_MAX_SS];\r
53668523 76\r
289f6a14 77 <em>f_fdisk</em>(0, plist, work); <span class="c">/* Divide physical drive 0 */</span>\r
53668523 78\r
289f6a14
L
79 f_mkfs("0:", FM_ANY, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 0 */</span>\r
80 f_mkfs("1:", FM_ANY, work, sizeof work); <span class="c">/* Create FAT volume on the logical drive 1 */</span>\r
53668523
L
81\r
82</pre>\r
83</div>\r
84\r
85<div class="para ref">\r
86<h4>See Also</h4>\r
87<p><a href="filename.html#vol">Volume management</a>, <a href="mkfs.html"><tt>f_mkfs</tt></a></p>\r
88</div>\r
89\r
90<p class="foot"><a href="../00index_e.html">Return</a></p>\r
91</body>\r
92</html>\r