• Home
  • Raw
  • Download

Lines Matching refs:sect

924 	LBA_t sect		/* Sector LBA to make appearance in the fs->win[] */  in move_window()  argument
934 if (sect != fs->winsect) { /* Window offset changed? */ in move_window()
939 if (disk_read(fs->pdrv, fs->win, sect, 1) != RES_OK) { in move_window()
940 sect = (LBA_t)0 - 1; /* Invalidate window if read data is not valid */ in move_window()
943 fs->winsect = sect; in move_window()
952 LBA_t sect /* Sector number to make appearance in the fs->win[] */ in move_window_readdir() argument
962 if (sect != fs->winsect) { /* Window offset changed? */ in move_window_readdir()
967 if (disk_read_readdir(fs->pdrv, fs->win, sect, 1) != RES_OK) { in move_window_readdir()
968 sect = 0xFFFFFFFF; /* Invalidate window if read data is not valid */ in move_window_readdir()
971 fs->winsect = sect; in move_window_readdir()
1403 LBA_t sect; in dir_clear() local
1413 sect = clst2sect(fs, clst); /* Top of the cluster */ in dir_clear()
1414 fs->winsect = sect; /* Set window to top of the cluster */ in dir_clear()
1422 …for (n = 0; n < fs->csize && disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* F… in dir_clear()
1428 …for (n = 0; n < fs->csize && disk_write(fs->pdrv, ibuf, sect + n, szb) == RES_OK; n += szb) ; /* F… in dir_clear()
1461 dp->sect = fs->dirbase; in dir_sdi()
1471 dp->sect = clst2sect(fs, clst); in dir_sdi()
1474 if (dp->sect == 0) return FR_INT_ERR; in dir_sdi()
1475 dp->sect += ofs / SS(fs); /* Sector# of the directory entry */ in dir_sdi()
1501 if (ofs >= (DWORD)MAX_DIR) dp->sect = 0; /* Disable it if the offset reached the max value */ in dir_next()
1502 if (dp->sect == 0) return FR_NO_FILE; /* Report EOT if it has been disabled */ in dir_next()
1505 dp->sect++; /* Next sector */ in dir_next()
1509 dp->sect = 0; return FR_NO_FILE; in dir_next()
1520 dp->sect = 0; return FR_NO_FILE; in dir_next()
1528 if (!stretch) dp->sect = 0; /* (this line is to suppress compiler warning) */ in dir_next()
1529 dp->sect = 0; return FR_NO_FILE; /* Report EOT */ in dir_next()
1533 dp->sect = clst2sect(fs, clst); in dir_next()
1568 res = move_window(fs, dp->sect); in dir_alloc()
1835 while (dp->sect) { in dir_read()
1836 res = move_window(fs, dp->sect); in dir_read()
1873 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */ in dir_read()
1892 while (dp->sect) { in dir_read_massive()
1893 res = move_window_readdir(fs, dp->sect); in dir_read_massive()
1930 if (res != FR_OK) dp->sect = 0; /* Terminate the read operation on error or EOT */ in dir_read_massive()
1959 res = move_window(fs, dp->sect); in dir_find()
2057 res = move_window(fs, dp->sect); in dir_register()
2077 res = move_window(fs, dp->sect); in dir_register()
2115 res = move_window(fs, dp->sect); in dir_remove()
2131 res = move_window(fs, dp->sect); in dir_remove()
2171 if (dp->sect == 0) return; /* Exit if read pointer has reached end of directory */ in get_fileinfo()
2700 LBA_t sect /* Sector to load and check if it is an FAT-VBR or not */ in check_fs() argument
2708 if (move_window(fs, sect) != FR_OK) return 4; /* Load the boot sector */ in check_fs()
3445 fp->sect = 0; /* Invalidate current data sector */ in f_open()
3477 fp->sect = sc + (DWORD)(ofs / SS(fs)); in f_open()
3479 if (disk_read(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) res = FR_DISK_ERR; in f_open()
3549 LBA_t sect; in f_read() local
3584 sect = clst2sect(fs, fp->clust); /* Get current sector */ in f_read()
3585 if (sect == 0) ABORT(fs, FR_INT_ERR); in f_read()
3586 sect += csect; in f_read()
3592 if (disk_read(fs->pdrv, rbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_read()
3595 if (fs->wflag && fs->winsect - sect < cc) { in f_read()
3597 … copy_ret = LOS_CopyFromKernel(rbuff + ((fs->winsect - sect) * SS(fs)), SS(fs), fs->win, SS(fs)); in f_read()
3600 mem_cpy(rbuff + ((fs->winsect - sect) * SS(fs)), fs->win, SS(fs)); in f_read()
3604 if ((fp->flag & FA_DIRTY) && fp->sect - sect < cc) { in f_read()
3606 copy_ret = LOS_CopyFromKernel(rbuff + ((fp->sect - sect) * SS(fs)), SS(fs), fp->buf, SS(fs)); in f_read()
3609 mem_cpy(rbuff + ((fp->sect - sect) * SS(fs)), fp->buf, SS(fs)); in f_read()
3618 if (fp->sect != sect) { /* Load data sector if not in cache */ in f_read()
3621 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_read()
3625 …if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); /* Fill sector cache … in f_read()
3628 fp->sect = sect; in f_read()
3633 if (move_window(fs, fp->sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window */ in f_read()
3669 LBA_t sect; in f_write() local
3715 …if (fs->winsect == fp->sect && sync_window(fs) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Write-back sec… in f_write()
3718 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_write()
3722 sect = clst2sect(fs, fp->clust); /* Get current sector */ in f_write()
3723 if (sect == 0) ABORT(fs, FR_INT_ERR); in f_write()
3724 sect += csect; in f_write()
3730 if (disk_write(fs->pdrv, wbuff, sect, cc) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_write()
3733 …if (fs->winsect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ in f_write()
3734 copy_ret = LOS_CopyToKernel(fs->win, SS(fs), wbuff + ((fs->winsect - sect) * SS(fs)), SS(fs)); in f_write()
3739 if (fp->sect - sect < cc) { /* Refill sector cache if it gets invalidated by the direct write */ in f_write()
3741 copy_ret = LOS_CopyToKernel(fp->buf, SS(fs), wbuff + ((fp->sect - sect) * SS(fs)), SS(fs)); in f_write()
3744 mem_cpy(fp->buf, wbuff + ((fp->sect - sect) * SS(fs)), SS(fs)); in f_write()
3756 fs->winsect = sect; in f_write()
3759 if (fp->sect != sect && /* Fill sector cache with file data */ in f_write()
3761 disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) { in f_write()
3765 fp->sect = sect; in f_write()
3770 if (move_window(fs, fp->sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window */ in f_write()
3814 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) LEAVE_FF(fs, FR_DISK_ERR); in f_sync()
3991 res = move_window(fs, dj.sect); in f_getcwd()
4112 if (fp->fptr % SS(fs) && dsc != fp->sect) { /* Refill sector cache if needed */ in f_lseek()
4116 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_lseek()
4122 fp->sect = dsc; in f_lseek()
4188 if (fp->fptr % SS(fs) && nsect != fp->sect) { /* Fill sector cache if needed */ in f_lseek()
4192 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR); in f_lseek()
4198 fp->sect = nsect; in f_lseek()
4421 LBA_t sect; in fat_count_free_entries() local
4442 sect = fs->fatbase; /* Top of the FAT */ in fat_count_free_entries()
4446 res = move_window(fs, sect++); in fat_count_free_entries()
4578 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) { in f_truncate()
4899 LBA_t sect; local
4991 sect = clst2sect(fs, ld_clust(fs, dir));
4992 if (sect == 0) {
4997 res = move_window(fs, sect);
5003 res = move_window(fs, sect);
5487 LBA_t sect; local
5512 sect = clst2sect(fs, fp->clust); /* Get current data sector */
5513 if (sect == 0) ABORT(fs, FR_INT_ERR);
5514 sect += csect;
5516 …if (move_window(fs, sect) != FR_OK) ABORT(fs, FR_DISK_ERR); /* Move sector window to the file data…
5519 if (fp->sect != sect) { /* Fill sector cache with file data */
5522 if (disk_write(fs->pdrv, fp->buf, fp->sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
5526 if (disk_read(fs->pdrv, fp->buf, sect, 1) != RES_OK) ABORT(fs, FR_DISK_ERR);
5530 fp->sect = sect;
5629 LBA_t sect, lba[2]; local
5893 sect = b_fat; /* FAT start sector */
5905 if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }
5907 sect += n; nsect -= n;
5915 if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }
5916 sect += n; nsect -= n;
5922 sect = b_fat - 1;
5924 if (disk_write(pdrv, buf, sect, 1) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }
6014 LBA_t sect, lba[2]; local
6265 sect = b_fat; /* FAT start sector */
6277 if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }
6279 sect += n;
6288 if (disk_write(pdrv, buf, sect, (UINT)n) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }
6289 sect += n;
6295 sect = b_fat - 1;
6297 if (disk_write(pdrv, buf, sect, 1) != RES_OK) { fr = FR_DISK_ERR; goto EXIT; }