Lines Matching refs:res

167 #define ABORT(fs, res)		{ fp->err = (BYTE)(res); LEAVE_FF(fs, res); }
176 #define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; }
178 #define LEAVE_FF(fs, res) { (void)fs; return res; }
181 #define LEAVE_FF(fs, res) return res
751 FRESULT res /* Result code to be returned */
754 if (fs && res != FR_NOT_ENABLED && res != FR_INVALID_DRIVE && res != FR_TIMEOUT) {
840 FRESULT res;
851 res = FR_OK;
853 res = FR_INT_ERR; /* Invalid index number */
855 return res;
900 FRESULT res = FR_OK;
914 res = FR_DISK_ERR;
917 return res;
927 FRESULT res = FR_OK;
936 res = sync_window(fs); /* Flush the window */
938 if (res == FR_OK) { /* Fill sector window with new data */
941 res = FR_DISK_ERR;
946 return res;
955 FRESULT res = FR_OK;
964 res = sync_window(fs); /* Flush the window */
966 if (res == FR_OK) { /* Fill sector window with new data */
969 res = FR_DISK_ERR;
974 return res;
987 FRESULT res;
990 res = sync_window(fs);
991 if (res == FR_OK) {
1009 if (disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR;
1012 return res;
1103 FRESULT res = FR_INT_ERR;
1114 res = move_window(fs, fs->fatbase + (bc / SS(fs)));
1115 if (res != FR_OK) break;
1119 res = move_window(fs, fs->fatbase + (bc / SS(fs)));
1120 if (res != FR_OK) break;
1127 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 2)));
1128 if (res != FR_OK) break;
1134 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 4)));
1135 if (res != FR_OK) break;
1142 return res;
1159 FRESULT res = FR_OK;
1171 res = put_fat(fs, pclst, 0xFFFFFFFF);
1172 if (res != FR_OK) return res;
1181 res = put_fat(fs, clst, 0); /* Mark the cluster 'free' on the FAT */
1182 if (res != FR_OK) return res;
1228 FRESULT res;
1327 res = put_fat(fs, ncl, 0xFFFFFFFF); /* Mark the new cluster 'EOC' */
1328 if (res == FR_OK && clst != 0) {
1329 res = put_fat(fs, clst, ncl); /* Link it from the previous one if needed */
1332 if (res == FR_OK) { /* Update FSINFO if function succeeded. */
1351 ncl = (res == FR_DISK_ERR) ? 0xFFFFFFFF : 1; /* Failed. Generate error status */
1559 FRESULT res;
1564 res = dir_sdi(dp, 0);
1565 if (res == FR_OK) {
1568 res = move_window(fs, dp->sect);
1569 if (res != FR_OK) break;
1575 res = dir_next(dp, 1); /* Next entry with table stretch enabled */
1576 } while (res == FR_OK);
1579 if (res == FR_NO_FILE) res = FR_DENIED; /* No directory entry to allocate */
1580 return res;
1828 FRESULT res = FR_NO_FILE;
1836 res = move_window(fs, dp->sect);
1837 if (res != FR_OK) break;
1840 res = FR_NO_FILE; break; /* Reached to end of the directory */
1869 res = dir_next(dp, 0); /* Next entry */
1870 if (res != FR_OK) break;
1873 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */
1874 return res;
1885 FRESULT res = FR_NO_FILE;
1893 res = move_window_readdir(fs, dp->sect);
1894 if (res != FR_OK) break;
1897 res = FR_NO_FILE; break; /* Reached to end of the directory */
1926 res = dir_next(dp, 0); /* Next entry */
1927 if (res != FR_OK) break;
1930 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */
1931 return res;
1944 FRESULT res;
1951 res = dir_sdi(dp, 0); /* Rewind directory object */
1952 if (res != FR_OK) return res;
1959 res = move_window(fs, dp->sect);
1960 if (res != FR_OK) break;
1962 if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
1988 res = dir_next(dp, 0); /* Next entry */
1989 } while (res == FR_OK);
1991 return res;
2025 FRESULT res;
2041 res = dir_find(dp); /* Check if the name collides with existing SFN */
2042 if (res != FR_OK) break;
2045 if (res != FR_NO_FILE) return res; /* Abort if the result is other than 'not collided' */
2051 res = dir_alloc(dp, n_ent); /* Allocate entries */
2052 if (res == FR_OK && --n_ent) { /* Set LFN entry if needed */
2053 res = dir_sdi(dp, dp->dptr - n_ent * SZDIRE);
2054 if (res == FR_OK) {
2057 res = move_window(fs, dp->sect);
2058 if (res != FR_OK) break;
2065 res = dir_next(dp, 0); /* Next entry */
2066 } while (res == FR_OK && --n_ent);
2071 res = dir_alloc(dp, 1); /* Allocate an entry for SFN */
2076 if (res == FR_OK) {
2077 res = move_window(fs, dp->sect);
2078 if (res == FR_OK) {
2092 return res;
2108 FRESULT res;
2112 res = (dp->blk_ofs == 0xFFFFFFFF) ? FR_OK : dir_sdi(dp, dp->blk_ofs); /* Goto top of the entry block if LFN is exist */
2113 if (res == FR_OK) {
2115 res = move_window(fs, dp->sect);
2116 if (res != FR_OK) break;
2125 res = dir_next(dp, 0); /* Next entry */
2126 } while (res == FR_OK);
2127 if (res == FR_NO_FILE) res = FR_INT_ERR;
2131 res = move_window(fs, dp->sect);
2132 if (res == FR_OK) {
2142 return res;
2557 FRESULT res;
2574 res = dir_sdi(dp, 0);
2578 res = create_name(dp, &path); /* Get a segment name of the path */
2579 if (res != FR_OK) break;
2580 res = dir_find(dp); /* Find an object with the segment name */
2582 if (res != FR_OK) { /* Failed to find the object */
2583 if (res == FR_NO_FILE) { /* Object is not found */
2587 res = FR_OK;
2589 if (!(ns & NS_LAST)) res = FR_NO_PATH; /* Adjust error code if not last segment */
2597 res = FR_NO_PATH; break;
2607 return res;
2976 FRESULT res = FR_INVALID_OBJECT;
2984 res = FR_OK;
2989 res = FR_TIMEOUT;
2992 res = FR_OK;
2996 res = FR_OK;
3000 *rfs = (res == FR_OK) ? obj->fs : 0; /* Return corresponding filesystem object if it is valid */
3001 return res;
3066 FRESULT res;
3101 res = mount_volume(&path, &fs, 0); /* Force mounted the volume */
3102 LEAVE_FF(fs, res);
3278 FRESULT res;
3299 res = mount_volume(&path, &fs, mode);
3303 if (res == FR_OK) {
3313 res = follow_virentry(&dj.obj,path);
3315 if (res == FR_INT_ERR) LEAVE_FF(fs_bak,res);
3317 if (res == FR_INT_ERR) LEAVE_FF(fs,res);
3319 if (res == FR_OK)
3324 res = follow_path(&dj, path); /* Follow the file path */
3326 if (res == FR_OK) {
3328 res = FR_INVALID_NAME;
3332 res = chk_share(&dj, (mode & ~FA_READ) ? 1 : 0); /* Check if the file can be used */
3338 if (res != FR_OK) { /* No file, create new */
3339 if ((res == FR_NO_FILE) && (mode & FA_OPEN_ALWAYS)) { /* There is no file to open, create a new entry */
3341 res = enq_share() ? dir_register(&dj) : FR_TOO_MANY_OPEN_FILES;
3343 res = dir_register(&dj);
3346 if (res == FR_OK)
3351 res = FR_IS_DIR;
3353 if (mode & FA_CREATE_NEW) res = FR_EXIST; /* Cannot create as new file */
3356 if (res == FR_OK && (mode & FA_CREATE_ALWAYS)) { /* Truncate it if overwrite mode */
3379 res = remove_chain(&dj.obj, cl, 0);
3380 if (res == FR_OK) {
3381 res = move_window(fs, sc);
3387 res = remove_chain(&dj.obj, cl, 0);
3388 if (res == FR_OK) {
3389 res = move_window(fs, dw);
3399 if (res == FR_OK) { /* Is the object exsiting? */
3401 res = FR_IS_DIR;
3404 res = FR_DENIED;
3409 if (res == FR_OK) {
3419 if (fp->obj.lockid == 0) res = FR_INT_ERR;
3423 if (res == FR_OK) {
3425 res = FR_INVALID_NAME;
3428 res = FR_NO_FILE;
3434 if (res == FR_OK) {
3451 res = FR_NOT_ENOUGH_CORE;
3456 LEAVE_FF(fs_bak, res);
3458 LEAVE_FF(fs, res);
3466 for (ofs = fp->obj.objsize; res == FR_OK && ofs > bcs; ofs -= bcs) {
3468 if (clst <= 1) res = FR_INT_ERR;
3469 if (clst == 0xFFFFFFFF) res = FR_DISK_ERR;
3472 if (res == FR_OK && ofs % SS(fs)) { /* Fill sector buffer if not on the sector boundary */
3475 res = FR_INT_ERR;
3479 if (disk_read(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR;
3490 if (res == FR_OK && (mode & ~FA_READ) && ISVIRPART(fs) &&
3497 res = FR_DISK_ERR;
3501 res = FR_OK;
3505 res = FR_INT_ERR;
3509 res = FR_INT_ERR;
3518 if (res != FR_OK) dec_share(fp->obj.lockid); /* Decrement file open counter if seek failed */
3524 if (res != FR_OK) fp->obj.fs = 0; /* Invalidate file object on error */
3526 LEAVE_FF(fs_bak, res);
3528 LEAVE_FF(fs, res);
3546 FRESULT res;
3558 res = validate(&fp->obj, &fs); /* Check validity of the file object */
3559 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */
3666 FRESULT res;
3677 res = validate(&fp->obj, &fs); /* Check validity of the file object */
3678 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); /* Check validity */
3706 res = FR_NO_SPACE_LEFT;
3789 LEAVE_FF(fs, res);
3803 FRESULT res;
3809 res = validate(&fp->obj, &fs); /* Check validity of the file object */
3810 if (res == FR_OK) {
3821 res = move_window(fs, fp->dir_sect);
3823 if (res == FR_OK) {
3840 res = sync_fs(fs); /* Restore it to the directory */
3846 LEAVE_FF(fs, res);
3862 FRESULT res;
3866 res = f_sync(fp); /* Flush cached data */
3867 if (res == FR_OK || res == FR_DISK_ERR)
3870 res = validate(&fp->obj, &fs); /* Lock volume */
3871 if (res == FR_OK) {
3873 res = dec_share(fp->obj.lockid); /* Decrement file open counter */
3874 if (res == FR_OK) fp->obj.fs = 0; /* Invalidate file object */
3883 return res;
3918 FRESULT res;
3925 res = mount_volume(&path, &fs, 0);
3926 if (res == FR_OK) {
3929 res = follow_path(&dj, path); /* Follow the path */
3930 if (res == FR_OK) { /* Follow completed */
3937 res = FR_NO_PATH; /* Reached but a file */
3942 if (res == FR_NO_FILE) res = FR_NO_PATH;
3944 if (res == FR_OK) {
3951 LEAVE_FF(fs, res);
3961 FRESULT res;
3979 res = mount_volume((const TCHAR**)&buff, &fs, 0); /* Get current volume */
3980 if (res == FR_OK) {
3989 res = dir_sdi(&dj, 1 * SZDIRE); /* Get parent directory */
3990 if (res != FR_OK) break;
3991 res = move_window(fs, dj.sect);
3992 if (res != FR_OK) break;
3994 res = dir_sdi(&dj, 0);
3995 if (res != FR_OK) break;
3997 res = DIR_READ_FILE(&dj);
3998 if (res != FR_OK) break;
4000 res = dir_next(&dj, 0);
4001 } while (res == FR_OK);
4002 if (res == FR_NO_FILE) res = FR_INT_ERR;/* It cannot be 'not found'. */
4003 if (res != FR_OK) break;
4007 res = FR_NOT_ENOUGH_CORE; break;
4012 if (res == FR_OK) {
4031 if (vl == 0) res = FR_NOT_ENOUGH_CORE;
4034 if (res == FR_OK) {
4044 LEAVE_FF(fs, res);
4062 FRESULT res;
4073 res = validate(&fp->obj, &fs); /* Check validity of the file object */
4074 if (res == FR_OK) res = (FRESULT)fp->err;
4075 if (res != FR_OK) LEAVE_FF(fs, res);
4102 res = FR_NOT_ENOUGH_CORE; /* Given table size is smaller than required */
4148 if (clst == 0) res = FR_NO_SPACE_LEFT;
4164 res = FR_NO_SPACE_LEFT;
4202 LEAVE_FF(fs, res);
4217 FRESULT res;
4225 res = mount_volume(&path, &fs, 0);
4226 if (res == FR_OK) {
4229 res = follow_path(dp, path); /* Follow the path to the directory */
4230 if (res == FR_OK) { /* Follow completed */
4235 res = FR_NO_DIR;
4238 if (res == FR_OK) {
4240 res = dir_sdi(dp, 0); /* Rewind directory */
4242 if (res == FR_OK) {
4245 if (!dp->obj.lockid) res = FR_TOO_MANY_OPEN_FILES;
4254 if (res == FR_NO_FILE) res = FR_NO_PATH;
4256 if (res != FR_OK) dp->obj.fs = 0; /* Invalidate the directory object if function failed */
4258 LEAVE_FF(fs, res);
4272 FRESULT res;
4276 res = validate(&dp->obj, &fs); /* Check validity of the file object */
4277 if (res == FR_OK) {
4279 if (dp->obj.lockid) res = dec_share(dp->obj.lockid); /* Decrement sub-directory open counter */
4280 if (res == FR_OK) dp->obj.fs = 0; /* Invalidate directory object */
4288 return res;
4303 FRESULT res;
4308 res = validate(&dp->obj, &fs); /* Check validity of the directory object */
4309 if (res == FR_OK) {
4311 res = dir_sdi(dp, 0); /* Rewind the directory object */
4314 res = DIR_READ_FILE(dp); /* Read an item */
4315 if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory */
4316 if (res == FR_OK) { /* A valid entry is found */
4318 res = dir_next(dp, 0); /* Increment index for next */
4319 if (res == FR_NO_FILE) res = FR_OK; /* Ignore end of directory now */
4324 LEAVE_FF(fs, res);
4339 FRESULT res;
4343 res = f_readdir(dp, fno); /* Get a directory item */
4344 if (res != FR_OK || !fno || !fno->fname[0]) break; /* Terminate if any error or end of directory */
4350 return res;
4366 FRESULT res;
4370 res = f_opendir(dp, path); /* Open the target directory */
4371 if (res == FR_OK) {
4372 res = f_findnext(dp, fno); /* Find the first item */
4374 return res;
4391 FRESULT res;
4397 res = mount_volume(&path, &dj.obj.fs, 0);
4398 if (res == FR_OK) {
4400 res = follow_path(&dj, path); /* Follow the file path */
4401 if (res == FR_OK) { /* Follow completed */
4403 res = FR_INVALID_NAME;
4411 LEAVE_FF(dj.obj.fs, res);
4424 FRESULT res = FR_OK;
4432 res = FR_DISK_ERR; break;
4435 res = FR_INT_ERR; break;
4446 res = move_window(fs, sect++);
4447 if (res != FR_OK) break;
4462 return res;
4476 FRESULT res;
4480 res = mount_volume(&path, &fs, 0);
4481 if (res == FR_OK) {
4488 res = fat_count_free_entries(nclst, fs);
4492 LEAVE_FF(fs, res);
4527 FRESULT res;
4531 res = validate(&fp->obj, &fs); /* Check validity of the file object */
4532 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);
4537 res = remove_chain(&fp->obj, fp->obj.sclust, 0);
4553 res = FR_OK;
4554 if (val == 0xFFFFFFFF) res = FR_DISK_ERR;
4555 if (val == 1) res = FR_INT_ERR;
4556 if (res == FR_OK && val < fs->n_fatent) {
4557 res = remove_chain(&fp->obj, val, fclust);
4561 if (res == FR_OK) {
4577 if (res == FR_OK && (fp->flag & FA_DIRTY)) {
4579 res = FR_DISK_ERR;
4585 if (res != FR_OK) ABORT(fs, res);
4588 LEAVE_FF(fs, res);
4602 FRESULT res;
4620 res = mount_volume(&path, &fs, FA_WRITE);
4625 if (res == FR_OK) {
4634 res = follow_virentry(&dj.obj,path);
4636 if (res == FR_INT_ERR) LEAVE_FF(fs_bak,res);
4638 if (res == FR_INT_ERR) LEAVE_FF(fs,res);
4640 if (res == FR_OK)
4645 res = follow_path(&dj, path); /* Follow the file path */
4646 if (FF_FS_RPATH && res == FR_OK && (dj.fn[NSFLAG] & NS_DOT)) {
4647 res = FR_INVALID_NAME; /* Cannot remove dot entry */
4650 if (res == FR_OK && ISVIRPART(fs)) {
4688 res = move_window(dj.obj.fs,st_bak);
4693 if (res == FR_OK) res = chk_share(&dj, 2); /* Check if it is an open object */
4695 if (res == FR_OK) { /* The object is accessible */
4697 res = FR_INVALID_NAME; /* Cannot remove the origin directory */
4700 res = FR_DENIED; /* Cannot remove R/O object */
4703 if (res == FR_OK) {
4708 res = FR_DENIED;
4714 res = dir_sdi(&sdj, 0);
4715 if (res == FR_OK) {
4716 res = DIR_READ_FILE(&sdj); /* Test if the directory is empty */
4717 if (res == FR_OK) res = FR_NO_EMPTY_DIR; /* Not empty? */
4718 if (res == FR_NO_FILE) res = FR_OK; /* Empty? */
4723 if (res == FR_OK) {
4724 res = dir_remove(&dj); /* Remove the directory entry */
4725 if (res == FR_OK && dclst != 0) { /* Remove the cluster chain if exist */
4726 res = remove_chain(&dj.obj, dclst, 0);
4728 if (res == FR_OK) res = sync_fs(fs);
4734 LEAVE_FF(fs_bak, res);
4736 LEAVE_FF(fs, res);
4751 FRESULT res;
4765 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */
4771 if (res == FR_OK) {
4780 res = follow_virentry(&dj.obj,path);
4782 if (res == FR_INT_ERR) LEAVE_FF(fs_bak,res);
4784 if (res == FR_INT_ERR) LEAVE_FF(fs,res);
4786 if (res == FR_OK)
4791 res = follow_path(&dj, path); /* Follow the file path */
4792 if (res == FR_OK) res = FR_EXIST; /* Name collision? */
4793 if (FF_FS_RPATH && res == FR_NO_FILE && (dj.fn[NSFLAG] & NS_DOT)) { /* Invalid name? */
4794 res = FR_INVALID_NAME;
4796 if (res == FR_NO_FILE) { /* It is clear to create a new directory */
4799 res = FR_OK;
4800 if (dcl == 0) res = FR_NO_SPACE_LEFT; /* No space to allocate a new cluster */
4801 if (dcl == 1) res = FR_INT_ERR; /* Any insanity? */
4802 if (dcl == 0xFFFFFFFF) res = FR_DISK_ERR; /* Disk error? */
4803 if (res == FR_OK) res = sync_window(fs); /* Flush FAT */
4805 if (res == FR_OK) { /* Initialize the new directory table */
4831 res = sync_window(fs);
4832 if (res != FR_OK) break;
4837 res = sync_window(fs);
4838 if (res != FR_OK) break;
4843 if (res == FR_OK) {
4844 res = dir_register(&dj); /* Register the object to the directoy */
4846 if (res == FR_OK) {
4862 if (res == FR_OK) {
4863 res = sync_fs(fs);
4872 LEAVE_FF(fs_bak, res);
4874 LEAVE_FF(fs, res);
4887 FRESULT res;
4903 res = mount_volume(&path_old, &fs, FA_WRITE); /* Get logical drive of the old object */
4907 if (res == FR_OK) {
4913 res = follow_virentry(&djo.obj,path_old);
4915 if (res == FR_INT_ERR) LEAVE_FF(fs_bak,res);
4917 if (res == FR_INT_ERR) LEAVE_FF(fs,res);
4919 if (res == FR_OK)
4924 res = follow_path(&djo, path_old); /* Check old object */
4925 if (res == FR_OK && (djo.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check validity of name */
4927 if (res == FR_OK) {
4928 res = chk_share(&djo, 2);
4932 if (res == FR_OK && ISVIRPART(fs)) {
4967 res = move_window(djo.obj.fs,st_bak);
4970 if (res == FR_OK) { /* Object to be renamed is found */
4974 res = follow_path(&djn, path_new); /* Make sure if new object name is not in use */
4975 if (res == FR_OK) { /* Is new name already in use by any other object? */
4976 res = FR_EXIST;
4978 if (res == FR_NO_FILE) { /* It is a valid path and no name collision */
4979 res = dir_register(&djn); /* Register the new entry */
4980 if (res == FR_OK) {
4993 res = FR_INT_ERR;
4997 res = move_window(fs, sect);
4999 if (res == FR_OK && dir[1] == '.') {
5003 res = move_window(fs, sect);
5005 if (res == FR_OK && dir[1] == '.') {
5014 if (res == FR_OK) {
5015 res = dir_remove(&djo); /* Remove old entry */
5016 if (res == FR_OK) {
5017 res = sync_fs(fs);
5025 LEAVE_FF(fs_bak, res);
5027 LEAVE_FF(fs, res);
5049 FRESULT res;
5058 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */
5059 if (res == FR_OK) {
5068 res = follow_virentry(&dj.obj,path);
5070 if (res == FR_INT_ERR) LEAVE_FF(fs_bak,res);
5072 if (res == FR_INT_ERR) LEAVE_FF(fs,res);
5074 if (res == FR_OK)
5079 res = follow_path(&dj, path); /* Follow the file path */
5080 if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object validity */
5081 if (res == FR_OK) {
5089 if (res == FR_OK) {
5090 res = sync_fs(fs);
5096 LEAVE_FF(fs_bak, res);
5098 LEAVE_FF(fs, res);
5114 FRESULT res;
5120 res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */
5121 if (res == FR_OK) {
5124 res = follow_path(&dj, path); /* Follow the file path */
5125 if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME; /* Check object validity */
5126 if (res == FR_OK) {
5129 if (res == FR_OK) {
5130 res = sync_fs(fs);
5136 LEAVE_FF(fs, res);
5154 FRESULT res;
5161 res = mount_volume(&path, &fs, 0);
5164 if (res == FR_OK && label) {
5166 res = dir_sdi(&dj, 0);
5167 if (res == FR_OK) {
5168 res = DIR_READ_LABEL(&dj); /* Find a volume label entry */
5169 if (res == FR_OK) {
5190 if (res == FR_NO_FILE) { /* No label entry and return nul string */
5192 res = FR_OK;
5197 if (res == FR_OK && vsn) {
5198 res = move_window(fs, fs->volbase);
5199 if (res == FR_OK) {
5212 LEAVE_FF(fs, res);
5224 FRESULT res;
5261 res = dir_sdi(&dj, 0);
5262 if (res == FR_OK) {
5263 res = DIR_READ_LABEL(&dj); /* Get volume label entry */
5264 if (res == FR_OK) {
5271 res = sync_fs(fs);
5273 if (res == FR_NO_FILE) {
5274 res = FR_OK;
5276 res = dir_alloc(&dj, 1); /* Allocate an entry */
5277 if (res == FR_OK) {
5282 res = sync_fs(fs);
5289 return res;
5296 FRESULT res;
5300 res = mount_volume(&label, &fs, FA_WRITE);
5301 if (res != FR_OK) LEAVE_FF(fs, res);
5303 res = set_volumn_label(fs, label);
5305 LEAVE_FF(fs, res);
5325 FRESULT res;
5331 res = validate(&fp->obj, &fs); /* Check validity of the file object */
5332 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);
5353 if (n == 1) { res = FR_INT_ERR; break; }
5354 if (n == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
5357 res = put_fat(fs, clstbak, clst);
5358 if (res != FR_OK)
5365 res = put_fat(fs, clst, 0xFFFFFFFF);
5370 res = FR_DENIED;
5383 if (n == 1) { res = FR_INT_ERR; break; }
5384 if (n == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
5387 res = put_fat(fs, clstbak, clst);
5388 if (res != FR_OK) break;
5394 res = put_fat(fs, clst, 0xFFFFFFFF);
5399 res = FR_DENIED;
5407 if (res == FR_OK) {
5414 res = put_fat(fs, fclust, scl);
5415 if (res != FR_OK) LEAVE_FF(fs, res);
5431 res = put_fat(fs, fclust, scl);
5432 if (res != FR_OK) LEAVE_FF(fs, res);
5455 if (n == 1 || n == 0) { res = FR_INT_ERR; break; }
5456 if (n == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
5457 res = put_fat(fs, clst, 0);
5458 if (res != FR_OK) break;
5462 res = put_fat(fs, fclust, 0xFFFFFFFF);
5465 LEAVE_FF(fs, res);
5484 FRESULT res;
5494 res = validate(&fp->obj, &fs); /* Check validity of the file object */
5495 if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res);
6393 FRESULT res;
6406 res = create_partition(pdrv, ptbl, 0x07, buf); /* Create partitions (system ID is temporary setting and determined by f_mkfs) */
6408 LEAVE_MKFS(res);
6905 FRESULT res;
6909 res = validate(&(dir_info->f_dir.obj), &fs); /* Lock volume */
6910 if (res == FR_OK) {
6916 res = remove_chain(&(dir_info->f_dir.obj), dir_info->fno.sclst, 0);
6918 res = FR_DENIED;
6921 res = FR_OK;
6925 res = FR_DISK_ERR;
6926 LEAVE_FF(fs, res);
6929 res = FR_INT_ERR;
6930 LEAVE_FF(fs, res);
6933 res = FR_OK;
6934 LEAVE_FF(fs, res);
6938 res = remove_chain(&(dir_info->f_dir.obj), val, dir_info->fno.sclst + tcl - 1);
6940 res = FR_DENIED;
6946 LEAVE_FF(fs, res);