Author: akhaldi
Date: Wed Jan 13 16:09:48 2016
New Revision: 70588
URL: http://svn.reactos.org/svn/reactos?rev=70588&view=rev
Log:
[0.4.0] * Merge the fatten work by Hermès in revisions 70545 => 70548.
Added:
branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/00history.txt
- copied unchanged from r70548, trunk/reactos/tools/fatten/fatfs/00history.txt
Modified:
branches/ros-branch-0_4_0/ (props changed)
branches/ros-branch-0_4_0/reactos/ (props changed)
branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/00readme.txt
branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.c
branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.h
branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/ff.c
branches/ros-branch-0_4_0/reactos/tools/fatten/fatten.c
Propchange: branches/ros-branch-0_4_0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 13 16:09:48 2016
@@ -1 +1 @@
-/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70464,70468,70470,70480,70497,70499-70501,70507-70510,70512-70513,70523,70527-70530,70552-70554,70557-70558,70576,70583
+/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70464,70468,70470,70480,70497,70499-70501,70507-70510,70512-70513,70523,70527-70530,70545-70548,70552-70554,70557-70558,70576,70583
Propchange: branches/ros-branch-0_4_0/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 13 16:09:48 2016
@@ -20,4 +20,4 @@
/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
/branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567
/branches/wlan-bringup:54809-54998
-/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70464,70468,70470,70480,70497,70501,70507-70510,70523,70527-70530,70552-70554,70557-70558,70576,70583
+/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70464,70468,70470,70480,70497,70501,70507-70510,70523,70527-70530,70545-70548,70552-70554,70557-70558,70576,70583
Modified: branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/00readme.txt
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/tools/…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/00readme.txt [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/00readme.txt [iso-8859-1] Wed Jan 13 16:09:48 2016
@@ -1,155 +1,21 @@
-FatFs Module Source Files R0.10a (C)ChaN, 2014
+FatFs Module Source Files R0.11
FILES
- ffconf.h Configuration file for FatFs module.
- ff.h Common include file for FatFs and application module.
- ff.c FatFs module.
- diskio.h Common include file for FatFs and disk I/O module.
- diskio.c An example of glue function to attach existing disk I/O module to FatFs.
- integer.h Integer type definitions for FatFs.
- option Optional external functions.
+ 00readme.txt This file.
+ history.txt Revision history.
+ ffconf.h Configuration file for FatFs module.
+ ff.h Common include file for FatFs and application module.
+ ff.c FatFs module.
+ diskio.h Common include file for FatFs and disk I/O module.
+ diskio.c An example of glue function to attach existing disk I/O module to FatFs.
+ integer.h Integer type definitions for FatFs.
+ option Optional external functions.
+
Low level disk I/O module is not included in this archive because the FatFs
module is only a generic file system layer and not depend on any specific
storage device. You have to provide a low level disk I/O module that written
- to control your storage device.
+ to control the target storage device.
-
-
-AGREEMENTS
-
- FatFs module is an open source software to implement FAT file system to
- small embedded systems. This is a free software and is opened for education,
- research and commercial developments under license policy of following trems.
-
- Copyright (C) 2014, ChaN, all right reserved.
-
- * The FatFs module is a free software and there is NO WARRANTY.
- * No restriction on use. You can use, modify and redistribute it for
- personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
- * Redistributions of source code must retain the above copyright notice.
-
-
-
-REVISION HISTORY
-
- Feb 26, 2006 R0.00 Prototype
-
- Apr 29, 2006 R0.01 First release.
-
- Jun 01, 2006 R0.02 Added FAT12.
- Removed unbuffered mode.
- Fixed a problem on small (<32M) patition.
-
- Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
-
- Sep 22, 2006 R0.03 Added f_rename.
- Changed option _FS_MINIMUM to _FS_MINIMIZE.
-
- Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
- Fixed f_mkdir creates incorrect directory on FAT32.
-
- Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
- Changed some APIs for multiple drive system.
- Added f_mkfs. (FatFs)
- Added _USE_FAT32 option. (Tiny-FatFs)
-
- Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
- Fixed an endian sensitive code in f_mkfs. (FatFs)
- Added a capability of extending the file size to f_lseek.
- Added minimization level 3.
- Fixed a problem that can collapse a sector when recreate an
- existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
-
- May 05, 2007 R0.04b Added _USE_NTFLAG option.
- Added FSInfo support.
- Fixed some problems corresponds to FAT32. (Tiny-FatFs)
- Fixed DBCS name can result FR_INVALID_NAME.
- Fixed short seek (0 < ofs <= csize) collapses the file object.
-
- Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
- Changed arguments of f_mkfs. (FatFs)
- Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
- Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
-
- Feb 03, 2008 R0.05a Added f_truncate().
- Added f_utime().
- Fixed off by one error at FAT sub-type determination.
- Fixed btr in f_read() can be mistruncated.
- Fixed cached sector is not flushed when create and close without write.
-
- Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
- Added string functions: fputc(), fputs(), fprintf() and fgets().
- Improved performance of f_lseek() on move to the same or following cluster.
-
- Apr 01, 2009, R0.07 Merged Tiny-FatFs as a buffer configuration option.
- Added long file name support.
- Added multiple code page support.
- Added re-entrancy for multitask operation.
- Added auto cluster size selection to f_mkfs().
- Added rewind option to f_readdir().
- Changed result code of critical errors.
- Renamed string functions to avoid name collision.
-
- Apr 14, 2009, R0.07a Separated out OS dependent code on reentrant cfg.
- Added multiple sector size support.
-
- Jun 21, 2009, R0.07c Fixed f_unlink() may return FR_OK on error.
- Fixed wrong cache control in f_lseek().
- Added relative path feature.
- Added f_chdir().
- Added f_chdrive().
- Added proper case conversion for extended characters.
-
- Nov 03, 2009 R0.07e Separated out configuration options from ff.h to ffconf.h.
- Added a configuration option, _LFN_UNICODE.
- Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
- Fixed name matching error on the 13 char boundary.
- Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
-
- May 15, 2010, R0.08 Added a memory configuration option. (_USE_LFN)
- Added file lock feature. (_FS_SHARE)
- Added fast seek feature. (_USE_FASTSEEK)
- Changed some types on the API, XCHAR->TCHAR.
- Changed fname member in the FILINFO structure on Unicode cfg.
- String functions support UTF-8 encoding files on Unicode cfg.
-
- Aug 16,'10 R0.08a Added f_getcwd(). (_FS_RPATH = 2)
- Added sector erase feature. (_USE_ERASE)
- Moved file lock semaphore table from fs object to the bss.
- Fixed a wrong directory entry is created on non-LFN cfg when the given name contains ';'.
- Fixed f_mkfs() creates wrong FAT32 volume.
-
- Jan 15,'11 R0.08b Fast seek feature is also applied to f_read() and f_write().
- f_lseek() reports required table size on creating CLMP.
- Extended format syntax of f_printf function.
- Ignores duplicated directory separators in given path names.
-
- Sep 06,'11 R0.09 f_mkfs() supports multiple partition to finish the multiple partition feature.
- Added f_fdisk(). (_MULTI_PARTITION = 2)
-
- Aug 27,'12 R0.09a Fixed assertion failure due to OS/2 EA on FAT12/16.
- Changed f_open() and f_opendir() reject null object pointer to avoid crash.
- Changed option name _FS_SHARE to _FS_LOCK.
-
- Jan 23,'13 R0.09b Added f_getlabel() and f_setlabel(). (_USE_LABEL)
-
- Oct 02,'13 R0.10 Added selection of character encoding on the file. (_STRF_ENCODE)
- Added f_closedir().
- Added forced full FAT scan for f_getfree(). (_FS_NOFSINFO)
- Added forced mount feature with changes of f_mount().
- Improved behavior of volume auto detection.
- Improved write throughput of f_puts() and f_printf().
- Changed argument of f_chdrive(), f_mkfs(), disk_read() and disk_write().
- Fixed f_write() can be truncated when the file size is close to 4GB.
- Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect error code.
-
- Jan 15,'14 R0.10a Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID)
- Added a configuration option of minimum sector size. (_MIN_SS)
- 2nd argument of f_rename() can have a drive number and it will be ignored.
- Fixed f_mount() with forced mount fails when drive number is >= 1.
- Fixed f_close() invalidates the file object without volume lock.
- Fixed f_closedir() returns but the volume lock is left acquired.
- Fixed creation of an entry with LFN fails on too many SFN collisions.
Modified: branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/tools/…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.c [iso-8859-1] Wed Jan 13 16:09:48 2016
@@ -1,12 +1,13 @@
/*-----------------------------------------------------------------------*/
-/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */
+/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
-/* storage control module to the FatFs module with a defined API. */
-/*-----------------------------------------------------------------------*/
-#include "diskio.h"
+/* storage control modules to the FatFs module with a defined API. */
+/*-----------------------------------------------------------------------*/
+
+#include "diskio.h" /* FatFs lower layer API */
#include <stdio.h>
/*-----------------------------------------------------------------------*/
Modified: branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/tools/…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.h [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/diskio.h [iso-8859-1] Wed Jan 13 16:09:48 2016
@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------/
-/ Low level disk interface modlue include file (C)ChaN, 2013 /
+/ Low level disk interface modlue include file (C)ChaN, 2014 /
/-----------------------------------------------------------------------*/
#ifndef _DISKIO_DEFINED
@@ -50,12 +50,12 @@
/* Command code for disk_ioctrl fucntion */
-/* Generic command (used by FatFs) */
-#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
-#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
-#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
-#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
-#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
+/* Generic command (Used by FatFs) */
+#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
+#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
+#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
+#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
+#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
/* Custom command for image file resizing */
#define SET_SECTOR_COUNT 126
Modified: branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/ff.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/tools/…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] Wed Jan 13 16:09:48 2016
@@ -3626,6 +3626,7 @@
mem_set(dir + DIR_Name, ' ', 11); /* Create "." entry */
dir[DIR_Name] = '.';
dir[DIR_Attr] = AM_DIR;
+ ST_DWORD(dir + DIR_CrtTime, tm);
ST_DWORD(dir + DIR_WrtTime, tm);
st_clust(dir, dcl);
mem_cpy(dir + SZ_DIRE, dir, SZ_DIRE); /* Create ".." entry */
@@ -3647,7 +3648,8 @@
} else {
dir = dj.dir;
dir[DIR_Attr] = AM_DIR; /* Attribute */
- ST_DWORD(dir + DIR_WrtTime, tm); /* Created time */
+ ST_DWORD(dir + DIR_CrtTime, tm); /* Created time */
+ ST_DWORD(dir + DIR_WrtTime, tm); /* Modified time */
st_clust(dir, dcl); /* Table start cluster */
dj.fs->wflag = 1;
res = sync_fs(dj.fs);
@@ -3959,6 +3961,7 @@
if (vn[0]) {
mem_cpy(dj.dir, vn, 11); /* Change the volume label name */
tm = GET_FATTIME();
+ ST_DWORD(dj.dir + DIR_CrtTime, tm);
ST_DWORD(dj.dir + DIR_WrtTime, tm);
} else {
dj.dir[0] = DDEM; /* Remove the volume label */
@@ -3975,6 +3978,7 @@
mem_cpy(dj.dir, vn, 11);
dj.dir[DIR_Attr] = AM_VOL;
tm = GET_FATTIME();
+ ST_DWORD(dj.dir + DIR_CrtTime, tm);
ST_DWORD(dj.dir + DIR_WrtTime, tm);
dj.fs->wflag = 1;
res = sync_fs(dj.fs);
@@ -4056,8 +4060,8 @@
/*-----------------------------------------------------------------------*/
/* Create file system on the logical drive */
/*-----------------------------------------------------------------------*/
-#define N_ROOTDIR12 224 /* Number of root directory entries for FAT12/16 */
-#define N_ROOTDIR16 512 /* Number of root directory entries for FAT12/16 */
+#define N_ROOTDIR12 224 /* Number of root directory entries for FAT12 */
+#define N_ROOTDIR16 512 /* Number of root directory entries for FAT16 */
#define N_FATS 2 /* Number of FATs (1 or 2) */
@@ -4141,10 +4145,10 @@
n_fat = (fmt == FS_FAT12) ? (n_clst * 3 + 1) / 2 + 3 : (n_clst * 2) + 4;
n_fat = (n_fat + SS(fs) - 1) / SS(fs);
n_rsv = 1;
- if(fmt == FS_FAT12)
- n_dir = (DWORD)N_ROOTDIR12 * SZ_DIRE / SS(fs);
- else
- n_dir = (DWORD)N_ROOTDIR16 * SZ_DIRE / SS(fs);
+ if (fmt == FS_FAT12)
+ n_dir = (DWORD)N_ROOTDIR12 * SZ_DIRE / SS(fs);
+ else
+ n_dir = (DWORD)N_ROOTDIR16 * SZ_DIRE / SS(fs);
}
b_fat = b_vol + n_rsv; /* FAT area start sector */
b_dir = b_fat + n_fat * N_FATS; /* Directory area start sector */
@@ -4158,9 +4162,9 @@
if (fmt == FS_FAT32) { /* FAT32: Move FAT offset */
n_rsv += n;
b_fat += n;
- } else { /* FAT12/16: Expand FAT size */
+ } else if (fmt == FS_FAT16) { /* FAT16: Expand FAT size */
n_fat += n;
- }
+ } // else /* if (fmt == FS_FAT12) */ {} /* FAT12: Do nothing */
/* Determine number of clusters and final check of validity of the FAT sub-type */
n_clst = (n_vol - n_rsv - n_fat * N_FATS - n_dir) / au;
@@ -4226,20 +4230,11 @@
ST_DWORD(tbl + BPB_TotSec32, n_vol);
}
tbl[BPB_Media] = md; /* Media descriptor */
- ST_DWORD(tbl + BPB_HiddSec, b_vol); /* Hidden sectors */
+ ST_DWORD(tbl + BPB_HiddSec, b_vol); /* Hidden sectors */
n = GET_FATTIME(); /* Use current time as VSN */
- if (fmt == FS_FAT12) {
- /* Assume floppy characteristics */
- ST_WORD(tbl + BPB_SecPerTrk, 0x12); /* Number of sectors per track */
- ST_WORD(tbl + BPB_NumHeads, 0x02); /* Number of heads */
- ST_DWORD(tbl + BS_VolID, n); /* VSN */
- ST_WORD(tbl + BPB_FATSz16, n_fat); /* Number of sectors per FAT */
- tbl[BS_DrvNum] = 0x00; /* Drive number */
- tbl[BS_BootSig] = 0x29; /* Extended boot signature */
- mem_cpy(tbl + BS_VolLab, "NO NAME " "FAT12 ", 19); /* Volume label, FAT signature */
- } else if (fmt == FS_FAT32) {
- ST_WORD(tbl + BPB_SecPerTrk, 63); /* Number of sectors per track */
- ST_WORD(tbl + BPB_NumHeads, 255); /* Number of heads */
+ if (fmt == FS_FAT32) {
+ ST_WORD(tbl + BPB_SecPerTrk, 63); /* Number of sectors per track */
+ ST_WORD(tbl + BPB_NumHeads, 255); /* Number of heads */
ST_DWORD(tbl + BS_VolID32, n); /* VSN */
ST_DWORD(tbl + BPB_FATSz32, n_fat); /* Number of sectors per FAT */
ST_DWORD(tbl + BPB_RootClus, 2); /* Root directory start cluster (2) */
@@ -4248,15 +4243,24 @@
tbl[BS_DrvNum32] = 0x80; /* Drive number */
tbl[BS_BootSig32] = 0x29; /* Extended boot signature */
mem_cpy(tbl + BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */
- } else {
- ST_WORD(tbl + BPB_SecPerTrk, 63); /* Number of sectors per track */
- ST_WORD(tbl + BPB_NumHeads, 255); /* Number of heads */
- ST_DWORD(tbl + BS_VolID, n); /* VSN */
- ST_WORD(tbl + BPB_FATSz16, n_fat); /* Number of sectors per FAT */
- tbl[BS_DrvNum] = 0x80; /* Drive number */
- tbl[BS_BootSig] = 0x29; /* Extended boot signature */
- mem_cpy(tbl + BS_VolLab, "NO NAME " "FAT ", 19); /* Volume label, FAT signature */
- }
+ } else if (fmt == FS_FAT16) {
+ ST_WORD(tbl + BPB_SecPerTrk, 63); /* Number of sectors per track */
+ ST_WORD(tbl + BPB_NumHeads, 255); /* Number of heads */
+ ST_DWORD(tbl + BS_VolID, n); /* VSN */
+ ST_WORD(tbl + BPB_FATSz16, n_fat); /* Number of sectors per FAT */
+ tbl[BS_DrvNum] = 0x80; /* Drive number */
+ tbl[BS_BootSig] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl + BS_VolLab, "NO NAME " "FAT16 ", 19); /* Volume label, FAT signature */
+ } else /* if (fmt == FS_FAT12) */ {
+ /* Assume floppy characteristics */
+ ST_WORD(tbl + BPB_SecPerTrk, 0x12); /* Number of sectors per track */
+ ST_WORD(tbl + BPB_NumHeads, 0x02); /* Number of heads */
+ ST_DWORD(tbl + BS_VolID, n); /* VSN */
+ ST_WORD(tbl + BPB_FATSz16, n_fat); /* Number of sectors per FAT */
+ tbl[BS_DrvNum] = 0x00; /* Drive number */
+ tbl[BS_BootSig] = 0x29; /* Extended boot signature */
+ mem_cpy(tbl + BS_VolLab, "NO NAME " "FAT12 ", 19); /* Volume label, FAT signature */
+ }
ST_WORD(tbl + BS_55AA, 0xAA55); /* Signature (Offset is fixed here regardless of sector size) */
if (disk_write(pdrv, tbl, b_vol, 1) != RES_OK) /* Write it to the VBR sector */
return FR_DISK_ERR;
Modified: branches/ros-branch-0_4_0/reactos/tools/fatten/fatten.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/tools/…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/tools/fatten/fatten.c [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/tools/fatten/fatten.c [iso-8859-1] Wed Jan 13 16:09:48 2016
@@ -45,7 +45,7 @@
timeinfo->tm_min,
timeinfo->tm_hour,
timeinfo->tm_mday,
- timeinfo->tm_mon,
+ timeinfo->tm_mon + 1,
timeinfo->tm_year - 80,
}
};
@@ -208,13 +208,15 @@
// Arg 2: custom header label (optional)
if (nargs > 1)
{
- char label[11];
+#define FAT_VOL_LABEL_LEN 11
+ char vol_label[2 + FAT_VOL_LABEL_LEN + 1]; // Null-terminated buffer
+ char* label = vol_label + 2; // The first two characters are reserved for the drive number "0:"
char ch;
int i, invalid = 0;
int len = strlen(argv[1]);
- if (len <= sizeof(label))
+ if (len <= FAT_VOL_LABEL_LEN)
{
// Verify each character (should be printable ASCII)
// and copy it in uppercase.
@@ -233,7 +235,7 @@
if (!invalid)
{
// Pad the label with spaces
- while (len < sizeof(label))
+ while (len < FAT_VOL_LABEL_LEN)
{
label[len++] = ' ';
}
@@ -260,11 +262,11 @@
if (g_Filesystem.fs_type == FS_FAT32)
{
- memcpy(buff + 71, label, sizeof(label));
+ memcpy(buff + 71, label, FAT_VOL_LABEL_LEN);
}
else
{
- memcpy(buff + 43, label, sizeof(label));
+ memcpy(buff + 43, label, FAT_VOL_LABEL_LEN);
}
if (disk_write(0, buff, 0, 1))
@@ -273,6 +275,11 @@
ret = 1;
goto exit;
}
+
+ // Set also the directory volume label
+ memcpy(vol_label, "0:", 2);
+ vol_label[2 + FAT_VOL_LABEL_LEN] = '\0';
+ f_setlabel(vol_label);
}
}
else if (strcmp(parg, "boot") == 0)