Lines Matching refs:i
922 UINT i, be; in chk_lock() local
926 for (i = 0; i < FF_FS_LOCK; i++) { in chk_lock()
927 if (Files[i].fs) { /* Existing entry */ in chk_lock()
928 if (Files[i].fs == dp->obj.fs && /* Check if the object matches with an open object */ in chk_lock()
929 Files[i].clu == dp->obj.sclust && in chk_lock()
930 Files[i].ofs == dp->dptr) break; in chk_lock()
935 if (i == FF_FS_LOCK) { /* The object has not been opened */ in chk_lock()
940 return (acc != 0 || Files[i].ctr == 0x100) ? FR_LOCKED : FR_OK; in chk_lock()
946 UINT i; in enq_lock() local
948 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; in enq_lock()
949 return (i == FF_FS_LOCK) ? 0 : 1; in enq_lock()
958 UINT i; in inc_lock() local
961 for (i = 0; i < FF_FS_LOCK; i++) { /* Find the object */ in inc_lock()
962 if (Files[i].fs == dp->obj.fs in inc_lock()
963 && Files[i].clu == dp->obj.sclust in inc_lock()
964 && Files[i].ofs == dp->dptr) break; in inc_lock()
967 if (i == FF_FS_LOCK) { /* Not opened. Register it as new. */ in inc_lock()
968 for (i = 0; i < FF_FS_LOCK && Files[i].fs; i++) ; in inc_lock()
969 if (i == FF_FS_LOCK) return 0; /* No free entry to register (int err) */ in inc_lock()
970 Files[i].fs = dp->obj.fs; in inc_lock()
971 Files[i].clu = dp->obj.sclust; in inc_lock()
972 Files[i].ofs = dp->dptr; in inc_lock()
973 Files[i].ctr = 0; in inc_lock()
976 if (acc >= 1 && Files[i].ctr) return 0; /* Access violation (int err) */ in inc_lock()
978 Files[i].ctr = acc ? 0x100 : Files[i].ctr + 1; /* Set semaphore value */ in inc_lock()
980 return i + 1; /* Index number origin from 1 */ in inc_lock()
985 UINT i /* Semaphore index (1..) */ in dec_lock() argument
992 if (--i < FF_FS_LOCK) { /* Index number origin from 0 */ in dec_lock()
993 n = Files[i].ctr; in dec_lock()
996 Files[i].ctr = n; in dec_lock()
997 if (n == 0) Files[i].fs = 0; /* Delete the entry if open count gets zero */ in dec_lock()
1010 UINT i; in clear_lock() local
1012 for (i = 0; i < FF_FS_LOCK; i++) { in clear_lock()
1013 if (Files[i].fs == fs) Files[i].fs = 0; in clear_lock()
1281 UINT i; in find_bitmap() local
1290 i = val / 8 % SS(fs); bm = 1 << (val % 8); in find_bitmap()
1293 bv = fs->win[i] & bm; bm <<= 1; /* Get bit value */ in find_bitmap()
1295 val = 0; bm = 0; i = SS(fs); in find_bitmap()
1305 } while (++i < SS(fs)); in find_bitmap()
1322 UINT i; in change_bitmap() local
1328 i = clst / 8 % SS(fs); /* Byte offset in the sector */ in change_bitmap()
1334 if (bv == (int)((fs->win[i] & bm) != 0)) return FR_INT_ERR; /* Is the bit expected value? */ in change_bitmap()
1335 fs->win[i] ^= bm; /* Flip the bit */ in change_bitmap()
1340 } while (++i < SS(fs)); /* Next byte */ in change_bitmap()
1341 i = 0; in change_bitmap()
1859 UINT i, s; local
1865 i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
1870 if (i >= FF_MAX_LFN + 1 || ff_wtoupper(uc) != ff_wtoupper(lfnbuf[i++])) { /* Compare it */
1879 …if ((dir[LDIR_Ord] & LLEF) && wc && lfnbuf[i]) return 0; /* Last segment matched but different len…
1895 UINT i, s; local
1901 i = ((dir[LDIR_Ord] & ~LLEF) - 1) * 13; /* Offset in the LFN buffer */
1906 if (i >= FF_MAX_LFN + 1) return 0; /* Buffer overflow? */
1907 lfnbuf[i++] = wc = uc; /* Store it */
1914 if (i >= FF_MAX_LFN + 1) return 0; /* Buffer overflow? */
1915 lfnbuf[i] = 0;
1935 UINT i, s; local
1944 i = (ord - 1) * 13; /* Get offset in the LFN working buffer */
1947 if (wc != 0xFFFF) wc = lfn[i++]; /* Get an effective character */
1951 if (wc == 0xFFFF || !lfn[i]) ord |= LLEF; /* Last LFN part is the start of LFN sequence */
1973 UINT i, j; local
1984 for (i = 0; i < 16; i++) {
1994 i = 7;
1998 ns[i--] = c;
1999 } while (i && seq);
2000 ns[i] = '~';
2003 for (j = 0; j < i && dst[j] != ' '; j++) { /* Find the offset to append */
2005 if (j == i - 1) break;
2010 dst[j++] = (i < 8) ? ns[i++] : ' ';
2048 UINT i, szblk; local
2053 for (i = sum = 0; i < szblk; i++) {
2054 if (i == XDIR_SetSum) { /* Skip 2-byte sum field */
2055 i++;
2057 sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + dir[i];
2104 UINT i, sz_ent; local
2127 i = 2 * SZDIRE; /* Name offset to load */
2135 if (i < MAXDIRB(FF_MAX_LFN)) memcpy(dirb + i, dp->dir, SZDIRE);
2136 } while ((i += SZDIRE) < sz_ent);
2139 if (i <= MAXDIRB(FF_MAX_LFN)) {
2234 UINT i; local
2245 i = SZDIRE * 2; /* Top of file_name entries */
2248 dirb[i++] = ET_FILENAME; dirb[i++] = 0;
2251 st_word(dirb + i, wc); /* Store it */
2252 i += 2;
2253 } while (i % SZDIRE != 0);
2810 UINT i, ni, si, di; local
2839 for (i = 0; i < 11; i++) { /* Create dot name for SFN entry */
2840 dp->fn[i] = (i < di) ? '.' : ' ';
2842 dp->fn[i] = cf | NS_DOT; /* This is a dot entry */
2860 i = b = 0; ni = 8;
2869 if (i >= ni || si == di) { /* End of field? */
2876 si = di; i = 8; ni = 11; b <<= 2; /* Enter name extension */
2898 if (i >= ni - 1) { /* Field overflow? */
2900 i = ni; continue; /* Next field */
2902 dp->fn[i++] = (BYTE)(wc >> 8); /* Put 1st byte */
2915 dp->fn[i++] = (BYTE)wc;
2934 UINT ni, si, i;
2940 si = i = 0; ni = 8;
2946 sfn[i++] = c;
2961 if (c == '.' || i >= ni) { /* End of body or field overflow? */
2963 i = 8; ni = 11; /* Enter file extension field */
2977 if (!dbc_2nd(d) || i >= ni - 1) return FR_INVALID_NAME; /* Reject invalid DBC */
2978 sfn[i++] = c;
2979 sfn[i++] = d;
2983 sfn[i++] = c;
2987 if (i == 0) return FR_INVALID_NAME; /* Reject nul string */
3096 int i; local
3108 i = FF_VOLUMES;
3110 i = (int)*tp - '0'; /* Get the LD number */
3114 i = 0;
3116 sp = VolumeStr[i]; tp = *path; /* This string volume ID and path name */
3122 } while ((c || tp != tt) && ++i < FF_VOLUMES); /* Repeat for each id until pattern match */
3125 if (i < FF_VOLUMES) { /* If a volume ID is found, get the drive number and strip it */
3126 vol = i; /* Drive number */
3134 i = 0;
3136 tt = tp; sp = VolumeStr[i]; /* Path name and this string volume ID */
3142 …} while ((c || (tc != '/' && !IsTerminator(tc))) && ++i < FF_VOLUMES); /* Repeat for each ID until…
3143 if (i < FF_VOLUMES) { /* If a volume ID is found, get the drive number and strip it */
3144 vol = i; /* Drive number */
3192 UINT i; local
3197 for (i = 0, bcc = 0xFFFFFFFF; i < 92; i++) { /* Check header BCC */
3198 bcc = crc32(bcc, i - GPTH_Bcc < 4 ? 0 : gpth[i]);
3283 UINT fmt, i; local
3301 for (v_ent = i = 0; i < n_ent; i++) { /* Find FAT partition */
3302 if (move_window(fs, pt_lba + i * SZ_GPTE / SS(fs)) != FR_OK) return 4; /* PT sector */
3303 ofs = i * SZ_GPTE % SS(fs); /* Offset in the sector */
3315 for (i = 0; i < 4; i++) { /* Load partition offset in the MBR */
3316 mbr_pt[i] = ld_dword(fs->win + MBR_Table + i * SZ_PTE + PTE_StLba);
3318 i = part ? part - 1 : 0; /* Table index to find first */
3320 fmt = mbr_pt[i] ? check_fs(fs, mbr_pt[i]) : 3; /* Check if the partition is FAT */
3321 } while (part == 0 && fmt >= 2 && ++i < 4);
3399 DWORD so, cv, bcl, i; local
3401 for (i = BPB_ZeroedEx; i < BPB_ZeroedEx + 53 && fs->win[i] == 0; i++) ; /* Check zero filler */
3402 if (i < BPB_ZeroedEx + 53) return FR_NO_FILESYSTEM;
3433 so = i = 0;
3435 if (i == 0) {
3440 if (fs->win[i] == ET_BITMAP) break; /* Is it a bitmap entry? */
3441 i = (i + SZDIRE) % SS(fs); /* Next entry */
3443 bcl = ld_dword(fs->win + i + 20); /* Bitmap cluster */
4210 UINT i; local
4256 for (i = FF_VOLUMES - 1; i && fs != FatFs[i]; i--) ; /* Set current drive */
4257 CurrVol = (BYTE)i;
4275 UINT i, n; local
4296 i = len; /* Bottom of buffer (directory stack base) */
4317 if (i < n + 1) { /* Insufficient space to store the path name? */
4320 while (n) buff[--i] = fno.fname[--n]; /* Stack the name */
4321 buff[--i] = '/';
4325 if (i == len) buff[--i] = '/'; /* Is it the root-directory? */
4330 if (i >= n + 2) {
4337 if (i >= 3) {
4347 do *tp++ = buff[i++]; while (i < len); /* Copy stacked path string */
4760 UINT i; local
4790 i = 0; /* Offset in the sector */
4792 if (i == 0) {
4796 for (b = 8, bm = fs->win[i]; b && clst; b--, clst--) {
4800 i = (i + 1) % SS(fs);
4807 i = 0; /* Offset in the sector */
4809 if (i == 0) {
4814 if (ld_word(fs->win + i) == 0) nfree++;
4815 i += 2;
4817 if ((ld_dword(fs->win + i) & 0x0FFFFFFF) == 0) nfree++;
4818 i += 4;
4820 i %= SS(fs);
5666 UINT i, cy; local
5719 for (i = 0; i < ss; bcc = crc32(bcc, buf[i++])) ; /* Calculate table check sum */
5737 …for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
5746 …for (i = 0, bcc= 0xFFFFFFFF; i < 92; bcc = crc32(bcc, buf[i++])) ; /* Calculate header check sum */
5766 …for (i = 0, nxt_alloc32 = n_sc; i < 4 && nxt_alloc32 != 0 && nxt_alloc32 < sz_drv32; i++, nxt_allo…
5767 sz_part32 = (DWORD)plst[i]; /* Get partition size */
5818 UINT n_fat, n_root, i; /* Index, Number of FATs and Number of roor dir entries */ local
5877 ofs = i = 0;
5880 …if (!memcmp(buf + ofs + GPTE_PtGuid, GUID_MS_Basic, 16) && ++i == ipart) { /* MS basic data partit…
5970 st = 0; si = 0; i = 0; j = 0; szb_case = 0;
5993 sum = xsum32(buf[i + 0] = (BYTE)ch, sum); /* Put it into the write buffer */
5994 sum = xsum32(buf[i + 1] = (BYTE)(ch >> 8), sum);
5995 i += 2; szb_case += 2;
5996 if (si == 0 || i == sz_buf * ss) { /* Write buffered data when buffer full or end of process */
5997 n = (i + ss - 1) / ss;
5999 sect += n; i = 0;
6010 …for (i = 0; nbit != 0 && i / 8 < sz_buf * ss; buf[i / 8] |= 1 << (i % 8), i++, nbit--) ; /* Mark u…
6020 memset(buf, 0, sz_buf * ss); i = 0; /* Clear work area and reset write offset */
6022 st_dword(buf + i, 0xFFFFFFF8); i += 4; clu++;
6023 st_dword(buf + i, 0xFFFFFFFF); i += 4; clu++;
6026 while (nbit != 0 && i < sz_buf * ss) { /* Create a chain */
6027 st_dword(buf + i, (nbit > 1) ? clu + 1 : 0xFFFFFFFF);
6028 i += 4; clu++; nbit--;
6031 } while (nbit != 0 && i < sz_buf * ss);
6070 …for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) ; /* Log2 of sector size…
6071 …for (buf[BPB_SecPerClusEx] = 0, i = sz_au; i >>= 1; buf[BPB_SecPerClusEx]++) ; /* Log2 of cluster …
6076 for (i = sum = 0; i < ss; i++) { /* VBR checksum */
6077 …if (i != BPB_VolFlagEx && i != BPB_VolFlagEx + 1 && i != BPB_PercInUseEx) sum = xsum32(buf[i], sum…
6084 for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
6090 for (i = 0; i < ss; sum = xsum32(buf[i++], sum)) ; /* VBR checksum */
6094 for (i = 0; i < ss; i += 4) st_dword(buf + i, sum); /* Fill with checksum value */
6107 for (i = 0, pau = 1; cst32[i] && cst32[i] <= n; i++, pau <<= 1) ; /* Get from table */
6117 for (i = 0, pau = 1; cst[i] && cst[i] <= n; i++, pau <<= 1) ; /* Get from table */
6231 for (i = 0; i < n_fat; i++) { /* Initialize FATs each */
6491 int i, nc; local
6504 i = pb->idx; /* Write index of pb->buf[] */
6505 if (i < 0) return; /* In write error? */
6557 st_word(&pb->buf[i], hs);
6558 i += 2;
6561 st_word(&pb->buf[i], wc);
6562 i += 2;
6565 pb->buf[i++] = (BYTE)(hs >> 8);
6566 pb->buf[i++] = (BYTE)hs;
6569 pb->buf[i++] = (BYTE)(wc >> 8);
6570 pb->buf[i++] = (BYTE)wc;
6575 pb->buf[i++] = (BYTE)(0xF0 | hs >> 8);
6576 pb->buf[i++] = (BYTE)(0x80 | (hs >> 2 & 0x3F));
6577 pb->buf[i++] = (BYTE)(0x80 | (hs & 3) << 4 | (wc >> 6 & 0x0F));
6578 pb->buf[i++] = (BYTE)(0x80 | (wc & 0x3F));
6581 pb->buf[i++] = (BYTE)wc;
6585 pb->buf[i++] = (BYTE)(0xC0 | wc >> 6);
6588 pb->buf[i++] = (BYTE)(0xE0 | wc >> 12);
6589 pb->buf[i++] = (BYTE)(0x80 | (wc >> 6 & 0x3F));
6591 pb->buf[i++] = (BYTE)(0x80 | (wc & 0x3F));
6599 pb->buf[i++] = (BYTE)(wc >> 8); nc++;
6601 pb->buf[i++] = (BYTE)wc;
6605 pb->buf[i++] = (BYTE)c;
6608 if (i >= (int)(sizeof pb->buf) - 4) { /* Write buffered characters to the file */
6609 f_write(pb->fp, pb->buf, (UINT)i, &n);
6610 i = (n == (UINT)i) ? 0 : -1;
6612 pb->idx = i;
6809 UINT i, j, w, f, r; local
6899 for (i = 0; str[i]; putc_bfd(&pb, str[i++])) ; /* Body */
6931 i = 0;
6935 str[i++] = d + '0';
6936 } while (v && i < SZ_NUM_BUF);
6937 if (f & 1) str[i++] = '-'; /* Sign */
6939 for (j = i; !(f & 2) && j < w; j++) putc_bfd(&pb, pad); /* Left pads */
6940 do putc_bfd(&pb, (TCHAR)str[--i]); while (i); /* Body */
6965 UINT i; local
6968 for (i = 0; validcp[i] != 0 && validcp[i] != cp; i++) ; /* Find the code page */
6969 if (validcp[i] != cp) return FR_INVALID_PARAMETER; /* Not found? */
6974 DbcTbl = tables[i];
6976 ExCvt = tables[i];