Lines Matching refs:i
953 UINT i, be; in chk_share() local
957 for (i = 0; i < FF_FS_LOCK; i++) { in chk_share()
958 if (Files[i].fs) { /* Existing entry */ in chk_share()
959 if (Files[i].fs == dp->obj.fs && /* Check if the object matches with an open object */ in chk_share()
960 Files[i].clu == dp->obj.sclust && in chk_share()
961 Files[i].ofs == dp->dptr) break; in chk_share()
966 if (i == FF_FS_LOCK) { /* The object has not been opened */ in chk_share()
971 return (acc != 0 || Files[i].ctr == 0x100) ? FR_LOCKED : FR_OK; in chk_share()
977 UINT i; in enq_share() local
979 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; /* Find a free entry */ in enq_share()
980 return (i == FF_FS_LOCK) ? 0 : 1; in enq_share()
989 UINT i; in inc_share() local
992 for (i = 0; i < FF_FS_LOCK; i++) { /* Find the object */ in inc_share()
993 if (Files[i].fs == dp->obj.fs in inc_share()
994 && Files[i].clu == dp->obj.sclust in inc_share()
995 && Files[i].ofs == dp->dptr) break; in inc_share()
998 if (i == FF_FS_LOCK) { /* Not opened. Register it as new. */ in inc_share()
999 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; /* Find a free entry */ in inc_share()
1000 if (i == FF_FS_LOCK) return 0; /* No free entry to register (int err) */ in inc_share()
1001 Files[i].fs = dp->obj.fs; in inc_share()
1002 Files[i].clu = dp->obj.sclust; in inc_share()
1003 Files[i].ofs = dp->dptr; in inc_share()
1004 Files[i].ctr = 0; in inc_share()
1007 if (acc >= 1 && Files[i].ctr) return 0; /* Access violation (int err) */ in inc_share()
1009 Files[i].ctr = acc ? 0x100 : Files[i].ctr + 1; /* Set semaphore value */ in inc_share()
1011 return i + 1; /* Index number origin from 1 */ in inc_share()
1016 UINT i /* Semaphore index (1..) */ in dec_share() argument
1023 if (--i < FF_FS_LOCK) { /* Index number origin from 0 */ in dec_share()
1024 n = Files[i].ctr; in dec_share()
1027 Files[i].ctr = n; in dec_share()
1029 …Files[i].fs = 0; /* Free the entry <<<If this memory write operation is not in atomic, FF_FS_REENT… in dec_share()
1043 UINT i; in clear_share() local
1045 for (i = 0; i < FF_FS_LOCK; i++) { in clear_share()
1046 if (Files[i].fs == fs) Files[i].fs = 0; in clear_share()
1327 UINT i; in find_bitmap() local
1336 i = val / 8 % SS(fs); bm = 1 << (val % 8); in find_bitmap()
1339 bv = fs->win[i] & bm; bm <<= 1; /* Get bit value */ in find_bitmap()
1341 val = 0; bm = 0; i = SS(fs); in find_bitmap()
1351 } while (++i < SS(fs)); in find_bitmap()
1368 UINT i; in change_bitmap() local
1374 i = clst / 8 % SS(fs); /* Byte offset in the sector */ in change_bitmap()
1380 if (bv == (int)((fs->win[i] & bm) != 0)) return FR_INT_ERR; /* Is the bit expected value? */ in change_bitmap()
1381 fs->win[i] ^= bm; /* Flip the bit */ in change_bitmap()
1386 } while (++i < SS(fs)); /* Next byte */ in change_bitmap()
1387 i = 0; in change_bitmap()
2022 UINT i, j; local
2033 for (i = 0; i < 16; i++) {
2043 i = 7;
2047 ns[i--] = c;
2048 } while (i && seq);
2049 ns[i] = '~';
2052 for (j = 0; j < i && dst[j] != ' '; j++) { /* Find the offset to append */
2054 if (j == i - 1) break;
2059 dst[j++] = (i < 8) ? ns[i++] : ' ';
2097 UINT i, szblk; local
2102 for (i = sum = 0; i < szblk; i++) {
2103 if (i == XDIR_SetSum) { /* Skip 2-byte sum field */
2104 i++;
2106 sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + dir[i];
2153 UINT i, sz_ent; local
2176 i = 2 * SZDIRE; /* Name offset to load */
2184 …if (i < MAXDIRB(FF_MAX_LFN)) memcpy(dirb + i, dp->dir, SZDIRE); /* Load name entries only if the o…
2185 } while ((i += SZDIRE) < sz_ent);
2188 if (i <= MAXDIRB(FF_MAX_LFN)) {
2286 UINT i; local
2297 i = SZDIRE * 2; /* Top of file name entries */
2300 dirb[i++] = ET_FILENAME; dirb[i++] = 0;
2303 st_word(dirb + i, chr); /* Store it */
2304 i += 2;
2305 } while (i % SZDIRE != 0);
2880 UINT i, ni, si, di; local
2908 for (i = 0; i < 11; i++) { /* Create dot name for SFN entry */
2909 dp->fn[i] = (i < di) ? '.' : ' ';
2911 dp->fn[i] = cf | NS_DOT; /* This is a dot entry */
2929 i = b = 0; ni = 8;
2938 if (i >= ni || si == di) { /* End of field? */
2945 si = di; i = 8; ni = 11; b <<= 2; /* Enter name extension */
2967 if (i >= ni - 1) { /* Field overflow? */
2969 i = ni; continue; /* Next field */
2971 dp->fn[i++] = (BYTE)(wc >> 8); /* Put 1st byte */
2984 dp->fn[i++] = (BYTE)wc;
3004 UINT ni, si, i;
3010 si = i = 0; ni = 8;
3016 sfn[i++] = c;
3031 if (c == '.' || i >= ni) { /* End of body or field overflow? */
3033 i = 8; ni = 11; /* Enter file extension field */
3047 if (!dbc_2nd(d) || i >= ni - 1) return FR_INVALID_NAME; /* Reject invalid DBC */
3048 sfn[i++] = c;
3049 sfn[i++] = d;
3053 sfn[i++] = c;
3057 if (i == 0) return FR_INVALID_NAME; /* Reject nul string */
3167 int i; local
3180 i = FF_VOLUMES;
3182 i = (int)*tp - '0'; /* Get the logical drive number */
3186 i = 0; /* Find volume ID string in the preconfigured table */
3188 vsp = VolumeStr[i]; tp = *path; /* Preconfigured string and path name to test */
3194 } while ((vchr || tp != tt) && ++i < FF_VOLUMES); /* Repeat for each id until pattern match */
3197 if (i >= FF_VOLUMES) return -1; /* Not found or invalid volume ID */
3199 return i; /* Return the found drive number */
3204 i = 0;
3206 vsp = VolumeStr[i]; tt = tp; /* Preconfigured string and path name to test */
3212 …} while ((vchr || (chr != '/' && !IsTerminator(chr))) && ++i < FF_VOLUMES); /* Repeat for each ID …
3213 if (i >= FF_VOLUMES) return -1; /* Not found (invalid volume ID) */
3215 return i; /* Return the found drive number */
3259 UINT i; local
3266 for (i = 0, bcc = 0xFFFFFFFF; i < hlen; i++) { /* Check header BCC */
3267 bcc = crc32(bcc, i - GPTH_Bcc < 4 ? 0 : gpth[i]);
3352 UINT fmt, i; local
3370 for (v_ent = i = 0; i < n_ent; i++) { /* Find FAT partition */
3371 if (move_window(fs, pt_lba + i * SZ_GPTE / SS(fs)) != FR_OK) return 4; /* PT sector */
3372 ofs = i * SZ_GPTE % SS(fs); /* Offset in the sector */
3384 for (i = 0; i < 4; i++) { /* Load partition offset in the MBR */
3385 mbr_pt[i] = ld_dword(fs->win + MBR_Table + i * SZ_PTE + PTE_StLba);
3387 i = part ? part - 1 : 0; /* Table index to find first */
3389 fmt = mbr_pt[i] ? check_fs(fs, mbr_pt[i]) : 3; /* Check if the partition is FAT */
3390 } while (part == 0 && fmt >= 2 && ++i < 4);
3467 DWORD so, cv, bcl, i; local
3469 for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ; /* Check zero filler */
3470 if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM;
3501 so = i = 0;
3503 if (i == 0) {
3508 if (fs->win[i] == ET_BITMAP) break; /* Is it a bitmap entry? */
3509 i = (i + SZDIRE) % SS(fs); /* Next entry */
3511 bcl = ld_dword(fs->win + i + 20); /* Bitmap cluster */
4289 UINT i; local
4335 for (i = FF_VOLUMES - 1; i && fs != FatFs[i]; i--) ; /* Set current drive */
4336 CurrVol = (BYTE)i;
4354 UINT i, n; local
4375 i = len; /* Bottom of buffer (directory stack base) */
4396 if (i < n + 1) { /* Insufficient space to store the path name? */
4399 while (n) buff[--i] = fno.fname[--n]; /* Stack the name */
4400 buff[--i] = '/';
4404 if (i == len) buff[--i] = '/'; /* Is it the root-directory? */
4409 if (i >= n + 2) {
4416 if (i >= 3) {
4427 *tp++ = buff[i++];
4428 } while (i < len);
4841 UINT i; local
4875 i = 0; /* Offset in the sector */
4877 if (i == 0) { /* New sector? */
4881 for (b = 8, bm = ~fs->win[i]; b && clst; b--, clst--) { /* Count clear bits in a byte */
4885 i = (i + 1) % SS(fs); /* Next byte */
4892 i = 0; /* Offset in the sector */
4894 if (i == 0) { /* New sector? */
4899 if (ld_word(fs->win + i) == 0) nfree++; /* FAT16: Is this cluster free? */
4900 i += 2; /* Next entry */
4902 if ((ld_dword(fs->win + i) & 0x0FFFFFFF) == 0) nfree++; /* FAT32: Is this cluster free? */
4903 i += 4; /* Next entry */
4905 i %= SS(fs);
5764 UINT i, cy; local
5817 for (i = 0; i < ss; bcc = crc32(bcc, buf[i++])) ; /* Calculate table check sum */
5835 …for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
5844 …for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
5864 …for (i = 0, nxt_alloc32 = n_sc; i < 4 && nxt_alloc32 != 0 && nxt_alloc32 < sz_drv32; i++, nxt_allo…
5865 sz_part32 = (DWORD)plst[i]; /* Get partition size */
5918 UINT n_fat, n_root, i; /* Number of FATs, number of roor directory entries and some index */ local
5980 ofs = i = 0;
5983 …if (!memcmp(buf + ofs + GPTE_PtGuid, GUID_MS_Basic, 16) && ++i == ipart) { /* MS basic data partit…
6073 st = 0; si = 0; i = 0; j = 0; szb_case = 0;
6096 sum = xsum32(buf[i + 0] = (BYTE)ch, sum); /* Put it into the write buffer */
6097 sum = xsum32(buf[i + 1] = (BYTE)(ch >> 8), sum);
6098 i += 2; szb_case += 2;
6099 if (si == 0 || i == sz_buf * ss) { /* Write buffered data when buffer full or end of process */
6100 n = (i + ss - 1) / ss;
6102 sect += n; i = 0;
6113 …for (i = 0; nbit != 0 && i / 8 < sz_buf * ss; buf[i / 8] |= 1 << (i % 8), i++, nbit--) ; /* Mark u…
6123 memset(buf, 0, sz_buf * ss); i = 0; /* Clear work area and reset write offset */
6125 st_dword(buf + i, 0xFFFFFFF8); i += 4; clu++;
6126 st_dword(buf + i, 0xFFFFFFFF); i += 4; clu++;
6130 while (nbit != 0 && i < sz_buf * ss) { /* Create a chain */
6131 st_dword(buf + i, (nbit > 1) ? clu + 1 : 0xFFFFFFFF);
6132 i += 4; clu++; nbit--;
6135 } while (nbit != 0 && i < sz_buf * ss);
6174 …for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) ; /* Log2 of sector siz…
6175 …for (buf[BPB_SecPerClusEx] = 0, i = sz_au; i >>= 1; buf[BPB_SecPerClusEx]++) ; /* Log2 of cluster …
6180 for (i = sum = 0; i < ss; i++) { /* VBR checksum */
6181 …if (i != BPB_VolFlagEx && i != BPB_VolFlagEx + 1 && i != BPB_PercInUseEx) sum = xsum32(buf[i], sum…
6188 for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
6194 for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
6198 for (i = 0; i < ss; i += 4) st_dword(buf + i, sum); /* Fill with checksum value */
6211 for (i = 0, pau = 1; cst32[i] && cst32[i] <= n; i++, pau <<= 1) ; /* Get from table */
6221 for (i = 0, pau = 1; cst[i] && cst[i] <= n; i++, pau <<= 1) ; /* Get from table */
6335 for (i = 0; i < n_fat; i++) { /* Initialize FATs each */
6600 int i, nc; local
6613 i = pb->idx; /* Write index of pb->buf[] */
6614 if (i < 0) return; /* In write error? */
6666 st_word(&pb->buf[i], hs);
6667 i += 2;
6670 st_word(&pb->buf[i], wc);
6671 i += 2;
6674 pb->buf[i++] = (BYTE)(hs >> 8);
6675 pb->buf[i++] = (BYTE)hs;
6678 pb->buf[i++] = (BYTE)(wc >> 8);
6679 pb->buf[i++] = (BYTE)wc;
6684 pb->buf[i++] = (BYTE)(0xF0 | hs >> 8);
6685 pb->buf[i++] = (BYTE)(0x80 | (hs >> 2 & 0x3F));
6686 pb->buf[i++] = (BYTE)(0x80 | (hs & 3) << 4 | (wc >> 6 & 0x0F));
6687 pb->buf[i++] = (BYTE)(0x80 | (wc & 0x3F));
6690 pb->buf[i++] = (BYTE)wc;
6694 pb->buf[i++] = (BYTE)(0xC0 | wc >> 6);
6697 pb->buf[i++] = (BYTE)(0xE0 | wc >> 12);
6698 pb->buf[i++] = (BYTE)(0x80 | (wc >> 6 & 0x3F));
6700 pb->buf[i++] = (BYTE)(0x80 | (wc & 0x3F));
6708 pb->buf[i++] = (BYTE)(wc >> 8); nc++;
6710 pb->buf[i++] = (BYTE)wc;
6714 pb->buf[i++] = (BYTE)c;
6717 if (i >= (int)(sizeof pb->buf) - 4) { /* Write buffered characters to the file */
6718 f_write(pb->fp, pb->buf, (UINT)i, &n);
6719 i = (n == (UINT)i) ? 0 : -1;
6721 pb->idx = i;
6922 UINT i, j, width, flag, radix; local
7018 for (i = 0; str[i]; putc_bfd(&pb, str[i++])) ; /* Body */
7049 i = 0;
7053 str[i++] = digit;
7054 } while (val && i < SZ_NUM_BUF);
7055 if (flag & 1) str[i++] = '-'; /* Sign */
7057 for (j = i; !(flag & 2) && j < width; j++) { /* Leading pads */
7061 putc_bfd(&pb, (TCHAR)str[--i]);
7062 } while (i);
7089 UINT i; local
7092 for (i = 0; validcp[i] != 0 && validcp[i] != cp; i++) ; /* Find the code page */
7093 if (validcp[i] != cp) return FR_INVALID_PARAMETER; /* Not found? */
7098 DbcTbl = tables[i];
7100 ExCvt = tables[i];