Lines Matching refs:res

234 #define ABORT(fs, res)		{ fp->err = (BYTE)(res); LEAVE_FF(fs, res); }  argument
242 #define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; } argument
244 #define LEAVE_FF(fs, res) return res argument
501 #define LEAVE_MKFS(res) return res argument
524 #define LEAVE_MKFS(res) return res argument
536 #define LEAVE_MKFS(res) return res argument
548 #define LEAVE_MKFS(res) { if (!work) ff_memfree(buf); return res; } argument
900 FRESULT res /* Result code to be returned */ in unlock_fs() argument
903 if (fs && res != FR_NOT_ENABLED && res != FR_INVALID_DRIVE && res != FR_TIMEOUT) { in unlock_fs()
989 FRESULT res; in dec_lock() local
998 res = FR_OK; in dec_lock()
1000 res = FR_INT_ERR; /* Invalid index nunber */ in dec_lock()
1002 return res; in dec_lock()
1029 FRESULT res = FR_OK; in sync_window() local
1039 res = FR_DISK_ERR; in sync_window()
1042 return res; in sync_window()
1052 FRESULT res = FR_OK; in move_window() local
1057 res = sync_window(fs); /* Flush the window */ in move_window()
1059 if (res == FR_OK) { /* Fill sector window with new data */ in move_window()
1062 res = FR_DISK_ERR; in move_window()
1067 return res; in move_window()
1082 FRESULT res; in sync_fs() local
1085 res = sync_window(fs); in sync_fs()
1086 if (res == FR_OK) { in sync_fs()
1100 if (disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR; in sync_fs()
1103 return res; in sync_fs()
1217 FRESULT res = FR_INT_ERR; in put_fat() local
1224 res = move_window(fs, fs->fatbase + (bc / SS(fs))); in put_fat()
1225 if (res != FR_OK) break; in put_fat()
1229 res = move_window(fs, fs->fatbase + (bc / SS(fs))); in put_fat()
1230 if (res != FR_OK) break; in put_fat()
1237 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 2))); in put_fat()
1238 if (res != FR_OK) break; in put_fat()
1247 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 4))); in put_fat()
1248 if (res != FR_OK) break; in put_fat()
1257 return res; in put_fat()
1354 FRESULT res; in fill_first_frag() local
1360 res = put_fat(obj->fs, cl, cl + 1); in fill_first_frag()
1361 if (res != FR_OK) return res; in fill_first_frag()
1379 FRESULT res; in fill_last_frag() local
1383 res = put_fat(obj->fs, lcl - obj->n_frag + 1, (obj->n_frag > 1) ? lcl - obj->n_frag + 2 : term); in fill_last_frag()
1384 if (res != FR_OK) return res; in fill_last_frag()
1405 FRESULT res = FR_OK; in remove_chain() local
1419 res = put_fat(fs, pclst, 0xFFFFFFFF); in remove_chain()
1420 if (res != FR_OK) return res; in remove_chain()
1430 res = put_fat(fs, clst, 0); /* Mark the cluster 'free' on the FAT */ in remove_chain()
1431 if (res != FR_OK) return res; in remove_chain()
1443res = change_bitmap(fs, scl, ecl - scl + 1, 0); /* Mark the cluster block 'free' on the bitmap */ in remove_chain()
1444 if (res != FR_OK) return res; in remove_chain()
1500 FRESULT res; in create_chain() local
1521 res = change_bitmap(fs, ncl, 1, 1); /* Mark the cluster 'in use' */ in create_chain()
1522 if (res == FR_INT_ERR) return 1; in create_chain()
1523 if (res == FR_DISK_ERR) return 0xFFFFFFFF; in create_chain()
1537 res = fill_last_frag(obj, clst, ncl); /* Fill last fragment on the FAT and link it to new one */ in create_chain()
1538 if (res == FR_OK) obj->n_frag = 1; in create_chain()
1570 res = put_fat(fs, ncl, 0xFFFFFFFF); /* Mark the new cluster 'EOC' */ in create_chain()
1571 if (res == FR_OK && clst != 0) { in create_chain()
1572 res = put_fat(fs, clst, ncl); /* Link it from the previous one if needed */ in create_chain()
1576 if (res == FR_OK) { /* Update FSINFO if function succeeded. */ in create_chain()
1581 ncl = (res == FR_DISK_ERR) ? 0xFFFFFFFF : 1; /* Failed. Generate error status */ in create_chain()
1780 FRESULT res; local
1785 res = dir_sdi(dp, 0);
1786 if (res == FR_OK) {
1789 res = move_window(fs, dp->sect);
1790 if (res != FR_OK) break;
1800 res = dir_next(dp, 1); /* Next entry with table stretch enabled */
1801 } while (res == FR_OK);
1804 if (res == FR_NO_FILE) res = FR_DENIED; /* No directory entry to allocate */
1805 return res;
2103 FRESULT res; local
2109 res = move_window(dp->obj.fs, dp->sect);
2110 if (res != FR_OK) return res;
2117 res = dir_next(dp, 0);
2118 if (res == FR_NO_FILE) res = FR_INT_ERR; /* It cannot be */
2119 if (res != FR_OK) return res;
2120 res = move_window(dp->obj.fs, dp->sect);
2121 if (res != FR_OK) return res;
2129 res = dir_next(dp, 0);
2130 if (res == FR_NO_FILE) res = FR_INT_ERR; /* It cannot be */
2131 if (res != FR_OK) return res;
2132 res = move_window(dp->obj.fs, dp->sect);
2133 if (res != FR_OK) return res;
2173 FRESULT res; local
2183 res = dir_sdi(dp, dp->blk_ofs); /* Goto object's entry block */
2184 if (res == FR_OK) {
2185 res = load_xdir(dp); /* Load the object's entry block */
2187 return res;
2201 FRESULT res; local
2210 res = dir_sdi(dp, dp->blk_ofs);
2211 while (res == FR_OK) {
2212 res = move_window(dp->obj.fs, dp->sect);
2213 if (res != FR_OK) break;
2218 res = dir_next(dp, 0);
2220 return (res == FR_OK || res == FR_DISK_ERR) ? res : FR_INT_ERR;
2280 FRESULT res = FR_NO_FILE; local
2288 res = move_window(fs, dp->sect);
2289 if (res != FR_OK) break;
2292 res = FR_NO_FILE; break; /* Reached to end of the directory */
2301 res = load_xdir(dp); /* Load the entry block */
2302 if (res == FR_OK) {
2337 res = dir_next(dp, 0); /* Next entry */
2338 if (res != FR_OK) break;
2341 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */
2342 return res;
2357 FRESULT res; local
2364 res = dir_sdi(dp, 0); /* Rewind directory object */
2365 if (res != FR_OK) return res;
2372 while ((res = DIR_READ_FILE(dp)) == FR_OK) { /* Read an item */
2383 return res;
2391 res = move_window(fs, dp->sect);
2392 if (res != FR_OK) break;
2394 if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
2420 res = dir_next(dp, 0); /* Next entry */
2421 } while (res == FR_OK);
2423 return res;
2438 FRESULT res; local
2451 res = dir_alloc(dp, n_ent); /* Allocate directory entries */
2452 if (res != FR_OK) return res;
2457 res = fill_first_frag(&dp->obj); /* Fill the first fragment on the FAT if needed */
2458 if (res != FR_OK) return res;
2459res = fill_last_frag(&dp->obj, dp->clust, 0xFFFFFFFF); /* Fill the last fragment on the FAT if nee…
2460 if (res != FR_OK) return res;
2464 res = load_obj_xdir(&dj, &dp->obj); /* Load the object status */
2465 if (res != FR_OK) return res;
2470 res = store_xdir(&dj); /* Store the object status */
2471 if (res != FR_OK) return res;
2485 res = dir_find(dp); /* Check if the name collides with existing SFN */
2486 if (res != FR_OK) break;
2489 if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
2495 res = dir_alloc(dp, n_ent); /* Allocate entries */
2496 if (res == FR_OK && --n_ent) { /* Set LFN entry if needed */
2497 res = dir_sdi(dp, dp->dptr - n_ent * SZDIRE);
2498 if (res == FR_OK) {
2501 res = move_window(fs, dp->sect);
2502 if (res != FR_OK) break;
2505 res = dir_next(dp, 0); /* Next entry */
2506 } while (res == FR_OK && --n_ent);
2511 res = dir_alloc(dp, 1); /* Allocate an entry for SFN */
2516 if (res == FR_OK) {
2517 res = move_window(fs, dp->sect);
2518 if (res == FR_OK) {
2528 return res;
2544 FRESULT res; local
2549res = (dp->blk_ofs == 0xFFFFFFFF) ? FR_OK : dir_sdi(dp, dp->blk_ofs); /* Goto top of the entry blo…
2550 if (res == FR_OK) {
2552 res = move_window(fs, dp->sect);
2553 if (res != FR_OK) break;
2561 res = dir_next(dp, 0); /* Next entry */
2562 } while (res == FR_OK);
2563 if (res == FR_NO_FILE) res = FR_INT_ERR;
2567 res = move_window(fs, dp->sect);
2568 if (res == FR_OK) {
2574 return res;
3008 FRESULT res; local
3031 res = load_obj_xdir(&dj, &dp->obj);
3032 if (res != FR_OK) return res;
3041 res = dir_sdi(dp, 0);
3045 res = create_name(dp, &path); /* Get a segment name of the path */
3046 if (res != FR_OK) break;
3047 res = dir_find(dp); /* Find an object with the segment name */
3049 if (res != FR_OK) { /* Failed to find the object */
3050 if (res == FR_NO_FILE) { /* Object is not found */
3054 res = FR_OK;
3056 if (!(ns & NS_LAST)) res = FR_NO_PATH; /* Adjust error code if not last segment */
3064 res = FR_NO_PATH; break;
3080 return res;
3566 FRESULT res = FR_INVALID_OBJECT; local
3573 res = FR_OK;
3578 res = FR_TIMEOUT;
3582 res = FR_OK;
3586 *rfs = (res == FR_OK) ? obj->fs : 0; /* Corresponding filesystem object */
3587 return res;
3613 FRESULT res; local
3642 res = mount_volume(&path, &fs, 0); /* Force mounted the volume */
3643 LEAVE_FF(fs, res);
3659 FRESULT res; local
3674 res = mount_volume(&path, &fs, mode);
3675 if (res == FR_OK) {
3678 res = follow_path(&dj, path); /* Follow the file path */
3680 if (res == FR_OK) {
3682 res = FR_INVALID_NAME;
3686 res = chk_lock(&dj, (mode & ~FA_READ) ? 1 : 0); /* Check if the file can be used */
3692 if (res != FR_OK) { /* No file, create new */
3693 if (res == FR_NO_FILE) { /* There is no file to open, create a new entry */
3695 res = enq_lock() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES;
3697 res = dir_register(&dj);
3704 res = FR_DENIED;
3706 if (mode & FA_CREATE_NEW) res = FR_EXIST; /* Cannot create as new file */
3709 if (res == FR_OK && (mode & FA_CREATE_ALWAYS)) { /* Truncate the file if overwrite mode */
3721 res = store_xdir(&dj);
3722 if (res == FR_OK && fp->obj.sclust != 0) { /* Remove the cluster chain if exist */
3723 res = remove_chain(&fp->obj, fp->obj.sclust, 0);
3740 res = remove_chain(&dj.obj, cl, 0);
3741 if (res == FR_OK) {
3742 res = move_window(fs, sc);
3750 if (res == FR_OK) { /* Is the object exsiting? */
3752 res = FR_NO_FILE;
3755 res = FR_DENIED;
3760 if (res == FR_OK) {
3766 if (fp->obj.lockid == 0) res = FR_INT_ERR;
3770 if (res == FR_OK) {
3772 res = FR_INVALID_NAME;
3775 res = FR_NO_FILE;
3781 if (res == FR_OK) {
3811 for (ofs = fp->obj.objsize; res == FR_OK && ofs > bcs; ofs -= bcs) {
3813 if (clst <= 1) res = FR_INT_ERR;
3814 if (clst == 0xFFFFFFFF) res = FR_DISK_ERR;
3817 if (res == FR_OK && ofs % SS(fs)) { /* Fill sector buffer if not on the sector boundary */
3820 res = FR_INT_ERR;
3824 if (disk_read(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR;
3829 if (res != FR_OK) dec_lock(fp->obj.lockid); /* Decrement file open counter if seek failed */
3838 if (res != FR_OK) fp->obj.fs = 0; /* Invalidate file object on error */
3840 LEAVE_FF(fs, res);
3857 FRESULT res; local
3867 res = validate(&fp->obj, &fs); /* Check validity of the file object */
3868 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */
3957 FRESULT res; local
3966 res = validate(&fp->obj, &fs); /* Check validity of the file object */
3967 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */
4075 FRESULT res; local
4081 res = validate(&fp->obj, &fs); /* Check validity of the file object */
4082 if (res == FR_OK) {
4094 res = fill_first_frag(&fp->obj); /* Fill first fragment on the FAT if needed */
4095 if (res == FR_OK) {
4096res = fill_last_frag(&fp->obj, fp->clust, 0xFFFFFFFF); /* Fill last fragment on the FAT if needed …
4098 if (res == FR_OK) {
4103 res = load_obj_xdir(&dj, &fp->obj); /* Load directory entry block */
4104 if (res == FR_OK) {
4113 res = store_xdir(&dj); /* Restore it to the directory */
4114 if (res == FR_OK) {
4115 res = sync_fs(fs);
4124 res = move_window(fs, fp->dir_sect);
4125 if (res == FR_OK) {
4133 res = sync_fs(fs); /* Restore it to the directory */
4140 LEAVE_FF(fs, res);
4156 FRESULT res; local
4160 res = f_sync(fp); /* Flush cached data */
4161 if (res == FR_OK)
4164 res = validate(&fp->obj, &fs); /* Lock volume */
4165 if (res == FR_OK) {
4167 res = dec_lock(fp->obj.lockid); /* Decrement file open counter */
4168 if (res == FR_OK) fp->obj.fs = 0; /* Invalidate file object */
4177 return res;
4212 FRESULT res; local
4219 res = mount_volume(&path, &fs, 0); local
4220 if (res == FR_OK) {
4223 res = follow_path(&dj, path); /* Follow the path */
4224 if (res == FR_OK) { /* Follow completed */
4248 res = FR_NO_PATH; /* Reached but a file */
4253 if (res == FR_NO_FILE) res = FR_NO_PATH;
4255 if (res == FR_OK) {
4262 LEAVE_FF(fs, res);
4272 FRESULT res; local
4290 res = mount_volume((const TCHAR**)&buff, &fs, 0); /* Get current volume */
4291 if (res == FR_OK) {
4300 res = dir_sdi(&dj, 1 * SZDIRE); /* Get parent directory */
4301 if (res != FR_OK) break;
4302 res = move_window(fs, dj.sect);
4303 if (res != FR_OK) break;
4305 res = dir_sdi(&dj, 0);
4306 if (res != FR_OK) break;
4308 res = DIR_READ_FILE(&dj);
4309 if (res != FR_OK) break;
4311 res = dir_next(&dj, 0);
4312 } while (res == FR_OK);
4313 if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
4314 if (res != FR_OK) break;
4318 res = FR_NOT_ENOUGH_CORE; break;
4324 if (res == FR_OK) {
4343 if (vl == 0) res = FR_NOT_ENOUGH_CORE;
4346 if (res == FR_OK) {
4354 LEAVE_FF(fs, res);
4372 FRESULT res; local
4383 res = validate(&fp->obj, &fs); /* Check validity of the file object */
4384 if (res == FR_OK) res = (FRESULT)fp->err;
4386 if (res == FR_OK && fs->fs_type == FS_EXFAT) {
4387res = fill_last_frag(&fp->obj, fp->clust, 0xFFFFFFFF); /* Fill last fragment on the FAT if needed …
4390 if (res != FR_OK) LEAVE_FF(fs, res);
4417 res = FR_NOT_ENOUGH_CORE; /* Given table size is smaller than required */
4521 LEAVE_FF(fs, res);
4536 FRESULT res; local
4544 res = mount_volume(&path, &fs, 0);
4545 if (res == FR_OK) {
4548 res = follow_path(dp, path); /* Follow the path to the directory */
4549 if (res == FR_OK) { /* Follow completed */
4564 res = FR_NO_PATH;
4567 if (res == FR_OK) {
4569 res = dir_sdi(dp, 0); /* Rewind directory */
4571 if (res == FR_OK) {
4574 if (!dp->obj.lockid) res = FR_TOO_MANY_OPEN_FILES;
4583 if (res == FR_NO_FILE) res = FR_NO_PATH;
4585 if (res != FR_OK) dp->obj.fs = 0; /* Invalidate the directory object if function faild */
4587 LEAVE_FF(fs, res);
4601 FRESULT res; local
4605 res = validate(&dp->obj, &fs); /* Check validity of the file object */
4606 if (res == FR_OK) {
4608 if (dp->obj.lockid) res = dec_lock(dp->obj.lockid); /* Decrement sub-directory open counter */
4609 if (res == FR_OK) dp->obj.fs = 0; /* Invalidate directory object */
4617 return res;
4632 FRESULT res; local
4637 res = validate(&dp->obj, &fs); /* Check validity of the directory object */ local
4638 if (res == FR_OK) {
4640 res = dir_sdi(dp, 0); /* Rewind the directory object */
4643 res = DIR_READ_FILE(dp); /* Read an item */
4644 if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory */
4645 if (res == FR_OK) { /* A valid entry is found */
4647 res = dir_next(dp, 0); /* Increment index for next */
4648 if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory now */
4653 LEAVE_FF(fs, res);
4668 FRESULT res; local
4672 res = f_readdir(dp, fno); /* Get a directory item */
4673 …if (res != FR_OK || !fno || !fno->fname[0]) break; /* Terminate if any error or end of directory */
4679 return res;
4695 FRESULT res; local
4699 res = f_opendir(dp, path); /* Open the target directory */
4700 if (res == FR_OK) {
4701 res = f_findnext(dp, fno); /* Find the first item */
4703 return res;
4720 FRESULT res; local
4726 res = mount_volume(&path, &dj.obj.fs, 0); local
4727 if (res == FR_OK) {
4729 res = follow_path(&dj, path); /* Follow the file path */
4730 if (res == FR_OK) { /* Follow completed */
4732 res = FR_INVALID_NAME;
4740 LEAVE_FF(dj.obj.fs, res);
4756 FRESULT res; local
4765 res = mount_volume(&path, &fs, 0);
4766 if (res == FR_OK) {
4778 if (stat == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
4779 if (stat == 1) { res = FR_INT_ERR; break; }
4793 res = move_window(fs, sect++);
4794 if (res != FR_OK) break;
4810 res = move_window(fs, sect++);
4811 if (res != FR_OK) break;
4824 if (res == FR_OK) { /* Update parameters if succeeded */
4832 LEAVE_FF(fs, res);
4846 FRESULT res; local
4851 res = validate(&fp->obj, &fs); /* Check validity of the file object */
4852 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);
4857 res = remove_chain(&fp->obj, fp->obj.sclust, 0);
4861 res = FR_OK;
4862 if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
4863 if (ncl == 1) res = FR_INT_ERR;
4864 if (res == FR_OK && ncl < fs->n_fatent) {
4865 res = remove_chain(&fp->obj, ncl, fp->clust);
4871 if (res == FR_OK && (fp->flag & FA_DIRTY)) {
4873 res = FR_DISK_ERR;
4879 if (res != FR_OK) ABORT(fs, res);
4882 LEAVE_FF(fs, res);
4896 FRESULT res; local
4907 res = mount_volume(&path, &fs, FA_WRITE); local
4908 if (res == FR_OK) {
4911 res = follow_path(&dj, path); /* Follow the file path */
4912 if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) {
4913 res = FR_INVALID_NAME; /* Cannot remove dot entry */
4916 if (res == FR_OK) res = chk_lock(&dj, 2); /* Check if it is an open object */
4918 if (res == FR_OK) { /* The object is accessible */
4920 res = FR_INVALID_NAME; /* Cannot remove the origin directory */
4923 res = FR_DENIED; /* Cannot remove R/O object */
4926 if (res == FR_OK) {
4940 res = FR_DENIED;
4952 res = dir_sdi(&sdj, 0);
4953 if (res == FR_OK) {
4954 res = DIR_READ_FILE(&sdj); /* Test if the directory is empty */
4955 if (res == FR_OK) res = FR_DENIED; /* Not empty? */
4956 if (res == FR_NO_FILE) res = FR_OK; /* Empty? */
4961 if (res == FR_OK) {
4962 res = dir_remove(&dj); /* Remove the directory entry */
4963 if (res == FR_OK && dclst != 0) { /* Remove the cluster chain if exist */
4965 res = remove_chain(&obj, dclst, 0);
4967 res = remove_chain(&dj.obj, dclst, 0);
4970 if (res == FR_OK) res = sync_fs(fs);
4976 LEAVE_FF(fs, res);
4990 FRESULT res; local
4998 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ local
4999 if (res == FR_OK) {
5002 res = follow_path(&dj, path); /* Follow the file path */
5003 if (res == FR_OK) res = FR_EXIST; /* Name collision? */
5004 if (FF_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT)) { /* Invalid name? */
5005 res = FR_INVALID_NAME;
5007 if (res == FR_NO_FILE) { /* It is clear to create a new directory */
5010 res = FR_OK;
5011 if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster? */
5012 if (dcl == 1) res = FR_INT_ERR; /* Any insanity? */
5013 if (dcl == 0xFFFFFFFF) res = FR_DISK_ERR; /* Disk error? */
5015 if (res == FR_OK) {
5016 res = dir_clear(fs, dcl); /* Clean up the new table */
5017 if (res == FR_OK) {
5029 res = dir_register(&dj); /* Register the object to the parent directoy */
5032 if (res == FR_OK) {
5041 res = store_xdir(&dj);
5050 if (res == FR_OK) {
5051 res = sync_fs(fs);
5060 LEAVE_FF(fs, res);
5075 FRESULT res; local
5084 res = mount_volume(&path_old, &fs, FA_WRITE); /* Get logical drive of the old object */
5085 if (res == FR_OK) {
5088 res = follow_path(&djo, path_old); /* Check old object */
5089 …if (res == FR_OK && (djo.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check valid…
5091 if (res == FR_OK) {
5092 res = chk_lock(&djo, 2);
5095 if (res == FR_OK) { /* Object to be renamed is found */
5103 res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */
5104 if (res == FR_OK) { /* Is new name already in use by any other object? */
5105 res = (djn.obj.sclust == djo.obj.sclust && djn.dptr == djo.dptr) ? FR_NO_FILE : FR_EXIST;
5107 if (res == FR_NO_FILE) { /* It is a valid path and no name collision */
5108 res = dir_register(&djn); /* Register the new entry */
5109 if (res == FR_OK) {
5117 res = store_xdir(&djn);
5125 res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */
5126 if (res == FR_OK) { /* Is new name already in use by any other object? */
5127 res = (djn.obj.sclust == djo.obj.sclust && djn.dptr == djo.dptr) ? FR_NO_FILE : FR_EXIST;
5129 if (res == FR_NO_FILE) { /* It is a valid path and no name collision */
5130 res = dir_register(&djn); /* Register the new entry */
5131 if (res == FR_OK) {
5140 res = FR_INT_ERR;
5143 res = move_window(fs, sect);
5145 if (res == FR_OK && dir[1] == '.') {
5154 if (res == FR_OK) {
5155 res = dir_remove(&djo); /* Remove old entry */
5156 if (res == FR_OK) {
5157 res = sync_fs(fs);
5165 LEAVE_FF(fs, res);
5186 FRESULT res; local
5192 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ local
5193 if (res == FR_OK) {
5196 res = follow_path(&dj, path); /* Follow the file path */
5197 …if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object…
5198 if (res == FR_OK) {
5203 res = store_xdir(&dj);
5210 if (res == FR_OK) {
5211 res = sync_fs(fs);
5217 LEAVE_FF(fs, res);
5232 FRESULT res; local
5238 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ local
5239 if (res == FR_OK) {
5242 res = follow_path(&dj, path); /* Follow the file path */
5243 …if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object…
5244 if (res == FR_OK) {
5248 res = store_xdir(&dj);
5255 if (res == FR_OK) {
5256 res = sync_fs(fs);
5262 LEAVE_FF(fs, res);
5280 FRESULT res; local
5287 res = mount_volume(&path, &fs, 0);
5290 if (res == FR_OK && label) {
5292 res = dir_sdi(&dj, 0);
5293 if (res == FR_OK) {
5294 res = DIR_READ_LABEL(&dj); /* Find a volume label entry */
5295 if (res == FR_OK) {
5335 if (res == FR_NO_FILE) { /* No label entry and return nul string */
5337 res = FR_OK;
5342 if (res == FR_OK && vsn) {
5343 res = move_window(fs, fs->volbase);
5344 if (res == FR_OK) {
5361 LEAVE_FF(fs, res);
5375 FRESULT res; local
5387 res = mount_volume(&label, &fs, FA_WRITE);
5388 if (res != FR_OK) LEAVE_FF(fs, res);
5439 res = dir_sdi(&dj, 0);
5440 if (res == FR_OK) {
5441 res = DIR_READ_LABEL(&dj); /* Get volume label entry */
5442 if (res == FR_OK) {
5454 res = sync_fs(fs);
5456 if (res == FR_NO_FILE) {
5457 res = FR_OK;
5459 res = dir_alloc(&dj, 1); /* Allocate an entry */
5460 if (res == FR_OK) {
5471 res = sync_fs(fs);
5478 LEAVE_FF(fs, res);
5497 FRESULT res; local
5502 res = validate(&fp->obj, &fs); /* Check validity of the file object */
5503 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);
5516 if (scl == 0) res = FR_DENIED; /* No contiguous cluster block was found */
5517 if (scl == 0xFFFFFFFF) res = FR_DISK_ERR;
5518 if (res == FR_OK) { /* A contiguous free area is found */
5520 res = change_bitmap(fs, scl, tcl, 1); /* Mark the cluster block 'in use' */
5533 if (n == 1) { res = FR_INT_ERR; break; }
5534 if (n == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
5540 if (clst == stcl) { res = FR_DENIED; break; } /* No contiguous cluster? */
5542 if (res == FR_OK) { /* A contiguous free area is found */
5545 res = put_fat(fs, clst, (n == 1) ? 0xFFFFFFFF : clst + 1);
5546 if (res != FR_OK) break;
5555 if (res == FR_OK) {
5569 LEAVE_FF(fs, res);
5588 FRESULT res; local
5598 res = validate(&fp->obj, &fs); /* Check validity of the file object */
5599 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);