Author: hbelusca Date: Fri Jan 8 13:51:45 2016 New Revision: 70548
URL: http://svn.reactos.org/svn/reactos?rev=70548&view=rev Log: [FATTEN]: Set the directory volume label in addition to the bootsector label. [FATFS]: For FAT12 volumes, do not expand the FAT size.
Modified: trunk/reactos/tools/fatten/fatfs/ff.c trunk/reactos/tools/fatten/fatten.c
Modified: trunk/reactos/tools/fatten/fatfs/ff.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatfs/ff.c?rev... ============================================================================== --- trunk/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatfs/ff.c [iso-8859-1] Fri Jan 8 13:51:45 2016 @@ -4162,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;
Modified: trunk/reactos/tools/fatten/fatten.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/fatten/fatten.c?rev=7... ============================================================================== --- trunk/reactos/tools/fatten/fatten.c [iso-8859-1] (original) +++ trunk/reactos/tools/fatten/fatten.c [iso-8859-1] Fri Jan 8 13:51:45 2016 @@ -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)