Lines Matching refs:dp

935 	FF_DIR* dp,		/* Directory object pointing the file to be checked */  in chk_lock()  argument
945 if (Files[i].fs == dp->obj.fs && /* Check if the object matches with an open object */ in chk_lock()
946 Files[i].clu == dp->obj.sclust && in chk_lock()
947 Files[i].ofs == dp->dptr) break; in chk_lock()
971 FF_DIR* dp, /* Directory object pointing the file to register or increment */ in inc_lock() argument
979 if (Files[i].fs == dp->obj.fs && in inc_lock()
980 Files[i].clu == dp->obj.sclust && in inc_lock()
981 Files[i].ofs == dp->dptr) break; in inc_lock()
987 Files[i].fs = dp->obj.fs; in inc_lock()
988 Files[i].clu = dp->obj.sclust; in inc_lock()
989 Files[i].ofs = dp->dptr; in inc_lock()
1684 FF_DIR* dp, /* Pointer to directory object */ in dir_sdi() argument
1689 FATFS *fs = dp->obj.fs; in dir_sdi()
1695 dp->dptr = ofs; /* Set current offset */ in dir_sdi()
1696 clst = dp->obj.sclust; /* Table start cluster (0:root) */ in dir_sdi()
1699 if (FF_FS_EXFAT) dp->obj.stat = 0; /* exFAT: Root dir has an FAT chain */ in dir_sdi()
1704 dp->sect = fs->dirbase; in dir_sdi()
1709 clst = get_fat(&dp->obj, clst); /* Get next cluster */ in dir_sdi()
1714 dp->sect = clst2sect(fs, clst); in dir_sdi()
1716 dp->clust = clst; /* Current cluster# */ in dir_sdi()
1717 if (dp->sect == 0) return FR_INT_ERR; in dir_sdi()
1718 dp->sect += ofs / SS(fs); /* Sector# of the directory entry */ in dir_sdi()
1719 dp->dir = fs->win + (ofs % SS(fs)); /* Pointer to the entry in the win[] */ in dir_sdi()
1732 FF_DIR* dp, /* Pointer to the directory object */ in dir_next() argument
1737 FATFS *fs = dp->obj.fs; in dir_next()
1740 ofs = dp->dptr + SZDIRE; /* Next entry */ in dir_next()
1741 …if (ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) dp->sect = 0;… in dir_next()
1742 if (dp->sect == 0) return FR_NO_FILE; /* Report EOT if it has been disabled */ in dir_next()
1745 dp->sect++; /* Next sector */ in dir_next()
1747 if (dp->clust == 0) { /* Static table */ in dir_next()
1749 dp->sect = 0; return FR_NO_FILE; in dir_next()
1754 clst = get_fat(&dp->obj, dp->clust); /* Get next cluster */ in dir_next()
1760 dp->sect = 0; return FR_NO_FILE; in dir_next()
1762 clst = create_chain(&dp->obj, dp->clust); /* Allocate a cluster */ in dir_next()
1767 if (FF_FS_EXFAT) dp->obj.stat |= 4; /* exFAT: The directory has been stretched */ in dir_next()
1769 if (!stretch) dp->sect = 0; /* (this line is to suppress compiler warning) */ in dir_next()
1770 dp->sect = 0; return FR_NO_FILE; /* Report EOT */ in dir_next()
1773 dp->clust = clst; /* Initialize data for new cluster */ in dir_next()
1774 dp->sect = clst2sect(fs, clst); in dir_next()
1778 dp->dptr = ofs; /* Current entry */ in dir_next()
1779 dp->dir = fs->win + ofs % SS(fs); /* Pointer to the entry in the win[] */ in dir_next()
1793 FF_DIR* dp, /* Pointer to the directory object */ argument
1799 FATFS *fs = dp->obj.fs;
1802 res = dir_sdi(dp, 0);
1806 res = move_window(fs, dp->sect);
1809 …if ((fs->fs_type == FS_EXFAT) ? (int)((dp->dir[XDIR_Type] & 0x80) == 0) : (int)(dp->dir[DIR_Name] …
1811 if (dp->dir[DIR_Name] == DDEM || dp->dir[DIR_Name] == 0) {
1817 res = dir_next(dp, 1);
2159 FF_DIR* dp /* Reading direcotry object pointing top of the entry block to load */ argument
2164 BYTE* dirb = dp->obj.fs->dirbuf; /* Pointer to the on-memory direcotry entry block 85+C0+C1s */
2168 res = move_window(dp->obj.fs, dp->sect);
2170 if (dp->dir[XDIR_Type] != ET_FILEDIR) return FR_INT_ERR; /* Invalid order */
2171 mem_cpy(dirb + 0 * SZDIRE, dp->dir, SZDIRE);
2176 res = dir_next(dp, 0);
2179 res = move_window(dp->obj.fs, dp->sect);
2181 if (dp->dir[XDIR_Type] != ET_STREAM) return FR_INT_ERR; /* Invalid order */
2182 mem_cpy(dirb + 1 * SZDIRE, dp->dir, SZDIRE);
2188 res = dir_next(dp, 0);
2191 res = move_window(dp->obj.fs, dp->sect);
2193 if (dp->dir[XDIR_Type] != ET_FILENAME) return FR_INT_ERR; /* Invalid order */
2194 if (i < MAXDIRB(FF_MAX_LFN)) mem_cpy(dirb + i, dp->dir, SZDIRE);
2228 FF_DIR* dp, /* Blank directory object to be used to access containing direcotry */ argument
2235 dp->obj.fs = obj->fs;
2236 dp->obj.sclust = obj->c_scl;
2237 dp->obj.stat = (BYTE)obj->c_size;
2238 dp->obj.objsize = obj->c_size & 0xFFFFFF00;
2239 dp->obj.n_frag = 0;
2240 dp->blk_ofs = obj->c_ofs;
2242 res = dir_sdi(dp, dp->blk_ofs); /* Goto object's entry block */
2244 res = load_xdir(dp); /* Load the object's entry block */
2257 FF_DIR* dp /* Pointer to the direcotry object */ argument
2262 BYTE* dirb = dp->obj.fs->dirbuf; /* Pointer to the direcotry entry block 85+C0+C1s */
2269 res = dir_sdi(dp, dp->blk_ofs);
2271 res = move_window(dp->obj.fs, dp->sect);
2273 mem_cpy(dp->dir, dirb, SZDIRE);
2274 dp->obj.fs->wflag = 1;
2277 res = dir_next(dp, 0);
2331 #define DIR_READ_FILE(dp) dir_read(dp, 0) argument
2332 #define DIR_READ_LABEL(dp) dir_read(dp, 1) argument
2335 FF_DIR* dp, /* Pointer to the directory object */ argument
2340 FATFS *fs = dp->obj.fs;
2346 while (dp->sect) {
2347 res = move_window(fs, dp->sect);
2349 b = dp->dir[DIR_Name]; /* Test for the entry type */
2359 dp->blk_ofs = dp->dptr; /* Get location of the block */
2360 res = load_xdir(dp); /* Load the entry block */
2362 dp->obj.attr = fs->dirbuf[XDIR_Attr] & AM_MASK; /* Get attribute */
2370 dp->obj.attr = attr = dp->dir[DIR_Attr] & AM_MASK; /* Get attribute */
2377 sum = dp->dir[LDIR_Chksum];
2379 dp->blk_ofs = dp->dptr;
2382 … ord = (b == ord && sum == dp->dir[LDIR_Chksum] && pick_lfn(fs->lfnbuf, dp->dir)) ? ord - 1 : 0xFF;
2384 if (ord != 0 || sum != sum_sfn(dp->dir)) { /* Is there a valid LFN? */
2385 dp->blk_ofs = 0xFFFFFFFF; /* It has no LFN. */
2396 res = dir_next(dp, 0); /* Next entry */
2400 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */
2413 FF_DIR* dp /* Pointer to the directory object with the file name */ argument
2417 FATFS *fs = dp->obj.fs;
2423 res = dir_sdi(dp, 0); /* Rewind directory object */
2431 while ((res = DIR_READ_FILE(dp)) == FR_OK) { /* Read an item */
2447 ord = sum = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */
2450 res = move_window(fs, dp->sect);
2452 c = dp->dir[DIR_Name];
2455 dp->obj.attr = a = dp->dir[DIR_Attr] & AM_MASK;
2457 ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */
2460 if (!(dp->fn[NSFLAG] & NS_NOLFN)) {
2462 sum = dp->dir[LDIR_Chksum];
2464 dp->blk_ofs = dp->dptr; /* Start offset of LFN */
2467 … ord = (c == ord && sum == dp->dir[LDIR_Chksum] && cmp_lfn(fs->lfnbuf, dp->dir)) ? ord - 1 : 0xFF;
2470 if (ord == 0 && sum == sum_sfn(dp->dir)) break; /* LFN matched? */
2471 if (!(dp->fn[NSFLAG] & NS_LOSS) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* SFN matched? */
2472 ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */
2476 dp->obj.attr = dp->dir[DIR_Attr] & AM_MASK;
2477 …if (!(dp->dir[DIR_Attr] & AM_VOL) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* Is it a valid entry?…
2479 res = dir_next(dp, 0); /* Next entry */
2494 FF_DIR* dp /* Target directory with object name to be created */ argument
2498 FATFS *fs = dp->obj.fs;
2504 if (dp->fn[NSFLAG] & (NS_DOT | NS_NONAME)) return FR_INVALID_NAME; /* Check name validity */
2510 res = dir_alloc(dp, nent); /* Allocate directory entries */
2512 dp->blk_ofs = dp->dptr - SZDIRE * (nent - 1); /* Set the allocated entry block offset */
2514 if (dp->obj.stat & 4) { /* Has the directory been stretched by new allocation? */
2515 dp->obj.stat &= ~4;
2516 res = fill_first_frag(&dp->obj); /* Fill the first fragment on the FAT if needed */
2518 …res = fill_last_frag(&dp->obj, dp->clust, 0xFFFFFFFF); /* Fill the last fragment on the FAT if nee…
2520 if (dp->obj.sclust != 0) { /* Is it a sub-directory? */
2523 res = load_obj_xdir(&dj, &dp->obj); /* Load the object status */
2525dp->obj.objsize += (DWORD)fs->csize * SS(fs); /* Increase the directory size by cluster size */
2526 st_qword(fs->dirbuf + XDIR_FileSize, dp->obj.objsize); /* Update the allocation status */
2527 st_qword(fs->dirbuf + XDIR_ValidFileSize, dp->obj.objsize);
2528 fs->dirbuf[XDIR_GenFlags] = dp->obj.stat | 1;
2539 mem_cpy(sn, dp->fn, 12);
2541 dp->fn[NSFLAG] = NS_NOLFN; /* Find only SFN */
2543 gen_numname(dp->fn, sn, fs->lfnbuf, n); /* Generate a numbered name */
2544 res = dir_find(dp); /* Check if the name collides with existing SFN */
2549 dp->fn[NSFLAG] = sn[NSFLAG];
2554 res = dir_alloc(dp, nent); /* Allocate entries */
2556 res = dir_sdi(dp, dp->dptr - nent * SZDIRE);
2558 sum = sum_sfn(dp->fn); /* Checksum value of the SFN tied to the LFN */
2560 res = move_window(fs, dp->sect);
2562 put_lfn(fs->lfnbuf, dp->dir, (BYTE)nent, sum);
2564 res = dir_next(dp, 0); /* Next entry */
2570 res = dir_alloc(dp, 1); /* Allocate an entry for SFN */
2576 res = move_window(fs, dp->sect);
2578 mem_set(dp->dir, 0, SZDIRE); /* Clean the entry */
2579 mem_cpy(dp->dir + DIR_Name, dp->fn, 11); /* Put SFN */
2581 dp->dir[DIR_NTres] = dp->fn[NSFLAG] & (NS_BODY | NS_EXT); /* Put NT flag */
2600 FF_DIR* dp /* Directory object pointing the entry to be removed */ argument
2604 FATFS *fs = dp->obj.fs;
2606 DWORD last = dp->dptr;
2608 …res = (dp->blk_ofs == 0xFFFFFFFF) ? FR_OK : dir_sdi(dp, dp->blk_ofs); /* Goto top of the entry blo…
2611 res = move_window(fs, dp->sect);
2614 dp->dir[XDIR_Type] &= 0x7F; /* Clear the entry InUse flag. */
2616 dp->dir[DIR_Name] = DDEM; /* Mark the entry 'deleted'. */
2619 …if (dp->dptr >= last) break; /* If reached last entry then all entries of the object has been dele…
2620 res = dir_next(dp, 0); /* Next entry */
2626 res = move_window(fs, dp->sect);
2628 dp->dir[DIR_Name] = DDEM; /* Mark the entry 'deleted'.*/
2646 FF_DIR* dp, /* Pointer to the directory object */ argument
2654 FATFS *fs = dp->obj.fs;
2661 if (dp->sect == 0) return; /* Exit if read pointer has reached end of directory */
2671 if (dp->blk_ofs != 0xFFFFFFFF) { /* Get LFN if available */
2690 wc = dp->dir[si++]; /* Get a char */
2695 if (dbc_1st((BYTE)wc) && si != 8 && si != 11 && dbc_2nd(dp->dir[si])) { /* Make a DBC if needed */
2696 wc = wc << 8 | dp->dir[si++];
2716 if (IsUpper(wc) && (dp->dir[DIR_NTres] & lcf)) wc += 0x20;
2721 …if (!dp->dir[DIR_NTres]) fno->altname[0] = 0; /* Altname is not needed if neither LFN nor case inf…
2727 c = (TCHAR)dp->dir[si++];
2736 fno->fattrib = dp->dir[DIR_Attr]; /* Attribute */
2737 fno->fsize = ld_dword(dp->dir + DIR_FileSize); /* Size */
2738 fno->ftime = ld_word(dp->dir + DIR_ModTime + 0); /* Time */
2739 fno->fdate = ld_word(dp->dir + DIR_ModTime + 2); /* Date */
2830 FF_DIR* dp, /* Pointer to the directory object */ argument
2843 p = *path; lfn = dp->obj.fs->lfnbuf; di = 0;
2863 dp->fn[i] = (i < di) ? '.' : ' ';
2865 dp->fn[i] = cf | NS_DOT; /* This is a dot entry */
2882 mem_set(dp->fn, ' ', 11);
2925 dp->fn[i++] = (BYTE)(wc >> 8); /* Put 1st byte */
2938 dp->fn[i++] = (BYTE)wc;
2941 …if (dp->fn[0] == DDEM) dp->fn[0] = RDDEM; /* If the first character collides with DDEM, replace it…
2950 dp->fn[NSFLAG] = cf; /* SFN is created into dp->fn[] */
2961 p = *path; sfn = dp->fn;
3027 FF_DIR* dp, /* Directory object to return last directory and found object */ argument
3033 FATFS *fs = dp->obj.fs;
3038 dp->obj.sclust = fs->cdir; /* Start from current directory */
3043 dp->obj.sclust = 0; /* Start from root directory */
3046 dp->obj.n_frag = 0; /* Invalidate last fragment counter of the object */
3048 if (fs->fs_type == FS_EXFAT && dp->obj.sclust) { /* exFAT: Retrieve the sub-directory's status */
3051 dp->obj.c_scl = fs->cdc_scl;
3052 dp->obj.c_size = fs->cdc_size;
3053 dp->obj.c_ofs = fs->cdc_ofs;
3054 res = load_obj_xdir(&dj, &dp->obj);
3056 dp->obj.objsize = ld_dword(fs->dirbuf + XDIR_FileSize);
3057 dp->obj.stat = fs->dirbuf[XDIR_GenFlags] & 2;
3063 dp->fn[NSFLAG] = NS_NONAME;
3064 res = dir_sdi(dp, 0);
3068 res = create_name(dp, &path); /* Get a segment name of the path */
3070 res = dir_find(dp); /* Find an object with the segment name */
3071 ns = dp->fn[NSFLAG];
3076 dp->fn[NSFLAG] = NS_NONAME;
3086 if (!(dp->obj.attr & AM_DIR)) { /* It is not a sub-directory and cannot follow */
3091 dp->obj.c_scl = dp->obj.sclust;
3092 dp->obj.c_size = ((DWORD)dp->obj.objsize & 0xFFFFFF00) | dp->obj.stat;
3093 dp->obj.c_ofs = dp->blk_ofs;
3094 init_alloc_info(fs, &dp->obj); /* Open next directory */
3098 dp->obj.sclust = ld_clust(fs, fs->win + dp->dptr % SS(fs)); /* Open next directory */
4416 FF_DIR* dp, /* Pointer to directory object to create */ argument
4425 if (!dp) return FR_INVALID_OBJECT;
4430 dp->obj.fs = fs;
4432 res = follow_path(dp, path); /* Follow the path to the directory */
4434 if (!(dp->fn[NSFLAG] & NS_NONAME)) { /* It is not the origin directory itself */
4435 if (dp->obj.attr & AM_DIR) { /* This object is a sub-directory */
4438 dp->obj.c_scl = dp->obj.sclust; /* Get containing directory inforamation */
4439 dp->obj.c_size = ((DWORD)dp->obj.objsize & 0xFFFFFF00) | dp->obj.stat;
4440 dp->obj.c_ofs = dp->blk_ofs;
4441 init_alloc_info(fs, &dp->obj); /* Get object allocation info */
4445 dp->obj.sclust = ld_clust(fs, dp->dir); /* Get object allocation info */
4452 dp->obj.id = fs->id;
4453 res = dir_sdi(dp, 0); /* Rewind directory */
4456 if (dp->obj.sclust != 0) {
4457 dp->obj.lockid = inc_lock(dp, 0); /* Lock the sub directory */
4458 if (!dp->obj.lockid) res = FR_TOO_MANY_OPEN_FILES;
4460 dp->obj.lockid = 0; /* Root directory need not to be locked */
4469 if (res != FR_OK) dp->obj.fs = 0; /* Invalidate the directory object if function faild */
4482 FF_DIR *dp /* Pointer to the directory object to be closed */ argument
4489 res = validate(&dp->obj, &fs); /* Check validity of the file object */
4492 if (dp->obj.lockid) res = dec_lock(dp->obj.lockid); /* Decrement sub-directory open counter */
4493 if (res == FR_OK) dp->obj.fs = 0; /* Invalidate directory object */
4495 dp->obj.fs = 0; /* Invalidate directory object */
4512 FF_DIR* dp, /* Pointer to the open directory object */ argument
4521 res = validate(&dp->obj, &fs); /* Check validity of the directory object */
4524 res = dir_sdi(dp, 0); /* Rewind the directory object */
4527 res = DIR_READ_FILE(dp); /* Read an item */
4530 get_fileinfo(dp, fno); /* Get the object information */
4531 res = dir_next(dp, 0); /* Increment index for next */
4548 FF_DIR* dp, /* Pointer to the open directory object */ argument
4556 res = f_readdir(dp, fno); /* Get a directory item */
4558 if (pattern_matching(dp->pat, fno->fname, 0, 0)) break; /* Test for the file name */
4560 if (pattern_matching(dp->pat, fno->altname, 0, 0)) break; /* Test for alternative name if exist */
4573 FF_DIR* dp, /* Pointer to the blank directory object */ argument
4582 dp->pat = pattern; /* Save pointer to pattern string */
4583 res = f_opendir(dp, path); /* Open the target directory */
4585 res = f_findnext(dp, fno); /* Find the first item */