forked from Imagelibrary/rtems
2004-03-22 Ralf Corsepius <ralf_corsepius@rtems.org>
* libfs/src/dosfs/fat.c, libfs/src/dosfs/fat.h, libfs/src/dosfs/fat_fat_operations.c, libfs/src/dosfs/fat_fat_operations.h, libfs/src/dosfs/fat_file.c, libfs/src/dosfs/fat_file.h, libfs/src/dosfs/msdos.h, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_initsupp.c, libfs/src/dosfs/msdos_misc.c, libfs/src/imfs/deviceio.c, libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_fchmod.c, libfs/src/imfs/linearfile.c, libfs/src/imfs/memfile.c: Convert to using c99 fixed-size types.
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
2004-03-22 Ralf Corsepius <ralf_corsepius@rtems.org>
|
||||||
|
|
||||||
|
* libfs/src/dosfs/fat.c, libfs/src/dosfs/fat.h,
|
||||||
|
libfs/src/dosfs/fat_fat_operations.c,
|
||||||
|
libfs/src/dosfs/fat_fat_operations.h, libfs/src/dosfs/fat_file.c,
|
||||||
|
libfs/src/dosfs/fat_file.h, libfs/src/dosfs/msdos.h,
|
||||||
|
libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_dir.c,
|
||||||
|
libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_initsupp.c,
|
||||||
|
libfs/src/dosfs/msdos_misc.c, libfs/src/imfs/deviceio.c,
|
||||||
|
libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_directory.c,
|
||||||
|
libfs/src/imfs/imfs_fchmod.c, libfs/src/imfs/linearfile.c,
|
||||||
|
libfs/src/imfs/memfile.c: Convert to using c99 fixed-size types.
|
||||||
|
|
||||||
2004-03-05 Joel Sherrill <joel@OARcorp.com>
|
2004-03-05 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* libnetworking/net/radix.c: Remove warning.
|
* libnetworking/net/radix.c: Remove warning.
|
||||||
|
|||||||
@@ -46,19 +46,19 @@
|
|||||||
ssize_t
|
ssize_t
|
||||||
_fat_block_read(
|
_fat_block_read(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 offset,
|
uint32_t offset,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
void *buff
|
void *buff
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
ssize_t cmpltd = 0;
|
ssize_t cmpltd = 0;
|
||||||
unsigned32 blk = start;
|
uint32_t blk = start;
|
||||||
unsigned32 ofs = offset;
|
uint32_t ofs = offset;
|
||||||
bdbuf_buffer *block = NULL;
|
bdbuf_buffer *block = NULL;
|
||||||
unsigned32 c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
@@ -97,18 +97,18 @@ _fat_block_read(
|
|||||||
ssize_t
|
ssize_t
|
||||||
_fat_block_write(
|
_fat_block_write(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 offset,
|
uint32_t offset,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
const void *buff)
|
const void *buff)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
ssize_t cmpltd = 0;
|
ssize_t cmpltd = 0;
|
||||||
unsigned32 blk = start;
|
uint32_t blk = start;
|
||||||
unsigned32 ofs = offset;
|
uint32_t ofs = offset;
|
||||||
bdbuf_buffer *block = NULL;
|
bdbuf_buffer *block = NULL;
|
||||||
unsigned32 c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
while(count > 0)
|
while(count > 0)
|
||||||
{
|
{
|
||||||
@@ -151,12 +151,12 @@ _fat_block_write(
|
|||||||
ssize_t
|
ssize_t
|
||||||
fat_cluster_read(
|
fat_cluster_read(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
void *buff
|
void *buff
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 fsec = 0;
|
uint32_t fsec = 0;
|
||||||
|
|
||||||
fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
|
fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
|
||||||
|
|
||||||
@@ -179,12 +179,12 @@ fat_cluster_read(
|
|||||||
ssize_t
|
ssize_t
|
||||||
fat_cluster_write(
|
fat_cluster_write(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
const void *buff
|
const void *buff
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 fsec = 0;
|
uint32_t fsec = 0;
|
||||||
|
|
||||||
fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
|
fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
|
|||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
register fat_vol_t *vol = &fs_info->vol;
|
register fat_vol_t *vol = &fs_info->vol;
|
||||||
unsigned32 data_secs = 0;
|
uint32_t data_secs = 0;
|
||||||
char boot_rec[FAT_MAX_BPB_SIZE];
|
char boot_rec[FAT_MAX_BPB_SIZE];
|
||||||
char fs_info_sector[FAT_USEFUL_INFO_SIZE];
|
char fs_info_sector[FAT_USEFUL_INFO_SIZE];
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
@@ -526,13 +526,13 @@ fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry)
|
|||||||
int
|
int
|
||||||
fat_init_clusters_chain(
|
fat_init_clusters_chain(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start_cln
|
uint32_t start_cln
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = start_cln;
|
uint32_t cur_cln = start_cln;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = calloc(fs_info->vol.bpc, sizeof(char));
|
buf = calloc(fs_info->vol.bpc, sizeof(char));
|
||||||
@@ -585,11 +585,11 @@ fat_init_clusters_chain(
|
|||||||
* 0 means FAILED !!!
|
* 0 means FAILED !!!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
unsigned32
|
uint32_t
|
||||||
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
|
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
|
||||||
{
|
{
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 j = 0;
|
uint32_t j = 0;
|
||||||
rtems_boolean resrc_unsuff = FALSE;
|
rtems_boolean resrc_unsuff = FALSE;
|
||||||
|
|
||||||
while (!resrc_unsuff)
|
while (!resrc_unsuff)
|
||||||
@@ -634,7 +634,7 @@ fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
|
|||||||
void
|
void
|
||||||
fat_free_unique_ino(
|
fat_free_unique_ino(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 ino
|
uint32_t ino
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
@@ -655,7 +655,7 @@ fat_free_unique_ino(
|
|||||||
inline rtems_boolean
|
inline rtems_boolean
|
||||||
fat_ino_is_unique(
|
fat_ino_is_unique(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 ino
|
uint32_t ino
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
@@ -677,14 +677,14 @@ fat_ino_is_unique(
|
|||||||
int
|
int
|
||||||
fat_fat32_update_fsinfo_sector(
|
fat_fat32_update_fsinfo_sector(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 free_count,
|
uint32_t free_count,
|
||||||
unsigned32 next_free
|
uint32_t next_free
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ssize_t ret1 = 0, ret2 = 0;
|
ssize_t ret1 = 0, ret2 = 0;
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 le_free_count = 0;
|
uint32_t le_free_count = 0;
|
||||||
unsigned32 le_next_free = 0;
|
uint32_t le_next_free = 0;
|
||||||
|
|
||||||
le_free_count = CT_LE_L(free_count);
|
le_free_count = CT_LE_L(free_count);
|
||||||
le_next_free = CT_LE_L(next_free);
|
le_next_free = CT_LE_L(next_free);
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if (CPU_BIG_ENDIAN == TRUE)
|
#if (CPU_BIG_ENDIAN == TRUE)
|
||||||
# define CF_LE_W(v) CPU_swap_u16((unsigned16)v)
|
# define CF_LE_W(v) CPU_swap_u16((uint16_t )v)
|
||||||
# define CF_LE_L(v) CPU_swap_u32((unsigned32)v)
|
# define CF_LE_L(v) CPU_swap_u32((uint32_t )v)
|
||||||
# define CT_LE_W(v) CPU_swap_u16((unsigned16)v)
|
# define CT_LE_W(v) CPU_swap_u16((uint16_t )v)
|
||||||
# define CT_LE_L(v) CPU_swap_u32((unsigned32)v)
|
# define CT_LE_L(v) CPU_swap_u32((uint32_t )v)
|
||||||
#else
|
#else
|
||||||
# define CF_LE_W(v) (v)
|
# define CF_LE_W(v) (v)
|
||||||
# define CF_LE_L(v) (v)
|
# define CF_LE_L(v) (v)
|
||||||
@@ -81,41 +81,41 @@ extern "C" {
|
|||||||
#define FAT_FAT16 0x02
|
#define FAT_FAT16 0x02
|
||||||
#define FAT_FAT32 0x04
|
#define FAT_FAT32 0x04
|
||||||
|
|
||||||
#define FAT_UNDEFINED_VALUE (unsigned32)0xFFFFFFFF
|
#define FAT_UNDEFINED_VALUE (uint32_t )0xFFFFFFFF
|
||||||
|
|
||||||
#define FAT_FAT12_EOC 0x0FF8
|
#define FAT_FAT12_EOC 0x0FF8
|
||||||
#define FAT_FAT16_EOC 0xFFF8
|
#define FAT_FAT16_EOC 0xFFF8
|
||||||
#define FAT_FAT32_EOC (unsigned32)0x0FFFFFF8
|
#define FAT_FAT32_EOC (uint32_t )0x0FFFFFF8
|
||||||
|
|
||||||
#define FAT_FAT12_FREE 0x0000
|
#define FAT_FAT12_FREE 0x0000
|
||||||
#define FAT_FAT16_FREE 0x0000
|
#define FAT_FAT16_FREE 0x0000
|
||||||
#define FAT_FAT32_FREE 0x00000000
|
#define FAT_FAT32_FREE 0x00000000
|
||||||
|
|
||||||
#define FAT_GENFAT_EOC (unsigned32)0xFFFFFFFF
|
#define FAT_GENFAT_EOC (uint32_t )0xFFFFFFFF
|
||||||
#define FAT_GENFAT_FREE (unsigned32)0x00000000
|
#define FAT_GENFAT_FREE (uint32_t )0x00000000
|
||||||
|
|
||||||
#define FAT_FAT12_SHIFT 0x04
|
#define FAT_FAT12_SHIFT 0x04
|
||||||
|
|
||||||
#define FAT_FAT12_MASK 0x00000FFF
|
#define FAT_FAT12_MASK 0x00000FFF
|
||||||
#define FAT_FAT16_MASK 0x0000FFFF
|
#define FAT_FAT16_MASK 0x0000FFFF
|
||||||
#define FAT_FAT32_MASK (unsigned32)0x0FFFFFFF
|
#define FAT_FAT32_MASK (uint32_t )0x0FFFFFFF
|
||||||
|
|
||||||
#define FAT_MAX_BPB_SIZE 90
|
#define FAT_MAX_BPB_SIZE 90
|
||||||
|
|
||||||
/* size of useful information in FSInfo sector */
|
/* size of useful information in FSInfo sector */
|
||||||
#define FAT_USEFUL_INFO_SIZE 12
|
#define FAT_USEFUL_INFO_SIZE 12
|
||||||
|
|
||||||
#define FAT_VAL8(x, ofs) (unsigned8)(*((unsigned8 *)(x) + (ofs)))
|
#define FAT_VAL8(x, ofs) (uint8_t )(*((uint8_t *)(x) + (ofs)))
|
||||||
|
|
||||||
#define FAT_VAL16(x, ofs) \
|
#define FAT_VAL16(x, ofs) \
|
||||||
(unsigned16)( (*((unsigned8 *)(x) + (ofs))) | \
|
(uint16_t )( (*((uint8_t *)(x) + (ofs))) | \
|
||||||
((*((unsigned8 *)(x) + (ofs) + 1)) << 8) )
|
((*((uint8_t *)(x) + (ofs) + 1)) << 8) )
|
||||||
|
|
||||||
#define FAT_VAL32(x, ofs) \
|
#define FAT_VAL32(x, ofs) \
|
||||||
(unsigned32)( (unsigned32)(*((unsigned8 *)(x) + (ofs))) | \
|
(uint32_t )( (uint32_t )(*((uint8_t *)(x) + (ofs))) | \
|
||||||
((unsigned32)(*((unsigned8 *)(x) + (ofs) + 1)) << 8) | \
|
((uint32_t )(*((uint8_t *)(x) + (ofs) + 1)) << 8) | \
|
||||||
((unsigned32)(*((unsigned8 *)(x) + (ofs) + 2)) << 16) | \
|
((uint32_t )(*((uint8_t *)(x) + (ofs) + 2)) << 16) | \
|
||||||
((unsigned32)(*((unsigned8 *)(x) + (ofs) + 3)) << 24) )
|
((uint32_t )(*((uint8_t *)(x) + (ofs) + 3)) << 24) )
|
||||||
|
|
||||||
/* macros to access boot sector fields */
|
/* macros to access boot sector fields */
|
||||||
#define FAT_BR_BYTES_PER_SECTOR(x) FAT_VAL16(x, 11)
|
#define FAT_BR_BYTES_PER_SECTOR(x) FAT_VAL16(x, 11)
|
||||||
@@ -170,33 +170,33 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
typedef struct fat_vol_s
|
typedef struct fat_vol_s
|
||||||
{
|
{
|
||||||
unsigned16 bps; /* bytes per sector */
|
uint16_t bps; /* bytes per sector */
|
||||||
unsigned8 sec_log2; /* log2 of bps */
|
uint8_t sec_log2; /* log2 of bps */
|
||||||
unsigned8 sec_mul; /* log2 of 512bts sectors number per sector */
|
uint8_t sec_mul; /* log2 of 512bts sectors number per sector */
|
||||||
unsigned8 spc; /* sectors per cluster */
|
uint8_t spc; /* sectors per cluster */
|
||||||
unsigned8 spc_log2; /* log2 of spc */
|
uint8_t spc_log2; /* log2 of spc */
|
||||||
unsigned16 bpc; /* bytes per cluster */
|
uint16_t bpc; /* bytes per cluster */
|
||||||
unsigned8 bpc_log2; /* log2 of bytes per cluster */
|
uint8_t bpc_log2; /* log2 of bytes per cluster */
|
||||||
unsigned8 fats; /* number of FATs */
|
uint8_t fats; /* number of FATs */
|
||||||
unsigned8 type; /* FAT type */
|
uint8_t type; /* FAT type */
|
||||||
unsigned32 mask;
|
uint32_t mask;
|
||||||
unsigned32 eoc_val;
|
uint32_t eoc_val;
|
||||||
unsigned16 fat_loc; /* FAT start */
|
uint16_t fat_loc; /* FAT start */
|
||||||
unsigned32 fat_length; /* sectors per FAT */
|
uint32_t fat_length; /* sectors per FAT */
|
||||||
unsigned32 rdir_loc; /* root directory start */
|
uint32_t rdir_loc; /* root directory start */
|
||||||
unsigned16 rdir_entrs; /* files per root directory */
|
uint16_t rdir_entrs; /* files per root directory */
|
||||||
unsigned32 rdir_secs; /* sectors per root directory */
|
uint32_t rdir_secs; /* sectors per root directory */
|
||||||
unsigned32 rdir_size; /* root directory size in bytes */
|
uint32_t rdir_size; /* root directory size in bytes */
|
||||||
unsigned32 tot_secs; /* total count of sectors */
|
uint32_t tot_secs; /* total count of sectors */
|
||||||
unsigned32 data_fsec; /* first data sector */
|
uint32_t data_fsec; /* first data sector */
|
||||||
unsigned32 data_cls; /* count of data clusters */
|
uint32_t data_cls; /* count of data clusters */
|
||||||
unsigned32 rdir_cl; /* first cluster of the root directory */
|
uint32_t rdir_cl; /* first cluster of the root directory */
|
||||||
unsigned16 info_sec; /* FSInfo Sector Structure location */
|
uint16_t info_sec; /* FSInfo Sector Structure location */
|
||||||
unsigned32 free_cls; /* last known free clusters count */
|
uint32_t free_cls; /* last known free clusters count */
|
||||||
unsigned32 next_cl; /* next free cluster number */
|
uint32_t next_cl; /* next free cluster number */
|
||||||
unsigned8 mirror; /* mirroring enabla/disable */
|
uint8_t mirror; /* mirroring enabla/disable */
|
||||||
unsigned32 afat_loc; /* active FAT location */
|
uint32_t afat_loc; /* active FAT location */
|
||||||
unsigned8 afat; /* the number of active FAT */
|
uint8_t afat; /* the number of active FAT */
|
||||||
dev_t dev; /* device ID */
|
dev_t dev; /* device ID */
|
||||||
disk_device *dd; /* disk device (see libblock) */
|
disk_device *dd; /* disk device (see libblock) */
|
||||||
void *private_data; /* reserved */
|
void *private_data; /* reserved */
|
||||||
@@ -205,9 +205,9 @@ typedef struct fat_vol_s
|
|||||||
|
|
||||||
typedef struct fat_cache_s
|
typedef struct fat_cache_s
|
||||||
{
|
{
|
||||||
unsigned32 blk_num;
|
uint32_t blk_num;
|
||||||
rtems_boolean modified;
|
rtems_boolean modified;
|
||||||
unsigned8 state;
|
uint8_t state;
|
||||||
bdbuf_buffer *buf;
|
bdbuf_buffer *buf;
|
||||||
} fat_cache_t;
|
} fat_cache_t;
|
||||||
|
|
||||||
@@ -221,11 +221,11 @@ typedef struct fat_fs_info_s
|
|||||||
Chain_Control *vhash; /* "vhash" of fat-file descriptors */
|
Chain_Control *vhash; /* "vhash" of fat-file descriptors */
|
||||||
Chain_Control *rhash; /* "rhash" of fat-file descriptors */
|
Chain_Control *rhash; /* "rhash" of fat-file descriptors */
|
||||||
char *uino; /* array of unique ino numbers */
|
char *uino; /* array of unique ino numbers */
|
||||||
unsigned32 index;
|
uint32_t index;
|
||||||
unsigned32 uino_pool_size; /* size */
|
uint32_t uino_pool_size; /* size */
|
||||||
unsigned32 uino_base;
|
uint32_t uino_base;
|
||||||
fat_cache_t c; /* cache */
|
fat_cache_t c; /* cache */
|
||||||
unsigned8 *sec_buf; /* just placeholder for anything */
|
uint8_t *sec_buf; /* just placeholder for anything */
|
||||||
} fat_fs_info_t;
|
} fat_fs_info_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -235,8 +235,8 @@ typedef struct fat_fs_info_s
|
|||||||
*/
|
*/
|
||||||
typedef struct fat_auxiliary_s
|
typedef struct fat_auxiliary_s
|
||||||
{
|
{
|
||||||
unsigned32 cln;
|
uint32_t cln;
|
||||||
unsigned32 ofs;
|
uint32_t ofs;
|
||||||
} fat_auxiliary_t;
|
} fat_auxiliary_t;
|
||||||
|
|
||||||
#define FAT_FAT_OFFSET(fat_type, cln) \
|
#define FAT_FAT_OFFSET(fat_type, cln) \
|
||||||
@@ -258,10 +258,10 @@ typedef struct fat_auxiliary_s
|
|||||||
#define FAT_OP_TYPE_READ 0x1
|
#define FAT_OP_TYPE_READ 0x1
|
||||||
#define FAT_OP_TYPE_GET 0x2
|
#define FAT_OP_TYPE_GET 0x2
|
||||||
|
|
||||||
static inline unsigned32
|
static inline uint32_t
|
||||||
fat_cluster_num_to_sector_num(
|
fat_cluster_num_to_sector_num(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln
|
uint32_t cln
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
@@ -273,10 +273,10 @@ fat_cluster_num_to_sector_num(
|
|||||||
fs_info->vol.data_fsec);
|
fs_info->vol.data_fsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned32
|
static inline uint32_t
|
||||||
fat_cluster_num_to_sector512_num(
|
fat_cluster_num_to_sector512_num(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln
|
uint32_t cln
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
@@ -289,11 +289,11 @@ fat_cluster_num_to_sector512_num(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
fat_buf_access(fat_fs_info_t *fs_info, unsigned32 blk, int op_type,
|
fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
|
||||||
bdbuf_buffer **buf)
|
bdbuf_buffer **buf)
|
||||||
{
|
{
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
unsigned8 i;
|
uint8_t i;
|
||||||
rtems_boolean sec_of_fat;
|
rtems_boolean sec_of_fat;
|
||||||
|
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ static inline int
|
|||||||
fat_buf_release(fat_fs_info_t *fs_info)
|
fat_buf_release(fat_fs_info_t *fs_info)
|
||||||
{
|
{
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
unsigned8 i;
|
uint8_t i;
|
||||||
rtems_boolean sec_of_fat;
|
rtems_boolean sec_of_fat;
|
||||||
|
|
||||||
if (fs_info->c.state == FAT_CACHE_EMPTY)
|
if (fs_info->c.state == FAT_CACHE_EMPTY)
|
||||||
@@ -430,26 +430,26 @@ fat_buf_mark_modified(fat_fs_info_t *fs_info)
|
|||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
_fat_block_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
_fat_block_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 offset,
|
uint32_t offset,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
void *buff);
|
void *buff);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
_fat_block_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
_fat_block_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 offset,
|
uint32_t offset,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
const void *buff);
|
const void *buff);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
fat_cluster_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_cluster_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
void *buff);
|
void *buff);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
fat_cluster_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_cluster_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
const void *buff);
|
const void *buff);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -457,32 +457,32 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry);
|
|||||||
|
|
||||||
int
|
int
|
||||||
fat_init_clusters_chain(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_init_clusters_chain(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 start_cln);
|
uint32_t start_cln);
|
||||||
|
|
||||||
unsigned32
|
uint32_t
|
||||||
fat_cluster_num_to_sector_num(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_cluster_num_to_sector_num(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln);
|
uint32_t cln);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry);
|
fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||||
|
|
||||||
|
|
||||||
unsigned32
|
uint32_t
|
||||||
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry);
|
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||||
|
|
||||||
rtems_boolean
|
rtems_boolean
|
||||||
fat_ino_is_unique(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_ino_is_unique(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 ino);
|
uint32_t ino);
|
||||||
|
|
||||||
void
|
void
|
||||||
fat_free_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_free_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 ino);
|
uint32_t ino);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_fat32_update_fsinfo_sector(
|
fat_fat32_update_fsinfo_sector(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 free_count,
|
uint32_t free_count,
|
||||||
unsigned32 next_free
|
uint32_t next_free
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -44,19 +44,19 @@
|
|||||||
int
|
int
|
||||||
fat_scan_fat_for_free_clusters(
|
fat_scan_fat_for_free_clusters(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 *chain,
|
uint32_t *chain,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
unsigned32 *cls_added,
|
uint32_t *cls_added,
|
||||||
unsigned32 *last_cl
|
uint32_t *last_cl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cl4find = 2;
|
uint32_t cl4find = 2;
|
||||||
unsigned32 next_cln = 0;
|
uint32_t next_cln = 0;
|
||||||
unsigned32 save_cln = 0;
|
uint32_t save_cln = 0;
|
||||||
unsigned32 data_cls_val = fs_info->vol.data_cls + 2;
|
uint32_t data_cls_val = fs_info->vol.data_cls + 2;
|
||||||
unsigned32 i = 2;
|
uint32_t i = 2;
|
||||||
|
|
||||||
*cls_added = 0;
|
*cls_added = 0;
|
||||||
|
|
||||||
@@ -166,14 +166,14 @@ fat_scan_fat_for_free_clusters(
|
|||||||
int
|
int
|
||||||
fat_free_fat_clusters_chain(
|
fat_free_fat_clusters_chain(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 chain
|
uint32_t chain
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK, rc1 = RC_OK;
|
int rc = RC_OK, rc1 = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = chain;
|
uint32_t cur_cln = chain;
|
||||||
unsigned32 next_cln = 0;
|
uint32_t next_cln = 0;
|
||||||
unsigned32 freed_cls_cnt = 0;
|
uint32_t freed_cls_cnt = 0;
|
||||||
|
|
||||||
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
|
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
|
||||||
{
|
{
|
||||||
@@ -223,15 +223,15 @@ fat_free_fat_clusters_chain(
|
|||||||
int
|
int
|
||||||
fat_get_fat_cluster(
|
fat_get_fat_cluster(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 *ret_val
|
uint32_t *ret_val
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
register fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
bdbuf_buffer *block0 = NULL;
|
bdbuf_buffer *block0 = NULL;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 ofs = 0;
|
uint32_t ofs = 0;
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) )
|
if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) )
|
||||||
@@ -252,7 +252,7 @@ fat_get_fat_cluster(
|
|||||||
* we are enforced in complex computations for FAT12 to escape CPU
|
* we are enforced in complex computations for FAT12 to escape CPU
|
||||||
* align problems for some architectures
|
* align problems for some architectures
|
||||||
*/
|
*/
|
||||||
*ret_val = (*((unsigned8 *)(block0->buffer + ofs)));
|
*ret_val = (*((uint8_t *)(block0->buffer + ofs)));
|
||||||
if ( ofs == (fs_info->vol.bps - 1) )
|
if ( ofs == (fs_info->vol.bps - 1) )
|
||||||
{
|
{
|
||||||
rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ,
|
rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ,
|
||||||
@@ -260,11 +260,11 @@ fat_get_fat_cluster(
|
|||||||
if (rc != RC_OK)
|
if (rc != RC_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
*ret_val |= (*((unsigned8 *)(block0->buffer)))<<8;
|
*ret_val |= (*((uint8_t *)(block0->buffer)))<<8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ret_val |= (*((unsigned8 *)(block0->buffer + ofs + 1)))<<8;
|
*ret_val |= (*((uint8_t *)(block0->buffer + ofs + 1)))<<8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FAT_CLUSTER_IS_ODD(cln) )
|
if ( FAT_CLUSTER_IS_ODD(cln) )
|
||||||
@@ -274,12 +274,12 @@ fat_get_fat_cluster(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FAT_FAT16:
|
case FAT_FAT16:
|
||||||
*ret_val = *((unsigned16 *)(block0->buffer + ofs));
|
*ret_val = *((uint16_t *)(block0->buffer + ofs));
|
||||||
*ret_val = CF_LE_W(*ret_val);
|
*ret_val = CF_LE_W(*ret_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAT_FAT32:
|
case FAT_FAT32:
|
||||||
*ret_val = *((unsigned32 *)(block0->buffer + ofs));
|
*ret_val = *((uint32_t *)(block0->buffer + ofs));
|
||||||
*ret_val = CF_LE_L(*ret_val);
|
*ret_val = CF_LE_L(*ret_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -307,16 +307,16 @@ fat_get_fat_cluster(
|
|||||||
int
|
int
|
||||||
fat_set_fat_cluster(
|
fat_set_fat_cluster(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 in_val
|
uint32_t in_val
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 ofs = 0;
|
uint32_t ofs = 0;
|
||||||
unsigned16 fat16_clv = 0;
|
uint16_t fat16_clv = 0;
|
||||||
unsigned32 fat32_clv = 0;
|
uint32_t fat32_clv = 0;
|
||||||
bdbuf_buffer *block0 = NULL;
|
bdbuf_buffer *block0 = NULL;
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
@@ -336,13 +336,13 @@ fat_set_fat_cluster(
|
|||||||
case FAT_FAT12:
|
case FAT_FAT12:
|
||||||
if ( FAT_CLUSTER_IS_ODD(cln) )
|
if ( FAT_CLUSTER_IS_ODD(cln) )
|
||||||
{
|
{
|
||||||
fat16_clv = ((unsigned16)in_val) << FAT_FAT12_SHIFT;
|
fat16_clv = ((uint16_t )in_val) << FAT_FAT12_SHIFT;
|
||||||
*((unsigned8 *)(block0->buffer + ofs)) =
|
*((uint8_t *)(block0->buffer + ofs)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs))) & 0x0F;
|
(*((uint8_t *)(block0->buffer + ofs))) & 0x0F;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer + ofs)) =
|
*((uint8_t *)(block0->buffer + ofs)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs))) |
|
(*((uint8_t *)(block0->buffer + ofs))) |
|
||||||
(unsigned8)(fat16_clv & 0x00FF);
|
(uint8_t )(fat16_clv & 0x00FF);
|
||||||
|
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
|
|
||||||
@@ -353,31 +353,31 @@ fat_set_fat_cluster(
|
|||||||
if (rc != RC_OK)
|
if (rc != RC_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer)) &= 0x00;
|
*((uint8_t *)(block0->buffer)) &= 0x00;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer)) =
|
*((uint8_t *)(block0->buffer)) =
|
||||||
(*((unsigned8 *)(block0->buffer))) |
|
(*((uint8_t *)(block0->buffer))) |
|
||||||
(unsigned8)((fat16_clv & 0xFF00)>>8);
|
(uint8_t )((fat16_clv & 0xFF00)>>8);
|
||||||
|
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((unsigned8 *)(block0->buffer + ofs + 1)) &= 0x00;
|
*((uint8_t *)(block0->buffer + ofs + 1)) &= 0x00;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer + ofs + 1)) =
|
*((uint8_t *)(block0->buffer + ofs + 1)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs + 1))) |
|
(*((uint8_t *)(block0->buffer + ofs + 1))) |
|
||||||
(unsigned8)((fat16_clv & 0xFF00)>>8);
|
(uint8_t )((fat16_clv & 0xFF00)>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fat16_clv = ((unsigned16)in_val) & FAT_FAT12_MASK;
|
fat16_clv = ((uint16_t )in_val) & FAT_FAT12_MASK;
|
||||||
*((unsigned8 *)(block0->buffer + ofs)) &= 0x00;
|
*((uint8_t *)(block0->buffer + ofs)) &= 0x00;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer + ofs)) =
|
*((uint8_t *)(block0->buffer + ofs)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs))) |
|
(*((uint8_t *)(block0->buffer + ofs))) |
|
||||||
(unsigned8)(fat16_clv & 0x00FF);
|
(uint8_t )(fat16_clv & 0x00FF);
|
||||||
|
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
|
|
||||||
@@ -388,41 +388,41 @@ fat_set_fat_cluster(
|
|||||||
if (rc != RC_OK)
|
if (rc != RC_OK)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer)) =
|
*((uint8_t *)(block0->buffer)) =
|
||||||
(*((unsigned8 *)(block0->buffer))) & 0xF0;
|
(*((uint8_t *)(block0->buffer))) & 0xF0;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer)) =
|
*((uint8_t *)(block0->buffer)) =
|
||||||
(*((unsigned8 *)(block0->buffer))) |
|
(*((uint8_t *)(block0->buffer))) |
|
||||||
(unsigned8)((fat16_clv & 0xFF00)>>8);
|
(uint8_t )((fat16_clv & 0xFF00)>>8);
|
||||||
|
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((unsigned8 *)(block0->buffer + ofs + 1)) =
|
*((uint8_t *)(block0->buffer + ofs + 1)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs + 1))) & 0xF0;
|
(*((uint8_t *)(block0->buffer + ofs + 1))) & 0xF0;
|
||||||
|
|
||||||
*((unsigned8 *)(block0->buffer + ofs+1)) =
|
*((uint8_t *)(block0->buffer + ofs+1)) =
|
||||||
(*((unsigned8 *)(block0->buffer + ofs+1))) |
|
(*((uint8_t *)(block0->buffer + ofs+1))) |
|
||||||
(unsigned8)((fat16_clv & 0xFF00)>>8);
|
(uint8_t )((fat16_clv & 0xFF00)>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAT_FAT16:
|
case FAT_FAT16:
|
||||||
*((unsigned16 *)(block0->buffer + ofs)) =
|
*((uint16_t *)(block0->buffer + ofs)) =
|
||||||
(unsigned16)(CT_LE_W(in_val));
|
(uint16_t )(CT_LE_W(in_val));
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FAT_FAT32:
|
case FAT_FAT32:
|
||||||
fat32_clv = CT_LE_L((in_val & FAT_FAT32_MASK));
|
fat32_clv = CT_LE_L((in_val & FAT_FAT32_MASK));
|
||||||
|
|
||||||
*((unsigned32 *)(block0->buffer + ofs)) =
|
*((uint32_t *)(block0->buffer + ofs)) =
|
||||||
(*((unsigned32 *)(block0->buffer + ofs))) & (CT_LE_L(0xF0000000));
|
(*((uint32_t *)(block0->buffer + ofs))) & (CT_LE_L(0xF0000000));
|
||||||
|
|
||||||
*((unsigned32 *)(block0->buffer + ofs)) =
|
*((uint32_t *)(block0->buffer + ofs)) =
|
||||||
fat32_clv | (*((unsigned32 *)(block0->buffer + ofs)));
|
fat32_clv | (*((uint32_t *)(block0->buffer + ofs)));
|
||||||
|
|
||||||
fat_buf_mark_modified(fs_info);
|
fat_buf_mark_modified(fs_info);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -28,27 +28,27 @@ extern "C" {
|
|||||||
|
|
||||||
int
|
int
|
||||||
fat_get_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_get_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 *ret_val);
|
uint32_t *ret_val);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_set_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_set_fat_cluster(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 in_val);
|
uint32_t in_val);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_scan_fat_for_free_clusters(
|
fat_scan_fat_for_free_clusters(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 *chain,
|
uint32_t *chain,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
unsigned32 *cls_added,
|
uint32_t *cls_added,
|
||||||
unsigned32 *last_cl
|
uint32_t *last_cl
|
||||||
);
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_free_fat_clusters_chain(
|
fat_free_fat_clusters_chain(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 chain
|
uint32_t chain
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -31,19 +31,19 @@
|
|||||||
#include "fat_file.h"
|
#include "fat_file.h"
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_hash_insert(Chain_Control *hash, unsigned32 key1, unsigned32 key2,
|
_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
|
||||||
fat_file_fd_t *el);
|
fat_file_fd_t *el);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_hash_delete(Chain_Control *hash, unsigned32 key1, unsigned32 key2,
|
_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
|
||||||
fat_file_fd_t *el);
|
fat_file_fd_t *el);
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
_hash_search(
|
_hash_search(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
Chain_Control *hash,
|
Chain_Control *hash,
|
||||||
unsigned32 key1,
|
uint32_t key1,
|
||||||
unsigned32 key2,
|
uint32_t key2,
|
||||||
fat_file_fd_t **ret
|
fat_file_fd_t **ret
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ static int
|
|||||||
fat_file_lseek(
|
fat_file_lseek(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 file_cln,
|
uint32_t file_cln,
|
||||||
unsigned32 *disk_cln
|
uint32_t *disk_cln
|
||||||
);
|
);
|
||||||
|
|
||||||
/* fat_file_open --
|
/* fat_file_open --
|
||||||
@@ -84,15 +84,15 @@ fat_file_lseek(
|
|||||||
int
|
int
|
||||||
fat_file_open(
|
fat_file_open(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 ofs,
|
uint32_t ofs,
|
||||||
fat_file_fd_t **fat_fd
|
fat_file_fd_t **fat_fd
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
fat_file_fd_t *lfat_fd = NULL;
|
fat_file_fd_t *lfat_fd = NULL;
|
||||||
unsigned32 key = 0;
|
uint32_t key = 0;
|
||||||
|
|
||||||
/* construct key */
|
/* construct key */
|
||||||
key = fat_construct_key(mt_entry, cln, ofs);
|
key = fat_construct_key(mt_entry, cln, ofs);
|
||||||
@@ -189,7 +189,7 @@ fat_file_close(
|
|||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 key = 0;
|
uint32_t key = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if links_num field of fat-file descriptor is greater than 1
|
* if links_num field of fat-file descriptor is greater than 1
|
||||||
@@ -256,23 +256,23 @@ ssize_t
|
|||||||
fat_file_read(
|
fat_file_read(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
char *buf
|
char *buf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cmpltd = 0;
|
uint32_t cmpltd = 0;
|
||||||
unsigned32 cur_cln = 0;
|
uint32_t cur_cln = 0;
|
||||||
unsigned32 cl_start = 0;
|
uint32_t cl_start = 0;
|
||||||
unsigned32 save_cln = 0;
|
uint32_t save_cln = 0;
|
||||||
unsigned32 ofs = 0;
|
uint32_t ofs = 0;
|
||||||
unsigned32 save_ofs;
|
uint32_t save_ofs;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
unsigned32 c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
/* it couldn't be removed - otherwise cache update will be broken */
|
/* it couldn't be removed - otherwise cache update will be broken */
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
@@ -361,23 +361,23 @@ ssize_t
|
|||||||
fat_file_write(
|
fat_file_write(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
const char *buf
|
const char *buf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cmpltd = 0;
|
uint32_t cmpltd = 0;
|
||||||
unsigned32 cur_cln = 0;
|
uint32_t cur_cln = 0;
|
||||||
unsigned32 save_cln = 0; /* FIXME: This might be incorrect, cf. below */
|
uint32_t save_cln = 0; /* FIXME: This might be incorrect, cf. below */
|
||||||
unsigned32 cl_start = 0;
|
uint32_t cl_start = 0;
|
||||||
unsigned32 ofs = 0;
|
uint32_t ofs = 0;
|
||||||
unsigned32 save_ofs;
|
uint32_t save_ofs;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
unsigned32 c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
if ( count == 0 )
|
if ( count == 0 )
|
||||||
return cmpltd;
|
return cmpltd;
|
||||||
@@ -472,19 +472,19 @@ int
|
|||||||
fat_file_extend(
|
fat_file_extend(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 new_length,
|
uint32_t new_length,
|
||||||
unsigned32 *a_length
|
uint32_t *a_length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 chain = 0;
|
uint32_t chain = 0;
|
||||||
unsigned32 bytes2add = 0;
|
uint32_t bytes2add = 0;
|
||||||
unsigned32 cls2add = 0;
|
uint32_t cls2add = 0;
|
||||||
unsigned32 old_last_cl;
|
uint32_t old_last_cl;
|
||||||
unsigned32 last_cl = 0;
|
uint32_t last_cl = 0;
|
||||||
unsigned32 bytes_remain = 0;
|
uint32_t bytes_remain = 0;
|
||||||
unsigned32 cls_added;
|
uint32_t cls_added;
|
||||||
|
|
||||||
*a_length = new_length;
|
*a_length = new_length;
|
||||||
|
|
||||||
@@ -600,14 +600,14 @@ int
|
|||||||
fat_file_truncate(
|
fat_file_truncate(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 new_length
|
uint32_t new_length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = 0;
|
uint32_t cur_cln = 0;
|
||||||
unsigned32 cl_start = 0;
|
uint32_t cl_start = 0;
|
||||||
unsigned32 new_last_cln = FAT_UNDEFINED_VALUE;
|
uint32_t new_last_cln = FAT_UNDEFINED_VALUE;
|
||||||
|
|
||||||
|
|
||||||
if ( new_length >= fat_fd->fat_file_size )
|
if ( new_length >= fat_fd->fat_file_size )
|
||||||
@@ -671,10 +671,10 @@ fat_file_ioctl(
|
|||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = 0;
|
uint32_t cur_cln = 0;
|
||||||
unsigned32 cl_start = 0;
|
uint32_t cl_start = 0;
|
||||||
unsigned32 pos = 0;
|
uint32_t pos = 0;
|
||||||
unsigned32 *ret;
|
uint32_t *ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, cmd);
|
va_start(ap, cmd);
|
||||||
@@ -682,8 +682,8 @@ fat_file_ioctl(
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case F_CLU_NUM:
|
case F_CLU_NUM:
|
||||||
pos = va_arg(ap, unsigned32);
|
pos = va_arg(ap, uint32_t );
|
||||||
ret = va_arg(ap, unsigned32 *);
|
ret = va_arg(ap, uint32_t *);
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ( pos >= fat_fd->fat_file_size )
|
if ( pos >= fat_fd->fat_file_size )
|
||||||
@@ -732,7 +732,7 @@ fat_file_mark_removed(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 key = 0;
|
uint32_t key = 0;
|
||||||
|
|
||||||
key = fat_construct_key(mt_entry, fat_fd->info_cln, fat_fd->info_ofs);
|
key = fat_construct_key(mt_entry, fat_fd->info_cln, fat_fd->info_ofs);
|
||||||
|
|
||||||
@@ -762,10 +762,10 @@ fat_file_datasync(
|
|||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = fat_fd->cln;
|
uint32_t cur_cln = fat_fd->cln;
|
||||||
bdbuf_buffer *block = NULL;
|
bdbuf_buffer *block = NULL;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
if (fat_fd->fat_file_size == 0)
|
if (fat_fd->fat_file_size == 0)
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
@@ -826,8 +826,8 @@ fat_file_size(
|
|||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
fat_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 cur_cln = fat_fd->cln;
|
uint32_t cur_cln = fat_fd->cln;
|
||||||
unsigned32 save_cln = 0;
|
uint32_t save_cln = 0;
|
||||||
|
|
||||||
/* Have we requested root dir size for FAT12/16? */
|
/* Have we requested root dir size for FAT12/16? */
|
||||||
if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
|
if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
|
||||||
@@ -867,7 +867,7 @@ fat_file_size(
|
|||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
_hash_insert(Chain_Control *hash, unsigned32 key1, unsigned32 key2,
|
_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
|
||||||
fat_file_fd_t *el)
|
fat_file_fd_t *el)
|
||||||
{
|
{
|
||||||
_Chain_Append((hash) + ((key1) % FAT_HASH_MODULE), &(el)->link);
|
_Chain_Append((hash) + ((key1) % FAT_HASH_MODULE), &(el)->link);
|
||||||
@@ -887,7 +887,7 @@ _hash_insert(Chain_Control *hash, unsigned32 key1, unsigned32 key2,
|
|||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
_hash_delete(Chain_Control *hash, unsigned32 key1, unsigned32 key2,
|
_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
|
||||||
fat_file_fd_t *el)
|
fat_file_fd_t *el)
|
||||||
{
|
{
|
||||||
_Chain_Extract(&(el)->link);
|
_Chain_Extract(&(el)->link);
|
||||||
@@ -911,18 +911,18 @@ static inline int
|
|||||||
_hash_search(
|
_hash_search(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
Chain_Control *hash,
|
Chain_Control *hash,
|
||||||
unsigned32 key1,
|
uint32_t key1,
|
||||||
unsigned32 key2,
|
uint32_t key2,
|
||||||
fat_file_fd_t **ret
|
fat_file_fd_t **ret
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned32 mod = (key1) % FAT_HASH_MODULE;
|
uint32_t mod = (key1) % FAT_HASH_MODULE;
|
||||||
Chain_Node *the_node = ((Chain_Control *)((hash) + mod))->first;
|
Chain_Node *the_node = ((Chain_Control *)((hash) + mod))->first;
|
||||||
|
|
||||||
for ( ; !_Chain_Is_tail((hash) + mod, the_node) ; )
|
for ( ; !_Chain_Is_tail((hash) + mod, the_node) ; )
|
||||||
{
|
{
|
||||||
fat_file_fd_t *ffd = (fat_file_fd_t *)the_node;
|
fat_file_fd_t *ffd = (fat_file_fd_t *)the_node;
|
||||||
unsigned32 ck =
|
uint32_t ck =
|
||||||
fat_construct_key(mt_entry, ffd->info_cln, ffd->info_ofs);
|
fat_construct_key(mt_entry, ffd->info_cln, ffd->info_ofs);
|
||||||
|
|
||||||
if ( (key1) == ck)
|
if ( (key1) == ck)
|
||||||
@@ -942,8 +942,8 @@ static int
|
|||||||
fat_file_lseek(
|
fat_file_lseek(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 file_cln,
|
uint32_t file_cln,
|
||||||
unsigned32 *disk_cln
|
uint32_t *disk_cln
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
@@ -954,9 +954,9 @@ fat_file_lseek(
|
|||||||
*disk_cln = fat_fd->map.disk_cln;
|
*disk_cln = fat_fd->map.disk_cln;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned32 cur_cln;
|
uint32_t cur_cln;
|
||||||
unsigned32 count;
|
uint32_t count;
|
||||||
unsigned32 i;
|
uint32_t i;
|
||||||
|
|
||||||
if (file_cln > fat_fd->map.file_cln)
|
if (file_cln > fat_fd->map.file_cln)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ typedef rtems_filesystem_node_types_t fat_file_type_t;
|
|||||||
|
|
||||||
typedef struct fat_file_map_s
|
typedef struct fat_file_map_s
|
||||||
{
|
{
|
||||||
unsigned32 file_cln;
|
uint32_t file_cln;
|
||||||
unsigned32 disk_cln;
|
uint32_t disk_cln;
|
||||||
unsigned32 last_cln;
|
uint32_t last_cln;
|
||||||
} fat_file_map_t;
|
} fat_file_map_t;
|
||||||
/*
|
/*
|
||||||
* descriptor of a fat-file
|
* descriptor of a fat-file
|
||||||
@@ -62,19 +62,19 @@ typedef struct fat_file_fd_s
|
|||||||
* collision lists are handled via link
|
* collision lists are handled via link
|
||||||
* field
|
* field
|
||||||
*/
|
*/
|
||||||
unsigned32 links_num; /*
|
uint32_t links_num; /*
|
||||||
* the number of fat_file_open call on
|
* the number of fat_file_open call on
|
||||||
* this fat-file
|
* this fat-file
|
||||||
*/
|
*/
|
||||||
unsigned32 ino; /* inode, file serial number :)))) */
|
uint32_t ino; /* inode, file serial number :)))) */
|
||||||
fat_file_type_t fat_file_type;
|
fat_file_type_t fat_file_type;
|
||||||
unsigned32 size_limit;
|
uint32_t size_limit;
|
||||||
unsigned32 fat_file_size; /* length */
|
uint32_t fat_file_size; /* length */
|
||||||
unsigned32 info_cln;
|
uint32_t info_cln;
|
||||||
unsigned32 cln;
|
uint32_t cln;
|
||||||
unsigned16 info_ofs;
|
uint16_t info_ofs;
|
||||||
unsigned char first_char;
|
unsigned char first_char;
|
||||||
unsigned8 flags;
|
uint8_t flags;
|
||||||
fat_file_map_t map;
|
fat_file_map_t map;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
|
|
||||||
@@ -119,11 +119,11 @@ typedef struct fat_file_fd_s
|
|||||||
* RETURNS:
|
* RETURNS:
|
||||||
* constructed key
|
* constructed key
|
||||||
*/
|
*/
|
||||||
static inline unsigned32
|
static inline uint32_t
|
||||||
fat_construct_key(
|
fat_construct_key(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cl,
|
uint32_t cl,
|
||||||
unsigned32 ofs)
|
uint32_t ofs)
|
||||||
{
|
{
|
||||||
return ( ((fat_cluster_num_to_sector512_num(mt_entry, cl) +
|
return ( ((fat_cluster_num_to_sector512_num(mt_entry, cl) +
|
||||||
(ofs >> FAT_SECTOR512_BITS)) << 4) +
|
(ofs >> FAT_SECTOR512_BITS)) << 4) +
|
||||||
@@ -133,8 +133,8 @@ fat_construct_key(
|
|||||||
/* Prototypes for "fat-file" operations */
|
/* Prototypes for "fat-file" operations */
|
||||||
int
|
int
|
||||||
fat_file_open(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_open(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
unsigned32 ofs,
|
uint32_t ofs,
|
||||||
fat_file_fd_t **fat_fd);
|
fat_file_fd_t **fat_fd);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -147,27 +147,27 @@ fat_file_close(rtems_filesystem_mount_table_entry_t *mt_entry,
|
|||||||
ssize_t
|
ssize_t
|
||||||
fat_file_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_read(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
char *buf);
|
char *buf);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
fat_file_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_write(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 start,
|
uint32_t start,
|
||||||
unsigned32 count,
|
uint32_t count,
|
||||||
const char *buf);
|
const char *buf);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_file_extend(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_extend(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 new_length,
|
uint32_t new_length,
|
||||||
unsigned32 *a_length);
|
uint32_t *a_length);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_file_truncate(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_truncate(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 new_length);
|
uint32_t new_length);
|
||||||
|
|
||||||
int
|
int
|
||||||
fat_file_datasync(rtems_filesystem_mount_table_entry_t *mt_entry,
|
fat_file_datasync(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ typedef struct msdos_fs_info_s
|
|||||||
* associated with
|
* associated with
|
||||||
* the volume
|
* the volume
|
||||||
*/
|
*/
|
||||||
unsigned8 *cl_buf; /*
|
uint8_t *cl_buf; /*
|
||||||
* just placeholder
|
* just placeholder
|
||||||
* for anything
|
* for anything
|
||||||
*/
|
*/
|
||||||
@@ -87,22 +87,22 @@ typedef rtems_filesystem_node_types_t msdos_node_type_t;
|
|||||||
*/
|
*/
|
||||||
#define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE 32 /* 32 bytes */
|
#define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE 32 /* 32 bytes */
|
||||||
|
|
||||||
#define MSDOS_DIR_NAME(x) (unsigned8 *)((x) + 0)
|
#define MSDOS_DIR_NAME(x) (uint8_t *)((x) + 0)
|
||||||
#define MSDOS_DIR_ATTR(x) (unsigned8 *)((x) + 11)
|
#define MSDOS_DIR_ATTR(x) (uint8_t *)((x) + 11)
|
||||||
#define MSDOS_DIR_NT_RES(x) (unsigned8 *)((x) + 12)
|
#define MSDOS_DIR_NT_RES(x) (uint8_t *)((x) + 12)
|
||||||
#define MSDOS_DIR_CRT_TIME_TENTH(x) (unsigned8 *)((x) + 13)
|
#define MSDOS_DIR_CRT_TIME_TENTH(x) (uint8_t *)((x) + 13)
|
||||||
#define MSDOS_DIR_CRT_TIME(x) (unsigned16 *)((x) + 14)
|
#define MSDOS_DIR_CRT_TIME(x) (uint16_t *)((x) + 14)
|
||||||
#define MSDOS_DIR_CRT_DATE(x) (unsigned16 *)((x) + 16)
|
#define MSDOS_DIR_CRT_DATE(x) (uint16_t *)((x) + 16)
|
||||||
#define MSDOS_DIR_LAST_ACCESS_DATE(x) (unsigned16 *)((x) + 18)
|
#define MSDOS_DIR_LAST_ACCESS_DATE(x) (uint16_t *)((x) + 18)
|
||||||
#define MSDOS_DIR_FIRST_CLUSTER_HI(x) (unsigned16 *)((x) + 20)
|
#define MSDOS_DIR_FIRST_CLUSTER_HI(x) (uint16_t *)((x) + 20)
|
||||||
#define MSDOS_DIR_WRITE_TIME(x) (unsigned16 *)((x) + 22)
|
#define MSDOS_DIR_WRITE_TIME(x) (uint16_t *)((x) + 22)
|
||||||
#define MSDOS_DIR_WRITE_DATE(x) (unsigned16 *)((x) + 24)
|
#define MSDOS_DIR_WRITE_DATE(x) (uint16_t *)((x) + 24)
|
||||||
#define MSDOS_DIR_FIRST_CLUSTER_LOW(x) (unsigned16 *)((x) + 26)
|
#define MSDOS_DIR_FIRST_CLUSTER_LOW(x) (uint16_t *)((x) + 26)
|
||||||
#define MSDOS_DIR_FILE_SIZE(x) (unsigned32 *)((x) + 28)
|
#define MSDOS_DIR_FILE_SIZE(x) (uint32_t *)((x) + 28)
|
||||||
|
|
||||||
#define MSDOS_EXTRACT_CLUSTER_NUM(p) \
|
#define MSDOS_EXTRACT_CLUSTER_NUM(p) \
|
||||||
(unsigned32)( (CF_LE_W(*MSDOS_DIR_FIRST_CLUSTER_LOW(p))) | \
|
(uint32_t )( (CF_LE_W(*MSDOS_DIR_FIRST_CLUSTER_LOW(p))) | \
|
||||||
((unsigned32)(CF_LE_W((*MSDOS_DIR_FIRST_CLUSTER_HI(p))))<<16) )
|
((uint32_t )(CF_LE_W((*MSDOS_DIR_FIRST_CLUSTER_HI(p))))<<16) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fields offset in 32 bytes long FAT Directory Entry
|
* Fields offset in 32 bytes long FAT Directory Entry
|
||||||
@@ -247,8 +247,8 @@ int
|
|||||||
msdos_file_open(
|
msdos_file_open(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const char *pathname, /* IN */
|
const char *pathname, /* IN */
|
||||||
unsigned32 flag, /* IN */
|
uint32_t flag, /* IN */
|
||||||
unsigned32 mode /* IN */
|
uint32_t mode /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -258,14 +258,14 @@ ssize_t
|
|||||||
msdos_file_read(
|
msdos_file_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
msdos_file_write(
|
msdos_file_write(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const void *buffer, /* IN */
|
const void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -294,7 +294,7 @@ msdos_file_datasync(rtems_libio_t *iop);
|
|||||||
int
|
int
|
||||||
msdos_file_ioctl(
|
msdos_file_ioctl(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
unsigned32 command, /* IN */
|
uint32_t command, /* IN */
|
||||||
void *buffer /* IN */
|
void *buffer /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -310,8 +310,8 @@ int
|
|||||||
msdos_dir_open(
|
msdos_dir_open(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const char *pathname, /* IN */
|
const char *pathname, /* IN */
|
||||||
unsigned32 flag, /* IN */
|
uint32_t flag, /* IN */
|
||||||
unsigned32 mode /* IN */
|
uint32_t mode /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -321,7 +321,7 @@ ssize_t
|
|||||||
msdos_dir_read(
|
msdos_dir_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -388,8 +388,8 @@ msdos_set_file_size(rtems_filesystem_mount_table_entry_t *mt_entry,
|
|||||||
|
|
||||||
int
|
int
|
||||||
msdos_set_first_char4file_name(rtems_filesystem_mount_table_entry_t *mt_entry,
|
msdos_set_first_char4file_name(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cl,
|
uint32_t cl,
|
||||||
unsigned32 ofs,
|
uint32_t ofs,
|
||||||
unsigned char first_char);
|
unsigned char first_char);
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -416,7 +416,7 @@ int
|
|||||||
msdos_find_node_by_cluster_num_in_fat_file(
|
msdos_find_node_by_cluster_num_in_fat_file(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 cl4find,
|
uint32_t cl4find,
|
||||||
fat_auxiliary_t *paux,
|
fat_auxiliary_t *paux,
|
||||||
char *dir_entry
|
char *dir_entry
|
||||||
);
|
);
|
||||||
@@ -424,7 +424,7 @@ msdos_find_node_by_cluster_num_in_fat_file(
|
|||||||
int
|
int
|
||||||
msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
fat_auxiliary_t *paux,
|
fat_auxiliary_t *paux,
|
||||||
char *dir_entry
|
char *dir_entry
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ msdos_creat_node(
|
|||||||
fat_file_fd_t *parent_fat_fd = parent_loc->node_access;
|
fat_file_fd_t *parent_fat_fd = parent_loc->node_access;
|
||||||
fat_file_fd_t *fat_fd = NULL;
|
fat_file_fd_t *fat_fd = NULL;
|
||||||
time_t time_ret = 0;
|
time_t time_ret = 0;
|
||||||
unsigned16 time_val = 0;
|
uint16_t time_val = 0;
|
||||||
unsigned16 date = 0;
|
uint16_t date = 0;
|
||||||
fat_auxiliary_t aux;
|
fat_auxiliary_t aux;
|
||||||
unsigned char new_node [MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
unsigned char new_node [MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
||||||
unsigned char dot_dotdot[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2];
|
unsigned char dot_dotdot[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2];
|
||||||
unsigned char link_node [MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
unsigned char link_node [MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
|
|
||||||
memset(new_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
memset(new_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
||||||
memset(dot_dotdot, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2);
|
memset(dot_dotdot, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2);
|
||||||
@@ -202,9 +202,9 @@ msdos_creat_node(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) =
|
*MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) =
|
||||||
CT_LE_W((unsigned16)((parent_fat_fd->cln) & 0x0000FFFF));
|
CT_LE_W((uint16_t )((parent_fat_fd->cln) & 0x0000FFFF));
|
||||||
*MSDOS_DIR_FIRST_CLUSTER_HI(DOTDOT_NODE_P(dot_dotdot)) =
|
*MSDOS_DIR_FIRST_CLUSTER_HI(DOTDOT_NODE_P(dot_dotdot)) =
|
||||||
CT_LE_W((unsigned16)(((parent_fat_fd->cln) & 0xFFFF0000)>>16));
|
CT_LE_W((uint16_t )(((parent_fat_fd->cln) & 0xFFFF0000)>>16));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -226,9 +226,9 @@ msdos_creat_node(
|
|||||||
|
|
||||||
/* set up cluster num for dot entry */
|
/* set up cluster num for dot entry */
|
||||||
*MSDOS_DIR_FIRST_CLUSTER_LOW(DOT_NODE_P(dot_dotdot)) =
|
*MSDOS_DIR_FIRST_CLUSTER_LOW(DOT_NODE_P(dot_dotdot)) =
|
||||||
CT_LE_W((unsigned16)((fat_fd->cln) & 0x0000FFFF));
|
CT_LE_W((uint16_t )((fat_fd->cln) & 0x0000FFFF));
|
||||||
*MSDOS_DIR_FIRST_CLUSTER_HI(DOT_NODE_P(dot_dotdot)) =
|
*MSDOS_DIR_FIRST_CLUSTER_HI(DOT_NODE_P(dot_dotdot)) =
|
||||||
CT_LE_W((unsigned16)(((fat_fd->cln) & 0xFFFF0000) >> 16));
|
CT_LE_W((uint16_t )(((fat_fd->cln) & 0xFFFF0000) >> 16));
|
||||||
|
|
||||||
/* rewrite dot entry */
|
/* rewrite dot entry */
|
||||||
ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0,
|
ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0,
|
||||||
|
|||||||
@@ -45,8 +45,8 @@
|
|||||||
* set apropriately)
|
* set apropriately)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
msdos_dir_open(rtems_libio_t *iop, const char *pathname, unsigned32 flag,
|
msdos_dir_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
|
||||||
unsigned32 mode)
|
uint32_t mode)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
@@ -196,7 +196,7 @@ msdos_format_dirent_with_dot(char *dst,const char *src)
|
|||||||
* set apropriately).
|
* set apropriately).
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
msdos_dir_read(rtems_libio_t *iop, void *buffer, unsigned32 count)
|
msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
@@ -204,12 +204,12 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, unsigned32 count)
|
|||||||
fat_file_fd_t *fat_fd = iop->file_info;
|
fat_file_fd_t *fat_fd = iop->file_info;
|
||||||
fat_file_fd_t *tmp_fat_fd = NULL;
|
fat_file_fd_t *tmp_fat_fd = NULL;
|
||||||
struct dirent tmp_dirent;
|
struct dirent tmp_dirent;
|
||||||
unsigned32 start = 0;
|
uint32_t start = 0;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
unsigned32 cmpltd = 0;
|
uint32_t cmpltd = 0;
|
||||||
unsigned32 j = 0, i = 0;
|
uint32_t j = 0, i = 0;
|
||||||
unsigned32 bts2rd = 0;
|
uint32_t bts2rd = 0;
|
||||||
unsigned32 cur_cln = 0;
|
uint32_t cur_cln = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cast start and count - protect against using sizes that are not exact
|
* cast start and count - protect against using sizes that are not exact
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
* and errno set appropriately
|
* and errno set appropriately
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
msdos_file_open(rtems_libio_t *iop, const char *pathname, unsigned32 flag,
|
msdos_file_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
|
||||||
unsigned32 mode)
|
uint32_t mode)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
@@ -144,7 +144,7 @@ msdos_file_close(rtems_libio_t *iop)
|
|||||||
* appropriately)
|
* appropriately)
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
msdos_file_read(rtems_libio_t *iop, void *buffer, unsigned32 count)
|
msdos_file_read(rtems_libio_t *iop, void *buffer, uint32_t count)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
@@ -177,7 +177,7 @@ msdos_file_read(rtems_libio_t *iop, void *buffer, unsigned32 count)
|
|||||||
* and errno set appropriately
|
* and errno set appropriately
|
||||||
*/
|
*/
|
||||||
ssize_t
|
ssize_t
|
||||||
msdos_file_write(rtems_libio_t *iop,const void *buffer, unsigned32 count)
|
msdos_file_write(rtems_libio_t *iop,const void *buffer, uint32_t count)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
@@ -230,7 +230,7 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence)
|
|||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info;
|
||||||
fat_file_fd_t *fat_fd = iop->file_info;
|
fat_file_fd_t *fat_fd = iop->file_info;
|
||||||
unsigned32 real_size = 0;
|
uint32_t real_size = 0;
|
||||||
|
|
||||||
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
|
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
|
||||||
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
|
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
|
||||||
@@ -437,7 +437,7 @@ msdos_file_datasync(rtems_libio_t *iop)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
msdos_file_ioctl(rtems_libio_t *iop,unsigned32 command, void *buffer)
|
msdos_file_ioctl(rtems_libio_t *iop,uint32_t command, void *buffer)
|
||||||
{
|
{
|
||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ msdos_initialize_support(
|
|||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
msdos_fs_info_t *fs_info = NULL;
|
msdos_fs_info_t *fs_info = NULL;
|
||||||
fat_file_fd_t *fat_fd = NULL;
|
fat_file_fd_t *fat_fd = NULL;
|
||||||
unsigned32 cl_buf_size;
|
uint32_t cl_buf_size;
|
||||||
|
|
||||||
fs_info = (msdos_fs_info_t *)calloc(1, sizeof(msdos_fs_info_t));
|
fs_info = (msdos_fs_info_t *)calloc(1, sizeof(msdos_fs_info_t));
|
||||||
if (!fs_info)
|
if (!fs_info)
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ msdos_get_name_node(
|
|||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info;
|
||||||
fat_file_fd_t *fat_fd = parent_loc->node_access;
|
fat_file_fd_t *fat_fd = parent_loc->node_access;
|
||||||
unsigned32 dotdot_cln = 0;
|
uint32_t dotdot_cln = 0;
|
||||||
|
|
||||||
/* find name in fat-file which correspondes to the directory */
|
/* find name in fat-file which correspondes to the directory */
|
||||||
rc = msdos_find_name_in_fat_file(parent_loc->mt_entry, fat_fd, name, paux,
|
rc = msdos_find_name_in_fat_file(parent_loc->mt_entry, fat_fd, name, paux,
|
||||||
@@ -377,7 +377,7 @@ msdos_get_name_node(
|
|||||||
int
|
int
|
||||||
msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cln,
|
uint32_t cln,
|
||||||
fat_auxiliary_t *paux,
|
fat_auxiliary_t *paux,
|
||||||
char *dir_entry
|
char *dir_entry
|
||||||
)
|
)
|
||||||
@@ -388,7 +388,7 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
|
|||||||
unsigned char dot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
unsigned char dot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
||||||
unsigned char dotdot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
unsigned char dotdot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
||||||
unsigned char cur_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
unsigned char cur_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
|
||||||
unsigned32 cl4find = 0;
|
uint32_t cl4find = 0;
|
||||||
|
|
||||||
memset(dot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
memset(dot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
||||||
memset(dotdot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
memset(dotdot_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
|
||||||
@@ -515,8 +515,8 @@ msdos_set_dir_wrt_time_and_date(
|
|||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned short time_val;
|
unsigned short time_val;
|
||||||
unsigned short date;
|
unsigned short date;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
|
|
||||||
msdos_date_unix2dos(fat_fd->mtime, &time_val, &date);
|
msdos_date_unix2dos(fat_fd->mtime, &time_val, &date);
|
||||||
|
|
||||||
@@ -562,11 +562,11 @@ msdos_set_first_cluster_num(
|
|||||||
{
|
{
|
||||||
ssize_t ret1 = 0, ret2 = 0;
|
ssize_t ret1 = 0, ret2 = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 new_cln = fat_fd->cln;
|
uint32_t new_cln = fat_fd->cln;
|
||||||
unsigned16 le_cl_low = 0;
|
uint16_t le_cl_low = 0;
|
||||||
unsigned16 le_cl_hi = 0;
|
uint16_t le_cl_hi = 0;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calculate input for _fat_block_write: convert (cluster num, offset) to
|
* calculate input for _fat_block_write: convert (cluster num, offset) to
|
||||||
@@ -577,11 +577,11 @@ msdos_set_first_cluster_num(
|
|||||||
/* byte from points to start of 32bytes structure */
|
/* byte from points to start of 32bytes structure */
|
||||||
byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1);
|
byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1);
|
||||||
|
|
||||||
le_cl_low = CT_LE_W((unsigned16)(new_cln & 0x0000FFFF));
|
le_cl_low = CT_LE_W((uint16_t )(new_cln & 0x0000FFFF));
|
||||||
ret1 = _fat_block_write(mt_entry, sec,
|
ret1 = _fat_block_write(mt_entry, sec,
|
||||||
byte + MSDOS_FIRST_CLUSTER_LOW_OFFSET, 2,
|
byte + MSDOS_FIRST_CLUSTER_LOW_OFFSET, 2,
|
||||||
(char *)(&le_cl_low));
|
(char *)(&le_cl_low));
|
||||||
le_cl_hi = CT_LE_W((unsigned16)((new_cln & 0xFFFF0000) >> 16));
|
le_cl_hi = CT_LE_W((uint16_t )((new_cln & 0xFFFF0000) >> 16));
|
||||||
ret2 = _fat_block_write(mt_entry, sec,
|
ret2 = _fat_block_write(mt_entry, sec,
|
||||||
byte + MSDOS_FIRST_CLUSTER_HI_OFFSET, 2,
|
byte + MSDOS_FIRST_CLUSTER_HI_OFFSET, 2,
|
||||||
(char *)(&le_cl_hi));
|
(char *)(&le_cl_hi));
|
||||||
@@ -611,9 +611,9 @@ msdos_set_file_size(
|
|||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 le_new_length = 0;
|
uint32_t le_new_length = 0;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
|
|
||||||
sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->info_cln);
|
sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->info_cln);
|
||||||
sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2);
|
sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2);
|
||||||
@@ -650,15 +650,15 @@ msdos_set_file_size(
|
|||||||
int
|
int
|
||||||
msdos_set_first_char4file_name(
|
msdos_set_first_char4file_name(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
unsigned32 cl,
|
uint32_t cl,
|
||||||
unsigned32 ofs,
|
uint32_t ofs,
|
||||||
unsigned char fchar
|
unsigned char fchar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 sec = 0;
|
uint32_t sec = 0;
|
||||||
unsigned32 byte = 0;
|
uint32_t byte = 0;
|
||||||
|
|
||||||
sec = fat_cluster_num_to_sector_num(mt_entry, cl);
|
sec = fat_cluster_num_to_sector_num(mt_entry, cl);
|
||||||
sec += (ofs >> fs_info->fat.vol.sec_log2);
|
sec += (ofs >> fs_info->fat.vol.sec_log2);
|
||||||
@@ -694,7 +694,7 @@ msdos_dir_is_empty(
|
|||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 j = 0, i = 0;
|
uint32_t j = 0, i = 0;
|
||||||
|
|
||||||
/* dir is not empty */
|
/* dir is not empty */
|
||||||
*ret_val = FALSE;
|
*ret_val = FALSE;
|
||||||
@@ -775,8 +775,8 @@ msdos_find_name_in_fat_file(
|
|||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 i = 0, j = 0;
|
uint32_t i = 0, j = 0;
|
||||||
unsigned32 bts2rd = 0;
|
uint32_t bts2rd = 0;
|
||||||
|
|
||||||
if (FAT_FD_OF_ROOT_DIR(fat_fd) &&
|
if (FAT_FD_OF_ROOT_DIR(fat_fd) &&
|
||||||
(fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16)))
|
(fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16)))
|
||||||
@@ -884,7 +884,7 @@ int
|
|||||||
msdos_find_node_by_cluster_num_in_fat_file(
|
msdos_find_node_by_cluster_num_in_fat_file(
|
||||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||||
fat_file_fd_t *fat_fd,
|
fat_file_fd_t *fat_fd,
|
||||||
unsigned32 cl4find,
|
uint32_t cl4find,
|
||||||
fat_auxiliary_t *paux,
|
fat_auxiliary_t *paux,
|
||||||
char *dir_entry
|
char *dir_entry
|
||||||
)
|
)
|
||||||
@@ -892,8 +892,8 @@ msdos_find_node_by_cluster_num_in_fat_file(
|
|||||||
int rc = RC_OK;
|
int rc = RC_OK;
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
msdos_fs_info_t *fs_info = mt_entry->fs_info;
|
||||||
unsigned32 bts2rd = 0;
|
uint32_t bts2rd = 0;
|
||||||
unsigned32 i = 0, j = 0;
|
uint32_t i = 0, j = 0;
|
||||||
|
|
||||||
if (FAT_FD_OF_ROOT_DIR(fat_fd) &&
|
if (FAT_FD_OF_ROOT_DIR(fat_fd) &&
|
||||||
(fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16)))
|
(fs_info->fat.vol.type & (FAT_FAT12 | FAT_FAT16)))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ rtems_deviceio_errno(rtems_status_code code)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code)))
|
if ((rc = rtems_assoc_remote_by_local(errno_assoc, (uint32_t ) code)))
|
||||||
{
|
{
|
||||||
errno = rc;
|
errno = rc;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -65,8 +65,8 @@ rtems_deviceio_errno(rtems_status_code code)
|
|||||||
int device_open(
|
int device_open(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
unsigned32 flag,
|
uint32_t flag,
|
||||||
unsigned32 mode
|
uint32_t mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_libio_open_close_args_t args;
|
rtems_libio_open_close_args_t args;
|
||||||
@@ -130,7 +130,7 @@ int device_close(
|
|||||||
ssize_t device_read(
|
ssize_t device_read(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_libio_rw_args_t args;
|
rtems_libio_rw_args_t args;
|
||||||
@@ -167,7 +167,7 @@ ssize_t device_read(
|
|||||||
ssize_t device_write(
|
ssize_t device_write(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
const void *buffer,
|
const void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_libio_rw_args_t args;
|
rtems_libio_rw_args_t args;
|
||||||
@@ -203,7 +203,7 @@ ssize_t device_write(
|
|||||||
|
|
||||||
int device_ioctl(
|
int device_ioctl(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
unsigned32 command,
|
uint32_t command,
|
||||||
void *buffer
|
void *buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -387,8 +387,8 @@ int memfile_ftruncate(
|
|||||||
int imfs_dir_open(
|
int imfs_dir_open(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const char *pathname, /* IN */
|
const char *pathname, /* IN */
|
||||||
unsigned32 flag, /* IN */
|
uint32_t flag, /* IN */
|
||||||
unsigned32 mode /* IN */
|
uint32_t mode /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int imfs_dir_close(
|
int imfs_dir_close(
|
||||||
@@ -398,7 +398,7 @@ int imfs_dir_close(
|
|||||||
ssize_t imfs_dir_read(
|
ssize_t imfs_dir_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int imfs_dir_lseek(
|
int imfs_dir_lseek(
|
||||||
@@ -419,7 +419,7 @@ int imfs_dir_rmnod(
|
|||||||
int linearfile_read(
|
int linearfile_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int linearfile_lseek(
|
int linearfile_lseek(
|
||||||
@@ -431,8 +431,8 @@ int linearfile_lseek(
|
|||||||
int memfile_open(
|
int memfile_open(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const char *pathname, /* IN */
|
const char *pathname, /* IN */
|
||||||
unsigned32 flag, /* IN */
|
uint32_t flag, /* IN */
|
||||||
unsigned32 mode /* IN */
|
uint32_t mode /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int memfile_close(
|
int memfile_close(
|
||||||
@@ -442,18 +442,18 @@ int memfile_close(
|
|||||||
ssize_t memfile_read(
|
ssize_t memfile_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
ssize_t memfile_write(
|
ssize_t memfile_write(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const void *buffer, /* IN */
|
const void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int memfile_ioctl(
|
int memfile_ioctl(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
unsigned32 command, /* IN */
|
uint32_t command, /* IN */
|
||||||
void *buffer /* IN */
|
void *buffer /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -470,8 +470,8 @@ int memfile_rmnod(
|
|||||||
int device_open(
|
int device_open(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const char *pathname, /* IN */
|
const char *pathname, /* IN */
|
||||||
unsigned32 flag, /* IN */
|
uint32_t flag, /* IN */
|
||||||
unsigned32 mode /* IN */
|
uint32_t mode /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int device_close(
|
int device_close(
|
||||||
@@ -481,18 +481,18 @@ int device_close(
|
|||||||
ssize_t device_read(
|
ssize_t device_read(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
void *buffer, /* IN */
|
void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
ssize_t device_write(
|
ssize_t device_write(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
const void *buffer, /* IN */
|
const void *buffer, /* IN */
|
||||||
unsigned32 count /* IN */
|
uint32_t count /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
int device_ioctl(
|
int device_ioctl(
|
||||||
rtems_libio_t *iop, /* IN */
|
rtems_libio_t *iop, /* IN */
|
||||||
unsigned32 command, /* IN */
|
uint32_t command, /* IN */
|
||||||
void *buffer /* IN */
|
void *buffer /* IN */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
int imfs_dir_open(
|
int imfs_dir_open(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
unsigned32 flag,
|
uint32_t flag,
|
||||||
unsigned32 mode
|
uint32_t mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
@@ -75,7 +75,7 @@ int imfs_dir_open(
|
|||||||
ssize_t imfs_dir_read(
|
ssize_t imfs_dir_read(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ int IMFS_fchmod(
|
|||||||
if ( (jnode->type == IMFS_LINEAR_FILE) &&
|
if ( (jnode->type == IMFS_LINEAR_FILE) &&
|
||||||
(mode & (S_IWUSR | S_IWGRP | S_IWOTH)) )
|
(mode & (S_IWUSR | S_IWGRP | S_IWOTH)) )
|
||||||
{
|
{
|
||||||
unsigned32 count = jnode->info.linearfile.size;
|
uint32_t count = jnode->info.linearfile.size;
|
||||||
const unsigned char *buffer = jnode->info.linearfile.direct;
|
const unsigned char *buffer = jnode->info.linearfile.direct;
|
||||||
|
|
||||||
jnode->type = IMFS_MEMORY_FILE;
|
jnode->type = IMFS_MEMORY_FILE;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
int linearfile_read(
|
int linearfile_read(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ void memfile_free_block(
|
|||||||
int memfile_open(
|
int memfile_open(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
unsigned32 flag,
|
uint32_t flag,
|
||||||
unsigned32 mode
|
uint32_t mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
@@ -137,7 +137,7 @@ int memfile_close(
|
|||||||
ssize_t memfile_read(
|
ssize_t memfile_read(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
@@ -156,7 +156,7 @@ ssize_t memfile_read(
|
|||||||
ssize_t memfile_write(
|
ssize_t memfile_write(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
const void *buffer,
|
const void *buffer,
|
||||||
unsigned32 count
|
uint32_t count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
@@ -180,7 +180,7 @@ ssize_t memfile_write(
|
|||||||
|
|
||||||
int memfile_ioctl(
|
int memfile_ioctl(
|
||||||
rtems_libio_t *iop,
|
rtems_libio_t *iop,
|
||||||
unsigned32 command,
|
uint32_t command,
|
||||||
void *buffer
|
void *buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user