Fix AVR warnings; FAT FS needs to use off_t instead of size_t
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3728 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
a06d4256e4
commit
37b42d4259
13 changed files with 79 additions and 68 deletions
|
|
@ -1824,4 +1824,7 @@
|
|||
check-in.
|
||||
* configs/teensy: Adds a board configuration for the PJRC Teensy++ 2.0 boar
|
||||
that features an Atmel AT90USB1286 MCU.
|
||||
|
||||
* fs/fat: Offsets, sector numbers, etc. need to be off_t, not size_t. size_t
|
||||
is intended to be the maximum size of a memory object, not a file offset. This
|
||||
does not make any difference except on systems (like the AVR) where size_t
|
||||
is only 16-bits.
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ CONFIG_START_DAY=17
|
|||
CONFIG_GREGORIAN_TIME=n
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
CONFIG_DEV_LOWCONSOLE=n
|
||||
CONFIG_DEV_LOWCONSOLE=y
|
||||
CONFIG_MUTEX_TYPES=n
|
||||
CONFIG_PRIORITY_INHERITANCE=n
|
||||
CONFIG_SEM_PREALLOCHOLDERS=0
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ static int bch_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
|||
|
||||
if (cmd == DIOC_GETPRIV)
|
||||
{
|
||||
FAR struct bchlib_s **bchr = (FAR struct bchlib_s **)arg;
|
||||
FAR struct bchlib_s **bchr = (FAR struct bchlib_s **)((uintptr_t)arg);
|
||||
|
||||
bchlib_semtake(bch);
|
||||
if (!bchr && bch->refs < 255)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ int bchdev_unregister(const char *chardev)
|
|||
* will hold a reference count on the state structure.
|
||||
*/
|
||||
|
||||
ret = ioctl(fd, DIOC_GETPRIV, (unsigned long)&bch);
|
||||
ret = ioctl(fd, DIOC_GETPRIV, (unsigned long)((uintptr_t)&bch));
|
||||
(void)close(fd);
|
||||
|
||||
if (ret < 0)
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
|
|||
static int rd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
|
||||
{
|
||||
struct rd_struct_s *dev ;
|
||||
void **ppv = (void**)arg;
|
||||
void **ppv = (void**)((uintptr_t)arg);
|
||||
|
||||
fvdbg("Entry\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ static inline int usbstrg_cmdread6(FAR struct usbstrg_dev_s *priv)
|
|||
{
|
||||
/* Get the Logical Block Address (LBA) from cdb[] as the starting sector */
|
||||
|
||||
priv->sector = (read6->mslba & SCSICMD_READ6_MSLBAMASK) << 16 | usbstrg_getbe16(read6->lslba);
|
||||
priv->sector = (uint32_t)(read6->mslba & SCSICMD_READ6_MSLBAMASK) << 16 | (uint32_t)usbstrg_getbe16(read6->lslba);
|
||||
|
||||
/* Verify that a block driver has been bound to the LUN */
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ static inline int usbstrg_cmdwrite6(FAR struct usbstrg_dev_s *priv)
|
|||
{
|
||||
/* Get the Logical Block Address (LBA) from cdb[] as the starting sector */
|
||||
|
||||
priv->sector = (write6->mslba & SCSICMD_WRITE6_MSLBAMASK) << 16 | usbstrg_getbe16(write6->lslba);
|
||||
priv->sector = (uint32_t)(write6->mslba & SCSICMD_WRITE6_MSLBAMASK) << 16 | (uint32_t)usbstrg_getbe16(write6->lslba);
|
||||
|
||||
/* Verify that a block driver has been bound to the LUN */
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
|
|||
|
||||
if ((oflags & (O_APPEND|O_WRONLY)) == (O_APPEND|O_WRONLY))
|
||||
{
|
||||
ssize_t offset = (ssize_t)fat_seek(filep, ff->ff_size, SEEK_SET);
|
||||
off_t offset = fat_seek(filep, ff->ff_size, SEEK_SET);
|
||||
if (offset < 0)
|
||||
{
|
||||
kfree(ff);
|
||||
|
|
@ -658,7 +658,7 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
|
|||
goto errout_with_semaphore;
|
||||
}
|
||||
|
||||
/* Check if the file size would exceed the range of size_t */
|
||||
/* Check if the file size would exceed the range of off_t */
|
||||
|
||||
if (ff->ff_size + buflen < ff->ff_size)
|
||||
{
|
||||
|
|
@ -860,7 +860,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence)
|
|||
struct fat_mountpt_s *fs;
|
||||
struct fat_file_s *ff;
|
||||
int32_t cluster;
|
||||
ssize_t position;
|
||||
off_t position;
|
||||
unsigned int clustersize;
|
||||
int ret;
|
||||
|
||||
|
|
@ -1701,8 +1701,8 @@ static int fat_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
|
|||
struct fat_dirinfo_s dirinfo;
|
||||
uint8_t *direntry;
|
||||
uint8_t *direntry2;
|
||||
size_t parentsector;
|
||||
ssize_t dirsector;
|
||||
off_t parentsector;
|
||||
off_t dirsector;
|
||||
int32_t dircluster;
|
||||
uint32_t parentcluster;
|
||||
uint32_t crtime;
|
||||
|
|
@ -1955,7 +1955,7 @@ int fat_rename(struct inode *mountpt, const char *oldrelpath,
|
|||
{
|
||||
struct fat_mountpt_s *fs;
|
||||
struct fat_dirinfo_s dirinfo;
|
||||
size_t oldsector;
|
||||
off_t oldsector;
|
||||
uint8_t *olddirentry;
|
||||
uint8_t *newdirentry;
|
||||
uint8_t dirstate[32-11];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* fs/fat/fs_fat32.h
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -516,13 +516,13 @@ struct fat_mountpt_s
|
|||
struct fat_file_s *fs_head; /* A list to all files opened on this mountpoint */
|
||||
|
||||
sem_t fs_sem; /* Used to assume thread-safe access */
|
||||
size_t fs_hwsectorsize; /* HW: Sector size reported by block driver*/
|
||||
size_t fs_hwnsectors; /* HW: The number of sectors reported by the hardware */
|
||||
size_t fs_fatbase; /* Logical block of start of filesystem (past resd sectors) */
|
||||
size_t fs_rootbase; /* MBR: Cluster no. of 1st cluster of root dir */
|
||||
size_t fs_database; /* Logical block of start data sectors */
|
||||
size_t fs_fsinfo; /* MBR: Sector number of FSINFO sector */
|
||||
size_t fs_currentsector; /* The sector number buffered in fs_buffer */
|
||||
off_t fs_hwsectorsize; /* HW: Sector size reported by block driver*/
|
||||
off_t fs_hwnsectors; /* HW: The number of sectors reported by the hardware */
|
||||
off_t fs_fatbase; /* Logical block of start of filesystem (past resd sectors) */
|
||||
off_t fs_rootbase; /* MBR: Cluster no. of 1st cluster of root dir */
|
||||
off_t fs_database; /* Logical block of start data sectors */
|
||||
off_t fs_fsinfo; /* MBR: Sector number of FSINFO sector */
|
||||
off_t fs_currentsector; /* The sector number buffered in fs_buffer */
|
||||
uint32_t fs_nclusters; /* Maximum number of data clusters */
|
||||
uint32_t fs_nfatsects; /* MBR: Count of sectors occupied by one fat */
|
||||
uint32_t fs_fattotsec; /* MBR: Total count of sectors on the volume */
|
||||
|
|
@ -554,11 +554,11 @@ struct fat_file_s
|
|||
uint8_t ff_sectorsincluster; /* Sectors remaining in cluster */
|
||||
uint16_t ff_dirindex; /* Index into ff_dirsector to directory entry */
|
||||
uint32_t ff_currentcluster; /* Current cluster being accessed */
|
||||
size_t ff_dirsector; /* Sector containing the directory entry */
|
||||
off_t ff_dirsector; /* Sector containing the directory entry */
|
||||
off_t ff_size; /* Size of the file in bytes */
|
||||
size_t ff_startcluster; /* Start cluster of file on media */
|
||||
size_t ff_currentsector; /* Current sector being operated on */
|
||||
size_t ff_cachesector; /* Current sector in the file buffer */
|
||||
off_t ff_startcluster; /* Start cluster of file on media */
|
||||
off_t ff_currentsector; /* Current sector being operated on */
|
||||
off_t ff_cachesector; /* Current sector in the file buffer */
|
||||
uint8_t *ff_buffer; /* File buffer (for partial sector accesses) */
|
||||
};
|
||||
|
||||
|
|
@ -615,16 +615,16 @@ EXTERN int fat_checkmount(struct fat_mountpt_s *fs);
|
|||
/* low-level hardware access */
|
||||
|
||||
EXTERN int fat_hwread(struct fat_mountpt_s *fs, uint8_t *buffer,
|
||||
size_t sector, unsigned int nsectors);
|
||||
off_t sector, unsigned int nsectors);
|
||||
EXTERN int fat_hwwrite(struct fat_mountpt_s *fs, uint8_t *buffer,
|
||||
size_t sector, unsigned int nsectors);
|
||||
off_t sector, unsigned int nsectors);
|
||||
|
||||
/* Cluster / cluster chain access helpers */
|
||||
|
||||
EXTERN ssize_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32_t cluster);
|
||||
EXTERN ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno);
|
||||
EXTERN off_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32_t cluster);
|
||||
EXTERN off_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno);
|
||||
EXTERN int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno,
|
||||
size_t startsector);
|
||||
off_t startsector);
|
||||
EXTERN int fat_removechain(struct fat_mountpt_s *fs, uint32_t cluster);
|
||||
EXTERN int32_t fat_extendchain(struct fat_mountpt_s *fs, uint32_t cluster);
|
||||
|
||||
|
|
@ -648,15 +648,15 @@ EXTERN int fat_remove(struct fat_mountpt_s *fs, const char *relpath, bool dir
|
|||
/* Mountpoint and file buffer cache (for partial sector accesses) */
|
||||
|
||||
EXTERN int fat_fscacheflush(struct fat_mountpt_s *fs);
|
||||
EXTERN int fat_fscacheread(struct fat_mountpt_s *fs, size_t sector);
|
||||
EXTERN int fat_fscacheread(struct fat_mountpt_s *fs, off_t sector);
|
||||
EXTERN int fat_ffcacheflush(struct fat_mountpt_s *fs, struct fat_file_s *ff);
|
||||
EXTERN int fat_ffcacheread(struct fat_mountpt_s *fs, struct fat_file_s *ff, size_t sector);
|
||||
EXTERN int fat_ffcacheread(struct fat_mountpt_s *fs, struct fat_file_s *ff, off_t sector);
|
||||
EXTERN int fat_ffcacheinvalidate(struct fat_mountpt_s *fs, struct fat_file_s *ff);
|
||||
|
||||
/* FSINFO sector support */
|
||||
|
||||
EXTERN int fat_updatefsinfo(struct fat_mountpt_s *fs);
|
||||
EXTERN int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters);
|
||||
EXTERN int fat_nfreeclusters(struct fat_mountpt_s *fs, off_t *pfreeclusters);
|
||||
EXTERN int fat_currentsector(struct fat_mountpt_s *fs, struct fat_file_s *ff, off_t position);
|
||||
|
||||
#undef EXTERN
|
||||
|
|
|
|||
|
|
@ -792,7 +792,7 @@ int fat_checkmount(struct fat_mountpt_s *fs)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_hwread(struct fat_mountpt_s *fs, uint8_t *buffer, size_t sector,
|
||||
int fat_hwread(struct fat_mountpt_s *fs, uint8_t *buffer, off_t sector,
|
||||
unsigned int nsectors)
|
||||
{
|
||||
int ret = -ENODEV;
|
||||
|
|
@ -823,7 +823,7 @@ int fat_hwread(struct fat_mountpt_s *fs, uint8_t *buffer, size_t sector,
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_hwwrite(struct fat_mountpt_s *fs, uint8_t *buffer, size_t sector,
|
||||
int fat_hwwrite(struct fat_mountpt_s *fs, uint8_t *buffer, off_t sector,
|
||||
unsigned int nsectors)
|
||||
{
|
||||
int ret = -ENODEV;
|
||||
|
|
@ -855,7 +855,7 @@ int fat_hwwrite(struct fat_mountpt_s *fs, uint8_t *buffer, size_t sector,
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32_t cluster )
|
||||
off_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32_t cluster )
|
||||
{
|
||||
cluster -= 2;
|
||||
if (cluster >= fs->fs_nclusters - 2)
|
||||
|
|
@ -874,7 +874,7 @@ ssize_t fat_cluster2sector(struct fat_mountpt_s *fs, uint32_t cluster )
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
||||
off_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
||||
{
|
||||
/* Verify that the cluster number is within range */
|
||||
|
||||
|
|
@ -888,7 +888,7 @@ ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
|||
{
|
||||
case FSTYPE_FAT12 :
|
||||
{
|
||||
size_t fatsector;
|
||||
off_t fatsector;
|
||||
unsigned int fatoffset;
|
||||
unsigned int cluster;
|
||||
unsigned int fatindex;
|
||||
|
|
@ -959,7 +959,7 @@ ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
|||
case FSTYPE_FAT16 :
|
||||
{
|
||||
unsigned int fatoffset = 2 * clusterno;
|
||||
size_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
off_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
unsigned int fatindex = fatoffset & SEC_NDXMASK(fs);
|
||||
|
||||
if (fat_fscacheread(fs, fatsector) < 0)
|
||||
|
|
@ -973,7 +973,7 @@ ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
|||
case FSTYPE_FAT32 :
|
||||
{
|
||||
unsigned int fatoffset = 4 * clusterno;
|
||||
size_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
off_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
unsigned int fatindex = fatoffset & SEC_NDXMASK(fs);
|
||||
|
||||
if (fat_fscacheread(fs, fatsector) < 0)
|
||||
|
|
@ -990,7 +990,7 @@ ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
|||
|
||||
/* There is no cluster information, or an error occured */
|
||||
|
||||
return (ssize_t)-EINVAL;
|
||||
return (off_t)-EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -1000,7 +1000,7 @@ ssize_t fat_getcluster(struct fat_mountpt_s *fs, uint32_t clusterno)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno, size_t nextcluster)
|
||||
int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno, off_t nextcluster)
|
||||
{
|
||||
/* Verify that the cluster number is within range. Zero erases the cluster. */
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno, size_t nextclus
|
|||
{
|
||||
case FSTYPE_FAT12 :
|
||||
{
|
||||
size_t fatsector;
|
||||
off_t fatsector;
|
||||
unsigned int fatoffset;
|
||||
unsigned int fatindex;
|
||||
uint8_t value;
|
||||
|
|
@ -1101,7 +1101,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno, size_t nextclus
|
|||
case FSTYPE_FAT16 :
|
||||
{
|
||||
unsigned int fatoffset = 2 * clusterno;
|
||||
size_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
off_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
unsigned int fatindex = fatoffset & SEC_NDXMASK(fs);
|
||||
|
||||
if (fat_fscacheread(fs, fatsector) < 0)
|
||||
|
|
@ -1116,7 +1116,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno, size_t nextclus
|
|||
case FSTYPE_FAT32 :
|
||||
{
|
||||
unsigned int fatoffset = 4 * clusterno;
|
||||
size_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
off_t fatsector = fs->fs_fatbase + SEC_NSECTORS(fs, fatoffset);
|
||||
unsigned int fatindex = fatoffset & SEC_NDXMASK(fs);
|
||||
|
||||
if (fat_fscacheread(fs, fatsector) < 0)
|
||||
|
|
@ -1202,7 +1202,7 @@ int fat_removechain(struct fat_mountpt_s *fs, uint32_t cluster)
|
|||
|
||||
int32_t fat_extendchain(struct fat_mountpt_s *fs, uint32_t cluster)
|
||||
{
|
||||
ssize_t startsector;
|
||||
off_t startsector;
|
||||
uint32_t newcluster;
|
||||
uint32_t startcluster;
|
||||
int ret;
|
||||
|
|
@ -1448,7 +1448,7 @@ int fat_nextdirentry(struct fat_mountpt_s *fs, struct fs_fatdir_s *dir)
|
|||
int fat_finddirentry(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo,
|
||||
const char *path)
|
||||
{
|
||||
size_t cluster;
|
||||
off_t cluster;
|
||||
uint8_t *direntry = NULL;
|
||||
char terminator;
|
||||
int ret;
|
||||
|
|
@ -1605,7 +1605,7 @@ int fat_finddirentry(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo,
|
|||
int fat_allocatedirentry(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo)
|
||||
{
|
||||
int32_t cluster;
|
||||
size_t sector;
|
||||
off_t sector;
|
||||
uint8_t *direntry;
|
||||
uint8_t ch;
|
||||
int ret;
|
||||
|
|
@ -1839,7 +1839,7 @@ int fat_dirtruncate(struct fat_mountpt_s *fs, struct fat_dirinfo_s *dirinfo)
|
|||
{
|
||||
unsigned int startcluster;
|
||||
uint32_t writetime;
|
||||
size_t savesector;
|
||||
off_t savesector;
|
||||
int ret;
|
||||
|
||||
/* Get start cluster of the file to truncate */
|
||||
|
|
@ -1948,7 +1948,7 @@ int fat_remove(struct fat_mountpt_s *fs, const char *relpath, bool directory)
|
|||
{
|
||||
struct fat_dirinfo_s dirinfo;
|
||||
uint32_t dircluster;
|
||||
size_t dirsector;
|
||||
off_t dirsector;
|
||||
int ret;
|
||||
|
||||
/* Find the directory entry referring to the entry to be deleted */
|
||||
|
|
@ -2172,7 +2172,7 @@ int fat_fscacheflush(struct fat_mountpt_s *fs)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_fscacheread(struct fat_mountpt_s *fs, size_t sector)
|
||||
int fat_fscacheread(struct fat_mountpt_s *fs, off_t sector)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -2251,7 +2251,7 @@ int fat_ffcacheflush(struct fat_mountpt_s *fs, struct fat_file_s *ff)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_ffcacheread(struct fat_mountpt_s *fs, struct fat_file_s *ff, size_t sector)
|
||||
int fat_ffcacheread(struct fat_mountpt_s *fs, struct fat_file_s *ff, off_t sector)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -2374,7 +2374,7 @@ int fat_updatefsinfo(struct fat_mountpt_s *fs)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters)
|
||||
int fat_nfreeclusters(struct fat_mountpt_s *fs, off_t *pfreeclusters)
|
||||
{
|
||||
uint32_t nfreeclusters;
|
||||
|
||||
|
|
@ -2391,7 +2391,7 @@ int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters)
|
|||
nfreeclusters = 0;
|
||||
if (fs->fs_type == FSTYPE_FAT12)
|
||||
{
|
||||
size_t sector;
|
||||
off_t sector;
|
||||
|
||||
/* Examine every cluster in the fat */
|
||||
|
||||
|
|
@ -2409,7 +2409,7 @@ int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters)
|
|||
else
|
||||
{
|
||||
unsigned int cluster;
|
||||
size_t fatsector;
|
||||
off_t fatsector;
|
||||
unsigned int offset;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* fs/fat/fs_writefat.c
|
||||
*
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -388,7 +388,7 @@ static inline int mkfatfs_writembr(FAR struct fat_format_s *fmt,
|
|||
static inline int mkfatfs_writefat(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var)
|
||||
{
|
||||
size_t offset = fmt->ff_rsvdseccount;
|
||||
off_t offset = fmt->ff_rsvdseccount;
|
||||
int fatno;
|
||||
int sectno;
|
||||
int ret;
|
||||
|
|
@ -471,7 +471,7 @@ static inline int mkfatfs_writefat(FAR struct fat_format_s *fmt,
|
|||
static inline int mkfatfs_writerootdir(FAR struct fat_format_s *fmt,
|
||||
FAR struct fat_var_s *var)
|
||||
{
|
||||
size_t offset = fmt->ff_rsvdseccount + fmt->ff_nfats * var->fv_nfatsects;
|
||||
off_t offset = fmt->ff_rsvdseccount + fmt->ff_nfats * var->fv_nfatsects;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence)
|
|||
{
|
||||
struct romfs_mountpt_s *rm;
|
||||
struct romfs_file_s *rf;
|
||||
ssize_t position;
|
||||
off_t position;
|
||||
int ret;
|
||||
|
||||
fvdbg("Seek to offset: %d whence: %d\n", offset, whence);
|
||||
|
|
|
|||
|
|
@ -108,13 +108,13 @@
|
|||
struct statfs
|
||||
{
|
||||
uint32_t f_type; /* Type of filesystem (see definitions above) */
|
||||
size_t f_namelen; /* Maximum length of filenames */
|
||||
size_t f_bsize; /* Optimal block size for transfers */
|
||||
size_t f_blocks; /* Total data blocks in the file system of this size */
|
||||
size_t f_bfree; /* Free blocks in the file system */
|
||||
size_t f_bavail; /* Free blocks avail to non-superuser */
|
||||
size_t f_files; /* Total file nodes in the file system */
|
||||
size_t f_ffree; /* Free file nodes in the file system */
|
||||
uint32_t f_namelen; /* Maximum length of filenames */
|
||||
off_t f_blocks; /* Total data blocks in the file system of this size */
|
||||
off_t f_bfree; /* Free blocks in the file system */
|
||||
off_t f_bavail; /* Free blocks avail to non-superuser */
|
||||
off_t f_files; /* Total file nodes in the file system */
|
||||
off_t f_ffree; /* Free file nodes in the file system */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ typedef double float64;
|
|||
|
||||
typedef unsigned int mode_t;
|
||||
|
||||
/* size_t is used for sizes of objects.
|
||||
/* size_t is used for sizes of memory objects.
|
||||
* ssize_t is used for a count of bytes or an error indication.
|
||||
*/
|
||||
|
||||
|
|
@ -161,15 +161,23 @@ typedef unsigned int id_t;
|
|||
/* blkcnt_t and off_t are signed integer types.
|
||||
*
|
||||
* blkcnt_t is used for file block counts.
|
||||
* off_t is used for file sizes.
|
||||
* off_t is used for file offsets and sizes.
|
||||
* fpos_t is used for file positions.
|
||||
*
|
||||
* Hence, both should be independent of processor architecture.
|
||||
* Hence, all should be independent of processor architecture.
|
||||
*/
|
||||
|
||||
typedef uint32_t blkcnt_t;
|
||||
typedef int32_t off_t;
|
||||
typedef off_t fpos_t;
|
||||
|
||||
/* Large file versions */
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
typedef int64_t off64_t;
|
||||
typedef int64_t fpos64_t;
|
||||
#endif
|
||||
|
||||
/* blksize_t is a signed integer value used for file block sizes */
|
||||
|
||||
typedef int16_t blksize_t;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue