Lines Matching refs:size
86 #define BPB_BytsPerSec 11 /* Sector size [byte] (WORD) */
87 #define BPB_SecPerClus 13 /* Cluster size [sector] (BYTE) */
91 #define BPB_TotSec16 19 /* Volume size (16-bit) [sector] (WORD) */
93 #define BPB_FATSz16 22 /* FAT size (16-bit) [sector] (WORD) */
97 #define BPB_TotSec32 32 /* Volume size (32-bit) [sector] (DWORD) */
107 #define BPB_FATSz32 36 /* FAT32: FAT size [sector] (DWORD) */
146 #define GPTH_Size 12 /* GPT HDR: Header size (DWORD) */
185 /* Definitions of sector size */
187 #error Wrong sector size configuration
2718 if ((w & (w - 1)) == 0 && w >= FF_MIN_SS && w <= FF_MAX_SS) { /* Properness of sector size */
2720 if (b != 0 && (b & (b - 1)) == 0 /* Properness of cluster size */
2723 && ld_word(fs->win + BPB_FATSz16) != 0) { /* Properness of FAT size */
2854 #if FF_MAX_SS != FF_MIN_SS /* Get sector size (multiple sector size cfg only) */
2873 if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_BytsPerSec must be equal to the physical sector size) */
2883 fs->csize = fs->win[BPB_SecPerClus]; /* Cluster size */
2897 if (tsect < sysect) return FR_NO_FILESYSTEM; /* (Invalid volume size) */
2899 if (nclst == 0) return FR_NO_FILESYSTEM; /* (Invalid volume size) */
2915 szbfat = fs->n_fatent * 4; /* (Needed FAT size) */
2919 szbfat = (fmt == FS_FAT16) ? /* (Needed FAT size) */
2922 if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_FATSz must not be less than the size needed) */
3115 if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) { /* (BPB_BytsPerSec must be equal to the physical sector size) */
3127 fs->csize = fs->win[BPB_SecPerClus]; /* Cluster size */
3141 if (tsect < sysect) return FR_NO_FILESYSTEM; /* (Invalid volume size) */
3143 if (nclst == 0) return FR_NO_FILESYSTEM; /* (Invalid volume size) */
3159 szbfat = fs->n_fatent * FAT32_ENTRY_SIZE; /* (Needed FAT size) */
3164 (fs->n_fatent * 3 / 2 + (fs->n_fatent & 1)); /* (Needed FAT size) */
3167 /* (BPB_FATSz must not be less than the size needed) */
3464 bcs = (DWORD)fs->csize * SS(fs); /* Cluster size in byte */
3587 cc = btr / SS(fs); /* When remaining bytes >= sector size, */
3681 /* Check fptr wrap-around (file size cannot reach 4 GiB at FAT volume) */
3725 cc = btw / SS(fs); /* When remaining bytes >= sector size, */
3827 st_dword(dir + DIR_FileSize, (DWORD)fp->obj.objsize); /* Update file size */
4081 tlen = *tbl++; ulen = 2; /* Given table size and required table size */
4102 res = FR_NOT_ENOUGH_CORE; /* Given table size is smaller than required */
4105 if (ofs > fp->obj.objsize) ofs = fp->obj.objsize; /* Clip offset at the file size */
4131 if (ofs > fp->obj.objsize && (FF_FS_READONLY || !(fp->flag & FA_WRITE))) { /* In read-only mode, clip offset with the file size */
4137 bcs = (DWORD)fs->csize * SS(fs); /* Cluster size (byte) */
4162 if (clst == 0) { /* Clip file size in case of disk full */
4184 if (!FF_FS_READONLY && fp->fptr > fp->obj.objsize) { /* Set file change flag if the file size is extended */
4536 if (fp->fptr == 0 && length == 0) { /* When set file size to zero, remove entire cluster chain */
4540 n = (DWORD)fs->csize * SS(fs); /* Cluster size */
4569 fp->obj.objsize = length; /* Set file size to length */
5321 FSIZE_t fsz, /* File size to be expanded to */
5336 n = (DWORD)fs->csize * SS(fs); /* Cluster size */
5565 /* Get drive size */
5577 n_lba32 = (DWORD)plst[i]; /* Get partition size */
5579 if (s_lba32 + n_lba32 > sz_drv32 || s_lba32 + n_lba32 < s_lba32) n_lba32 = sz_drv32 - s_lba32; /* Clip at drive size */
5616 static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0}; /* Cluster size boundary for FAT volume (4Ks unit) */
5617 static const WORD cst32[] = {1, 2, 4, 8, 16, 32, 0}; /* Cluster size boundary for FAT32 volume (128Ks unit) */
5625 WORD ss; /* Sector size */
5660 if (sz_blk == 0) disk_ioctl(pdrv, GET_BLOCK_SIZE, &sz_blk); /* Block size from the paramter or lower layer */
5661 if (sz_blk == 0 || sz_blk > 0x8000 || (sz_blk & (sz_blk - 1))) sz_blk = 1; /* Use default if the block size is invalid */
5717 sz_vol = ld_dword(pte + PTE_SizLba); /* Get volume size */
5720 sz_vol = LD2PC(vol); /* Volume size */
5725 sz_vol = LD2PC(vol); /* Volume size */
5743 sz_vol -= b_vol; /* Volume size */
5745 if (sz_vol < 128) {fr = FR_MKFS_ABORTED; goto EXIT;} /* Check if volume size is >=128s */
5766 n = (DWORD)sz_vol / 0x20000; /* Volume size in unit of 128KS */
5770 sz_fat = (n_clst * 4 + 8 + ss - 1) / ss; /* FAT size [sector] */
5776 n = (DWORD)sz_vol / 0x1000; /* Volume size in unit of 4KS */
5781 n = n_clst * 2 + 4; /* FAT size [byte] */
5784 n = (n_clst * 3 + 1) / 2 + 3; /* FAT size [byte] */
5786 sz_fat = (n + ss - 1) / ss; /* FAT size [sector] */
5788 sz_dir = (DWORD)n_root * SZDIRE / ss; /* Rootdir size [sector] */
5812 if (sz_au == 0 && (sz_au = pau / 2) != 0) continue; /* Adjust cluster size and retry */
5819 sz_au = pau * 2; continue; /* Adjust cluster size and retry */
5824 if (sz_au == 0 && (sz_au = pau * 2) <= 128) continue; /* Adjust cluster size and retry */
5828 if (sz_au == 0 && (sz_au = pau * 2) <= 128) continue; /* Adjust cluster size and retry */
5845 st_word(buf + BPB_BytsPerSec, ss); /* Sector size [byte] */
5846 buf[BPB_SecPerClus] = (BYTE)pau; /* Cluster size [sector] */
5851 st_word(buf + BPB_TotSec16, (WORD)sz_vol); /* Volume size in 16-bit LBA */
5853 st_dword(buf + BPB_TotSec32, (DWORD)sz_vol); /* Volume size in 32-bit LBA */
5861 st_dword(buf + BPB_FATSz32, sz_fat); /* FAT size [sector] */
5870 st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */
5875 st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */
6007 static const WORD cst[] = {1, 4, 16, 64, 256, 512, 0}; /* Cluster size boundary for FAT volume (4Ks unit) */
6008 static const WORD cst32[] = {1, 2, 4, 8, 16, 32, 0}; /* Cluster size boundary for FAT32 volume (128Ks unit) */
6107 sz_vol = partition->sector_count; /* Volume size */
6114 sz_vol -= b_vol; /* Volume size */
6116 if (sz_vol < VOL_MIN_SIZE) {fr = FR_MKFS_ABORTED; goto EXIT;} /* Check if volume size is >=128s */
6137 n = (DWORD)sz_vol / 0x20000; /* Volume size in unit of 128KS */
6141 sz_fat = ((n_clst + FAT_RESERVED_NUM) * FAT32_ENTRY_SIZE + ss - 1) / ss; /* FAT size [sector] */
6147 n = (DWORD)sz_vol / 0x1000; /* Volume size in unit of 4KS */
6152 n = (n_clst + FAT_RESERVED_NUM) * FAT16_ENTRY_SIZE; /* FAT size [byte] */
6155 n = (n_clst * 3 + 1) / 2 + 3; /* FAT size [byte] */
6157 sz_fat = (n + ss - 1) / ss; /* FAT size [sector] */
6159 sz_dir = (DWORD)n_root * SZDIRE / ss; /* Rootdir size [sector] */
6183 if (sz_au == 0 && (sz_au = pau / 2) != 0) continue; /* Adjust cluster size and retry */
6190 sz_au = pau * 2; continue; /* Adjust cluster size and retry */
6195 if (sz_au == 0 && (sz_au = pau * 2) <= FAT32_MAX_CLUSTER_SIZE) continue; /* Adjust cluster size and retry */
6199 if (sz_au == 0 && (sz_au = pau * 2) <= FAT32_MAX_CLUSTER_SIZE) continue; /* Adjust cluster size and retry */
6216 st_word(buf + BPB_BytsPerSec, ss); /* Sector size [byte] */
6217 buf[BPB_SecPerClus] = (BYTE)pau; /* Cluster size [sector] */
6222 st_word(buf + BPB_TotSec16, (WORD)sz_vol); /* Volume size in 16-bit LBA */
6224 st_dword(buf + BPB_TotSec32, (DWORD)sz_vol); /* Volume size in 32-bit LBA */
6232 st_dword(buf + BPB_FATSz32, sz_fat); /* FAT size [sector] */
6241 st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */
6246 st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */
6385 const DWORD szt[], /* Pointer to the size table for each partitions */
6911 clust_size = (DWORD)fs->csize * SS(fs); /* Cluster size */
6913 if (dir_info->fno.fsize == 0) { /* When set file size to zero, remove entire cluster chain */