summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-20 20:54:45 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-20 20:54:45 +0000
commitd30d34a6c826747aa920cb5495a635cb758858a0 (patch)
tree65e2d9fba872a4c59786de4c1a478b77767c5bcf /nuttx/fs
parente23fb305e00f5c2cca3d5eaa898c556030e92076 (diff)
downloadpx4-nuttx-d30d34a6c826747aa920cb5495a635cb758858a0.tar.gz
px4-nuttx-d30d34a6c826747aa920cb5495a635cb758858a0.tar.bz2
px4-nuttx-d30d34a6c826747aa920cb5495a635cb758858a0.zip
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
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/fat/fs_fat32.c12
-rw-r--r--nuttx/fs/fat/fs_fat32.h40
-rw-r--r--nuttx/fs/fat/fs_fat32util.c44
-rw-r--r--nuttx/fs/fat/fs_writefat.c6
-rw-r--r--nuttx/fs/romfs/fs_romfs.c2
5 files changed, 52 insertions, 52 deletions
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index 4547d0b24..a572f4ac7 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -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];
diff --git a/nuttx/fs/fat/fs_fat32.h b/nuttx/fs/fat/fs_fat32.h
index 710417720..59dbb1f8b 100644
--- a/nuttx/fs/fat/fs_fat32.h
+++ b/nuttx/fs/fat/fs_fat32.h
@@ -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
diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c
index a37f8fadb..5bd543163 100644
--- a/nuttx/fs/fat/fs_fat32util.c
+++ b/nuttx/fs/fat/fs_fat32util.c
@@ -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;
diff --git a/nuttx/fs/fat/fs_writefat.c b/nuttx/fs/fat/fs_writefat.c
index 0d35baaf7..714ad389e 100644
--- a/nuttx/fs/fat/fs_writefat.c
+++ b/nuttx/fs/fat/fs_writefat.c
@@ -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;
diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c
index b2ffffaaf..ca420939c 100644
--- a/nuttx/fs/romfs/fs_romfs.c
+++ b/nuttx/fs/romfs/fs_romfs.c
@@ -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);