summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2004-04-17 08:34:41 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2004-04-17 08:34:41 +0000
commita5305f6b33159d425e6fc5beb6807a675f70ecc9 (patch)
treef55d224dfb3bd157f6e7422d66919df283207a07 /cpukit
parent2004-04-17 Ralf Corsepius <ralf_corsepius@rtems.org> (diff)
downloadrtems-a5305f6b33159d425e6fc5beb6807a675f70ecc9.tar.bz2
Remove stray white spaces.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libfs/src/dosfs/fat.c200
-rw-r--r--cpukit/libfs/src/dosfs/fat.h138
-rw-r--r--cpukit/libfs/src/dosfs/fat_fat_operations.c166
-rw-r--r--cpukit/libfs/src/dosfs/fat_fat_operations.h4
-rw-r--r--cpukit/libfs/src/dosfs/fat_file.c392
-rw-r--r--cpukit/libfs/src/dosfs/fat_file.h62
-rw-r--r--cpukit/libfs/src/dosfs/msdos.h130
-rw-r--r--cpukit/libfs/src/dosfs/msdos_conv.c12
-rw-r--r--cpukit/libfs/src/dosfs/msdos_create.c132
-rw-r--r--cpukit/libfs/src/dosfs/msdos_dir.c192
-rw-r--r--cpukit/libfs/src/dosfs/msdos_eval.c152
-rw-r--r--cpukit/libfs/src/dosfs/msdos_file.c136
-rw-r--r--cpukit/libfs/src/dosfs/msdos_free.c6
-rw-r--r--cpukit/libfs/src/dosfs/msdos_fsunmount.c14
-rw-r--r--cpukit/libfs/src/dosfs/msdos_handlers_dir.c4
-rw-r--r--cpukit/libfs/src/dosfs/msdos_handlers_file.c4
-rw-r--r--cpukit/libfs/src/dosfs/msdos_init.c8
-rw-r--r--cpukit/libfs/src/dosfs/msdos_initsupp.c28
-rw-r--r--cpukit/libfs/src/dosfs/msdos_misc.c394
-rw-r--r--cpukit/libfs/src/dosfs/msdos_mknod.c18
-rw-r--r--cpukit/libfs/src/dosfs/msdos_node_type.c16
-rw-r--r--cpukit/libfs/src/imfs/deviceio.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs.h30
-rw-r--r--cpukit/libfs/src/imfs/imfs_chown.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_creat.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_debug.c4
-rw-r--r--cpukit/libfs/src/imfs/imfs_directory.c66
-rw-r--r--cpukit/libfs/src/imfs/imfs_eval.c66
-rw-r--r--cpukit/libfs/src/imfs/imfs_fchmod.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_fcntl.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_free.c4
-rw-r--r--cpukit/libfs/src/imfs/imfs_fsunmount.c10
-rw-r--r--cpukit/libfs/src/imfs/imfs_getchild.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_gtkn.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_init.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_link.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_load_tar.c10
-rw-r--r--cpukit/libfs/src/imfs/imfs_mknod.c8
-rw-r--r--cpukit/libfs/src/imfs/imfs_mount.c4
-rw-r--r--cpukit/libfs/src/imfs/imfs_ntype.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_readlink.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_rmnod.c8
-rw-r--r--cpukit/libfs/src/imfs/imfs_stat.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_symlink.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_unixstub.c4
-rw-r--r--cpukit/libfs/src/imfs/imfs_unlink.c6
-rw-r--r--cpukit/libfs/src/imfs/imfs_unmount.c16
-rw-r--r--cpukit/libfs/src/imfs/imfs_utime.c2
-rw-r--r--cpukit/libfs/src/imfs/ioman.c10
-rw-r--r--cpukit/libfs/src/imfs/memfile.c28
50 files changed, 1263 insertions, 1263 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index 526b0e7e47..e0bcdb2cc0 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -28,8 +28,8 @@
/* _fat_block_read --
* This function reads 'count' bytes from device filesystem is mounted on,
- * starts at 'start+offset' position where 'start' computed in sectors
- * and 'offset' is offset inside sector (reading may cross sectors
+ * starts at 'start+offset' position where 'start' computed in sectors
+ * and 'offset' is offset inside sector (reading may cross sectors
* boundary; in this case assumed we want to read sequential sector(s))
*
* PARAMETERS:
@@ -45,10 +45,10 @@
*/
ssize_t
_fat_block_read(
- rtems_filesystem_mount_table_entry_t *mt_entry,
- uint32_t start,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
+ uint32_t start,
uint32_t offset,
- uint32_t count,
+ uint32_t count,
void *buff
)
{
@@ -59,7 +59,7 @@ _fat_block_read(
uint32_t ofs = offset;
bdbuf_buffer *block = NULL;
uint32_t c = 0;
-
+
while (count > 0)
{
rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block);
@@ -78,9 +78,9 @@ _fat_block_read(
}
/* _fat_block_write --
- * This function write 'count' bytes to device filesystem is mounted on,
- * starts at 'start+offset' position where 'start' computed in sectors
- * and 'offset' is offset inside sector (writing may cross sectors
+ * This function write 'count' bytes to device filesystem is mounted on,
+ * starts at 'start+offset' position where 'start' computed in sectors
+ * and 'offset' is offset inside sector (writing may cross sectors
* boundary; in this case assumed we want to write sequential sector(s))
*
* PARAMETERS:
@@ -96,10 +96,10 @@ _fat_block_read(
*/
ssize_t
_fat_block_write(
- rtems_filesystem_mount_table_entry_t *mt_entry,
- uint32_t start,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
+ uint32_t start,
uint32_t offset,
- uint32_t count,
+ uint32_t count,
const void *buff)
{
int rc = RC_OK;
@@ -109,7 +109,7 @@ _fat_block_write(
uint32_t ofs = offset;
bdbuf_buffer *block = NULL;
uint32_t c = 0;
-
+
while(count > 0)
{
c = MIN(count, (fs_info->vol.bps - ofs));
@@ -120,7 +120,7 @@ _fat_block_write(
rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block);
if (rc != RC_OK)
return -1;
-
+
memcpy((block->buffer + ofs), (buff + cmpltd), c);
fat_buf_mark_modified(fs_info);
@@ -148,7 +148,7 @@ _fat_block_write(
* bytes read on success, or -1 if error occured
* and errno set appropriately
*/
-ssize_t
+ssize_t
fat_cluster_read(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln,
@@ -156,13 +156,13 @@ fat_cluster_read(
)
{
fat_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t fsec = 0;
-
- fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
+ uint32_t fsec = 0;
- return _fat_block_read(mt_entry, fsec, 0,
- fs_info->vol.spc << fs_info->vol.sec_log2, buff);
-}
+ fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
+
+ return _fat_block_read(mt_entry, fsec, 0,
+ fs_info->vol.spc << fs_info->vol.sec_log2, buff);
+}
/* fat_cluster_write --
* wrapper for writting a whole cluster at once
@@ -176,7 +176,7 @@ fat_cluster_read(
* bytes written on success, or -1 if error occured
* and errno set appropriately
*/
-ssize_t
+ssize_t
fat_cluster_write(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln,
@@ -185,12 +185,12 @@ fat_cluster_write(
{
fat_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t fsec = 0;
-
- fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
-
+
+ fsec = fat_cluster_num_to_sector_num(mt_entry, cln);
+
return _fat_block_write(mt_entry, fsec, 0,
- fs_info->vol.spc << fs_info->vol.sec_log2, buff);
-}
+ fs_info->vol.spc << fs_info->vol.sec_log2, buff);
+}
/* fat_init_volume_info --
* Get inforamtion about volume on which filesystem is mounted on
@@ -206,7 +206,7 @@ int
fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
{
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;
uint32_t data_secs = 0;
char boot_rec[FAT_MAX_BPB_SIZE];
@@ -220,15 +220,15 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
if (rc == -1)
return rc;
- /* rtmes feature: no block devices, all are character devices */
+ /* rtmes feature: no block devices, all are character devices */
if (!S_ISCHR(stat_buf.st_mode))
- set_errno_and_return_minus_one(ENOTBLK);
+ set_errno_and_return_minus_one(ENOTBLK);
/* check that device is registred as block device and lock it */
vol->dd = rtems_disk_lookup(stat_buf.st_dev);
- if (vol->dd == NULL)
+ if (vol->dd == NULL)
set_errno_and_return_minus_one(ENOTBLK);
-
+
vol->dev = stat_buf.st_dev;
fd = open(mt_entry->dev, O_RDONLY);
@@ -236,8 +236,8 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
{
rtems_disk_release(vol->dd);
return -1;
- }
-
+ }
+
ret = read(fd, (void *)boot_rec, FAT_MAX_BPB_SIZE);
if ( ret != FAT_MAX_BPB_SIZE )
{
@@ -248,19 +248,19 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
close(fd);
vol->bps = FAT_BR_BYTES_PER_SECTOR(boot_rec);
-
- if ( (vol->bps != 512) &&
- (vol->bps != 1024) &&
+
+ if ( (vol->bps != 512) &&
+ (vol->bps != 1024) &&
(vol->bps != 2048) &&
(vol->bps != 4096))
- {
+ {
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one( EINVAL );
- }
+ }
- for (vol->sec_mul = 0, i = (vol->bps >> FAT_SECTOR512_BITS); (i & 1) == 0;
+ for (vol->sec_mul = 0, i = (vol->bps >> FAT_SECTOR512_BITS); (i & 1) == 0;
i >>= 1, vol->sec_mul++);
- for (vol->sec_log2 = 0, i = vol->bps; (i & 1) == 0;
+ for (vol->sec_log2 = 0, i = vol->bps; (i & 1) == 0;
i >>= 1, vol->sec_log2++);
vol->spc = FAT_BR_SECTORS_PER_CLUSTER(boot_rec);
@@ -272,28 +272,28 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
{
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one(EINVAL);
- }
+ }
- for (vol->spc_log2 = 0, i = vol->spc; (i & 1) == 0;
+ for (vol->spc_log2 = 0, i = vol->spc; (i & 1) == 0;
i >>= 1, vol->spc_log2++);
-
- /*
+
+ /*
* "bytes per cluster" value greater than 32K is invalid
*/
if ((vol->bpc = vol->bps << vol->spc_log2) > MS_BYTES_PER_CLUSTER_LIMIT)
{
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one(EINVAL);
- }
+ }
- for (vol->bpc_log2 = 0, i = vol->bpc; (i & 1) == 0;
+ for (vol->bpc_log2 = 0, i = vol->bpc; (i & 1) == 0;
i >>= 1, vol->bpc_log2++);
vol->fats = FAT_BR_FAT_NUM(boot_rec);
vol->fat_loc = FAT_BR_RESERVED_SECTORS_NUM(boot_rec);
vol->rdir_entrs = FAT_BR_FILES_PER_ROOT_DIR(boot_rec);
-
+
/* calculate the count of sectors occupied by the root directory */
vol->rdir_secs = ((vol->rdir_entrs * FAT_DIRENTRY_SIZE) + (vol->bps - 1)) /
vol->bps;
@@ -304,20 +304,20 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
vol->fat_length = FAT_BR_SECTORS_PER_FAT(boot_rec);
else
vol->fat_length = FAT_BR_SECTORS_PER_FAT32(boot_rec);
-
- vol->data_fsec = vol->fat_loc + vol->fats * vol->fat_length +
+
+ vol->data_fsec = vol->fat_loc + vol->fats * vol->fat_length +
vol->rdir_secs;
/* for FAT12/16 root dir starts at(sector) */
vol->rdir_loc = vol->fat_loc + vol->fats * vol->fat_length;
-
+
if ( (FAT_BR_TOTAL_SECTORS_NUM16(boot_rec)) != 0)
vol->tot_secs = FAT_BR_TOTAL_SECTORS_NUM16(boot_rec);
else
vol->tot_secs = FAT_BR_TOTAL_SECTORS_NUM32(boot_rec);
-
+
data_secs = vol->tot_secs - vol->data_fsec;
-
+
vol->data_cls = data_secs / vol->spc;
/* determine FAT type at least */
@@ -327,7 +327,7 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
vol->mask = FAT_FAT12_MASK;
vol->eoc_val = FAT_FAT12_EOC;
}
- else
+ else
{
if ( vol->data_cls < FAT_FAT16_MAX_CLN)
{
@@ -342,58 +342,58 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
vol->eoc_val = FAT_FAT32_EOC;
}
}
-
+
if (vol->type == FAT_FAT32)
{
vol->rdir_cl = FAT_BR_FAT32_ROOT_CLUSTER(boot_rec);
-
+
vol->mirror = FAT_BR_EXT_FLAGS(boot_rec) & FAT_BR_EXT_FLAGS_MIRROR;
if (vol->mirror)
vol->afat = FAT_BR_EXT_FLAGS(boot_rec) & FAT_BR_EXT_FLAGS_FAT_NUM;
else
- vol->afat = 0;
+ vol->afat = 0;
vol->info_sec = FAT_BR_FAT32_FS_INFO_SECTOR(boot_rec);
if( vol->info_sec == 0 )
- {
+ {
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one( EINVAL );
- }
- else
+ }
+ else
{
- ret = _fat_block_read(mt_entry, vol->info_sec , 0,
+ ret = _fat_block_read(mt_entry, vol->info_sec , 0,
FAT_FSI_LEADSIG_SIZE, fs_info_sector);
if ( ret < 0 )
{
rtems_disk_release(vol->dd);
return -1;
- }
-
- if (FAT_FSINFO_LEAD_SIGNATURE(fs_info_sector) !=
+ }
+
+ if (FAT_FSINFO_LEAD_SIGNATURE(fs_info_sector) !=
FAT_FSINFO_LEAD_SIGNATURE_VALUE)
- {
+ {
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one( EINVAL );
- }
+ }
else
{
- ret = _fat_block_read(mt_entry, vol->info_sec , FAT_FSI_INFO,
+ ret = _fat_block_read(mt_entry, vol->info_sec , FAT_FSI_INFO,
FAT_USEFUL_INFO_SIZE, fs_info_sector);
if ( ret < 0 )
{
rtems_disk_release(vol->dd);
return -1;
- }
-
+ }
+
vol->free_cls = FAT_FSINFO_FREE_CLUSTER_COUNT(fs_info_sector);
vol->next_cl = FAT_FSINFO_NEXT_FREE_CLUSTER(fs_info_sector);
- rc = fat_fat32_update_fsinfo_sector(mt_entry, 0xFFFFFFFF,
+ rc = fat_fat32_update_fsinfo_sector(mt_entry, 0xFFFFFFFF,
0xFFFFFFFF);
if ( rc != RC_OK )
{
- rtems_disk_release(vol->dd);
- return rc;
- }
+ rtems_disk_release(vol->dd);
+ return rc;
+ }
}
}
}
@@ -409,17 +409,17 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
/* set up collection of fat-files fd */
fs_info->vhash = calloc(FAT_HASH_SIZE, sizeof(Chain_Control));
- if ( fs_info->vhash == NULL )
+ if ( fs_info->vhash == NULL )
{
rtems_disk_release(vol->dd);
set_errno_and_return_minus_one( ENOMEM );
- }
+ }
for (i = 0; i < FAT_HASH_SIZE; i++)
_Chain_Initialize_empty(fs_info->vhash + i);
fs_info->rhash = calloc(FAT_HASH_SIZE, sizeof(Chain_Control));
- if ( fs_info->rhash == NULL )
+ if ( fs_info->rhash == NULL )
{
rtems_disk_release(vol->dd);
free(fs_info->vhash);
@@ -427,7 +427,7 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
}
for (i = 0; i < FAT_HASH_SIZE; i++)
_Chain_Initialize_empty(fs_info->rhash + i);
-
+
fs_info->uino_pool_size = FAT_UINO_POOL_INIT_SIZE;
fs_info->uino_base = (vol->tot_secs << vol->sec_mul) << 4;
fs_info->index = 0;
@@ -448,12 +448,12 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry)
free(fs_info->uino);
set_errno_and_return_minus_one( ENOMEM );
}
-
- return RC_OK;
+
+ return RC_OK;
}
/* fat_shutdown_drive --
- * Free all allocated resources and synchronize all necessary data
+ * Free all allocated resources and synchronize all necessary data
*
* PARAMETERS:
* mt_entry - mount table entry
@@ -475,10 +475,10 @@ fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry)
fs_info->vol.next_cl);
if ( rc != RC_OK )
rc = -1;
- }
+ }
fat_buf_release(fs_info);
-
+
if (rtems_bdbuf_syncdev(fs_info->vol.dev) != RTEMS_SUCCESSFUL)
rc = -1;
@@ -486,10 +486,10 @@ fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry)
{
Chain_Node *node = NULL;
Chain_Control *the_chain = fs_info->vhash + i;
-
+
while ( (node = _Chain_Get(the_chain)) != NULL )
free(node);
- }
+ }
for (i = 0; i < FAT_HASH_SIZE; i++)
{
@@ -498,10 +498,10 @@ fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry)
while ( (node = _Chain_Get(the_chain)) != NULL )
free(node);
- }
+ }
free(fs_info->vhash);
- free(fs_info->rhash);
+ free(fs_info->rhash);
free(fs_info->uino);
free(fs_info->sec_buf);
@@ -517,7 +517,7 @@ fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry)
*
* PARAMETERS:
* mt_entry - mount table entry
- * start_cluster_num - num of first cluster in the chain
+ * start_cluster_num - num of first cluster in the chain
*
* RETURNS:
* RC_OK on success, or -1 if error occured
@@ -534,7 +534,7 @@ fat_init_clusters_chain(
register fat_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t cur_cln = start_cln;
char *buf;
-
+
buf = calloc(fs_info->vol.bpc, sizeof(char));
if ( buf == NULL )
set_errno_and_return_minus_one( EIO );
@@ -554,13 +554,13 @@ fat_init_clusters_chain(
free(buf);
return rc;
}
-
+
}
free(buf);
return rc;
-}
-
-#define FAT_UNIQ_INO_BASE 0x0FFFFF00
+}
+
+#define FAT_UNIQ_INO_BASE 0x0FFFFF00
#define FAT_UNIQ_INO_IS_BUSY(index, arr) \
(((arr)[((index)>>3)]>>((index) & (8-1))) & 0x01)
@@ -583,9 +583,9 @@ fat_init_clusters_chain(
*
* ATTENTION:
* 0 means FAILED !!!
- *
+ *
*/
-uint32_t
+uint32_t
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
{
register fat_fs_info_t *fs_info = mt_entry->fs_info;
@@ -593,13 +593,13 @@ fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
rtems_boolean resrc_unsuff = FALSE;
while (!resrc_unsuff)
- {
+ {
for (j = 0; j < fs_info->uino_pool_size; j++)
{
if (!FAT_UNIQ_INO_IS_BUSY(fs_info->index, fs_info->uino))
{
FAT_SET_UNIQ_INO_BUSY(fs_info->index, fs_info->uino);
- return (fs_info->uino_base + fs_info->index);
+ return (fs_info->uino_base + fs_info->index);
}
fs_info->index++;
if (fs_info->index >= fs_info->uino_pool_size)
@@ -612,12 +612,12 @@ fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry)
fs_info->uino = realloc(fs_info->uino, fs_info->uino_pool_size);
if (fs_info->uino != NULL)
fs_info->index = fs_info->uino_pool_size;
- else
+ else
resrc_unsuff = TRUE;
}
else
resrc_unsuff = TRUE;
- }
+ }
return 0;
}
@@ -638,7 +638,7 @@ fat_free_unique_ino(
)
{
fat_fs_info_t *fs_info = mt_entry->fs_info;
-
+
FAT_SET_UNIQ_INO_FREE((ino - fs_info->uino_base), fs_info->uino);
}
@@ -659,7 +659,7 @@ fat_ino_is_unique(
)
{
fat_fs_info_t *fs_info = mt_entry->fs_info;
-
+
return (ino >= fs_info->uino_base);
}
diff --git a/cpukit/libfs/src/dosfs/fat.h b/cpukit/libfs/src/dosfs/fat.h
index e45d24d695..43f56b7393 100644
--- a/cpukit/libfs/src/dosfs/fat.h
+++ b/cpukit/libfs/src/dosfs/fat.h
@@ -38,9 +38,9 @@ extern "C" {
#define RC_OK 0x00000000
#endif
-/*
- * Remember that all FAT file system on disk data structure is
- * "little endian"!
+/*
+ * Remember that all FAT file system on disk data structure is
+ * "little endian"!
* (derived from linux)
*/
/*
@@ -55,12 +55,12 @@ extern "C" {
# define CF_LE_L(v) CPU_swap_u32((uint32_t )v)
# define CT_LE_W(v) CPU_swap_u16((uint16_t )v)
# define CT_LE_L(v) CPU_swap_u32((uint32_t )v)
-#else
+#else
# define CF_LE_W(v) (v)
# define CF_LE_L(v) (v)
# define CT_LE_W(v) (v)
# define CT_LE_L(v) (v)
-#endif
+#endif
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -72,16 +72,16 @@ extern "C" {
#define FAT_SECTOR512_BITS 9 /* log2(SECTOR_SIZE) */
/* maximum + 1 number of clusters for FAT12 */
-#define FAT_FAT12_MAX_CLN 4085
+#define FAT_FAT12_MAX_CLN 4085
/* maximum + 1 number of clusters for FAT16 */
-#define FAT_FAT16_MAX_CLN 65525
+#define FAT_FAT16_MAX_CLN 65525
#define FAT_FAT12 0x01
#define FAT_FAT16 0x02
#define FAT_FAT32 0x04
-
-#define FAT_UNDEFINED_VALUE (uint32_t )0xFFFFFFFF
+
+#define FAT_UNDEFINED_VALUE (uint32_t )0xFFFFFFFF
#define FAT_FAT12_EOC 0x0FF8
#define FAT_FAT16_EOC 0xFFF8
@@ -106,7 +106,7 @@ extern "C" {
#define FAT_USEFUL_INFO_SIZE 12
#define FAT_VAL8(x, ofs) (uint8_t )(*((uint8_t *)(x) + (ofs)))
-
+
#define FAT_VAL16(x, ofs) \
(uint16_t )( (*((uint8_t *)(x) + (ofs))) | \
((*((uint8_t *)(x) + (ofs) + 1)) << 8) )
@@ -116,15 +116,15 @@ extern "C" {
((uint32_t )(*((uint8_t *)(x) + (ofs) + 1)) << 8) | \
((uint32_t )(*((uint8_t *)(x) + (ofs) + 2)) << 16) | \
((uint32_t )(*((uint8_t *)(x) + (ofs) + 3)) << 24) )
-
+
/* macros to access boot sector fields */
#define FAT_BR_BYTES_PER_SECTOR(x) FAT_VAL16(x, 11)
-#define FAT_BR_SECTORS_PER_CLUSTER(x) FAT_VAL8(x, 13)
+#define FAT_BR_SECTORS_PER_CLUSTER(x) FAT_VAL8(x, 13)
#define FAT_BR_RESERVED_SECTORS_NUM(x) FAT_VAL16(x, 14)
#define FAT_BR_FAT_NUM(x) FAT_VAL8(x, 16)
#define FAT_BR_FILES_PER_ROOT_DIR(x) FAT_VAL16(x, 17)
#define FAT_BR_TOTAL_SECTORS_NUM16(x) FAT_VAL16(x, 19)
-#define FAT_BR_MEDIA(x) FAT_VAL8(x, 21)
+#define FAT_BR_MEDIA(x) FAT_VAL8(x, 21)
#define FAT_BR_SECTORS_PER_FAT(x) FAT_VAL16(x, 22)
#define FAT_BR_TOTAL_SECTORS_NUM32(x) FAT_VAL32(x, 32)
#define FAT_BR_SECTORS_PER_FAT32(x) FAT_VAL32(x, 36)
@@ -132,8 +132,8 @@ extern "C" {
#define FAT_BR_FAT32_ROOT_CLUSTER(x) FAT_VAL32(x, 44)
#define FAT_BR_FAT32_FS_INFO_SECTOR(x) FAT_VAL16(x, 48)
#define FAT_FSINFO_LEAD_SIGNATURE(x) FAT_VAL32(x, 0)
-/*
- * I read FSInfo sector from offset 484 to access the information, so offsets
+/*
+ * I read FSInfo sector from offset 484 to access the information, so offsets
* of these fields a relative
*/
#define FAT_FSINFO_FREE_CLUSTER_COUNT(x) FAT_VAL32(x, 4)
@@ -143,7 +143,7 @@ extern "C" {
#define FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET 492
-#define FAT_RSRVD_CLN 0x02
+#define FAT_RSRVD_CLN 0x02
#define FAT_FSINFO_LEAD_SIGNATURE_VALUE 0x41615252
@@ -158,17 +158,17 @@ extern "C" {
#define FAT_BR_EXT_FLAGS_FAT_NUM 0x000F
-#define FAT_DIRENTRY_SIZE 32
-
+#define FAT_DIRENTRY_SIZE 32
+
#define FAT_DIRENTRIES_PER_SEC512 16
-/*
+/*
* Volume descriptor
- * Description of the volume the FAT filesystem is located on - generally
+ * Description of the volume the FAT filesystem is located on - generally
* the fields of the structure corresponde to Boot Sector and BPB Srtucture
* fields
*/
-typedef struct fat_vol_s
+typedef struct fat_vol_s
{
uint16_t bps; /* bytes per sector */
uint8_t sec_log2; /* log2 of bps */
@@ -210,9 +210,9 @@ typedef struct fat_cache_s
uint8_t state;
bdbuf_buffer *buf;
} fat_cache_t;
-
-/*
- * This structure identifies the instance of the filesystem on the FAT
+
+/*
+ * This structure identifies the instance of the filesystem on the FAT
* ("fat-file") level.
*/
typedef struct fat_fs_info_s
@@ -228,9 +228,9 @@ typedef struct fat_fs_info_s
uint8_t *sec_buf; /* just placeholder for anything */
} fat_fs_info_t;
-/*
+/*
* if the name we looking for is file we store not only first data cluster
- * number, but and cluster number and offset for directory entry for this
+ * number, but and cluster number and offset for directory entry for this
* name
*/
typedef struct fat_auxiliary_s
@@ -258,22 +258,22 @@ typedef struct fat_auxiliary_s
#define FAT_OP_TYPE_READ 0x1
#define FAT_OP_TYPE_GET 0x2
-static inline uint32_t
+static inline uint32_t
fat_cluster_num_to_sector_num(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln
)
{
register fat_fs_info_t *fs_info = mt_entry->fs_info;
-
+
if ( (cln == 0) && (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)) )
- return fs_info->vol.rdir_loc;
+ return fs_info->vol.rdir_loc;
- return (((cln - FAT_RSRVD_CLN) << fs_info->vol.spc_log2) +
+ return (((cln - FAT_RSRVD_CLN) << fs_info->vol.spc_log2) +
fs_info->vol.data_fsec);
-}
+}
-static inline uint32_t
+static inline uint32_t
fat_cluster_num_to_sector512_num(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln
@@ -286,31 +286,31 @@ fat_cluster_num_to_sector512_num(
return (fat_cluster_num_to_sector_num(mt_entry, cln) <<
fs_info->vol.sec_mul);
-}
+}
static inline int
-fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
+fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
bdbuf_buffer **buf)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uint8_t i;
rtems_boolean sec_of_fat;
-
+
if (fs_info->c.state == FAT_CACHE_EMPTY)
{
if (op_type == FAT_OP_TYPE_READ)
sc = rtems_bdbuf_read(fs_info->vol.dev, blk, &fs_info->c.buf);
else
- sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf);
+ sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- fs_info->c.blk_num = blk;
- fs_info->c.modified = 0;
- fs_info->c.state = FAT_CACHE_ACTUAL;
+ fs_info->c.blk_num = blk;
+ fs_info->c.modified = 0;
+ fs_info->c.state = FAT_CACHE_ACTUAL;
}
-
- sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) &&
+
+ sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) &&
(fs_info->c.blk_num < fs_info->vol.rdir_loc));
if (fs_info->c.blk_num != blk)
@@ -318,24 +318,24 @@ fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
if (fs_info->c.modified)
{
if (sec_of_fat && !fs_info->vol.mirror)
- memcpy(fs_info->sec_buf, fs_info->c.buf->buffer,
+ memcpy(fs_info->sec_buf, fs_info->c.buf->buffer,
fs_info->vol.bps);
-
+
sc = rtems_bdbuf_release_modified(fs_info->c.buf);
fs_info->c.state = FAT_CACHE_EMPTY;
- fs_info->c.modified = 0;
+ fs_info->c.modified = 0;
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
if (sec_of_fat && !fs_info->vol.mirror)
{
bdbuf_buffer *b;
-
+
for (i = 1; i < fs_info->vol.fats; i++)
{
sc = rtems_bdbuf_get(fs_info->vol.dev,
- fs_info->c.blk_num +
- fs_info->vol.fat_length * i,
+ fs_info->c.blk_num +
+ fs_info->vol.fat_length * i,
&b);
if ( sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(ENOMEM);
@@ -344,7 +344,7 @@ fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
if ( sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(ENOMEM);
}
- }
+ }
}
else
{
@@ -352,12 +352,12 @@ fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
fs_info->c.state = FAT_CACHE_EMPTY;
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
- }
+
+ }
if (op_type == FAT_OP_TYPE_READ)
sc = rtems_bdbuf_read(fs_info->vol.dev, blk, &fs_info->c.buf);
else
- sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf);
+ sc = rtems_bdbuf_get(fs_info->vol.dev, blk, &fs_info->c.buf);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
fs_info->c.blk_num = blk;
@@ -368,38 +368,38 @@ fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type,
}
-static inline int
+static inline int
fat_buf_release(fat_fs_info_t *fs_info)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uint8_t i;
rtems_boolean sec_of_fat;
-
+
if (fs_info->c.state == FAT_CACHE_EMPTY)
return RC_OK;
-
- sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) &&
+
+ sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) &&
(fs_info->c.blk_num < fs_info->vol.rdir_loc));
if (fs_info->c.modified)
{
if (sec_of_fat && !fs_info->vol.mirror)
memcpy(fs_info->sec_buf, fs_info->c.buf->buffer, fs_info->vol.bps);
-
+
sc = rtems_bdbuf_release_modified(fs_info->c.buf);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- fs_info->c.modified = 0;
-
+ fs_info->c.modified = 0;
+
if (sec_of_fat && !fs_info->vol.mirror)
{
bdbuf_buffer *b;
-
+
for (i = 1; i < fs_info->vol.fats; i++)
{
sc = rtems_bdbuf_get(fs_info->vol.dev,
- fs_info->c.blk_num +
- fs_info->vol.fat_length * i,
+ fs_info->c.blk_num +
+ fs_info->vol.fat_length * i,
&b);
if ( sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(ENOMEM);
@@ -408,14 +408,14 @@ fat_buf_release(fat_fs_info_t *fs_info)
if ( sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(ENOMEM);
}
- }
+ }
}
else
{
sc = rtems_bdbuf_release(fs_info->c.buf);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- }
+ }
fs_info->c.state = FAT_CACHE_EMPTY;
return RC_OK;
}
@@ -459,7 +459,7 @@ int
fat_init_clusters_chain(rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t start_cln);
-uint32_t
+uint32_t
fat_cluster_num_to_sector_num(rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln);
@@ -467,9 +467,9 @@ int
fat_shutdown_drive(rtems_filesystem_mount_table_entry_t *mt_entry);
-uint32_t
+uint32_t
fat_get_unique_ino(rtems_filesystem_mount_table_entry_t *mt_entry);
-
+
rtems_boolean
fat_ino_is_unique(rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t ino);
@@ -484,9 +484,9 @@ fat_fat32_update_fsinfo_sector(
uint32_t free_count,
uint32_t next_free
);
-
+
#ifdef __cplusplus
}
#endif
-
+
#endif /* __DOSFS_FAT_H__ */
diff --git a/cpukit/libfs/src/dosfs/fat_fat_operations.c b/cpukit/libfs/src/dosfs/fat_fat_operations.c
index 00c1e4f28f..0e6411f799 100644
--- a/cpukit/libfs/src/dosfs/fat_fat_operations.c
+++ b/cpukit/libfs/src/dosfs/fat_fat_operations.c
@@ -31,44 +31,44 @@
*
* PARAMETERS:
* mt_entry - mount table entry
- * chain - the number of the first allocated cluster (first cluster
+ * chain - the number of the first allocated cluster (first cluster
* in the chain)
* count - count of clusters to allocate (chain length)
*
* RETURNS:
- * RC_OK on success, or error code if error occured (errno set
+ * RC_OK on success, or error code if error occured (errno set
* appropriately)
*
- *
+ *
*/
-int
+int
fat_scan_fat_for_free_clusters(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t *chain,
uint32_t count,
uint32_t *cls_added,
- uint32_t *last_cl
+ uint32_t *last_cl
)
{
int rc = RC_OK;
fat_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t cl4find = 2;
uint32_t next_cln = 0;
- uint32_t save_cln = 0;
+ uint32_t save_cln = 0;
uint32_t data_cls_val = fs_info->vol.data_cls + 2;
uint32_t i = 2;
-
- *cls_added = 0;
+
+ *cls_added = 0;
if (count == 0)
return rc;
-
+
if (fs_info->vol.next_cl != FAT_UNDEFINED_VALUE)
- cl4find = fs_info->vol.next_cl;
+ cl4find = fs_info->vol.next_cl;
- /*
- * fs_info->vol.data_cls is exactly the count of data clusters
- * starting at cluster 2, so the maximum valid cluster number is
+ /*
+ * fs_info->vol.data_cls is exactly the count of data clusters
+ * starting at cluster 2, so the maximum valid cluster number is
* (fs_info->vol.data_cls + 1)
*/
while (i < data_cls_val)
@@ -79,13 +79,13 @@ fat_scan_fat_for_free_clusters(
if (*cls_added != 0)
fat_free_fat_clusters_chain(mt_entry, (*chain));
return rc;
- }
+ }
if (next_cln == FAT_GENFAT_FREE)
{
/*
* We are enforced to process allocation of the first free cluster
- * by separate 'if' statement because otherwise undo function
+ * by separate 'if' statement because otherwise undo function
* wouldn't work properly
*/
if (*cls_added == 0)
@@ -94,22 +94,22 @@ fat_scan_fat_for_free_clusters(
rc = fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_EOC);
if ( rc != RC_OK )
{
- /*
- * this is the first cluster we tried to allocate so no
- * cleanup activity needed
+ /*
+ * this is the first cluster we tried to allocate so no
+ * cleanup activity needed
*/
- return rc;
+ return rc;
}
}
else
- {
+ {
/* set EOC value to new allocated cluster */
rc = fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_EOC);
if ( rc != RC_OK )
{
/* cleanup activity */
fat_free_fat_clusters_chain(mt_entry, (*chain));
- return rc;
+ return rc;
}
rc = fat_set_fat_cluster(mt_entry, save_cln, cl4find);
@@ -120,9 +120,9 @@ fat_scan_fat_for_free_clusters(
/* trying to save last allocated cluster for future use */
fat_set_fat_cluster(mt_entry, cl4find, FAT_GENFAT_FREE);
fat_buf_release(fs_info);
- return rc;
+ return rc;
}
- }
+ }
save_cln = cl4find;
(*cls_added)++;
@@ -133,37 +133,37 @@ fat_scan_fat_for_free_clusters(
fs_info->vol.next_cl = save_cln;
if (fs_info->vol.free_cls != 0xFFFFFFFF)
fs_info->vol.free_cls -= (*cls_added);
- *last_cl = save_cln;
+ *last_cl = save_cln;
fat_buf_release(fs_info);
- return rc;
- }
+ return rc;
+ }
}
i++;
- cl4find++;
+ cl4find++;
if (cl4find >= data_cls_val)
cl4find = 2;
}
fs_info->vol.next_cl = save_cln;
if (fs_info->vol.free_cls != 0xFFFFFFFF)
- fs_info->vol.free_cls -= (*cls_added);
+ fs_info->vol.free_cls -= (*cls_added);
*last_cl = save_cln;
fat_buf_release(fs_info);
- return RC_OK;
-}
+ return RC_OK;
+}
/* fat_free_fat_clusters_chain --
* Free chain of clusters in Files Allocation Table.
*
* PARAMETERS:
* mt_entry - mount table entry
- * chain - number of the first cluster in the chain
+ * chain - number of the first cluster in the chain
*
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately)
*/
-int
+int
fat_free_fat_clusters_chain(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t chain
@@ -171,10 +171,10 @@ fat_free_fat_clusters_chain(
{
int rc = RC_OK, rc1 = RC_OK;
fat_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t cur_cln = chain;
- uint32_t next_cln = 0;
+ uint32_t cur_cln = chain;
+ uint32_t next_cln = 0;
uint32_t freed_cls_cnt = 0;
-
+
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
{
rc = fat_get_fat_cluster(mt_entry, cur_cln, &next_cln);
@@ -183,9 +183,9 @@ fat_free_fat_clusters_chain(
if(fs_info->vol.free_cls != FAT_UNDEFINED_VALUE)
fs_info->vol.free_cls += freed_cls_cnt;
- fat_buf_release(fs_info);
+ fat_buf_release(fs_info);
return rc;
- }
+ }
rc = fat_set_fat_cluster(mt_entry, cur_cln, FAT_GENFAT_FREE);
if ( rc != RC_OK )
@@ -203,18 +203,18 @@ fat_free_fat_clusters_chain(
if (rc1 != RC_OK)
return rc1;
- return RC_OK;
+ return RC_OK;
}
/* fat_get_fat_cluster --
- * Fetches the contents of the cluster (link to next cluster in the chain)
+ * Fetches the contents of the cluster (link to next cluster in the chain)
* from Files Allocation Table.
*
* PARAMETERS:
* mt_entry - mount table entry
* cln - number of cluster to fetch the contents from
- * ret_val - contents of the cluster 'cln' (link to next cluster in
- * the chain)
+ * ret_val - contents of the cluster 'cln' (link to next cluster in
+ * the chain)
*
* RETURNS:
* RC_OK on success, or -1 if error occured
@@ -237,7 +237,7 @@ fat_get_fat_cluster(
if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) )
set_errno_and_return_minus_one(EIO);
- sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) +
+ sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) +
fs_info->vol.afat_loc;
ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1);
@@ -248,14 +248,14 @@ fat_get_fat_cluster(
switch ( fs_info->vol.type )
{
case FAT_FAT12:
- /*
+ /*
* we are enforced in complex computations for FAT12 to escape CPU
* align problems for some architectures
*/
*ret_val = (*((uint8_t *)(block0->buffer + ofs)));
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,
&block0);
if (rc != RC_OK)
return rc;
@@ -263,7 +263,7 @@ fat_get_fat_cluster(
*ret_val |= (*((uint8_t *)(block0->buffer)))<<8;
}
else
- {
+ {
*ret_val |= (*((uint8_t *)(block0->buffer + ofs + 1)))<<8;
}
@@ -298,7 +298,7 @@ fat_get_fat_cluster(
* PARAMETERS:
* mt_entry - mount table entry
* cln - number of cluster to set contents to
- * in_val - value to set
+ * in_val - value to set
*
* RETURNS:
* RC_OK on success, or -1 if error occured
@@ -317,16 +317,16 @@ fat_set_fat_cluster(
uint32_t ofs = 0;
uint16_t fat16_clv = 0;
uint32_t fat32_clv = 0;
- bdbuf_buffer *block0 = NULL;
+ bdbuf_buffer *block0 = NULL;
/* sanity check */
if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) )
set_errno_and_return_minus_one(EIO);
- sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) +
+ sec = (FAT_FAT_OFFSET(fs_info->vol.type, cln) >> fs_info->vol.sec_log2) +
fs_info->vol.afat_loc;
ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1);
-
+
rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &block0);
if (rc != RC_OK)
return rc;
@@ -337,93 +337,93 @@ fat_set_fat_cluster(
if ( FAT_CLUSTER_IS_ODD(cln) )
{
fat16_clv = ((uint16_t )in_val) << FAT_FAT12_SHIFT;
- *((uint8_t *)(block0->buffer + ofs)) =
+ *((uint8_t *)(block0->buffer + ofs)) =
(*((uint8_t *)(block0->buffer + ofs))) & 0x0F;
- *((uint8_t *)(block0->buffer + ofs)) =
- (*((uint8_t *)(block0->buffer + ofs))) |
+ *((uint8_t *)(block0->buffer + ofs)) =
+ (*((uint8_t *)(block0->buffer + ofs))) |
(uint8_t )(fat16_clv & 0x00FF);
fat_buf_mark_modified(fs_info);
-
+
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,
&block0);
if (rc != RC_OK)
return rc;
*((uint8_t *)(block0->buffer)) &= 0x00;
-
- *((uint8_t *)(block0->buffer)) =
- (*((uint8_t *)(block0->buffer))) |
+
+ *((uint8_t *)(block0->buffer)) =
+ (*((uint8_t *)(block0->buffer))) |
(uint8_t )((fat16_clv & 0xFF00)>>8);
-
+
fat_buf_mark_modified(fs_info);
}
else
{
*((uint8_t *)(block0->buffer + ofs + 1)) &= 0x00;
-
- *((uint8_t *)(block0->buffer + ofs + 1)) =
- (*((uint8_t *)(block0->buffer + ofs + 1))) |
+
+ *((uint8_t *)(block0->buffer + ofs + 1)) =
+ (*((uint8_t *)(block0->buffer + ofs + 1))) |
(uint8_t )((fat16_clv & 0xFF00)>>8);
- }
+ }
}
else
{
fat16_clv = ((uint16_t )in_val) & FAT_FAT12_MASK;
*((uint8_t *)(block0->buffer + ofs)) &= 0x00;
- *((uint8_t *)(block0->buffer + ofs)) =
- (*((uint8_t *)(block0->buffer + ofs))) |
+ *((uint8_t *)(block0->buffer + ofs)) =
+ (*((uint8_t *)(block0->buffer + ofs))) |
(uint8_t )(fat16_clv & 0x00FF);
-
- fat_buf_mark_modified(fs_info);
-
+
+ fat_buf_mark_modified(fs_info);
+
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,
&block0);
if (rc != RC_OK)
return rc;
- *((uint8_t *)(block0->buffer)) =
+ *((uint8_t *)(block0->buffer)) =
(*((uint8_t *)(block0->buffer))) & 0xF0;
-
- *((uint8_t *)(block0->buffer)) =
- (*((uint8_t *)(block0->buffer))) |
+
+ *((uint8_t *)(block0->buffer)) =
+ (*((uint8_t *)(block0->buffer))) |
(uint8_t )((fat16_clv & 0xFF00)>>8);
-
- fat_buf_mark_modified(fs_info);
+
+ fat_buf_mark_modified(fs_info);
}
else
{
- *((uint8_t *)(block0->buffer + ofs + 1)) =
+ *((uint8_t *)(block0->buffer + ofs + 1)) =
(*((uint8_t *)(block0->buffer + ofs + 1))) & 0xF0;
- *((uint8_t *)(block0->buffer + ofs+1)) =
- (*((uint8_t *)(block0->buffer + ofs+1))) |
+ *((uint8_t *)(block0->buffer + ofs+1)) =
+ (*((uint8_t *)(block0->buffer + ofs+1))) |
(uint8_t )((fat16_clv & 0xFF00)>>8);
- }
+ }
}
break;
case FAT_FAT16:
- *((uint16_t *)(block0->buffer + ofs)) =
+ *((uint16_t *)(block0->buffer + ofs)) =
(uint16_t )(CT_LE_W(in_val));
- fat_buf_mark_modified(fs_info);
+ fat_buf_mark_modified(fs_info);
break;
case FAT_FAT32:
fat32_clv = CT_LE_L((in_val & FAT_FAT32_MASK));
- *((uint32_t *)(block0->buffer + ofs)) =
+ *((uint32_t *)(block0->buffer + ofs)) =
(*((uint32_t *)(block0->buffer + ofs))) & (CT_LE_L(0xF0000000));
- *((uint32_t *)(block0->buffer + ofs)) =
+ *((uint32_t *)(block0->buffer + ofs)) =
fat32_clv | (*((uint32_t *)(block0->buffer + ofs)));
-
+
fat_buf_mark_modified(fs_info);
break;
diff --git a/cpukit/libfs/src/dosfs/fat_fat_operations.h b/cpukit/libfs/src/dosfs/fat_fat_operations.h
index 1b6ea553ef..bf5cf04564 100644
--- a/cpukit/libfs/src/dosfs/fat_fat_operations.h
+++ b/cpukit/libfs/src/dosfs/fat_fat_operations.h
@@ -1,7 +1,7 @@
/*
* fat_fat_operations.h
*
- * Constants/data structures/prototypes for operations on Files Allocation
+ * Constants/data structures/prototypes for operations on Files Allocation
* Table
*
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
@@ -42,7 +42,7 @@ fat_scan_fat_for_free_clusters(
uint32_t *chain,
uint32_t count,
uint32_t *cls_added,
- uint32_t *last_cl
+ uint32_t *last_cl
);
int
diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c
index 697f8c078f..de9a064ddc 100644
--- a/cpukit/libfs/src/dosfs/fat_file.c
+++ b/cpukit/libfs/src/dosfs/fat_file.c
@@ -31,23 +31,23 @@
#include "fat_file.h"
static inline void
-_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
+_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
fat_file_fd_t *el);
static inline void
-_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
+_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
fat_file_fd_t *el);
-static inline int
+static inline int
_hash_search(
rtems_filesystem_mount_table_entry_t *mt_entry,
- Chain_Control *hash,
- uint32_t key1,
- uint32_t key2,
+ Chain_Control *hash,
+ uint32_t key1,
+ uint32_t key2,
fat_file_fd_t **ret
);
-static int
+static int
fat_file_lseek(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
@@ -56,20 +56,20 @@ fat_file_lseek(
);
/* fat_file_open --
- * Open fat-file. Two hash tables are accessed by key
- * constructed from cluster num and offset of the node (i.e.
+ * Open fat-file. Two hash tables are accessed by key
+ * constructed from cluster num and offset of the node (i.e.
* files/directories are distinguished by location on the disk).
- * First, hash table("vhash") consists of fat-file descriptors corresponded
- * to "valid" files is accessed. Search is made by 2 fields equal to key
- * constructed. If descriptor is found in the "vhash" - return it.
- * Otherwise search is made in hash table("rhash") consits of fat-file
- * descriptors corresponded to "removed-but-still-open" files with the
+ * First, hash table("vhash") consists of fat-file descriptors corresponded
+ * to "valid" files is accessed. Search is made by 2 fields equal to key
+ * constructed. If descriptor is found in the "vhash" - return it.
+ * Otherwise search is made in hash table("rhash") consits of fat-file
+ * descriptors corresponded to "removed-but-still-open" files with the
* same keys.
* If search failed, new fat-file descriptor is added to "vhash"
- * with both key fields equal to constructed key. Otherwise new fat-file
+ * with both key fields equal to constructed key. Otherwise new fat-file
* descriptor is added to "vhash" with first key field equal to key
* constructed and the second equal to an unique (unique among all values
- * of second key fields) value.
+ * of second key fields) value.
*
* PARAMETERS:
* mt_entry - mount table entry
@@ -78,33 +78,33 @@ fat_file_lseek(
* fat_fd - placeholder for returned fat-file descriptor
*
* RETURNS:
- * RC_OK and pointer to opened descriptor on success, or -1 if error
+ * RC_OK and pointer to opened descriptor on success, or -1 if error
* occured (errno set appropriately)
*/
int
fat_file_open(
rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cln,
- uint32_t ofs,
+ uint32_t ofs,
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_file_fd_t *lfat_fd = NULL;
uint32_t key = 0;
-
+
/* construct key */
key = fat_construct_key(mt_entry, cln, ofs);
-
+
/* access "valid" hash table */
rc = _hash_search(mt_entry, fs_info->vhash, key, 0, &lfat_fd);
- if ( rc == RC_OK )
+ if ( rc == RC_OK )
{
/* return pointer to fat_file_descriptor allocated before */
(*fat_fd) = lfat_fd;
lfat_fd->links_num++;
- return rc;
+ return rc;
}
/* access "removed-but-still-open" hash table */
@@ -112,34 +112,34 @@ fat_file_open(
lfat_fd = (*fat_fd) = (fat_file_fd_t*)malloc(sizeof(fat_file_fd_t));
if ( lfat_fd == NULL )
- set_errno_and_return_minus_one( ENOMEM );
+ set_errno_and_return_minus_one( ENOMEM );
lfat_fd->links_num = 1;
lfat_fd->flags &= ~FAT_FILE_REMOVED;
lfat_fd->map.last_cln = FAT_UNDEFINED_VALUE;
-
+
if ( rc != RC_OK )
lfat_fd->ino = key;
else
{
lfat_fd->ino = fat_get_unique_ino(mt_entry);
-
+
if ( lfat_fd->ino == 0 )
{
free((*fat_fd));
- /*
- * XXX: kernel resource is unsufficient, but not the memory,
+ /*
+ * XXX: kernel resource is unsufficient, but not the memory,
* but there is no suitable errno :(
*/
- set_errno_and_return_minus_one( ENOMEM );
+ set_errno_and_return_minus_one( ENOMEM );
}
}
_hash_insert(fs_info->vhash, key, lfat_fd->ino, lfat_fd);
-
- /*
- * other fields of fat-file descriptor will be initialized on upper
- * level
+
+ /*
+ * other fields of fat-file descriptor will be initialized on upper
+ * level
*/
return RC_OK;
@@ -147,13 +147,13 @@ fat_file_open(
/* fat_file_reopen --
- * Increment by 1 number of links
+ * Increment by 1 number of links
*
* PARAMETERS:
* fat_fd - fat-file descriptor
*
* RETURNS:
- * RC_OK
+ * RC_OK
*/
int
fat_file_reopen(fat_file_fd_t *fat_fd)
@@ -163,15 +163,15 @@ fat_file_reopen(fat_file_fd_t *fat_fd)
}
/* fat_file_close --
- * Close fat-file. If count of links to fat-file
+ * Close fat-file. If count of links to fat-file
* descriptor is greater than 1 (i.e. somebody esle holds pointer
- * to this descriptor) just decrement it. Otherwise
+ * to this descriptor) just decrement it. Otherwise
* do the following. If this descriptor corresponded to removed fat-file
- * then free clusters contained fat-file data, delete descriptor from
- * "rhash" table and free memory allocated by descriptor. If descriptor
- * correspondes to non-removed fat-file and 'ino' field has value from
- * unique inode numbers pool then set count of links to descriptor to zero
- * and leave it in hash, otherwise delete descriptor from "vhash" and free
+ * then free clusters contained fat-file data, delete descriptor from
+ * "rhash" table and free memory allocated by descriptor. If descriptor
+ * correspondes to non-removed fat-file and 'ino' field has value from
+ * unique inode numbers pool then set count of links to descriptor to zero
+ * and leave it in hash, otherwise delete descriptor from "vhash" and free
* memory allocated by the descriptor
*
* PARAMETERS:
@@ -192,7 +192,7 @@ fat_file_close(
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
* decrement the count of links and return
*/
if (fat_fd->links_num > 1)
@@ -226,8 +226,8 @@ fat_file_close(
{
_hash_delete(fs_info->vhash, key, fat_fd->ino, fat_fd);
free(fat_fd);
- }
- }
+ }
+ }
/*
* flush any modified "cached" buffer back to disk
*/
@@ -237,7 +237,7 @@ fat_file_close(
}
/* fat_file_read --
- * Read 'count' bytes from 'start' position from fat-file. This
+ * Read 'count' bytes from 'start' position from fat-file. This
* interface hides the architecture of fat-file, represents it as
* linear file
*
@@ -246,10 +246,10 @@ fat_file_close(
* fat_fd - fat-file descriptor
* start - offset in fat-file (in bytes) to read from
* count - count of bytes to read
- * buf - buffer provided by user
+ * buf - buffer provided by user
*
* RETURNS:
- * the number of bytes read on success, or -1 if error occured (errno
+ * the number of bytes read on success, or -1 if error occured (errno
* set appropriately)
*/
ssize_t
@@ -278,38 +278,38 @@ fat_file_read(
if (count == 0)
return cmpltd;
- /*
- * >= because start is offset and computed from 0 and file_size
+ /*
+ * >= because start is offset and computed from 0 and file_size
* computed from 1
*/
if ( start >= fat_fd->fat_file_size )
return FAT_EOF;
-
- if ((count > fat_fd->fat_file_size) ||
- (start > fat_fd->fat_file_size - count))
+
+ if ((count > fat_fd->fat_file_size) ||
+ (start > fat_fd->fat_file_size - count))
count = fat_fd->fat_file_size - start;
-
- if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
- (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
+
+ if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
+ (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
{
sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->cln);
sec += (start >> fs_info->vol.sec_log2);
byte = start & (fs_info->vol.bps - 1);
- ret = _fat_block_read(mt_entry, sec, byte, count, buf);
+ ret = _fat_block_read(mt_entry, sec, byte, count, buf);
if ( ret < 0 )
- return -1;
+ return -1;
return ret;
- }
-
- cl_start = start >> fs_info->vol.bpc_log2;
+ }
+
+ cl_start = start >> fs_info->vol.bpc_log2;
save_ofs = ofs = start & (fs_info->vol.bpc - 1);
rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln);
if (rc != RC_OK)
return rc;
-
+
while (count > 0)
{
c = MIN(count, (fs_info->vol.bpc - ofs));
@@ -320,21 +320,21 @@ fat_file_read(
ret = _fat_block_read(mt_entry, sec, byte, c, buf + cmpltd);
if ( ret < 0 )
- return -1;
+ return -1;
count -= c;
cmpltd += c;
save_cln = cur_cln;
rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln);
if ( rc != RC_OK )
- return rc;
+ return rc;
ofs = 0;
}
/* update cache */
/* XXX: check this - I'm not sure :( */
- fat_fd->map.file_cln = cl_start +
+ fat_fd->map.file_cln = cl_start +
((save_ofs + cmpltd - 1) >> fs_info->vol.bpc_log2);
fat_fd->map.disk_cln = save_cln;
@@ -342,8 +342,8 @@ fat_file_read(
}
/* fat_file_write --
- * Write 'count' bytes of data from user supplied buffer to fat-file
- * starting at offset 'start'. This interface hides the architecture
+ * Write 'count' bytes of data from user supplied buffer to fat-file
+ * starting at offset 'start'. This interface hides the architecture
* of fat-file, represents it as linear file
*
* PARAMETERS:
@@ -351,10 +351,10 @@ fat_file_read(
* fat_fd - fat-file descriptor
* start - offset(in bytes) to write from
* count - count
- * buf - buffer provided by user
+ * buf - buffer provided by user
*
* RETURNS:
- * number of bytes actually written to the file on success, or -1 if
+ * number of bytes actually written to the file on success, or -1 if
* error occured (errno set appropriately)
*/
ssize_t
@@ -373,48 +373,48 @@ fat_file_write(
uint32_t cur_cln = 0;
uint32_t save_cln = 0; /* FIXME: This might be incorrect, cf. below */
uint32_t cl_start = 0;
- uint32_t ofs = 0;
+ uint32_t ofs = 0;
uint32_t save_ofs;
uint32_t sec = 0;
uint32_t byte = 0;
uint32_t c = 0;
-
+
if ( count == 0 )
return cmpltd;
if ( start > fat_fd->fat_file_size )
set_errno_and_return_minus_one( EIO );
- if ((count > fat_fd->size_limit) ||
- (start > fat_fd->size_limit - count))
- set_errno_and_return_minus_one( EIO );
-
+ if ((count > fat_fd->size_limit) ||
+ (start > fat_fd->size_limit - count))
+ set_errno_and_return_minus_one( EIO );
+
rc = fat_file_extend(mt_entry, fat_fd, start + count, &c);
if (rc != RC_OK)
return rc;
- /*
- * check whether there was enough room on device to locate
+ /*
+ * check whether there was enough room on device to locate
* file of 'start + count' bytes
*/
if (c != (start + count))
- count = c - start;
-
- if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
- (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
+ count = c - start;
+
+ if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
+ (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
{
sec = fat_cluster_num_to_sector_num(mt_entry, fat_fd->cln);
sec += (start >> fs_info->vol.sec_log2);
byte = start & (fs_info->vol.bps - 1);
- ret = _fat_block_write(mt_entry, sec, byte, count, buf);
+ ret = _fat_block_write(mt_entry, sec, byte, count, buf);
if ( ret < 0 )
- return -1;
+ return -1;
return ret;
- }
-
- cl_start = start >> fs_info->vol.bpc_log2;
+ }
+
+ cl_start = start >> fs_info->vol.bpc_log2;
save_ofs = ofs = start & (fs_info->vol.bpc - 1);
rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln);
@@ -431,21 +431,21 @@ fat_file_write(
ret = _fat_block_write(mt_entry, sec, byte, c, buf + cmpltd);
if ( ret < 0 )
- return -1;
+ return -1;
count -= c;
cmpltd += c;
save_cln = cur_cln;
rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln);
if ( rc != RC_OK )
- return rc;
+ return rc;
ofs = 0;
}
/* update cache */
/* XXX: check this - I'm not sure :( */
- fat_fd->map.file_cln = cl_start +
+ fat_fd->map.file_cln = cl_start +
((save_ofs + cmpltd - 1) >> fs_info->vol.bpc_log2);
fat_fd->map.disk_cln = save_cln;
@@ -453,71 +453,71 @@ fat_file_write(
}
/* fat_file_extend --
- * Extend fat-file. If new length less than current fat-file size -
- * do nothing. Otherwise calculate necessary count of clusters to add,
- * allocate it and add new clusters chain to the end of
+ * Extend fat-file. If new length less than current fat-file size -
+ * do nothing. Otherwise calculate necessary count of clusters to add,
+ * allocate it and add new clusters chain to the end of
* existing clusters chain.
*
* PARAMETERS:
* mt_entry - mount table entry
* fat_fd - fat-file descriptor
- * new_length - new length
+ * new_length - new length
* a_length - placeholder for result - actual new length of file
*
* RETURNS:
- * RC_OK and new length of file on success, or -1 if error occured (errno
+ * RC_OK and new length of file on success, or -1 if error occured (errno
* set appropriately)
*/
int
fat_file_extend(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
+ fat_file_fd_t *fat_fd,
uint32_t new_length,
uint32_t *a_length
)
{
int rc = RC_OK;
fat_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t chain = 0;
+ uint32_t chain = 0;
uint32_t bytes2add = 0;
uint32_t cls2add = 0;
uint32_t old_last_cl;
uint32_t last_cl = 0;
uint32_t bytes_remain = 0;
uint32_t cls_added;
-
+
*a_length = new_length;
if (new_length <= fat_fd->fat_file_size)
return RC_OK;
- if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
- (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
+ if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
+ (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
set_errno_and_return_minus_one( ENOSPC );
- bytes_remain = (fs_info->vol.bpc -
- (fat_fd->fat_file_size & (fs_info->vol.bpc - 1))) &
+ bytes_remain = (fs_info->vol.bpc -
+ (fat_fd->fat_file_size & (fs_info->vol.bpc - 1))) &
(fs_info->vol.bpc - 1);
bytes2add = new_length - fat_fd->fat_file_size;
-
+
if (bytes2add > bytes_remain)
bytes2add -= bytes_remain;
else
- bytes2add = 0;
+ bytes2add = 0;
- /*
+ /*
* if in last cluster allocated for the file there is enough room to
- * handle extention (hence we don't need to add even one cluster to the
+ * handle extention (hence we don't need to add even one cluster to the
* file ) - return
*/
if (bytes2add == 0)
- return RC_OK;
+ return RC_OK;
cls2add = ((bytes2add - 1) >> fs_info->vol.bpc_log2) + 1;
-
- rc = fat_scan_fat_for_free_clusters(mt_entry, &chain, cls2add,
- &cls_added, &last_cl);
+
+ rc = fat_scan_fat_for_free_clusters(mt_entry, &chain, cls2add,
+ &cls_added, &last_cl);
/* this means that low level I/O error occured */
if (rc != RC_OK)
@@ -525,12 +525,12 @@ fat_file_extend(
/* this means that no space left on device */
if ((cls_added == 0) && (bytes_remain == 0))
- set_errno_and_return_minus_one(ENOSPC);
+ set_errno_and_return_minus_one(ENOSPC);
/* check wether we satisfied request for 'cls2add' clusters */
if (cls2add != cls_added)
- *a_length = new_length -
- ((cls2add - cls_added - 1) << fs_info->vol.bpc_log2) -
+ *a_length = new_length -
+ ((cls2add - cls_added - 1) << fs_info->vol.bpc_log2) -
(bytes2add & (fs_info->vol.bpc - 1));
/* add new chain to the end of existed */
@@ -554,17 +554,17 @@ fat_file_extend(
fat_free_fat_clusters_chain(mt_entry, chain);
return rc;
}
- }
+ }
rc = fat_set_fat_cluster(mt_entry, old_last_cl, chain);
if ( rc != RC_OK )
{
fat_free_fat_clusters_chain(mt_entry, chain);
- return rc;
+ return rc;
}
fat_buf_release(fs_info);
}
-
+
/* update number of the last cluster of the file if it changed */
if (cls_added != 0)
{
@@ -575,23 +575,23 @@ fat_file_extend(
if ( rc != RC_OK )
{
fat_free_fat_clusters_chain(mt_entry, chain);
- return rc;
+ return rc;
}
}
- }
+ }
return RC_OK;
}
/* fat_file_truncate --
- * Truncate fat-file. If new length greater than current fat-file size -
+ * Truncate fat-file. If new length greater than current fat-file size -
* do nothing. Otherwise find first cluster to free and free all clusters
* in the chain starting from this cluster.
- *
+ *
* PARAMETERS:
* mt_entry - mount table entry
* fat_fd - fat-file descriptor
- * new_length - new length
+ * new_length - new length
*
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately)
@@ -599,7 +599,7 @@ fat_file_extend(
int
fat_file_truncate(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
+ fat_file_fd_t *fat_fd,
uint32_t new_length
)
{
@@ -608,25 +608,25 @@ fat_file_truncate(
uint32_t cur_cln = 0;
uint32_t cl_start = 0;
uint32_t new_last_cln = FAT_UNDEFINED_VALUE;
-
-
+
+
if ( new_length >= fat_fd->fat_file_size )
return rc;
assert(fat_fd->fat_file_size);
-
+
cl_start = (new_length + fs_info->vol.bpc - 1) >> fs_info->vol.bpc_log2;
-
+
if ((cl_start << fs_info->vol.bpc_log2) >= fat_fd->fat_file_size)
return RC_OK;
-
+
if (cl_start != 0)
{
rc = fat_file_lseek(mt_entry, fat_fd, cl_start - 1, &new_last_cln);
if (rc != RC_OK)
return rc;
- }
+ }
rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln);
if (rc != RC_OK)
@@ -640,24 +640,24 @@ fat_file_truncate(
{
rc = fat_set_fat_cluster(mt_entry, new_last_cln, FAT_GENFAT_EOC);
if ( rc != RC_OK )
- return rc;
+ return rc;
fat_fd->map.file_cln = cl_start - 1;
fat_fd->map.disk_cln = new_last_cln;
fat_fd->map.last_cln = new_last_cln;
- }
+ }
return RC_OK;
-}
+}
/* fat_file_ioctl --
* F_CLU_NUM:
- * make mapping between serial number of the cluster in fat-file and
- * its real number on the volume
- *
+ * make mapping between serial number of the cluster in fat-file and
+ * its real number on the volume
+ *
* PARAMETERS:
* fat_fd - fat-file descriptor
* mt_entry - mount table entry
* cmd - command
- * ...
+ * ...
*
* RETURNS:
* RC_OK on success, or -1 if error occured and errno set appropriately
@@ -665,8 +665,8 @@ fat_file_truncate(
int
fat_file_ioctl(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
- int cmd,
+ fat_file_fd_t *fat_fd,
+ int cmd,
...)
{
int rc = RC_OK;
@@ -675,8 +675,8 @@ fat_file_ioctl(
uint32_t cl_start = 0;
uint32_t pos = 0;
uint32_t *ret;
- va_list ap;
-
+ va_list ap;
+
va_start(ap, cmd);
switch (cmd)
@@ -689,19 +689,19 @@ fat_file_ioctl(
if ( pos >= fat_fd->fat_file_size )
set_errno_and_return_minus_one( EIO );
- if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
+ if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
(fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
{
/* cluster 0 (zero) reserved for root dir */
*ret = 0;
return RC_OK;
- }
-
- cl_start = pos >> fs_info->vol.bpc_log2;
-
+ }
+
+ cl_start = pos >> fs_info->vol.bpc_log2;
+
rc = fat_file_lseek(mt_entry, fat_fd, cl_start, &cur_cln);
if ( rc != RC_OK )
- return rc;
+ return rc;
*ret = cur_cln;
break;
@@ -709,15 +709,15 @@ fat_file_ioctl(
default:
errno = EINVAL;
rc = -1;
- break;
+ break;
}
return rc;
}
/* fat_file_mark_removed --
- * Remove the fat-file descriptor from "valid" hash table, insert it
- * into "removed-but-still-open" hash table and set up "removed" bit.
- *
+ * Remove the fat-file descriptor from "valid" hash table, insert it
+ * into "removed-but-still-open" hash table and set up "removed" bit.
+ *
* PARAMETERS:
* fat_fd - fat-file descriptor
* mt_entry - mount table entry
@@ -733,19 +733,19 @@ fat_file_mark_removed(
{
fat_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t key = 0;
-
+
key = fat_construct_key(mt_entry, fat_fd->info_cln, fat_fd->info_ofs);
-
+
_hash_delete(fs_info->vhash, key, fat_fd->ino, fat_fd);
_hash_insert(fs_info->rhash, key, fat_fd->ino, fat_fd);
- fat_fd->flags |= FAT_FILE_REMOVED;
-}
+ fat_fd->flags |= FAT_FILE_REMOVED;
+}
/* fat_file_datasync --
* Synchronize fat-file - flush all buffered data to the media.
- *
+ *
* PARAMETERS:
* mt_entry - mount table entry
* fat_fd - fat-file descriptor
@@ -762,22 +762,22 @@ fat_file_datasync(
int rc = RC_OK;
rtems_status_code sc = RTEMS_SUCCESSFUL;
fat_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t cur_cln = fat_fd->cln;
+ uint32_t cur_cln = fat_fd->cln;
bdbuf_buffer *block = NULL;
uint32_t sec = 0;
uint32_t i = 0;
-
+
if (fat_fd->fat_file_size == 0)
return RC_OK;
-
- /*
- * we can use only one bdbuf :( and we also know that cache is useless
+
+ /*
+ * we can use only one bdbuf :( and we also know that cache is useless
* for sync operation, so don't use it
*/
rc = fat_buf_release(fs_info);
if (rc != RC_OK)
return rc;
-
+
/* for each cluster of the file ... */
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
{
@@ -786,11 +786,11 @@ fat_file_datasync(
for ( i = 0; i < fs_info->vol.spc; i++ )
{
/* ... sync it */
- sc = rtems_bdbuf_read(fs_info->vol.dev, (sec + i), &block);
+ sc = rtems_bdbuf_read(fs_info->vol.dev, (sec + i), &block);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one( EIO );
- sc = rtems_bdbuf_sync(block);
+ sc = rtems_bdbuf_sync(block);
if ( sc != RTEMS_SUCCESSFUL )
set_errno_and_return_minus_one( EIO );
}
@@ -800,7 +800,7 @@ fat_file_datasync(
return rc;
}
return rc;
-}
+}
/* fat_file_size --
* Calculate fat-file size - fat-file is nothing that clusters chain, so
@@ -808,9 +808,9 @@ fat_file_datasync(
* special case is root directory for FAT12/16 volumes.
* This function is used only for directories which are fat-files with
* non-zero length, hence 'fat_fd->cln' always contains valid data.
- * Calculated size is stored in 'fat_file_size' field of fat-file
+ * Calculated size is stored in 'fat_file_size' field of fat-file
* descriptor.
- *
+ *
* PARAMETERS:
* mt_entry - mount table entry
* fat_fd - fat-file descriptor
@@ -819,26 +819,26 @@ fat_file_datasync(
* RC_OK on success, or -1 if error occured (errno set appropriately)
*/
int
-fat_file_size(
+fat_file_size(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd
)
{
int rc = RC_OK;
fat_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t cur_cln = fat_fd->cln;
+ uint32_t cur_cln = fat_fd->cln;
uint32_t save_cln = 0;
-
+
/* Have we requested root dir size for FAT12/16? */
- if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
- (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
+ if ((FAT_FD_OF_ROOT_DIR(fat_fd)) &&
+ (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)))
{
fat_fd->fat_file_size = fs_info->vol.rdir_size;
return rc;
}
-
+
fat_fd->fat_file_size = 0;
-
+
while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val)
{
save_cln = cur_cln;
@@ -850,7 +850,7 @@ fat_file_size(
}
fat_fd->map.last_cln = save_cln;
return rc;
-}
+}
/* hash support routines */
@@ -867,7 +867,7 @@ fat_file_size(
* None
*/
static inline void
-_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
+_hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
fat_file_fd_t *el)
{
_Chain_Append((hash) + ((key1) % FAT_HASH_MODULE), &(el)->link);
@@ -880,25 +880,25 @@ _hash_insert(Chain_Control *hash, uint32_t key1, uint32_t key2,
* PARAMETERS:
* hash - hash element will be removed from
* key1 - not used
- * key2 - not used
+ * key2 - not used
* el - element to delete
*
* RETURNS:
* None
*/
static inline void
-_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
+_hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
fat_file_fd_t *el)
{
_Chain_Extract(&(el)->link);
-}
+}
/* _hash_search --
* Search element in hash. If both keys match pointer to found element
* is returned
*
* PARAMETERS:
- * mt_entry - mount table entry
+ * mt_entry - mount table entry
* hash - hash element will be removed from
* key1 - search key
* key2 - search key
@@ -907,22 +907,22 @@ _hash_delete(Chain_Control *hash, uint32_t key1, uint32_t key2,
* RETURNS:
* 0 and pointer to found element on success, -1 otherwise
*/
-static inline int
+static inline int
_hash_search(
rtems_filesystem_mount_table_entry_t *mt_entry,
- Chain_Control *hash,
- uint32_t key1,
- uint32_t key2,
+ Chain_Control *hash,
+ uint32_t key1,
+ uint32_t key2,
fat_file_fd_t **ret
)
-{
+{
uint32_t mod = (key1) % FAT_HASH_MODULE;
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;
- uint32_t ck =
+ uint32_t ck =
fat_construct_key(mt_entry, ffd->info_cln, ffd->info_ofs);
if ( (key1) == ck)
@@ -933,12 +933,12 @@ _hash_search(
return 0;
}
}
- the_node = the_node->next;
+ the_node = the_node->next;
}
- return -1;
+ return -1;
}
-static int
+static int
fat_file_lseek(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
@@ -947,9 +947,9 @@ fat_file_lseek(
)
{
int rc = RC_OK;
-/*
+/*
assert(fat_fd->fat_file_size);
- */
+ */
if (file_cln == fat_fd->map.file_cln)
*disk_cln = fat_fd->map.disk_cln;
else
@@ -957,31 +957,31 @@ fat_file_lseek(
uint32_t cur_cln;
uint32_t count;
uint32_t i;
-
+
if (file_cln > fat_fd->map.file_cln)
{
cur_cln = fat_fd->map.disk_cln;
count = file_cln - fat_fd->map.file_cln;
- }
+ }
else
{
cur_cln = fat_fd->cln;
count = file_cln;
- }
+ }
/* skip over the clusters */
for (i = 0; i < count; i++)
{
rc = fat_get_fat_cluster(mt_entry, cur_cln, &cur_cln);
if ( rc != RC_OK )
- return rc;
- }
+ return rc;
+ }
/* update cache */
fat_fd->map.file_cln = file_cln;
fat_fd->map.disk_cln = cur_cln;
-
+
*disk_cln = cur_cln;
}
- return RC_OK;
+ return RC_OK;
}
diff --git a/cpukit/libfs/src/dosfs/fat_file.h b/cpukit/libfs/src/dosfs/fat_file.h
index b16b9b370f..fcde2e620e 100644
--- a/cpukit/libfs/src/dosfs/fat_file.h
+++ b/cpukit/libfs/src/dosfs/fat_file.h
@@ -24,10 +24,10 @@ extern "C" {
#include <time.h>
-/* "fat-file" representation
- *
- * the idea is: fat-file is nothing but a cluster chain, any open fat-file is
- * represented in system by fat-file descriptor and has well-known
+/* "fat-file" representation
+ *
+ * the idea is: fat-file is nothing but a cluster chain, any open fat-file is
+ * represented in system by fat-file descriptor and has well-known
* file interface:
*
* fat_file_open()
@@ -35,10 +35,10 @@ extern "C" {
* fat_file_read()
* fat_file_write()
*
- * Such interface hides the architecture of fat-file and represents it like
+ * Such interface hides the architecture of fat-file and represents it like
* linear file
*/
-
+
typedef rtems_filesystem_node_types_t fat_file_type_t;
#define FAT_DIRECTORY RTEMS_FILESYSTEM_DIRECTORY
@@ -50,34 +50,34 @@ typedef struct fat_file_map_s
uint32_t disk_cln;
uint32_t last_cln;
} fat_file_map_t;
-/*
- * descriptor of a fat-file
+/*
+ * descriptor of a fat-file
*
- * To each particular clusters chain
+ * To each particular clusters chain
*/
typedef struct fat_file_fd_s
{
- Chain_Node link; /*
+ Chain_Node link; /*
* fat-file descriptors organized into hash;
- * collision lists are handled via link
+ * collision lists are handled via link
* field
*/
- uint32_t links_num; /*
- * the number of fat_file_open call on
+ uint32_t links_num; /*
+ * the number of fat_file_open call on
* this fat-file
*/
- uint32_t ino; /* inode, file serial number :)))) */
+ uint32_t ino; /* inode, file serial number :)))) */
fat_file_type_t fat_file_type;
uint32_t size_limit;
uint32_t fat_file_size; /* length */
uint32_t info_cln;
uint32_t cln;
- uint16_t info_ofs;
+ uint16_t info_ofs;
unsigned char first_char;
uint8_t flags;
fat_file_map_t map;
time_t mtime;
-
+
} fat_file_fd_t;
@@ -89,16 +89,16 @@ typedef struct fat_file_fd_s
/* ioctl macros */
#define F_CLU_NUM 0x01
-/*
- * Each file and directory on a MSDOS volume is unique identified by it
- * location, i.e. location of it 32 Bytes Directory Entry Structure. We can
- * distinguish them by cluster number it locates on and offset inside this
+/*
+ * Each file and directory on a MSDOS volume is unique identified by it
+ * location, i.e. location of it 32 Bytes Directory Entry Structure. We can
+ * distinguish them by cluster number it locates on and offset inside this
* cluster. But root directory on any volumes (FAT12/16/32) has no 32 Bytes
* Directory Entry Structure corresponded to it. So we assume 32 Bytes
* Directory Entry Structure of root directory locates at cluster 1 (invalid
* cluaster number) and offset 0
*/
-#define FAT_ROOTDIR_CLUSTER_NUM 0x01
+#define FAT_ROOTDIR_CLUSTER_NUM 0x01
#define FAT_FD_OF_ROOT_DIR(fat_fd) \
((fat_fd->info_cln == FAT_ROOTDIR_CLUSTER_NUM ) && \
@@ -108,7 +108,7 @@ typedef struct fat_file_fd_s
/* fat_construct_key --
* Construct key for hash access: convert (cluster num, offset) to
- * (sector512 num, new offset) and than construct key as
+ * (sector512 num, new offset) and than construct key as
* key = (sector512 num) << 4 | (new offset)
*
* PARAMETERS:
@@ -119,28 +119,28 @@ typedef struct fat_file_fd_s
* RETURNS:
* constructed key
*/
-static inline uint32_t
+static inline uint32_t
fat_construct_key(
rtems_filesystem_mount_table_entry_t *mt_entry,
- uint32_t cl,
+ uint32_t cl,
uint32_t ofs)
{
- return ( ((fat_cluster_num_to_sector512_num(mt_entry, cl) +
- (ofs >> FAT_SECTOR512_BITS)) << 4) +
+ return ( ((fat_cluster_num_to_sector512_num(mt_entry, cl) +
+ (ofs >> FAT_SECTOR512_BITS)) << 4) +
((ofs >> 5) & (FAT_DIRENTRIES_PER_SEC512 - 1)) );
}
/* Prototypes for "fat-file" operations */
-int
+int
fat_file_open(rtems_filesystem_mount_table_entry_t *mt_entry,
- uint32_t cln,
+ uint32_t cln,
uint32_t ofs,
fat_file_fd_t **fat_fd);
int
fat_file_reopen(fat_file_fd_t *fat_fd);
-int
+int
fat_file_close(rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd);
@@ -168,11 +168,11 @@ int
fat_file_truncate(rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
uint32_t new_length);
-
+
int
fat_file_datasync(rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd);
-
+
int
fat_file_ioctl(rtems_filesystem_mount_table_entry_t *mt_entry,
diff --git a/cpukit/libfs/src/dosfs/msdos.h b/cpukit/libfs/src/dosfs/msdos.h
index 88b01fee18..3c6caef224 100644
--- a/cpukit/libfs/src/dosfs/msdos.h
+++ b/cpukit/libfs/src/dosfs/msdos.h
@@ -24,44 +24,44 @@ extern "C" {
#include "fat.h"
#include "fat_file.h"
-
+
#ifndef RC_OK
#define RC_OK 0x00000000
#endif
-#define MSDOS_NAME_NOT_FOUND_ERR 0xDD000001
+#define MSDOS_NAME_NOT_FOUND_ERR 0xDD000001
/*
- * This structure identifies the instance of the filesystem on the MSDOS
- * level.
+ * This structure identifies the instance of the filesystem on the MSDOS
+ * level.
*/
typedef struct msdos_fs_info_s
{
- fat_fs_info_t fat; /*
- * volume
+ fat_fs_info_t fat; /*
+ * volume
* description
*/
- rtems_filesystem_file_handlers_r *directory_handlers; /*
+ rtems_filesystem_file_handlers_r *directory_handlers; /*
* a set of routines
- * that handles the
- * nodes of directory
+ * that handles the
+ * nodes of directory
* type
*/
- rtems_filesystem_file_handlers_r *file_handlers; /*
+ rtems_filesystem_file_handlers_r *file_handlers; /*
* a set of routines
- * that handles the
- * nodes of file
+ * that handles the
+ * nodes of file
* type
*/
- rtems_id vol_sema; /*
- * semaphore
- * associated with
+ rtems_id vol_sema; /*
+ * semaphore
+ * associated with
* the volume
*/
- uint8_t *cl_buf; /*
+ uint8_t *cl_buf; /*
* just placeholder
- * for anything
- */
+ * for anything
+ */
} msdos_fs_info_t;
/* a set of routines that handle the nodes which are directories */
@@ -78,11 +78,11 @@ extern rtems_filesystem_file_handlers_r msdos_file_handlers;
#define MSDOS_DIRECTORY RTEMS_FILESYSTEM_DIRECTORY
#define MSDOS_REGULAR_FILE RTEMS_FILESYSTEM_MEMORY_FILE
#define MSDOS_HARD_LINK RTEMS_FILESYSTEM_HARD_LINK /* pseudo type */
-
+
typedef rtems_filesystem_node_types_t msdos_node_type_t;
-/*
- * Macros for fetching fields from 32 bytes long FAT Directory Entry
+/*
+ * Macros for fetching fields from 32 bytes long FAT Directory Entry
* Structure
*/
#define MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE 32 /* 32 bytes */
@@ -165,7 +165,7 @@ typedef rtems_filesystem_node_types_t msdos_node_type_t;
#define MSDOS_DOT_NAME ". " /* ".", padded to MSDOS_NAME chars */
#define MSDOS_DOTDOT_NAME ".. " /* "..", padded to MSDOS_NAME chars */
-typedef enum msdos_token_types_e
+typedef enum msdos_token_types_e
{
MSDOS_NO_MORE_PATH,
MSDOS_CURRENT_DIR,
@@ -192,45 +192,45 @@ typedef enum msdos_token_types_e
#define MSDOS_MAX_DIR_LENGHT 0x200000 /* 2,097,152 bytes */
#define MSDOS_MAX_FILE_SIZE 0xFFFFFFFF /* 4 Gb */
-/*
+/*
* The number of 32 bytes long FAT Directory Entry
- * Structures per 512 bytes sector
- */
+ * Structures per 512 bytes sector
+ */
#define MSDOS_DPS512_NUM 16
/* Prototypes */
-int
+int
msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry);
-int
+int
msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry);
-int
+int
msdos_eval_path(const char *pathname, /* IN */
int flags, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN/OUT */);
-int
+int
msdos_eval4make(const char *path, /* IN */
rtems_filesystem_location_info_t *pathloc, /* IN/OUT */
- const char **name /* OUT */);
-
-int
+ const char **name /* OUT */);
+
+int
msdos_unlink(rtems_filesystem_location_info_t *pathloc /* IN */);
-int
+int
msdos_free_node_info(rtems_filesystem_location_info_t *pathloc /* IN */);
-rtems_filesystem_node_types_t
+rtems_filesystem_node_types_t
msdos_node_type(rtems_filesystem_location_info_t *pathloc);
-int
+int
msdos_mknod(const char *path, /* IN */
mode_t mode, /* IN */
dev_t dev, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN/OUT */);
-int
+int
msdos_utime(rtems_filesystem_location_info_t *pathloc, /* IN */
time_t actime, /* IN */
time_t modtime /* IN */);
@@ -243,7 +243,7 @@ msdos_initialize_support(
rtems_filesystem_file_handlers_r *directory_handlers
);
-int
+int
msdos_file_open(
rtems_libio_t *iop, /* IN */
const char *pathname, /* IN */
@@ -251,62 +251,62 @@ msdos_file_open(
uint32_t mode /* IN */
);
-int
+int
msdos_file_close(rtems_libio_t *iop /* IN */);
-ssize_t
+ssize_t
msdos_file_read(
rtems_libio_t *iop, /* IN */
void *buffer, /* IN */
uint32_t count /* IN */
);
-ssize_t
+ssize_t
msdos_file_write(
rtems_libio_t *iop, /* IN */
const void *buffer, /* IN */
uint32_t count /* IN */
);
-int
+int
msdos_file_lseek(
rtems_libio_t *iop, /* IN */
off_t offset, /* IN */
int whence /* IN */
);
-int
+int
msdos_file_stat(rtems_filesystem_location_info_t *loc, /* IN */
struct stat *buf /* OUT */);
-int
+int
msdos_file_ftruncate(
rtems_libio_t *iop, /* IN */
off_t length /* IN */
);
-int
+int
msdos_file_sync(rtems_libio_t *iop);
-int
+int
msdos_file_datasync(rtems_libio_t *iop);
-
-int
+
+int
msdos_file_ioctl(
rtems_libio_t *iop, /* IN */
uint32_t command, /* IN */
void *buffer /* IN */
);
-int
+int
msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
-
-int
+
+int
msdos_file_link(rtems_filesystem_location_info_t *to_loc,
rtems_filesystem_location_info_t *pa_loc,
const char *token);
-int
+int
msdos_dir_open(
rtems_libio_t *iop, /* IN */
const char *pathname, /* IN */
@@ -314,30 +314,30 @@ msdos_dir_open(
uint32_t mode /* IN */
);
-int
+int
msdos_dir_close(rtems_libio_t *iop /* IN */);
-ssize_t
+ssize_t
msdos_dir_read(
rtems_libio_t *iop, /* IN */
void *buffer, /* IN */
uint32_t count /* IN */
);
-int
+int
msdos_dir_lseek(
rtems_libio_t *iop, /* IN */
off_t offset, /* IN */
int whence /* IN */
);
-int
+int
msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
-int
+int
msdos_dir_sync(rtems_libio_t *iop);
-int
+int
msdos_dir_stat(
rtems_filesystem_location_info_t *loc, /* IN */
struct stat *buf /* OUT */
@@ -372,7 +372,7 @@ int
msdos_filename_unix2dos(char *un, int unlen, char *dn);
void
-msdos_date_unix2dos(unsigned int tsp, unsigned short *ddp,
+msdos_date_unix2dos(unsigned int tsp, unsigned short *ddp,
unsigned short *dtp);
unsigned int
@@ -386,7 +386,7 @@ int
msdos_set_file_size(rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd);
-int
+int
msdos_set_first_char4file_name(rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cl,
uint32_t ofs,
@@ -397,26 +397,26 @@ msdos_set_dir_wrt_time_and_date(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd
);
-
+
int
msdos_dir_is_empty(rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
+ fat_file_fd_t *fat_fd,
rtems_boolean *ret_val);
int
msdos_find_name_in_fat_file(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
- char *name,
+ fat_file_fd_t *fat_fd,
+ char *name,
fat_auxiliary_t *paux,
char *name_dir_entry);
-
+
int
msdos_find_node_by_cluster_num_in_fat_file(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
- uint32_t cl4find,
+ uint32_t cl4find,
fat_auxiliary_t *paux,
char *dir_entry
);
diff --git a/cpukit/libfs/src/dosfs/msdos_conv.c b/cpukit/libfs/src/dosfs/msdos_conv.c
index b456304979..732558b146 100644
--- a/cpukit/libfs/src/dosfs/msdos_conv.c
+++ b/cpukit/libfs/src/dosfs/msdos_conv.c
@@ -4,17 +4,17 @@
/* $NetBSD: msdosfs_conv.c,v 1.10 1994/12/27 18:36:24 mycroft Exp $ */
/*
* Written by Paul Popelka (paulp@uts.amdahl.com)
- *
+ *
* You can do anything you want with this software, just don't say you wrote
* it, and don't remove this notice.
- *
+ *
* This software is provided "as is".
- *
+ *
* The author supplies this software to be publicly redistributed on the
* understanding that the author is not responsible for the correct
* functioning of this software in any circumstances and is not liable for
* any damages caused by this software.
- *
+ *
* October 1992
*/
@@ -54,7 +54,7 @@ static u_short lastdtime;
* file timestamps. The passed in unix time is assumed to be in GMT.
*/
void
-msdos_date_unix2dos(unsigned int t, unsigned short *ddp,
+msdos_date_unix2dos(unsigned int t, unsigned short *ddp,
unsigned short *dtp)
{
u_long days;
@@ -102,7 +102,7 @@ msdos_date_unix2dos(unsigned int t, unsigned short *ddp,
* results.
*/
if (year > 1980)
- lastddate += (year - 1980) <<
+ lastddate += (year - 1980) <<
MSDOS_DD_YEAR_SHIFT;
}
}
diff --git a/cpukit/libfs/src/dosfs/msdos_create.c b/cpukit/libfs/src/dosfs/msdos_create.c
index d87d2c5d7d..49cf56917d 100644
--- a/cpukit/libfs/src/dosfs/msdos_create.c
+++ b/cpukit/libfs/src/dosfs/msdos_create.c
@@ -29,10 +29,10 @@
#include "msdos.h"
/* msdos_creat_node --
- * Create a new node. If a new node is file, FAT 32 Bytes Directory
- * Entry Structure is initialized, free space is found in parent
- * directory and structure is written to the disk. In case of directory,
- * all above steps present and also new cluster is allocated for a
+ * Create a new node. If a new node is file, FAT 32 Bytes Directory
+ * Entry Structure is initialized, free space is found in parent
+ * directory and structure is written to the disk. In case of directory,
+ * all above steps present and also new cluster is allocated for a
* new directory and dot and dotdot nodes are created in alloceted cluster.
*
* PARAMETERS:
@@ -45,22 +45,22 @@
*
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately).
- *
+ *
*/
-int
+int
msdos_creat_node(
rtems_filesystem_location_info_t *parent_loc,
msdos_node_type_t type,
char *name,
mode_t mode,
const fat_file_fd_t *link_fd
- )
+ )
{
int rc = RC_OK;
ssize_t ret = 0;
msdos_fs_info_t *fs_info = parent_loc->mt_entry->fs_info;
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;
uint16_t time_val = 0;
uint16_t date = 0;
@@ -70,16 +70,16 @@ msdos_creat_node(
unsigned char link_node [MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
uint32_t sec = 0;
uint32_t byte = 0;
-
+
memset(new_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
memset(dot_dotdot, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2);
-
+
/* set up name */
strncpy(MSDOS_DIR_NAME(new_node), name, MSDOS_NAME_MAX);
/* fill reserved field */
*MSDOS_DIR_NT_RES(new_node) = MSDOS_RES_NT_VALUE;
-
+
/* set up last write date and time */
time_ret = time(NULL);
if ( time_ret == -1 )
@@ -88,7 +88,7 @@ msdos_creat_node(
msdos_date_unix2dos(time_ret, &time_val, &date);
*MSDOS_DIR_WRITE_TIME(new_node) = CT_LE_W(time_val);
*MSDOS_DIR_WRITE_DATE(new_node) = CT_LE_W(date);
-
+
/* initialize directory/file size */
*MSDOS_DIR_FILE_SIZE(new_node) = MSDOS_INIT_DIR_SIZE;
@@ -98,23 +98,23 @@ msdos_creat_node(
else if (type == MSDOS_HARD_LINK) {
/*
* when we establish a (temporary) hard link,
- * we must copy some information from the original
+ * we must copy some information from the original
* node to the newly created
- */
+ */
/*
* read the original directory entry
*/
- sec = fat_cluster_num_to_sector_num(parent_loc->mt_entry,
+ sec = fat_cluster_num_to_sector_num(parent_loc->mt_entry,
link_fd->info_cln);
sec += (link_fd->info_ofs >> fs_info->fat.vol.sec_log2);
byte = (link_fd->info_ofs & (fs_info->fat.vol.bps - 1));
-
- ret = _fat_block_read(parent_loc->mt_entry,
+
+ ret = _fat_block_read(parent_loc->mt_entry,
sec, byte, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE,
link_node);
if (ret < 0) {
return -1;
- }
+ }
/*
* copy various attributes
*/
@@ -123,14 +123,14 @@ msdos_creat_node(
*MSDOS_DIR_CRT_TIME(new_node) =*MSDOS_DIR_CRT_TIME(link_node);
*MSDOS_DIR_CRT_DATE(new_node) =*MSDOS_DIR_CRT_DATE(link_node);
- /*
+ /*
* copy/set "file size", "first cluster"
*/
*MSDOS_DIR_FILE_SIZE(new_node) =*MSDOS_DIR_FILE_SIZE(link_node);
- *MSDOS_DIR_FIRST_CLUSTER_LOW(new_node) =
+ *MSDOS_DIR_FIRST_CLUSTER_LOW(new_node) =
*MSDOS_DIR_FIRST_CLUSTER_LOW(link_node);
- *MSDOS_DIR_FIRST_CLUSTER_HI(new_node) =
+ *MSDOS_DIR_FIRST_CLUSTER_HI(new_node) =
*MSDOS_DIR_FIRST_CLUSTER_HI(link_node);
/*
* set "archive bit" due to changes
@@ -145,16 +145,16 @@ msdos_creat_node(
*MSDOS_DIR_ATTR(new_node) |= MSDOS_ATTR_ARCHIVE;
}
- /*
- * find free space in the parent directory and write new initialized
+ /*
+ * find free space in the parent directory and write new initialized
* FAT 32 Bytes Directory Entry Structure to the disk
*/
rc = msdos_get_name_node(parent_loc, NULL, &aux, new_node);
if ( rc != RC_OK )
return rc;
-
- /*
- * if we create a new file we are done, if directory there are more steps
+
+ /*
+ * if we create a new file we are done, if directory there are more steps
* to do
*/
if (type == MSDOS_DIRECTORY)
@@ -164,7 +164,7 @@ msdos_creat_node(
if (rc != RC_OK)
goto err;
- /*
+ /*
* we opened fat-file for node we just created, so initialize fat-file
* descritor
*/
@@ -173,27 +173,27 @@ msdos_creat_node(
fat_fd->fat_file_size = 0;
fat_fd->fat_file_type = FAT_DIRECTORY;
fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT;
-
- /*
- * dot and dotdot entries are identical to new node except the
- * names
+
+ /*
+ * dot and dotdot entries are identical to new node except the
+ * names
*/
- memcpy(DOT_NODE_P(dot_dotdot), new_node,
- MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
+ memcpy(DOT_NODE_P(dot_dotdot), new_node,
+ MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
memcpy(DOTDOT_NODE_P(dot_dotdot), new_node,
- MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
- memcpy(MSDOS_DIR_NAME(DOT_NODE_P(dot_dotdot)), MSDOS_DOT_NAME,
+ MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
+ memcpy(MSDOS_DIR_NAME(DOT_NODE_P(dot_dotdot)), MSDOS_DOT_NAME,
MSDOS_NAME_MAX);
- memcpy(MSDOS_DIR_NAME(DOTDOT_NODE_P(dot_dotdot)), MSDOS_DOTDOT_NAME,
+ memcpy(MSDOS_DIR_NAME(DOTDOT_NODE_P(dot_dotdot)), MSDOS_DOTDOT_NAME,
MSDOS_NAME_MAX);
-
+
/* set up cluster num for dotdot entry */
- /*
- * here we can ommit FAT32 condition because for all FAT types dirs
- * right under root dir should contain 0 in dotdot entry but for
+ /*
+ * here we can ommit FAT32 condition because for all FAT types dirs
+ * right under root dir should contain 0 in dotdot entry but for
* FAT12/16 parent_fat_fd->cluster_num always contains such value
- */
- if ((FAT_FD_OF_ROOT_DIR(parent_fat_fd)) &&
+ */
+ if ((FAT_FD_OF_ROOT_DIR(parent_fat_fd)) &&
(fs_info->fat.vol.type & FAT_FAT32))
{
*MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) = 0x0000;
@@ -201,26 +201,26 @@ msdos_creat_node(
}
else
{
- *MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) =
+ *MSDOS_DIR_FIRST_CLUSTER_LOW(DOTDOT_NODE_P(dot_dotdot)) =
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((uint16_t )(((parent_fat_fd->cln) & 0xFFFF0000)>>16));
- }
-
- /*
- * write dot and dotdot entries to new fat-file: currently fat-file
- * correspondes to a new node is zero length, so it will be extended
+ }
+
+ /*
+ * write dot and dotdot entries to new fat-file: currently fat-file
+ * correspondes to a new node is zero length, so it will be extended
* by one cluster and entries will be written
*/
- ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0,
- MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2,
+ ret = fat_file_write(parent_loc->mt_entry, fat_fd, 0,
+ MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE * 2,
dot_dotdot);
if (ret < 0)
{
rc = -1;
goto error;
}
-
+
/* increment fat-file size by cluster size */
fat_fd->fat_file_size += fs_info->fat.vol.bpc;
@@ -231,7 +231,7 @@ msdos_creat_node(
CT_LE_W((uint16_t )(((fat_fd->cln) & 0xFFFF0000) >> 16));
/* 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,
MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE,
DOT_NODE_P(dot_dotdot));
if (ret < 0)
@@ -239,12 +239,12 @@ msdos_creat_node(
rc = -1;
goto error;
}
-
+
/* write first cluster num of a new directory to disk */
- rc = msdos_set_first_cluster_num(parent_loc->mt_entry, fat_fd);
+ rc = msdos_set_first_cluster_num(parent_loc->mt_entry, fat_fd);
if (rc != RC_OK)
- goto error;
-
+ goto error;
+
fat_file_close(parent_loc->mt_entry, fat_fd);
}
return RC_OK;
@@ -254,7 +254,7 @@ error:
err:
/* mark 32bytes structure on the disk as free */
- msdos_set_first_char4file_name(parent_loc->mt_entry, aux.cln, aux.ofs,
+ msdos_set_first_char4file_name(parent_loc->mt_entry, aux.cln, aux.ofs,
0xE5);
return rc;
}
@@ -264,13 +264,13 @@ err:
* MSDOS FAT FS does not support links, but this call is needed to
* allow "rename" operations. The current NEWLIB rename performs a link
* from the old to the new name and then deletes the old filename.
- *
+ *
* This pseudo-"link" operation will create a new directory entry,
* copy the file size and cluster information from the "old"
* to the "new" directory entry and then clear the file size and cluster
- * info from the "old" filename, leaving this file as
+ * info from the "old" filename, leaving this file as
* a valid, but empty entry.
- *
+ *
* When this "link" call is part of a "rename" sequence, the "old"
* entry will be deleted in a subsequent "rmnod" call
*
@@ -285,7 +285,7 @@ err:
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately)
*/
-int
+int
msdos_file_link(rtems_filesystem_location_info_t *to_loc,
rtems_filesystem_location_info_t *par_loc,
const char *token
@@ -298,11 +298,11 @@ msdos_file_link(rtems_filesystem_location_info_t *to_loc,
char new_name[ MSDOS_NAME_MAX + 1 ];
int len;
- /*
- * check spelling and format new node name
- */
+ /*
+ * check spelling and format new node name
+ */
if (MSDOS_NAME != msdos_get_token(token, new_name, &len)) {
- set_errno_and_return_minus_one(ENAMETOOLONG);
+ set_errno_and_return_minus_one(ENAMETOOLONG);
}
/*
* verify, that the existing node can be linked to
diff --git a/cpukit/libfs/src/dosfs/msdos_dir.c b/cpukit/libfs/src/dosfs/msdos_dir.c
index 17593b32ea..4afc404592 100644
--- a/cpukit/libfs/src/dosfs/msdos_dir.c
+++ b/cpukit/libfs/src/dosfs/msdos_dir.c
@@ -31,7 +31,7 @@
#include "msdos.h"
/* msdos_dir_open --
- * Open fat-file which correspondes to the directory being opened and
+ * Open fat-file which correspondes to the directory being opened and
* set offset field of file control block to zero.
*
* PARAMETERS:
@@ -41,34 +41,34 @@
* mode - mode
*
* RETURNS:
- * RC_OK, if directory opened successfully, or -1 if error occured (errno
+ * RC_OK, if directory opened successfully, or -1 if error occured (errno
* set apropriately)
*/
-int
+int
msdos_dir_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
uint32_t mode)
{
- int rc = RC_OK;
+ int rc = RC_OK;
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;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one( EIO );
-
+
rc = fat_file_reopen(fat_fd);
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
iop->offset = 0;
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
-}
+}
/* msdos_dir_close --
* Close fat-file which correspondes to the directory being closed
@@ -77,27 +77,27 @@ msdos_dir_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
* iop - file control block
*
* RETURNS:
- * RC_OK, if directory closed successfully, or -1 if error occured (errno
+ * RC_OK, if directory closed successfully, or -1 if error occured (errno
* set apropriately.
*/
-int
+int
msdos_dir_close(rtems_libio_t *iop)
{
int rc = RC_OK;
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;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one( EIO );
-
+
rc = fat_file_close(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
rtems_semaphore_release(fs_info->vol_sema);
@@ -105,9 +105,9 @@ msdos_dir_close(rtems_libio_t *iop)
}
/* msdos_format_dirent_with_dot --
- * This routine convert a (short) MSDOS filename as present on disk
+ * This routine convert a (short) MSDOS filename as present on disk
* (fixed 8+3 characters, filled with blanks, without separator dot)
- * to a "normal" format, with between 0 and 8 name chars,
+ * to a "normal" format, with between 0 and 8 name chars,
* a separating dot and up to 3 extension characters
* Rules to work:
* - copy any (0-8) "name" part characters that are non-blank
@@ -121,9 +121,9 @@ msdos_dir_close(rtems_libio_t *iop)
*
*
* RETURNS:
- * the number of bytes (without trailing '\0'(written to destination
+ * the number of bytes (without trailing '\0'(written to destination
*/
-static ssize_t
+static ssize_t
msdos_format_dirent_with_dot(char *dst,const char *src)
{
ssize_t len;
@@ -152,7 +152,7 @@ msdos_format_dirent_with_dot(char *dst,const char *src)
*/
for ((i = MSDOS_SHORT_EXT_LEN ,
src_tmp = src + MSDOS_SHORT_BASE_LEN+MSDOS_SHORT_EXT_LEN-1);
- ((i > 0) &&
+ ((i > 0) &&
(*src_tmp == ' '));
i--,src_tmp--)
{};
@@ -175,15 +175,15 @@ msdos_format_dirent_with_dot(char *dst,const char *src)
/* msdos_dir_read --
* This routine will read the next directory entry based on the directory
- * offset. The offset should be equal to -n- time the size of an
- * individual dirent structure. If n is not an integer multiple of the
- * sizeof a dirent structure, an integer division will be performed to
- * determine directory entry that will be returned in the buffer. Count
- * should reflect -m- times the sizeof dirent bytes to be placed in the
+ * offset. The offset should be equal to -n- time the size of an
+ * individual dirent structure. If n is not an integer multiple of the
+ * sizeof a dirent structure, an integer division will be performed to
+ * determine directory entry that will be returned in the buffer. Count
+ * should reflect -m- times the sizeof dirent bytes to be placed in the
* buffer.
- * If there are not -m- dirent elements from the current directory
- * position to the end of the exisiting file, the remaining entries will
- * be placed in the buffer and the returned value will be equal to
+ * If there are not -m- dirent elements from the current directory
+ * position to the end of the exisiting file, the remaining entries will
+ * be placed in the buffer and the returned value will be equal to
* -m actual- times the size of a directory entry.
*
* PARAMETERS:
@@ -192,15 +192,15 @@ msdos_format_dirent_with_dot(char *dst,const char *src)
* count - count of bytes to read
*
* RETURNS:
- * the number of bytes read on success, or -1 if error occured (errno
+ * the number of bytes read on success, or -1 if error occured (errno
* set apropriately).
*/
-ssize_t
+ssize_t
msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
{
int rc = RC_OK;
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 *tmp_fat_fd = NULL;
struct dirent tmp_dirent;
@@ -210,40 +210,40 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
uint32_t j = 0, i = 0;
uint32_t bts2rd = 0;
uint32_t cur_cln = 0;
-
- /*
- * cast start and count - protect against using sizes that are not exact
- * multiples of the -dirent- size. These could result in unexpected
- * results
+
+ /*
+ * cast start and count - protect against using sizes that are not exact
+ * multiples of the -dirent- size. These could result in unexpected
+ * results
*/
start = iop->offset / sizeof(struct dirent);
- count = (count / sizeof(struct dirent)) * sizeof(struct dirent);
-
- /*
- * optimization: we know that root directory for FAT12/16 volumes is
+ count = (count / sizeof(struct dirent)) * sizeof(struct dirent);
+
+ /*
+ * optimization: we know that root directory for FAT12/16 volumes is
* sequential set of sectors and any cluster is sequential set of sectors
- * too, so read such set of sectors is quick operation for low-level IO
+ * too, so read such set of sectors is quick operation for low-level IO
* layer.
*/
bts2rd = (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))) ?
fat_fd->fat_file_size :
- fs_info->fat.vol.bpc;
+ fs_info->fat.vol.bpc;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
while (count > 0)
- {
- /*
- * fat-file is already opened by open call, so read it
+ {
+ /*
+ * fat-file is already opened by open call, so read it
* Always read directory fat-file from the beggining because of MSDOS
- * directories feature :( - we should count elements currently
+ * directories feature :( - we should count elements currently
* present in the directory because there may be holes :)
*/
- ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, (j * bts2rd),
+ ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, (j * bts2rd),
bts2rd, fs_info->cl_buf);
if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
{
@@ -253,33 +253,33 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
for (i = 0; i < ret; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
{
- if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY)
{
- rtems_semaphore_release(fs_info->vol_sema);
+ rtems_semaphore_release(fs_info->vol_sema);
return cmpltd;
- }
-
- if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ }
+
+ if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_EMPTY)
continue;
-
- /*
+
+ /*
* skip active entries until get the entry to start from
*/
if (start)
{
- start--;
+ start--;
continue;
- }
-
- /*
+ }
+
+ /*
* Move the entry to the return buffer
*
- * unfortunately there is no method to extract ino except to
+ * unfortunately there is no method to extract ino except to
* open fat-file descriptor :( ... so, open it
*/
-
+
/* get number of cluster we are working with */
rc = fat_file_ioctl(iop->pathinfo.mt_entry, fat_fd, F_CLU_NUM,
j * bts2rd, &cur_cln);
@@ -289,7 +289,7 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
return rc;
}
- rc = fat_file_open(iop->pathinfo.mt_entry, cur_cln, i,
+ rc = fat_file_open(iop->pathinfo.mt_entry, cur_cln, i,
&tmp_fat_fd);
if (rc != RC_OK)
{
@@ -309,15 +309,15 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
* convert dir entry from fixed 8+3 format (without dot)
* to 0..8 + 1dot + 0..3 format
*/
- tmp_dirent.d_namlen =
+ tmp_dirent.d_namlen =
msdos_format_dirent_with_dot(tmp_dirent.d_name,
fs_info->cl_buf + i); /* src text */
memcpy(buffer + cmpltd, &tmp_dirent, sizeof(struct dirent));
-
+
iop->offset = iop->offset + sizeof(struct dirent);
cmpltd += (sizeof(struct dirent));
count -= (sizeof(struct dirent));
-
+
/* inode number extracted, close fat-file */
rc = fat_file_close(iop->pathinfo.mt_entry, tmp_fat_fd);
if (rc != RC_OK)
@@ -359,19 +359,19 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, uint32_t count)
* whence - predefine directive
*
* RETURNS:
- * RC_OK on success, or -1 if error occured (errno
+ * RC_OK on success, or -1 if error occured (errno
* set apropriately).
*/
-int
+int
msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence)
{
- switch (whence)
+ switch (whence)
{
case SEEK_SET:
- case SEEK_CUR:
+ case SEEK_CUR:
break;
- /*
- * Movement past the end of the directory via lseek is not a
+ /*
+ * Movement past the end of the directory via lseek is not a
* permitted operation
*/
case SEEK_END:
@@ -383,7 +383,7 @@ msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence)
}
/* msdos_dir_stat --
- *
+ *
* This routine will obtain the following information concerning the current
* directory:
* st_dev device id
@@ -391,7 +391,7 @@ msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence)
* st_mode mode extracted from the node
* st_size total size in bytes
* st_blksize blocksize for filesystem I/O
- * st_blocks number of blocks allocated
+ * st_blocks number of blocks allocated
* stat_mtime time of last modification
*
* PARAMETERS:
@@ -399,24 +399,24 @@ msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence)
* buf - stat buffer provided by user
*
* RETURNS:
- * RC_OK and filled stat buffer on success, or -1 if error occured (errno
+ * RC_OK and filled stat buffer on success, or -1 if error occured (errno
* set apropriately).
*/
-int
+int
msdos_dir_stat(
rtems_filesystem_location_info_t *loc,
struct stat *buf
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
- msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
+ msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
fat_file_fd_t *fat_fd = loc->node_access;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
buf->st_dev = fs_info->fat.vol.dev;
buf->st_ino = fat_fd->ino;
buf->st_mode = S_IFDIR;
@@ -425,7 +425,7 @@ msdos_dir_stat(
buf->st_blocks = fat_fd->fat_file_size >> FAT_SECTOR512_BITS;
buf->st_blksize = fs_info->fat.vol.bps;
buf->st_mtime = fat_fd->mtime;
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
}
@@ -441,8 +441,8 @@ msdos_dir_stat(
/* msdos_dir_sync --
* The following routine does a syncronization on a MSDOS directory node.
- * DIR_WrtTime, DIR_WrtDate and DIR_fileSize fields of 32 Bytes Directory
- * Entry Structure should not be updated for directories, so only call
+ * DIR_WrtTime, DIR_WrtDate and DIR_fileSize fields of 32 Bytes Directory
+ * Entry Structure should not be updated for directories, so only call
* to corresponding fat-file routine.
*
* PARAMETERS:
@@ -458,12 +458,12 @@ msdos_dir_sync(rtems_libio_t *iop)
rtems_status_code sc = RTEMS_SUCCESSFUL;
fat_file_fd_t *fat_fd = iop->file_info;
msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info;
-
+
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd);
rtems_semaphore_release(fs_info->vol_sema);
@@ -471,9 +471,9 @@ msdos_dir_sync(rtems_libio_t *iop)
}
/* msdos_dir_rmnod --
- * Remove directory node.
+ * Remove directory node.
*
- * Check that this directory node is not opened as fat-file, is empty and
+ * Check that this directory node is not opened as fat-file, is empty and
* not filesystem root node. If all this conditions met then delete.
*
* PARAMETERS:
@@ -482,34 +482,34 @@ msdos_dir_sync(rtems_libio_t *iop)
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set apropriately).
*/
-int
+int
msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
{
int rc = RC_OK;
rtems_status_code sc = RTEMS_SUCCESSFUL;
- msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
+ msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
fat_file_fd_t *fat_fd = pathloc->node_access;
rtems_boolean is_empty = FALSE;
-
+
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
/*
- * We deny attemp to delete open directory (if directory is current
+ * We deny attemp to delete open directory (if directory is current
* directory we assume it is open one)
*/
if (fat_fd->links_num > 1)
{
rtems_semaphore_release(fs_info->vol_sema);
set_errno_and_return_minus_one(EBUSY);
- }
-
+ }
+
/*
* You cannot remove a node that still has children
*/
- rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty);
+ rc = msdos_dir_is_empty(pathloc->mt_entry, fat_fd, &is_empty);
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
@@ -518,9 +518,9 @@ msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
if (!is_empty)
{
- rtems_semaphore_release(fs_info->vol_sema);
+ rtems_semaphore_release(fs_info->vol_sema);
set_errno_and_return_minus_one(ENOTEMPTY);
- }
+ }
/*
* You cannot remove the file system root node.
@@ -537,8 +537,8 @@ msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
*/
/* mark file removed */
- rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln,
- fat_fd->info_ofs,
+ rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln,
+ fat_fd->info_ofs,
MSDOS_THIS_DIR_ENTRY_EMPTY);
if (rc != RC_OK)
{
@@ -546,7 +546,7 @@ msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
return rc;
}
- fat_file_mark_removed(pathloc->mt_entry, fat_fd);
+ fat_file_mark_removed(pathloc->mt_entry, fat_fd);
rtems_semaphore_release(fs_info->vol_sema);
return rc;
diff --git a/cpukit/libfs/src/dosfs/msdos_eval.c b/cpukit/libfs/src/dosfs/msdos_eval.c
index 3cd07f7b84..0bba0c0a5e 100644
--- a/cpukit/libfs/src/dosfs/msdos_eval.c
+++ b/cpukit/libfs/src/dosfs/msdos_eval.c
@@ -32,7 +32,7 @@
#include "msdos.h"
/* msdos_set_handlers --
- * Set handlers for the node with specified type(i.e. handlers for file
+ * Set handlers for the node with specified type(i.e. handlers for file
* or directory).
*
* PARAMETERS:
@@ -41,10 +41,10 @@
* RETURNS:
* None
*/
-static void
+static void
msdos_set_handlers(rtems_filesystem_location_info_t *loc)
{
- msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
+ msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
fat_file_fd_t *fat_fd = loc->node_access;
if (fat_fd->fat_file_type == FAT_DIRECTORY)
@@ -67,13 +67,13 @@ msdos_set_handlers(rtems_filesystem_location_info_t *loc)
* RETURNS:
* RC_OK and filled pathloc on success, or -1 if error occured
* (errno set appropriately)
- *
+ *
*/
-int
+int
msdos_eval_path(
const char *pathname,
int flags,
- rtems_filesystem_location_info_t *pathloc
+ rtems_filesystem_location_info_t *pathloc
)
{
int rc = RC_OK;
@@ -90,28 +90,28 @@ msdos_eval_path(
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
if (!pathloc->node_access)
{
errno = ENOENT;
rc = -1;
goto err;
- }
+ }
- fat_fd = pathloc->node_access;
+ fat_fd = pathloc->node_access;
rc = fat_file_reopen(fat_fd);
if (rc != RC_OK)
goto err;
-
- while ((type != MSDOS_NO_MORE_PATH) && (type != MSDOS_INVALID_TOKEN))
+
+ while ((type != MSDOS_NO_MORE_PATH) && (type != MSDOS_INVALID_TOKEN))
{
type = msdos_get_token(&pathname[i], token, &len);
i += len;
-
- fat_fd = pathloc->node_access;
-
- switch (type)
+
+ fat_fd = pathloc->node_access;
+
+ switch (type)
{
case MSDOS_UP_DIR:
/*
@@ -122,24 +122,24 @@ msdos_eval_path(
errno = ENOTDIR;
rc = -1;
goto error;
- }
+ }
/*
* Am I at the root of this mounted filesystem?
*/
- if (pathloc->node_access ==
- pathloc->mt_entry->mt_fs_root.node_access)
+ if (pathloc->node_access ==
+ pathloc->mt_entry->mt_fs_root.node_access)
{
/*
* Am I at the root of all filesystems?
* XXX: MSDOS is not supposed to be base fs.
*/
- if (pathloc->node_access ==
- rtems_filesystem_root.node_access)
- {
+ if (pathloc->node_access ==
+ rtems_filesystem_root.node_access)
+ {
break; /* Throw out the .. in this case */
- }
- else
+ }
+ else
{
newloc = pathloc->mt_entry->mt_point_node;
*pathloc = newloc;
@@ -147,13 +147,13 @@ msdos_eval_path(
rc = fat_file_close(pathloc->mt_entry, fat_fd);
if (rc != RC_OK)
goto err;
-
+
rtems_semaphore_release(fs_info->vol_sema);
return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),
flags, pathloc);
}
- }
- else
+ }
+ else
{
rc = msdos_find_name(pathloc, token);
if (rc != RC_OK)
@@ -162,9 +162,9 @@ msdos_eval_path(
{
errno = ENOENT;
rc = -1;
- }
- goto error;
- }
+ }
+ goto error;
+ }
}
break;
@@ -177,10 +177,10 @@ msdos_eval_path(
errno = ENOTDIR;
rc = -1;
goto error;
- }
+ }
/*
- * Otherwise find the token name in the present location and
+ * Otherwise find the token name in the present location and
* set the node access to the point we have found.
*/
rc = msdos_find_name(pathloc, token);
@@ -190,13 +190,13 @@ msdos_eval_path(
{
errno = ENOENT;
rc = -1;
- }
- goto error;
- }
+ }
+ goto error;
+ }
break;
case MSDOS_NO_MORE_PATH:
- case MSDOS_CURRENT_DIR:
+ case MSDOS_CURRENT_DIR:
break;
case MSDOS_INVALID_TOKEN:
@@ -204,7 +204,7 @@ msdos_eval_path(
rc = -1;
goto error;
break;
-
+
}
}
@@ -214,15 +214,15 @@ msdos_eval_path(
* If we are at a node that is a mount point. Set loc to the
* new fs root node and let let the mounted filesystem set the handlers.
*
- * NOTE: The behavior of stat() on a mount point appears to be
+ * NOTE: The behavior of stat() on a mount point appears to be
* questionable.
* NOTE: MSDOS filesystem currently doesn't support mount functionality ->
* action not implemented
*/
fat_fd = pathloc->node_access;
-
+
msdos_set_handlers(pathloc);
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
@@ -231,7 +231,7 @@ error:
err:
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
/* msdos_eval4make --
@@ -242,20 +242,20 @@ err:
*
* PARAMETERS:
* path - path for evaluation
- * pathloc - IN/OUT (start point for evaluation/parent directory for
+ * pathloc - IN/OUT (start point for evaluation/parent directory for
* creation)
* name - new node name
*
* RETURNS:
- * RC_OK, filled pathloc for parent directory and name of new node on
+ * RC_OK, filled pathloc for parent directory and name of new node on
* success, or -1 if error occured (errno set appropriately)
*/
-int
+int
msdos_eval4make(
- const char *path,
- rtems_filesystem_location_info_t *pathloc,
+ const char *path,
+ rtems_filesystem_location_info_t *pathloc,
const char **name
- )
+ )
{
int rc = RC_OK;
rtems_status_code sc = RTEMS_SUCCESSFUL;
@@ -272,27 +272,27 @@ msdos_eval4make(
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
if (!pathloc->node_access)
{
errno = ENOENT;
rc = -1;
goto err;
- }
+ }
- fat_fd = pathloc->node_access;
+ fat_fd = pathloc->node_access;
rc = fat_file_reopen(fat_fd);
if (rc != RC_OK)
goto err;
- while (!done)
+ while (!done)
{
type = msdos_get_token(&path[i], token, &len);
i += len;
- fat_fd = pathloc->node_access;
+ fat_fd = pathloc->node_access;
- switch (type)
+ switch (type)
{
case MSDOS_UP_DIR:
/*
@@ -303,24 +303,24 @@ msdos_eval4make(
errno = ENOTDIR;
rc = -1;
goto error;
- }
+ }
/*
* Am I at the root of this mounted filesystem?
*/
- if (pathloc->node_access ==
- pathloc->mt_entry->mt_fs_root.node_access)
+ if (pathloc->node_access ==
+ pathloc->mt_entry->mt_fs_root.node_access)
{
/*
* Am I at the root of all filesystems?
* XXX: MSDOS is not supposed to be base fs.
*/
- if (pathloc->node_access ==
- rtems_filesystem_root.node_access)
- {
+ if (pathloc->node_access ==
+ rtems_filesystem_root.node_access)
+ {
break; /* Throw out the .. in this case */
- }
- else
+ }
+ else
{
newloc = pathloc->mt_entry->mt_point_node;
*pathloc = newloc;
@@ -330,11 +330,11 @@ msdos_eval4make(
goto err;
rtems_semaphore_release(fs_info->vol_sema);
- return (*pathloc->ops->evalformake_h)(&path[i-len],
+ return (*pathloc->ops->evalformake_h)(&path[i-len],
pathloc, name);
}
- }
- else
+ }
+ else
{
rc = msdos_find_name(pathloc, token);
if (rc != RC_OK)
@@ -343,9 +343,9 @@ msdos_eval4make(
{
errno = ENOENT;
rc = -1;
- }
- goto error;
- }
+ }
+ goto error;
+ }
}
break;
@@ -358,10 +358,10 @@ msdos_eval4make(
errno = ENOTDIR;
rc = -1;
goto error;
- }
+ }
/*
- * Otherwise find the token name in the present location and
+ * Otherwise find the token name in the present location and
* set the node access to the point we have found.
*/
rc = msdos_find_name(pathloc, token);
@@ -375,7 +375,7 @@ msdos_eval4make(
}
else
done = TRUE;
- }
+ }
break;
case MSDOS_NO_MORE_PATH:
@@ -383,7 +383,7 @@ msdos_eval4make(
rc = -1;
goto error;
break;
-
+
case MSDOS_CURRENT_DIR:
break;
@@ -402,14 +402,14 @@ msdos_eval4make(
* We have evaluated the path as far as we can.
* Verify there is not any invalid stuff at the end of the name.
*/
- for( ; path[i] != '\0'; i++)
+ for( ; path[i] != '\0'; i++)
{
if (!msdos_is_separator(path[i]))
{
errno = ENOENT;
rc = -1;
goto error;
- }
+ }
}
fat_fd = pathloc->node_access;
@@ -419,10 +419,10 @@ msdos_eval4make(
errno = ENOTDIR;
rc = -1;
goto error;
- }
-
+ }
+
msdos_set_handlers(pathloc);
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
@@ -431,5 +431,5 @@ error:
err:
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c
index 528fc9c890..14bd96b325 100644
--- a/cpukit/libfs/src/dosfs/msdos_file.c
+++ b/cpukit/libfs/src/dosfs/msdos_file.c
@@ -41,13 +41,13 @@
* RC_OK, if file opened successfully, or -1 if error occured
* and errno set appropriately
*/
-int
+int
msdos_file_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
uint32_t mode)
{
- int rc = RC_OK;
+ int rc = RC_OK;
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;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
@@ -59,49 +59,49 @@ msdos_file_open(rtems_libio_t *iop, const char *pathname, uint32_t flag,
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
if (iop->flags & LIBIO_FLAGS_APPEND)
iop->offset = fat_fd->fat_file_size;
-
+
iop->size = fat_fd->fat_file_size;
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
}
/* msdos_file_close --
- * Close fat-file which correspondes to the file. If fat-file descriptor
- * which correspondes to the file is not marked "removed", synchronize
+ * Close fat-file which correspondes to the file. If fat-file descriptor
+ * which correspondes to the file is not marked "removed", synchronize
* size, first cluster number, write time and date fields of the file.
*
* PARAMETERS:
* iop - file control block
*
* RETURNS:
- * RC_OK, if file closed successfully, or -1 if error occured (errno set
+ * RC_OK, if file closed successfully, or -1 if error occured (errno set
* appropriately)
*/
-int
+int
msdos_file_close(rtems_libio_t *iop)
{
- int rc = RC_OK;
+ int rc = RC_OK;
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;
- sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
+ sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
- /*
- * if fat-file descriptor is not marked as "removed", synchronize
+
+ /*
+ * if fat-file descriptor is not marked as "removed", synchronize
* size, first cluster number, write time and date fields of the file
*/
if (!FAT_FILE_IS_REMOVED(fat_fd))
- {
+ {
rc = msdos_set_first_cluster_num(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
{
@@ -111,19 +111,19 @@ msdos_file_close(rtems_libio_t *iop)
rc = msdos_set_file_size(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
- {
+ {
rtems_semaphore_release(fs_info->vol_sema);
return rc;
- }
+ }
rc = msdos_set_dir_wrt_time_and_date(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
return rc;
- }
+ }
}
-
+
rc = fat_file_close(iop->pathinfo.mt_entry, fat_fd);
rtems_semaphore_release(fs_info->vol_sema);
@@ -140,15 +140,15 @@ msdos_file_close(rtems_libio_t *iop)
* count - the number of bytes to read
*
* RETURNS:
- * the number of bytes read on success, or -1 if error occured (errno set
+ * the number of bytes read on success, or -1 if error occured (errno set
* appropriately)
*/
-ssize_t
+ssize_t
msdos_file_read(rtems_libio_t *iop, void *buffer, uint32_t count)
{
ssize_t ret = 0;
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;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
@@ -156,7 +156,7 @@ msdos_file_read(rtems_libio_t *iop, void *buffer, uint32_t count)
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, iop->offset, count,
+ ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, iop->offset, count,
buffer);
rtems_semaphore_release(fs_info->vol_sema);
@@ -164,7 +164,7 @@ msdos_file_read(rtems_libio_t *iop, void *buffer, uint32_t count)
}
/* msdos_file_write --
- * This routine writes the specified data buffer into the file pointed to
+ * This routine writes the specified data buffer into the file pointed to
* by file control block.
*
* PARAMETERS:
@@ -176,12 +176,12 @@ msdos_file_read(rtems_libio_t *iop, void *buffer, uint32_t count)
* the number of bytes written on success, or -1 if error occured
* and errno set appropriately
*/
-ssize_t
+ssize_t
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;
- 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;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
@@ -189,16 +189,16 @@ msdos_file_write(rtems_libio_t *iop,const void *buffer, uint32_t count)
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- ret = fat_file_write(iop->pathinfo.mt_entry, fat_fd, iop->offset, count,
+ ret = fat_file_write(iop->pathinfo.mt_entry, fat_fd, iop->offset, count,
buffer);
if (ret < 0)
{
- rtems_semaphore_release(fs_info->vol_sema);
+ rtems_semaphore_release(fs_info->vol_sema);
return -1;
}
- /*
- * update file size in both fat-file descriptor and file control block if
+ /*
+ * update file size in both fat-file descriptor and file control block if
* file was extended
*/
if (iop->offset + ret > fat_fd->fat_file_size)
@@ -211,7 +211,7 @@ msdos_file_write(rtems_libio_t *iop,const void *buffer, uint32_t count)
}
/* msdos_file_lseek --
- * Process lseek call to the file: extend file if lseek is up to the end
+ * Process lseek call to the file: extend file if lseek is up to the end
* of the file.
*
* PARAMETERS:
@@ -220,15 +220,15 @@ msdos_file_write(rtems_libio_t *iop,const void *buffer, uint32_t count)
* whence - predefine directive
*
* RETURNS:
- * new offset on success, or -1 if error occured (errno set
+ * new offset on success, or -1 if error occured (errno set
* appropriately).
*/
-int
+int
msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence)
{
int rc = RC_OK;
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;
uint32_t real_size = 0;
@@ -237,7 +237,7 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence)
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
- rc = fat_file_extend(iop->pathinfo.mt_entry, fat_fd, iop->offset,
+ rc = fat_file_extend(iop->pathinfo.mt_entry, fat_fd, iop->offset,
&real_size);
if (rc != RC_OK)
{
@@ -247,7 +247,7 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence)
if (real_size > fat_fd->fat_file_size)
fat_fd->fat_file_size = iop->offset = real_size;
-
+
iop->size = fat_fd->fat_file_size;
rtems_semaphore_release(fs_info->vol_sema);
@@ -263,21 +263,21 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence)
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately)
*/
-int
+int
msdos_file_stat(
rtems_filesystem_location_info_t *loc,
struct stat *buf
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
- msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
+ msdos_fs_info_t *fs_info = loc->mt_entry->fs_info;
fat_file_fd_t *fat_fd = loc->node_access;
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
buf->st_dev = fs_info->fat.vol.dev;
buf->st_ino = fat_fd->ino;
buf->st_mode = S_IFREG;
@@ -296,17 +296,17 @@ msdos_file_stat(
*
* PARAMETERS:
* iop - file control block
- * length - new length
+ * length - new length
*
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately).
*/
-int
+int
msdos_file_ftruncate(rtems_libio_t *iop, off_t length)
{
int rc = RC_OK;
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;
if (length >= fat_fd->fat_file_size)
@@ -316,7 +316,7 @@ msdos_file_ftruncate(rtems_libio_t *iop, off_t length)
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
rc = fat_file_truncate(iop->pathinfo.mt_entry, fat_fd, length);
if (rc != RC_OK)
{
@@ -324,19 +324,19 @@ msdos_file_ftruncate(rtems_libio_t *iop, off_t length)
return rc;
}
- /*
- * fat_file_truncate do nothing if new length >= fat-file size, so update
+ /*
+ * fat_file_truncate do nothing if new length >= fat-file size, so update
* file size only if length < fat-file size
*/
if (length < fat_fd->fat_file_size)
iop->size = fat_fd->fat_file_size = length;
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
}
/* msdos_file_sync --
- * Synchronize file - synchronize file data and if file is not removed
+ * Synchronize file - synchronize file data and if file is not removed
* synchronize file metadata.
*
* PARAMETERS:
@@ -352,12 +352,12 @@ msdos_file_sync(rtems_libio_t *iop)
rtems_status_code sc = RTEMS_SUCCESSFUL;
fat_file_fd_t *fat_fd = iop->file_info;
msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info;
-
+
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
/* synchronize file data */
rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
@@ -366,12 +366,12 @@ msdos_file_sync(rtems_libio_t *iop)
return rc;
}
- /*
- * if fat-file descriptor is not marked "removed" - synchronize file
+ /*
+ * if fat-file descriptor is not marked "removed" - synchronize file
* metadata
*/
if (!FAT_FILE_IS_REMOVED(fat_fd))
- {
+ {
rc = msdos_set_first_cluster_num(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
{
@@ -383,15 +383,15 @@ msdos_file_sync(rtems_libio_t *iop)
{
rtems_semaphore_release(fs_info->vol_sema);
return rc;
- }
+ }
rc = msdos_set_dir_wrt_time_and_date(iop->pathinfo.mt_entry, fat_fd);
if (rc != RC_OK)
{
rtems_semaphore_release(fs_info->vol_sema);
return rc;
- }
+ }
}
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
}
@@ -412,15 +412,15 @@ msdos_file_datasync(rtems_libio_t *iop)
rtems_status_code sc = RTEMS_SUCCESSFUL;
fat_file_fd_t *fat_fd = iop->file_info;
msdos_fs_info_t *fs_info = iop->pathinfo.mt_entry->fs_info;
-
+
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
MSDOS_VOLUME_SEMAPHORE_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
set_errno_and_return_minus_one(EIO);
-
+
/* synchronize file data */
rc = fat_file_datasync(iop->pathinfo.mt_entry, fat_fd);
-
+
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
}
@@ -436,7 +436,7 @@ msdos_file_datasync(rtems_libio_t *iop)
* RETURNS:
*
*/
-int
+int
msdos_file_ioctl(rtems_libio_t *iop,uint32_t command, void *buffer)
{
int rc = RC_OK;
@@ -445,8 +445,8 @@ msdos_file_ioctl(rtems_libio_t *iop,uint32_t command, void *buffer)
}
/* msdos_file_rmnod --
- * Remove node associated with a file - set up first name character to
- * predefined value(and write it to the disk), and mark fat-file which
+ * Remove node associated with a file - set up first name character to
+ * predefined value(and write it to the disk), and mark fat-file which
* correspondes to the file as "removed"
*
* PARAMETERS:
@@ -455,7 +455,7 @@ msdos_file_ioctl(rtems_libio_t *iop,uint32_t command, void *buffer)
* RETURNS:
* RC_OK on success, or -1 if error occured (errno set appropriately)
*/
-int
+int
msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc)
{
int rc = RC_OK;
@@ -469,8 +469,8 @@ msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc)
set_errno_and_return_minus_one(EIO);
/* mark file removed */
- rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln,
- fat_fd->info_ofs,
+ rc = msdos_set_first_char4file_name(pathloc->mt_entry, fat_fd->info_cln,
+ fat_fd->info_ofs,
MSDOS_THIS_DIR_ENTRY_EMPTY);
if (rc != RC_OK)
{
@@ -478,7 +478,7 @@ msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc)
return rc;
}
- fat_file_mark_removed(pathloc->mt_entry, fat_fd);
+ fat_file_mark_removed(pathloc->mt_entry, fat_fd);
rtems_semaphore_release(fs_info->vol_sema);
return RC_OK;
diff --git a/cpukit/libfs/src/dosfs/msdos_free.c b/cpukit/libfs/src/dosfs/msdos_free.c
index 55baeaf6c6..2fb74e2387 100644
--- a/cpukit/libfs/src/dosfs/msdos_free.c
+++ b/cpukit/libfs/src/dosfs/msdos_free.c
@@ -17,7 +17,7 @@
#endif
#include <rtems.h>
-#include <rtems/libio_.h>
+#include <rtems/libio_.h>
#include <errno.h>
@@ -40,7 +40,7 @@
int
msdos_free_node_info(rtems_filesystem_location_info_t *pathloc)
{
- int rc = RC_OK;
+ int rc = RC_OK;
rtems_status_code sc = RTEMS_SUCCESSFUL;
msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
@@ -52,5 +52,5 @@ msdos_free_node_info(rtems_filesystem_location_info_t *pathloc)
rc = fat_file_close(pathloc->mt_entry, pathloc->node_access);
rtems_semaphore_release(fs_info->vol_sema);
- return rc;
+ return rc;
}
diff --git a/cpukit/libfs/src/dosfs/msdos_fsunmount.c b/cpukit/libfs/src/dosfs/msdos_fsunmount.c
index 71fc956a8d..bd978179e2 100644
--- a/cpukit/libfs/src/dosfs/msdos_fsunmount.c
+++ b/cpukit/libfs/src/dosfs/msdos_fsunmount.c
@@ -8,7 +8,7 @@
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
- * @(#) $Id$
+ * @(#) $Id$
*/
#if HAVE_CONFIG_H
@@ -32,8 +32,8 @@
#include "msdos.h"
/* msdos_shut_down --
- * Shut down MSDOS filesystem - free all allocated resources (don't
- * return if deallocation of some resource failed - free as much as
+ * Shut down MSDOS filesystem - free all allocated resources (don't
+ * return if deallocation of some resource failed - free as much as
* possible).
*
* PARAMETERS:
@@ -43,10 +43,10 @@
* RC_OK on success, or -1 if error occured (errno set apropriately).
*
*/
-int
+int
msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
{
- int rc = RC_OK;
+ int rc = RC_OK;
msdos_fs_info_t *fs_info = temp_mt_entry->fs_info;
fat_file_fd_t *fat_fd = temp_mt_entry->mt_fs_root.node_access;
@@ -62,10 +62,10 @@ msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
/* no return - try to free as much as possible */
rc = -1;
}
-
+
rtems_semaphore_delete(fs_info->vol_sema);
free(fs_info->cl_buf);
free(temp_mt_entry->fs_info);
-
+
return rc;
}
diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c
index dcbd0852cd..4a6d098b8e 100644
--- a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c
+++ b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c
@@ -28,8 +28,8 @@ rtems_filesystem_file_handlers_r msdos_dir_handlers = {
msdos_dir_stat,
NULL,
NULL, /* msdos_dir_ftruncate */
- NULL,
- msdos_dir_sync,
+ NULL,
+ msdos_dir_sync,
msdos_dir_sync,
NULL, /* msdos_dir_fcntl */
msdos_dir_rmnod
diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_file.c b/cpukit/libfs/src/dosfs/msdos_handlers_file.c
index 5c86c6e1c7..857c5ad7a6 100644
--- a/cpukit/libfs/src/dosfs/msdos_handlers_file.c
+++ b/cpukit/libfs/src/dosfs/msdos_handlers_file.c
@@ -28,8 +28,8 @@ rtems_filesystem_file_handlers_r msdos_file_handlers = {
msdos_file_stat,
NULL,
msdos_file_ftruncate,
- NULL,
- msdos_file_sync,
+ NULL,
+ msdos_file_sync,
msdos_file_datasync,
NULL, /* msdos_file_fcntl */
msdos_file_rmnod
diff --git a/cpukit/libfs/src/dosfs/msdos_init.c b/cpukit/libfs/src/dosfs/msdos_init.c
index 1ff329b8a9..f09f8d7291 100644
--- a/cpukit/libfs/src/dosfs/msdos_init.c
+++ b/cpukit/libfs/src/dosfs/msdos_init.c
@@ -26,7 +26,7 @@ rtems_filesystem_operations_table msdos_ops = {
#else
msdos_file_link, /* msdos_link (pseudo-functionality) */
#endif
- msdos_file_rmnod,
+ msdos_file_rmnod,
msdos_node_type,
msdos_mknod,
NULL, /* msdos_chown */
@@ -42,7 +42,7 @@ rtems_filesystem_operations_table msdos_ops = {
};
/* msdos_initialize --
- * MSDOS filesystem initialization
+ * MSDOS filesystem initialization
*
* PARAMETERS:
* temp_mt_entry - mount table entry
@@ -51,11 +51,11 @@ rtems_filesystem_operations_table msdos_ops = {
* RC_OK on success, or -1 if error occured (errno set apropriately).
*
*/
-int
+int
msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
{
int rc = RC_OK;
-
+
rc = msdos_initialize_support(temp_mt_entry,
&msdos_ops,
&msdos_file_handlers,
diff --git a/cpukit/libfs/src/dosfs/msdos_initsupp.c b/cpukit/libfs/src/dosfs/msdos_initsupp.c
index cc3a633c56..006fb38d09 100644
--- a/cpukit/libfs/src/dosfs/msdos_initsupp.c
+++ b/cpukit/libfs/src/dosfs/msdos_initsupp.c
@@ -8,14 +8,14 @@
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
- * @(#) $Id$
+ * @(#) $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
-#include <sys/types.h>
+#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
@@ -38,14 +38,14 @@
* temp_mt_entry - mount table entry
* op_table - filesystem operations table
* file_handlers - file operations table
- * directory_handlers - directory operations table
+ * directory_handlers - directory operations table
*
* RETURNS:
- * RC_OK and filled temp_mt_entry on success, or -1 if error occured
+ * RC_OK and filled temp_mt_entry on success, or -1 if error occured
* (errno set apropriately)
*
*/
-int
+int
msdos_initialize_support(
rtems_filesystem_mount_table_entry_t *temp_mt_entry,
rtems_filesystem_operations_table *op_table,
@@ -75,11 +75,11 @@ msdos_initialize_support(
fs_info->file_handlers = file_handlers;
fs_info->directory_handlers = directory_handlers;
- /*
+ /*
* open fat-file which correspondes to root directory
* (so inode number 0x00000010 is always used for root directory)
*/
- rc = fat_file_open(temp_mt_entry, FAT_ROOTDIR_CLUSTER_NUM, 0, &fat_fd);
+ rc = fat_file_open(temp_mt_entry, FAT_ROOTDIR_CLUSTER_NUM, 0, &fat_fd);
if (rc != RC_OK)
{
fat_shutdown_drive(temp_mt_entry);
@@ -93,7 +93,7 @@ msdos_initialize_support(
fat_fd->info_cln = FAT_ROOTDIR_CLUSTER_NUM;
fat_fd->info_ofs = 0;
fat_fd->cln = fs_info->fat.vol.rdir_cl;
-
+
fat_fd->map.file_cln = 0;
fat_fd->map.disk_cln = fat_fd->cln;
@@ -101,13 +101,13 @@ msdos_initialize_support(
if ( fat_fd->cln == 0 )
{
fat_fd->fat_file_size = fs_info->fat.vol.rdir_size;
- cl_buf_size = (fs_info->fat.vol.bpc > fs_info->fat.vol.rdir_size) ?
+ cl_buf_size = (fs_info->fat.vol.bpc > fs_info->fat.vol.rdir_size) ?
fs_info->fat.vol.bpc :
- fs_info->fat.vol.rdir_size;
- }
+ fs_info->fat.vol.rdir_size;
+ }
else
{
- rc = fat_file_size(temp_mt_entry, fat_fd);
+ rc = fat_file_size(temp_mt_entry, fat_fd);
if ( rc != RC_OK )
{
fat_file_close(temp_mt_entry, fat_fd);
@@ -117,7 +117,7 @@ msdos_initialize_support(
}
cl_buf_size = fs_info->fat.vol.bpc;
}
-
+
fs_info->cl_buf = (char *)calloc(cl_buf_size, sizeof(char));
if (fs_info->cl_buf == NULL)
{
@@ -144,6 +144,6 @@ msdos_initialize_support(
temp_mt_entry->mt_fs_root.node_access = fat_fd;
temp_mt_entry->mt_fs_root.handlers = directory_handlers;
temp_mt_entry->mt_fs_root.ops = op_table;
-
+
return rc;
}
diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c
index a778c7a869..7274fddaef 100644
--- a/cpukit/libfs/src/dosfs/msdos_misc.c
+++ b/cpukit/libfs/src/dosfs/msdos_misc.c
@@ -37,47 +37,47 @@
* token_len - length of returned token
*
* RETURNS:
- * token type, token and token length
+ * token type, token and token length
*
*/
-msdos_token_types_t
+msdos_token_types_t
msdos_get_token(const char *path, char *ret_token, int *token_len)
{
int rc = RC_OK;
register int i = 0;
msdos_token_types_t type = MSDOS_NAME;
- char token[MSDOS_NAME_MAX_WITH_DOT+1];
+ char token[MSDOS_NAME_MAX_WITH_DOT+1];
register char c;
- /*
+ /*
* Copy a name into token. (Remember NULL is a token.)
*/
c = path[i];
- while ( (!msdos_is_separator(c)) && (i <= MSDOS_NAME_MAX_WITH_DOT) )
+ while ( (!msdos_is_separator(c)) && (i <= MSDOS_NAME_MAX_WITH_DOT) )
{
token[i] = c;
if ( i == MSDOS_NAME_MAX_WITH_DOT )
return MSDOS_INVALID_TOKEN;
if ( !msdos_is_valid_name_char(c) )
- return MSDOS_INVALID_TOKEN;
+ return MSDOS_INVALID_TOKEN;
c = path [++i];
}
/*
* Copy a seperator into token.
*/
- if ( i == 0 )
+ if ( i == 0 )
{
token[i] = c;
- if ( token[i] != '\0' )
+ if ( token[i] != '\0' )
{
i++;
type = MSDOS_CURRENT_DIR;
- }
- else
+ }
+ else
type = MSDOS_NO_MORE_PATH;
- }
- else if (token[ i-1 ] != '\0')
+ }
+ else if (token[ i-1 ] != '\0')
token[i] = '\0';
/*
@@ -89,25 +89,25 @@ msdos_get_token(const char *path, char *ret_token, int *token_len)
* If we copied something that was not a seperator see if
* it was a special name.
*/
- if ( type == MSDOS_NAME )
+ if ( type == MSDOS_NAME )
{
if ( strcmp( token, "..") == 0 )
{
strcpy(ret_token, MSDOS_DOTDOT_NAME);
type = MSDOS_UP_DIR;
return type;
- }
+ }
if ( strcmp( token, "." ) == 0 )
{
strcpy(ret_token, MSDOS_DOT_NAME);
type = MSDOS_CURRENT_DIR;
- return type;
+ return type;
}
rc = msdos_filename_unix2dos(token, *token_len, ret_token);
if ( rc != RC_OK )
- return MSDOS_INVALID_TOKEN;
+ return MSDOS_INVALID_TOKEN;
}
ret_token[MSDOS_NAME_MAX] = '\0';
return type;
@@ -115,8 +115,8 @@ msdos_get_token(const char *path, char *ret_token, int *token_len)
/* msdos_find_name --
- * Find the node which correspondes to the name, open fat-file which
- * correspondes to the found node and close fat-file which correspondes
+ * Find the node which correspondes to the name, open fat-file which
+ * correspondes to the found node and close fat-file which correspondes
* to the node we searched in.
*
* PARAMETERS:
@@ -124,11 +124,11 @@ msdos_get_token(const char *path, char *ret_token, int *token_len)
* name - name to find
*
* RETURNS:
- * RC_OK and updated 'parent_loc' on success, or -1 if error
+ * RC_OK and updated 'parent_loc' on success, or -1 if error
* occured (errno set apropriately)
*
*/
-int
+int
msdos_find_name(
rtems_filesystem_location_info_t *parent_loc,
char *name
@@ -141,11 +141,11 @@ msdos_find_name(
unsigned short time_val = 0;
unsigned short date = 0;
unsigned char node_entry[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
-
+
memset(node_entry, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
-
- /*
- * find the node which correspondes to the name in the directory pointed by
+
+ /*
+ * find the node which correspondes to the name in the directory pointed by
* 'parent_loc'
*/
rc = msdos_get_name_node(parent_loc, name, &aux, node_entry);
@@ -156,12 +156,12 @@ msdos_find_name(
rc = fat_file_open(parent_loc->mt_entry, aux.cln, aux.ofs, &fat_fd);
if (rc != RC_OK)
return rc;
-
+
/*
- * I don't like this if, but: we should do it , or should write new file
- * size and first cluster num to the disk after each write operation
- * (even if one byte is written - that is TOO non-optimize) because
- * otherwise real values of these fields stored in fat-file descriptor
+ * I don't like this if, but: we should do it , or should write new file
+ * size and first cluster num to the disk after each write operation
+ * (even if one byte is written - that is TOO non-optimize) because
+ * otherwise real values of these fields stored in fat-file descriptor
* may be accidentely rewritten with wrong values stored on the disk
*/
if (fat_fd->links_num == 1)
@@ -170,17 +170,17 @@ msdos_find_name(
fat_fd->info_ofs = aux.ofs;
fat_fd->cln = MSDOS_EXTRACT_CLUSTER_NUM(node_entry);
fat_fd->first_char = *MSDOS_DIR_NAME(node_entry);
-
+
time_val = *MSDOS_DIR_WRITE_TIME(node_entry);
date = *MSDOS_DIR_WRITE_DATE(node_entry);
-
+
fat_fd->mtime = msdos_date_dos2unix(CF_LE_W(time_val), CF_LE_W(date));
-
+
if ((*MSDOS_DIR_ATTR(node_entry)) & MSDOS_ATTR_DIRECTORY)
{
fat_fd->fat_file_type = FAT_DIRECTORY;
- fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT;
-
+ fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT;
+
rc = fat_file_size(parent_loc->mt_entry, fat_fd);
if (rc != RC_OK)
{
@@ -190,16 +190,16 @@ msdos_find_name(
}
else
{
- fat_fd->fat_file_size = CF_LE_L(*MSDOS_DIR_FILE_SIZE(node_entry));
- fat_fd->fat_file_type = FAT_FILE;
+ fat_fd->fat_file_size = CF_LE_L(*MSDOS_DIR_FILE_SIZE(node_entry));
+ fat_fd->fat_file_type = FAT_FILE;
fat_fd->size_limit = MSDOS_MAX_FILE_SIZE;
}
-
+
/* these data is not actual for zero-length fat-file */
fat_fd->map.file_cln = 0;
fat_fd->map.disk_cln = fat_fd->cln;
-
- if ((fat_fd->fat_file_size != 0) &&
+
+ if ((fat_fd->fat_file_size != 0) &&
(fat_fd->fat_file_size <= fs_info->fat.vol.bpc))
{
fat_fd->map.last_cln = fat_fd->cln;
@@ -208,7 +208,7 @@ msdos_find_name(
{
fat_fd->map.last_cln = FAT_UNDEFINED_VALUE;
}
- }
+ }
/* close fat-file corresponded to the node we searched in */
rc = fat_file_close(parent_loc->mt_entry, parent_loc->node_access);
@@ -220,23 +220,23 @@ msdos_find_name(
/* update node_info_ptr field */
parent_loc->node_access = fat_fd;
-
+
return rc;
-}
+}
/* msdos_get_name_node --
* This routine is used in two ways: for a new mode creation (a) or for
* search the node which correspondes to the name parameter (b).
- * In case (a) 'name' should be set up to NULL and 'name_dir_entry' should
- * point to initialized 32 bytes structure described a new node.
+ * In case (a) 'name' should be set up to NULL and 'name_dir_entry' should
+ * point to initialized 32 bytes structure described a new node.
* In case (b) 'name' should contain a valid string.
*
- * (a): reading fat-file which correspondes to directory we are going to
- * create node in. If free slot is found write contents of
- * 'name_dir_entry' into it. If reach end of fat-file and no free
+ * (a): reading fat-file which correspondes to directory we are going to
+ * create node in. If free slot is found write contents of
+ * 'name_dir_entry' into it. If reach end of fat-file and no free
* slot found, write 32 bytes to the end of fat-file.
*
- * (b): reading fat-file which correspondes to directory and trying to
+ * (b): reading fat-file which correspondes to directory and trying to
* find slot with the name field == 'name' parameter
*
*
@@ -244,18 +244,18 @@ msdos_find_name(
* parent_loc - node description to create node in or to find name in
* name - NULL or name to find
* paux - identify a node location on the disk -
- * cluster num and offset inside the cluster
+ * cluster num and offset inside the cluster
* name_dir_entry - node to create/placeholder for found node (IN/OUT)
*
* RETURNS:
- * RC_OK, filled aux_struct_ptr and name_dir_entry on success, or -1 if
+ * RC_OK, filled aux_struct_ptr and name_dir_entry on success, or -1 if
* error occured (errno set apropriately)
*
*/
int
msdos_get_name_node(
- rtems_filesystem_location_info_t *parent_loc,
- char *name,
+ rtems_filesystem_location_info_t *parent_loc,
+ char *name,
fat_auxiliary_t *paux,
char *name_dir_entry
)
@@ -271,44 +271,44 @@ msdos_get_name_node(
name_dir_entry);
if ((rc != RC_OK) && (rc != MSDOS_NAME_NOT_FOUND_ERR))
return rc;
-
+
/* if we search for valid name and name not found -> return */
if ((rc == MSDOS_NAME_NOT_FOUND_ERR) && (name != NULL))
return rc;
-
- /*
- * if we try to create new entry and the directory is not big enough
- * currently - try to enlarge directory
+
+ /*
+ * if we try to create new entry and the directory is not big enough
+ * currently - try to enlarge directory
*/
if ((rc == MSDOS_NAME_NOT_FOUND_ERR) && (name == NULL))
{
- ret = fat_file_write(parent_loc->mt_entry, fat_fd,
- fat_fd->fat_file_size,
- MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE,
+ ret = fat_file_write(parent_loc->mt_entry, fat_fd,
+ fat_fd->fat_file_size,
+ MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE,
name_dir_entry);
if (ret == -1)
- return -1;
+ return -1;
/* on success directory is enlarged by a new cluster */
fat_fd->fat_file_size += fs_info->fat.vol.bpc;
-
+
/* get cluster num where a new node located */
rc = fat_file_ioctl(parent_loc->mt_entry, fat_fd, F_CLU_NUM,
fat_fd->fat_file_size - 1, &paux->cln);
-
+
if (rc != RC_OK)
return rc;
- /*
- * if new cluster allocated succesfully then new node is at very
- * beginning of the cluster (offset is computed in bytes)
+ /*
+ * if new cluster allocated succesfully then new node is at very
+ * beginning of the cluster (offset is computed in bytes)
*/
paux->ofs = 0;
- return RC_OK;
- }
-
- /*
- * if we have deal with ".." - it is a special case :(((
+ return RC_OK;
+ }
+
+ /*
+ * if we have deal with ".." - it is a special case :(((
*
* Really, we should return cluster num and offset not of ".." slot, but
* slot which correspondes to real directory name.
@@ -321,14 +321,14 @@ msdos_get_name_node(
/* are we right under root dir ? */
if (dotdot_cln == 0)
- {
- /*
- * we can relax about first_char field - it never should be
+ {
+ /*
+ * we can relax about first_char field - it never should be
* used for root dir
*/
paux->cln = FAT_ROOTDIR_CLUSTER_NUM;
paux->ofs = 0;
- }
+ }
else
{
rc = msdos_get_dotdot_dir_info_cluster_num_and_offset(
@@ -340,7 +340,7 @@ msdos_get_name_node(
if (rc != RC_OK)
return rc;
}
- }
+ }
}
return rc;
}
@@ -348,26 +348,26 @@ msdos_get_name_node(
/*
* msdos_get_dotdot_dir_info_cluster_num_and_offset
*
- * Unfortunately, in general, we cann't work here in fat-file ideologic
- * (open fat_file "..", get ".." and ".", open "..", find an entry ...)
+ * Unfortunately, in general, we cann't work here in fat-file ideologic
+ * (open fat_file "..", get ".." and ".", open "..", find an entry ...)
* because if we open
* fat-file ".." it may happend that we have two different fat-file
- * descriptors ( for real name of directory and ".." name ) for a single
+ * descriptors ( for real name of directory and ".." name ) for a single
* file ( cluster num of both pointers to the same cluster )
* But...we do it because we protected by semaphore
- *
+ *
*/
/* msdos_get_dotdot_dir_info_cluster_num_and_offset --
- * Get cluster num and offset not of ".." slot, but slot which correspondes
- * to real directory name.
+ * Get cluster num and offset not of ".." slot, but slot which correspondes
+ * to real directory name.
*
* PARAMETERS:
* mt_entry - mount table entry
* cln - data cluster num extracted drom ".." slot
* paux - identify a node location on the disk -
* number of cluster and offset inside the cluster
- * dir_entry - placeholder for found node
+ * dir_entry - placeholder for found node
*
* RETURNS:
* RC_OK, filled 'paux' and 'dir_entry' on success, or -1 if error occured
@@ -376,7 +376,7 @@ msdos_get_name_node(
*/
int
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,
uint32_t cln,
fat_auxiliary_t *paux,
char *dir_entry
@@ -389,24 +389,24 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
unsigned char dotdot_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
unsigned char cur_node[MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE];
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(cur_node, 0, MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
-
+
/*
* open fat-file corresponded to ".."
*/
rc = fat_file_open(mt_entry, paux->cln, paux->ofs, &fat_fd);
if (rc != RC_OK)
return rc;
-
+
fat_fd->info_cln = paux->cln;
fat_fd->info_ofs = paux->ofs;
fat_fd->cln = cln;
fat_fd->fat_file_type = FAT_DIRECTORY;
fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT;
-
+
fat_fd->map.file_cln = 0;
fat_fd->map.disk_cln = fat_fd->cln;
@@ -415,30 +415,30 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
{
fat_file_close(mt_entry, fat_fd);
return rc;
- }
-
+ }
+
/* find "." node in opened directory */
- rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOT_NAME, paux,
+ rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOT_NAME, paux,
dot_node);
-
+
if (rc != RC_OK)
{
fat_file_close(mt_entry, fat_fd);
return rc;
}
-
+
/* find ".." node in opened directory */
- rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOTDOT_NAME, paux,
+ rc = msdos_find_name_in_fat_file(mt_entry, fat_fd, MSDOS_DOTDOT_NAME, paux,
dotdot_node);
-
- if (rc != RC_OK)
+
+ if (rc != RC_OK)
{
fat_file_close(mt_entry, fat_fd);
return rc;
}
cl4find = MSDOS_EXTRACT_CLUSTER_NUM(dot_node);
-
+
/* close fat-file corresponded to ".." directory */
rc = fat_file_close(mt_entry, fat_fd);
if ( rc != RC_OK )
@@ -446,8 +446,8 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
if ( (MSDOS_EXTRACT_CLUSTER_NUM(dotdot_node)) == 0)
{
- /*
- * we handle root dir for all FAT types in the same way with the
+ /*
+ * we handle root dir for all FAT types in the same way with the
* ordinary directories ( through fat_file_* calls )
*/
paux->cln = FAT_ROOTDIR_CLUSTER_NUM;
@@ -469,7 +469,7 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
fat_fd->fat_file_type = FAT_DIRECTORY;
fat_fd->size_limit = MSDOS_MAX_DIR_LENGHT;
-
+
fat_fd->map.file_cln = 0;
fat_fd->map.disk_cln = fat_fd->cln;
@@ -478,10 +478,10 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
{
fat_file_close(mt_entry, fat_fd);
return rc;
- }
-
+ }
+
/* in this directory find slot with specified cluster num */
- rc = msdos_find_node_by_cluster_num_in_fat_file(mt_entry, fat_fd, cl4find,
+ rc = msdos_find_node_by_cluster_num_in_fat_file(mt_entry, fat_fd, cl4find,
paux, dir_entry);
if (rc != RC_OK)
{
@@ -494,11 +494,11 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
/* msdos_set_dir_wrt_time_and_date --
- * Write last write date and time for a file to the disk (to corresponded
- * 32bytes node)
+ * Write last write date and time for a file to the disk (to corresponded
+ * 32bytes node)
*
* PARAMETERS:
- * mt_entry - mount table entry
+ * mt_entry - mount table entry
* fat_fd - fat-file descriptor
*
* RETURNS:
@@ -507,7 +507,7 @@ msdos_get_dotdot_dir_info_cluster_num_and_offset(
*/
int
msdos_set_dir_wrt_time_and_date(
- rtems_filesystem_mount_table_entry_t *mt_entry,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd
)
{
@@ -517,10 +517,10 @@ msdos_set_dir_wrt_time_and_date(
unsigned short date;
uint32_t sec = 0;
uint32_t byte = 0;
-
+
msdos_date_unix2dos(fat_fd->mtime, &time_val, &date);
-
- /*
+
+ /*
* calculate input for _fat_block_write: convert (cluster num, offset) to
* (sector num, new offset)
*/
@@ -528,7 +528,7 @@ msdos_set_dir_wrt_time_and_date(
sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2);
/* byte points to start of 32bytes structure */
byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1);
-
+
time_val = CT_LE_W(time_val);
ret1 = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_WTIME_OFFSET,
2, (char *)(&time_val));
@@ -543,11 +543,11 @@ msdos_set_dir_wrt_time_and_date(
}
/* msdos_set_first_cluster_num --
- * Write number of first cluster of the file to the disk (to corresponded
- * 32bytes slot)
+ * Write number of first cluster of the file to the disk (to corresponded
+ * 32bytes slot)
*
* PARAMETERS:
- * mt_entry - mount table entry
+ * mt_entry - mount table entry
* fat_fd - fat-file descriptor
*
* RETURNS:
@@ -556,7 +556,7 @@ msdos_set_dir_wrt_time_and_date(
*/
int
msdos_set_first_cluster_num(
- rtems_filesystem_mount_table_entry_t *mt_entry,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd
)
{
@@ -564,11 +564,11 @@ msdos_set_first_cluster_num(
msdos_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t new_cln = fat_fd->cln;
uint16_t le_cl_low = 0;
- uint16_t le_cl_hi = 0;
+ uint16_t le_cl_hi = 0;
uint32_t sec = 0;
uint32_t byte = 0;
- /*
+ /*
* calculate input for _fat_block_write: convert (cluster num, offset) to
* (sector num, new offset)
*/
@@ -576,9 +576,9 @@ msdos_set_first_cluster_num(
sec += (fat_fd->info_ofs >> fs_info->fat.vol.sec_log2);
/* byte from points to start of 32bytes structure */
byte = fat_fd->info_ofs & (fs_info->fat.vol.bps - 1);
-
+
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,
(char *)(&le_cl_low));
le_cl_hi = CT_LE_W((uint16_t )((new_cln & 0xFFFF0000) >> 16));
@@ -593,10 +593,10 @@ msdos_set_first_cluster_num(
/* msdos_set_file size --
- * Write file size of the file to the disk (to corresponded 32bytes slot)
+ * Write file size of the file to the disk (to corresponded 32bytes slot)
*
* PARAMETERS:
- * mt_entry - mount table entry
+ * mt_entry - mount table entry
* fat_fd - fat-file descriptor
*
* RETURNS:
@@ -605,7 +605,7 @@ msdos_set_first_cluster_num(
*/
int
msdos_set_file_size(
- rtems_filesystem_mount_table_entry_t *mt_entry,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd
)
{
@@ -634,11 +634,11 @@ msdos_set_file_size(
*/
/* msdos_set_first_char4file_name --
- * Write first character of the name of the file to the disk (to
- * corresponded 32bytes slot)
+ * Write first character of the name of the file to the disk (to
+ * corresponded 32bytes slot)
*
* PARAMETERS:
- * mt_entry - mount table entry
+ * mt_entry - mount table entry
* cl - number of cluster
* ofs - offset inside cluster
* fchar - character to set up
@@ -647,9 +647,9 @@ msdos_set_file_size(
* RC_OK on success, or -1 if error occured (errno set apropriately)
*
*/
-int
+int
msdos_set_first_char4file_name(
- rtems_filesystem_mount_table_entry_t *mt_entry,
+ rtems_filesystem_mount_table_entry_t *mt_entry,
uint32_t cl,
uint32_t ofs,
unsigned char fchar
@@ -664,22 +664,22 @@ msdos_set_first_char4file_name(
sec += (ofs >> fs_info->fat.vol.sec_log2);
byte = (ofs & (fs_info->fat.vol.bps - 1));
- ret = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_NAME_OFFSET, 1,
+ ret = _fat_block_write(mt_entry, sec, byte + MSDOS_FILE_NAME_OFFSET, 1,
&fchar);
if ( ret < 0)
return -1;
return RC_OK;
-}
+}
/* msdos_dir_is_empty --
- * Check whether directory which correspondes to the fat-file descriptor is
- * empty.
+ * Check whether directory which correspondes to the fat-file descriptor is
+ * empty.
*
* PARAMETERS:
- * mt_entry - mount table entry
- * fat_fd - fat-file descriptor
- * ret_val - placeholder for result
+ * mt_entry - mount table entry
+ * fat_fd - fat-file descriptor
+ * ret_val - placeholder for result
*
* RETURNS:
* RC_OK on success, or -1 if error occured
@@ -688,48 +688,48 @@ msdos_set_first_char4file_name(
int
msdos_dir_is_empty(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
+ fat_file_fd_t *fat_fd,
rtems_boolean *ret_val
)
{
ssize_t ret = 0;
msdos_fs_info_t *fs_info = mt_entry->fs_info;
uint32_t j = 0, i = 0;
-
+
/* dir is not empty */
*ret_val = FALSE;
while ((ret = fat_file_read(mt_entry, fat_fd, j * fs_info->fat.vol.bps,
- fs_info->fat.vol.bps,
+ fs_info->fat.vol.bps,
fs_info->cl_buf)) != FAT_EOF)
{
if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
return -1;
assert(ret == fs_info->fat.vol.bps);
-
- for (i = 0;
- i < fs_info->fat.vol.bps;
+
+ for (i = 0;
+ i < fs_info->fat.vol.bps;
i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
{
- if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
- MSDOS_THIS_DIR_ENTRY_EMPTY) ||
- (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), MSDOS_DOT_NAME,
+ if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ MSDOS_THIS_DIR_ENTRY_EMPTY) ||
+ (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), MSDOS_DOT_NAME,
MSDOS_SHORT_NAME_LEN) == 0) ||
(strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)),
- MSDOS_DOTDOT_NAME,
+ MSDOS_DOTDOT_NAME,
MSDOS_SHORT_NAME_LEN) == 0))
continue;
- if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY)
{
*ret_val = TRUE;
return RC_OK;
}
return RC_OK;
- }
- j++;
+ }
+ j++;
}
*ret_val = TRUE;
return RC_OK;
@@ -739,35 +739,35 @@ msdos_dir_is_empty(
/* msdos_find_name_in_fat_file --
* This routine is used in two ways: for a new mode creation (a) or for
* search the node which correspondes to the 'name' parameter (b).
- * In case (a) name should be set up to NULL and 'name_dir_entry' should
- * point to initialized 32 bytes structure described a new node.
+ * In case (a) name should be set up to NULL and 'name_dir_entry' should
+ * point to initialized 32 bytes structure described a new node.
* In case (b) 'name' should contain a valid string.
*
* (a): reading fat-file corresponded to directory we are going to create
* node in. If found free slot write contents of name_dir_entry into
- * it.
+ * it.
*
* (b): reading fat-file corresponded to directory and trying to find slot
* with the name field == name parameter
*
* PARAMETERS:
- * mt_entry - mount table entry
- * fat_fd - fat-file descriptor
- * name - NULL or name to find
+ * mt_entry - mount table entry
+ * fat_fd - fat-file descriptor
+ * name - NULL or name to find
* paux - identify a node location on the disk -
* number of cluster and offset inside the cluster
* name_dir_entry - node to create/placeholder for found node
*
* RETURNS:
- * RC_OK on success, or error code if error occured (errno set
+ * RC_OK on success, or error code if error occured (errno set
* appropriately)
*
*/
int
msdos_find_name_in_fat_file(
rtems_filesystem_mount_table_entry_t *mt_entry,
- fat_file_fd_t *fat_fd,
- char *name,
+ fat_file_fd_t *fat_fd,
+ char *name,
fat_auxiliary_t *paux,
char *name_dir_entry
)
@@ -778,75 +778,75 @@ msdos_find_name_in_fat_file(
uint32_t i = 0, j = 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)))
- bts2rd = fat_fd->fat_file_size;
+ bts2rd = fat_fd->fat_file_size;
else
bts2rd = fs_info->fat.vol.bpc;
-
- while ((ret = fat_file_read(mt_entry, fat_fd, (j * bts2rd), bts2rd,
- fs_info->cl_buf)) != FAT_EOF)
+
+ while ((ret = fat_file_read(mt_entry, fat_fd, (j * bts2rd), bts2rd,
+ fs_info->cl_buf)) != FAT_EOF)
{
if (ret < MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
set_errno_and_return_minus_one(EIO);
-
- assert(ret == bts2rd);
+
+ assert(ret == bts2rd);
for (i = 0; i < bts2rd; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
{
/* is the entry empty ? */
- if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY) ||
- ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_EMPTY))
{
/* whether we are looking for an empty entry */
if (name == NULL)
{
/* get current cluster number */
- rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM,
+ rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM,
j * bts2rd, &paux->cln);
if (rc != RC_OK)
return rc;
/* offset is computed in bytes */
paux->ofs = i;
-
+
/* write new node entry */
- ret = fat_file_write(mt_entry, fat_fd, j * bts2rd + i,
+ ret = fat_file_write(mt_entry, fat_fd, j * bts2rd + i,
MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE,
name_dir_entry);
if (ret != MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
return -1;
- /*
- * we don't update fat_file_size here - it should not
- * increase
+ /*
+ * we don't update fat_file_size here - it should not
+ * increase
*/
return RC_OK;
}
- /*
- * if name != NULL and there is no more entries in the
+ /*
+ * if name != NULL and there is no more entries in the
* directory - return name-not-found
*/
- if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
+ if (((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY))
return MSDOS_NAME_NOT_FOUND_ERR;
- }
+ }
else
{
/* entry not empty and name != NULL -> compare names */
if (name != NULL)
{
- if (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), name,
+ if (strncmp(MSDOS_DIR_NAME((fs_info->cl_buf + i)), name,
MSDOS_SHORT_NAME_LEN) == 0)
{
- /*
- * we get the entry we looked for - fill auxiliary
+ /*
+ * we get the entry we looked for - fill auxiliary
* structure and copy all 32 bytes of the entry
*/
- rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM,
+ rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM,
j * bts2rd, &paux->cln);
if (rc != RC_OK)
return rc;
@@ -857,11 +857,11 @@ msdos_find_name_in_fat_file(
MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
return RC_OK;
}
- }
- }
- }
+ }
+ }
+ }
j++;
- }
+ }
return MSDOS_NAME_NOT_FOUND_ERR;
}
@@ -869,9 +869,9 @@ msdos_find_name_in_fat_file(
* Find node with specified number of cluster in fat-file.
*
* PARAMETERS:
- * mt_entry - mount table entry
- * fat_fd - fat-file descriptor
- * cl4find - number of cluster to find
+ * mt_entry - mount table entry
+ * fat_fd - fat-file descriptor
+ * cl4find - number of cluster to find
* paux - identify a node location on the disk -
* cluster num and offset inside the cluster
* dir_entry - placeholder for found node
@@ -884,7 +884,7 @@ int
msdos_find_node_by_cluster_num_in_fat_file(
rtems_filesystem_mount_table_entry_t *mt_entry,
fat_file_fd_t *fat_fd,
- uint32_t cl4find,
+ uint32_t cl4find,
fat_auxiliary_t *paux,
char *dir_entry
)
@@ -892,12 +892,12 @@ msdos_find_node_by_cluster_num_in_fat_file(
int rc = RC_OK;
ssize_t ret = 0;
msdos_fs_info_t *fs_info = mt_entry->fs_info;
- uint32_t bts2rd = 0;
+ uint32_t bts2rd = 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)))
- bts2rd = fat_fd->fat_file_size;
+ bts2rd = fat_fd->fat_file_size;
else
bts2rd = fs_info->fat.vol.bpc;
@@ -908,7 +908,7 @@ msdos_find_node_by_cluster_num_in_fat_file(
set_errno_and_return_minus_one( EIO );
assert(ret == bts2rd);
-
+
for (i = 0; i < bts2rd; i += MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE)
{
/* if this and all rest entries are empty - return not-found */
@@ -916,7 +916,7 @@ msdos_find_node_by_cluster_num_in_fat_file(
MSDOS_THIS_DIR_ENTRY_AND_REST_EMPTY)
return MSDOS_NAME_NOT_FOUND_ERR;
- /* if this entry is empty - skip it */
+ /* if this entry is empty - skip it */
if ((*MSDOS_DIR_NAME(fs_info->cl_buf + i)) ==
MSDOS_THIS_DIR_ENTRY_EMPTY)
continue;
@@ -925,18 +925,18 @@ msdos_find_node_by_cluster_num_in_fat_file(
if (MSDOS_EXTRACT_CLUSTER_NUM((fs_info->cl_buf + i)) == cl4find)
{
/* on success fill aux structure and copy all 32 bytes */
- rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, j * bts2rd,
+ rc = fat_file_ioctl(mt_entry, fat_fd, F_CLU_NUM, j * bts2rd,
&paux->cln);
if (rc != RC_OK)
return rc;
paux->ofs = i;
- memcpy(dir_entry, fs_info->cl_buf + i,
+ memcpy(dir_entry, fs_info->cl_buf + i,
MSDOS_DIRECTORY_ENTRY_STRUCT_SIZE);
return RC_OK;
}
- }
+ }
j++;
- }
+ }
return MSDOS_NAME_NOT_FOUND_ERR;
}
diff --git a/cpukit/libfs/src/dosfs/msdos_mknod.c b/cpukit/libfs/src/dosfs/msdos_mknod.c
index a7b91850df..a17de1ade1 100644
--- a/cpukit/libfs/src/dosfs/msdos_mknod.c
+++ b/cpukit/libfs/src/dosfs/msdos_mknod.c
@@ -45,22 +45,22 @@
* RC_OK on succes, or -1 if error occured and set errno
*
*/
-int
+int
msdos_mknod(
const char *token,
- mode_t mode,
+ mode_t mode,
dev_t dev,
- rtems_filesystem_location_info_t *pathloc
+ rtems_filesystem_location_info_t *pathloc
)
{
- int rc = RC_OK;
+ int rc = RC_OK;
rtems_status_code sc = RTEMS_SUCCESSFUL;
- msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
+ msdos_fs_info_t *fs_info = pathloc->mt_entry->fs_info;
msdos_token_types_t type = 0;
char new_name[ MSDOS_NAME_MAX + 1 ];
int len;
- /* check spelling and format new node name */
+ /* check spelling and format new node name */
msdos_get_token(token, new_name, &len);
/*
@@ -69,12 +69,12 @@ msdos_mknod(
if (S_ISDIR(mode))
{
type = MSDOS_DIRECTORY;
- }
+ }
else if (S_ISREG(mode))
{
type = MSDOS_REGULAR_FILE;
- }
- else
+ }
+ else
set_errno_and_return_minus_one(EINVAL);
sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
diff --git a/cpukit/libfs/src/dosfs/msdos_node_type.c b/cpukit/libfs/src/dosfs/msdos_node_type.c
index 124b445b35..877cf60492 100644
--- a/cpukit/libfs/src/dosfs/msdos_node_type.c
+++ b/cpukit/libfs/src/dosfs/msdos_node_type.c
@@ -33,7 +33,7 @@
/* msdos_node_type --
* Determine type of the node that the pathloc refers to.
- *
+ *
* PARAMETERS:
* pathloc - node description
*
@@ -41,18 +41,18 @@
* node type
*
*/
-rtems_filesystem_node_types_t
+rtems_filesystem_node_types_t
msdos_node_type(rtems_filesystem_location_info_t *pathloc)
{
fat_file_fd_t *fat_fd;
- /*
- * we don't need to obtain the volume semaphore here because node_type_h
- * call always follows evalpath_h call(hence link increment occured) and
- * hence node_access memory can't be freed during processing node_type_h
+ /*
+ * we don't need to obtain the volume semaphore here because node_type_h
+ * call always follows evalpath_h call(hence link increment occured) and
+ * hence node_access memory can't be freed during processing node_type_h
* call
*/
fat_fd = pathloc->node_access;
-
- return fat_fd->fat_file_type;
+
+ return fat_fd->fat_file_type;
}
diff --git a/cpukit/libfs/src/imfs/deviceio.c b/cpukit/libfs/src/imfs/deviceio.c
index 4737d087c8..c0758396e3 100644
--- a/cpukit/libfs/src/imfs/deviceio.c
+++ b/cpukit/libfs/src/imfs/deviceio.c
@@ -47,7 +47,7 @@ static int
rtems_deviceio_errno(rtems_status_code code)
{
int rc;
-
+
if ((rc = rtems_assoc_remote_by_local(errno_assoc, (uint32_t ) code)))
{
errno = rc;
diff --git a/cpukit/libfs/src/imfs/imfs.h b/cpukit/libfs/src/imfs/imfs.h
index d2ee3fa5a6..eb41abd03d 100644
--- a/cpukit/libfs/src/imfs/imfs.h
+++ b/cpukit/libfs/src/imfs/imfs.h
@@ -138,9 +138,9 @@ typedef union {
IMFS_directory_t directory;
IMFS_device_t device;
IMFS_link_t hard_link;
- IMFS_sym_link_t sym_link;
- IMFS_memfile_t file;
- IMFS_linearfile_t linearfile;
+ IMFS_sym_link_t sym_link;
+ IMFS_memfile_t file;
+ IMFS_linearfile_t linearfile;
} IMFS_types_union;
/*
@@ -156,7 +156,7 @@ typedef union {
struct IMFS_jnode_tt {
Chain_Node Node; /* for chaining them together */
IMFS_jnode_t *Parent; /* Parent node */
- char name[IMFS_NAME_MAX+1]; /* "basename" */
+ char name[IMFS_NAME_MAX+1]; /* "basename" */
mode_t st_mode; /* File mode */
nlink_t st_nlink; /* Link count */
ino_t st_ino; /* inode */
@@ -177,14 +177,14 @@ struct IMFS_jnode_tt {
gettimeofday( &tv, 0 ); \
_jnode->stat_atime = (time_t) tv.tv_sec; \
} while (0)
-
+
#define IMFS_update_mtime( _jnode ) \
do { \
struct timeval tv; \
gettimeofday( &tv, 0 ); \
_jnode->stat_mtime = (time_t) tv.tv_sec; \
} while (0)
-
+
#define IMFS_update_ctime( _jnode ) \
do { \
struct timeval tv; \
@@ -216,7 +216,7 @@ typedef struct {
#endif
#define decrement_linkcounts( _fs_info ) \
- ((IMFS_fs_info_t * )_fs_info)->link_counts--;
+ ((IMFS_fs_info_t * )_fs_info)->link_counts--;
/*
* Type defination for tokens returned from IMFS_get_token
@@ -241,21 +241,21 @@ extern rtems_filesystem_file_handlers_r IMFS_linearfile_handlers;
extern rtems_filesystem_file_handlers_r IMFS_memfile_handlers;
extern rtems_filesystem_operations_table IMFS_ops;
extern rtems_filesystem_operations_table miniIMFS_ops;
-extern rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS;
+extern rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS;
/*
* Routines
*/
-int IMFS_initialize(
+int IMFS_initialize(
rtems_filesystem_mount_table_entry_t *mt_entry
);
-int miniIMFS_initialize(
+int miniIMFS_initialize(
rtems_filesystem_mount_table_entry_t *mt_entry
);
-int IMFS_initialize_support(
+int IMFS_initialize_support(
rtems_filesystem_mount_table_entry_t *mt_entry,
rtems_filesystem_operations_table *op_table,
rtems_filesystem_file_handlers_r *linearfile_handlers,
@@ -306,8 +306,8 @@ int IMFS_stat(
struct stat *buf /* OUT */
);
-int IMFS_Set_handlers(
- rtems_filesystem_location_info_t *loc
+int IMFS_Set_handlers(
+ rtems_filesystem_location_info_t *loc
);
int IMFS_evaluate_link(
@@ -315,7 +315,7 @@ int IMFS_evaluate_link(
int flags /* IN */
);
-int IMFS_eval_path(
+int IMFS_eval_path(
const char *pathname, /* IN */
int flags, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN/OUT */
@@ -522,7 +522,7 @@ int IMFS_symlink(
int IMFS_readlink(
rtems_filesystem_location_info_t *loc, /* IN */
char *buf, /* OUT */
- size_t bufsize
+ size_t bufsize
);
int IMFS_fdatasync(
diff --git a/cpukit/libfs/src/imfs/imfs_chown.c b/cpukit/libfs/src/imfs/imfs_chown.c
index 344ce6387f..7f0c7b5688 100644
--- a/cpukit/libfs/src/imfs/imfs_chown.c
+++ b/cpukit/libfs/src/imfs/imfs_chown.c
@@ -1,7 +1,7 @@
/*
* IMFS_chown
*
- * This routine is the implementation of the chown() system
+ * This routine is the implementation of the chown() system
* call for the IMFS.
*
* COPYRIGHT (c) 1989-1999.
diff --git a/cpukit/libfs/src/imfs/imfs_creat.c b/cpukit/libfs/src/imfs/imfs_creat.c
index c95b99a96b..94d9dac9c1 100644
--- a/cpukit/libfs/src/imfs/imfs_creat.c
+++ b/cpukit/libfs/src/imfs/imfs_creat.c
@@ -61,7 +61,7 @@ IMFS_jnode_t *IMFS_create_node(
*/
node->st_mode = mode & ~rtems_filesystem_umask;
-
+
#if defined(RTEMS_POSIX_API)
node->st_uid = geteuid();
node->st_gid = getegid();
diff --git a/cpukit/libfs/src/imfs/imfs_debug.c b/cpukit/libfs/src/imfs/imfs_debug.c
index 1927a69f22..094e90657d 100644
--- a/cpukit/libfs/src/imfs/imfs_debug.c
+++ b/cpukit/libfs/src/imfs/imfs_debug.c
@@ -33,7 +33,7 @@
*
* Printable names for each of the IMFS file system types.
*/
-
+
char *IMFS_types[ IMFS_NUMBER_OF_TYPES ] = {
"directory",
"device",
@@ -48,7 +48,7 @@ char *IMFS_types[ IMFS_NUMBER_OF_TYPES ] = {
* This routine prints the contents of the specified jnode.
*/
-void IMFS_print_jnode(
+void IMFS_print_jnode(
IMFS_jnode_t *the_jnode
)
{
diff --git a/cpukit/libfs/src/imfs/imfs_directory.c b/cpukit/libfs/src/imfs/imfs_directory.c
index c9b88ef23c..b5ce125321 100644
--- a/cpukit/libfs/src/imfs/imfs_directory.c
+++ b/cpukit/libfs/src/imfs/imfs_directory.c
@@ -34,11 +34,11 @@
* imfs_dir_open
*
* This rountine will verify that the node being opened as a directory is
- * in fact a directory node. If it is then the offset into the directory
+ * in fact a directory node. If it is then the offset into the directory
* will be set to 0 to position to the first directory entry.
*/
-int imfs_dir_open(
+int imfs_dir_open(
rtems_libio_t *iop,
const char *pathname,
uint32_t flag,
@@ -60,14 +60,14 @@ int imfs_dir_open(
/*
* imfs_dir_read
*
- * This routine will read the next directory entry based on the directory
+ * This routine will read the next directory entry based on the directory
* offset. The offset should be equal to -n- time the size of an individual
- * dirent structure. If n is not an integer multiple of the sizeof a
- * dirent structure, an integer division will be performed to determine
+ * dirent structure. If n is not an integer multiple of the sizeof a
+ * dirent structure, an integer division will be performed to determine
* directory entry that will be returned in the buffer. Count should reflect
* -m- times the sizeof dirent bytes to be placed in the buffer.
* If there are not -m- dirent elements from the current directory position
- * to the end of the exisiting file, the remaining entries will be placed in
+ * to the end of the exisiting file, the remaining entries will be placed in
* the buffer and the returned value will be equal to -m actual- times the
* size of a directory entry.
*/
@@ -93,7 +93,7 @@ ssize_t imfs_dir_read(
the_jnode = (IMFS_jnode_t *)iop->file_info;
the_chain = &the_jnode->info.directory.Entries;
-
+
if ( Chain_Is_empty( the_chain ) )
return 0;
@@ -107,18 +107,18 @@ ssize_t imfs_dir_read(
last_entry = first_entry + (count/sizeof(struct dirent)) * sizeof(struct dirent);
/* The directory was not empty so try to move to the desired entry in chain*/
- for (
- current_entry = 0;
- current_entry < last_entry;
+ for (
+ current_entry = 0;
+ current_entry < last_entry;
current_entry = current_entry + sizeof(struct dirent) ){
- if ( Chain_Is_tail( the_chain, the_node ) ){
+ if ( Chain_Is_tail( the_chain, the_node ) ){
/* We hit the tail of the chain while trying to move to the first */
/* entry in the read */
return bytes_transferred; /* Indicate that there are no more */
/* entries to return */
}
-
+
if( current_entry >= first_entry ) {
/* Move the entry to the return buffer */
tmp_dirent.d_off = current_entry;
@@ -127,10 +127,10 @@ ssize_t imfs_dir_read(
tmp_dirent.d_ino = the_jnode->st_ino;
tmp_dirent.d_namlen = strlen( the_jnode->name );
strcpy( tmp_dirent.d_name, the_jnode->name );
- memcpy(
- buffer + bytes_transferred,
- (void *)&tmp_dirent,
- sizeof( struct dirent )
+ memcpy(
+ buffer + bytes_transferred,
+ (void *)&tmp_dirent,
+ sizeof( struct dirent )
);
iop->offset = iop->offset + sizeof(struct dirent);
bytes_transferred = bytes_transferred + sizeof( struct dirent );
@@ -161,7 +161,7 @@ int imfs_dir_close(
* and associated memory. At present the imfs_dir_close simply
* returns a successful completion status.
*/
-
+
return 0;
}
@@ -170,7 +170,7 @@ int imfs_dir_close(
/*
* imfs_dir_lseek
*
- * This routine will behave in one of three ways based on the state of
+ * This routine will behave in one of three ways based on the state of
* argument whence. Based on the state of its value the offset argument will
* be interpreted using one of the following methods:
*
@@ -210,7 +210,7 @@ int imfs_dir_lseek(
/*
* imfs_dir_fstat
*
- * This routine will obtain the following information concerning the current
+ * This routine will obtain the following information concerning the current
* directory:
* st_dev 0ll
* st_ino 1
@@ -219,9 +219,9 @@ int imfs_dir_lseek(
* st_uid uid extracted from the jnode
* st_gid gid extracted from the jnode
* st_rdev 0ll
- * st_size the number of bytes in the directory
+ * st_size the number of bytes in the directory
* This is calculated by taking the number of entries
- * in the directory and multiplying by the size of a
+ * in the directory and multiplying by the size of a
* dirent structure
* st_blksize 0
* st_blocks 0
@@ -267,7 +267,7 @@ int imfs_dir_fstat(
for ( the_node = the_chain->first ;
!_Chain_Is_tail( the_chain, the_node ) ;
the_node = the_node->next ) {
-
+
buf->st_size = buf->st_size + sizeof( struct dirent );
}
@@ -277,7 +277,7 @@ int imfs_dir_fstat(
/*
* IMFS_dir_rmnod
*
- * This routine is available from the optable to remove a node
+ * This routine is available from the optable to remove a node
* from the IMFS file system.
*/
@@ -285,33 +285,33 @@ int imfs_dir_rmnod(
rtems_filesystem_location_info_t *pathloc /* IN */
)
{
- IMFS_jnode_t *the_jnode;
+ IMFS_jnode_t *the_jnode;
the_jnode = (IMFS_jnode_t *) pathloc->node_access;
- /*
- * You cannot remove a node that still has children
+ /*
+ * You cannot remove a node that still has children
*/
if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) )
rtems_set_errno_and_return_minus_one( ENOTEMPTY );
- /*
+ /*
* You cannot remove the file system root node.
*/
if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access )
rtems_set_errno_and_return_minus_one( EBUSY );
- /*
+ /*
* You cannot remove a mountpoint.
*/
if ( the_jnode->info.directory.mt_fs != NULL )
- rtems_set_errno_and_return_minus_one( EBUSY );
-
- /*
- * Take the node out of the parent's chain that contains this node
+ rtems_set_errno_and_return_minus_one( EBUSY );
+
+ /*
+ * Take the node out of the parent's chain that contains this node
*/
if ( the_jnode->Parent != NULL ) {
@@ -332,7 +332,7 @@ int imfs_dir_rmnod(
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
- /*
+ /*
* Is the rtems_filesystem_current is this node?
*/
diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c
index f53a33e02f..b2bac3f4da 100644
--- a/cpukit/libfs/src/imfs/imfs_eval.c
+++ b/cpukit/libfs/src/imfs/imfs_eval.c
@@ -81,30 +81,30 @@ int IMFS_evaluate_permission(
if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 );
- rtems_set_errno_and_return_minus_one( EIO );
+ rtems_set_errno_and_return_minus_one( EIO );
}
jnode = node->node_access;
#if defined(RTEMS_POSIX_API)
st_uid = geteuid();
- st_gid = getegid();
+ st_gid = getegid();
#else
st_uid = jnode->st_uid;
st_gid = jnode->st_gid;
#endif
-
+
/*
* Check if I am owner or a group member or someone else.
*/
-
+
flags_to_test = flags;
if ( st_uid == jnode->st_uid )
flags_to_test <<= 6;
else if ( st_gid == jnode->st_gid )
flags_to_test <<= 3;
- else
+ else
/* must be other - do nothing */;
/*
@@ -143,7 +143,7 @@ int IMFS_evaluate_hard_link(
*/
node->node_access = jnode->info.hard_link.link_node;
-
+
IMFS_Set_handlers( node );
/*
@@ -157,13 +157,13 @@ int IMFS_evaluate_hard_link(
}
-/*
+/*
* IMFS_evaluate_sym_link
*
* The following routine evaluates a symbolic link to the actual node.
*/
-int IMFS_evaluate_sym_link(
+int IMFS_evaluate_sym_link(
rtems_filesystem_location_info_t *node, /* IN/OUT */
int flags /* IN */
)
@@ -190,7 +190,7 @@ int IMFS_evaluate_sym_link(
node->node_access = jnode->Parent;
- rtems_filesystem_get_sym_start_loc(
+ rtems_filesystem_get_sym_start_loc(
jnode->info.sym_link.name,
&i,
node
@@ -200,7 +200,7 @@ int IMFS_evaluate_sym_link(
* Use eval path to evaluate the path of the symbolic link.
*/
- result = IMFS_eval_path(
+ result = IMFS_eval_path(
&jnode->info.sym_link.name[i],
flags,
node
@@ -224,7 +224,7 @@ int IMFS_evaluate_sym_link(
* The following routine returns the real node pointed to by a link.
*/
-int IMFS_evaluate_link(
+int IMFS_evaluate_link(
rtems_filesystem_location_info_t *node, /* IN/OUT */
int flags /* IN */
)
@@ -255,7 +255,7 @@ int IMFS_evaluate_link(
else if (jnode->type == IMFS_SYM_LINK )
result = IMFS_evaluate_sym_link( node, flags );
- } while ( ( result == 0 ) && ( ( jnode->type == IMFS_SYM_LINK ) ||
+ } while ( ( result == 0 ) && ( ( jnode->type == IMFS_SYM_LINK ) ||
( jnode->type == IMFS_HARD_LINK ) ) );
/*
@@ -265,7 +265,7 @@ int IMFS_evaluate_link(
rtems_filesystem_link_counts = 0;
return result;
-}
+}
/*
@@ -273,7 +273,7 @@ int IMFS_evaluate_link(
*
* The following routine evaluate path for a new node to be created.
* pathloc is returned with a pointer to the parent of the new node.
- * name is returned with a pointer to the first character in the
+ * name is returned with a pointer to the first character in the
* new node name. The parent node is verified to be a directory.
*/
@@ -290,8 +290,8 @@ int IMFS_evaluate_for_make(
rtems_filesystem_location_info_t newloc;
IMFS_jnode_t *node;
int done = 0;
- int result;
-
+ int result;
+
/*
* This was filled in by the caller and is valid in the
* mount table.
@@ -306,7 +306,7 @@ int IMFS_evaluate_for_make(
type = IMFS_get_token( &path[i], token, &len );
i += len;
-
+
if ( !pathloc->node_access )
rtems_set_errno_and_return_minus_one( ENOENT );
@@ -343,7 +343,7 @@ int IMFS_evaluate_for_make(
*/
if ( pathloc->node_access == rtems_filesystem_root.node_access ) {
- break;
+ break;
} else {
newloc = pathloc->mt_entry->mt_point_node;
@@ -379,7 +379,7 @@ int IMFS_evaluate_for_make(
node = pathloc->node_access;
if ( !node )
- rtems_set_errno_and_return_minus_one( ENOTDIR );
+ rtems_set_errno_and_return_minus_one( ENOTDIR );
/*
* Only a directory can be decended into.
@@ -406,7 +406,7 @@ int IMFS_evaluate_for_make(
node = IMFS_find_match_in_dir( node, token );
/*
- * If there is no node we have found the name of the node we
+ * If there is no node we have found the name of the node we
* wish to create.
*/
@@ -416,7 +416,7 @@ int IMFS_evaluate_for_make(
pathloc->node_access = node;
break;
-
+
case IMFS_NO_MORE_PATH:
rtems_set_errno_and_return_minus_one( EEXIST );
break;
@@ -431,18 +431,18 @@ int IMFS_evaluate_for_make(
}
*name = &path[ i - len ];
-
+
/*
* We have evaluated the path as far as we can.
- * Verify there is not any invalid stuff at the end of the name.
+ * Verify there is not any invalid stuff at the end of the name.
*/
for( ; path[i] != '\0'; i++) {
- if ( !IMFS_is_separator( path[ i ] ) )
+ if ( !IMFS_is_separator( path[ i ] ) )
rtems_set_errno_and_return_minus_one( ENOENT );
}
- /*
+ /*
* Verify we can execute and write to this directory.
*/
@@ -461,7 +461,7 @@ int IMFS_evaluate_for_make(
if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
rtems_set_errno_and_return_minus_one( EACCES );
-
+
return result;
}
@@ -474,7 +474,7 @@ int IMFS_evaluate_for_make(
* node to be accessed.
*/
-int IMFS_eval_path(
+int IMFS_eval_path(
const char *pathname, /* IN */
int flags, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN/OUT */
@@ -486,15 +486,15 @@ int IMFS_eval_path(
char token[ IMFS_NAME_MAX + 1 ];
rtems_filesystem_location_info_t newloc;
IMFS_jnode_t *node;
- int result;
+ int result;
if ( !rtems_libio_is_valid_perms( flags ) ) {
assert( 0 );
- rtems_set_errno_and_return_minus_one( EIO );
+ rtems_set_errno_and_return_minus_one( EIO );
}
/*
- * This was filled in by the caller and is valid in the
+ * This was filled in by the caller and is valid in the
* mount table.
*/
@@ -508,7 +508,7 @@ int IMFS_eval_path(
type = IMFS_get_token( &pathname[i], token, &len );
i += len;
-
+
if ( !pathloc->node_access )
rtems_set_errno_and_return_minus_one( ENOENT );
@@ -535,7 +535,7 @@ int IMFS_eval_path(
* Am I at the root of this mounted filesystem?
*/
- if (pathloc->node_access ==
+ if (pathloc->node_access ==
pathloc->mt_entry->mt_fs_root.node_access) {
/*
@@ -565,7 +565,7 @@ int IMFS_eval_path(
case IMFS_NAME:
/*
* If we are at a link follow it.
- */
+ */
if ( node->type == IMFS_HARD_LINK ) {
diff --git a/cpukit/libfs/src/imfs/imfs_fchmod.c b/cpukit/libfs/src/imfs/imfs_fchmod.c
index b4c6dc0972..4d30b98781 100644
--- a/cpukit/libfs/src/imfs/imfs_fchmod.c
+++ b/cpukit/libfs/src/imfs/imfs_fchmod.c
@@ -37,7 +37,7 @@ int IMFS_fchmod(
unsigned int length
);
-
+
jnode = loc->node_access;
/*
diff --git a/cpukit/libfs/src/imfs/imfs_fcntl.c b/cpukit/libfs/src/imfs/imfs_fcntl.c
index d6dcd4d75e..ca802b8331 100644
--- a/cpukit/libfs/src/imfs/imfs_fcntl.c
+++ b/cpukit/libfs/src/imfs/imfs_fcntl.c
@@ -1,7 +1,7 @@
/*
* IMFS_fcntl
*
- * The following routine does a fcntl on an IMFS node.
+ * The following routine does a fcntl on an IMFS node.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
diff --git a/cpukit/libfs/src/imfs/imfs_free.c b/cpukit/libfs/src/imfs/imfs_free.c
index 19b4f1b7e0..affbcaa044 100644
--- a/cpukit/libfs/src/imfs/imfs_free.c
+++ b/cpukit/libfs/src/imfs/imfs_free.c
@@ -25,8 +25,8 @@
* IMFS_freenodinfo
*
* This routine is the IMFS free node handler for the file system
- * operations table.
- *
+ * operations table.
+ *
* The In Memory File System keeps its nodes in memory. This routine
* is for file sytems that do not.
*/
diff --git a/cpukit/libfs/src/imfs/imfs_fsunmount.c b/cpukit/libfs/src/imfs/imfs_fsunmount.c
index 72e44af6d8..c87b2e665b 100644
--- a/cpukit/libfs/src/imfs/imfs_fsunmount.c
+++ b/cpukit/libfs/src/imfs/imfs_fsunmount.c
@@ -51,17 +51,17 @@ int IMFS_fsunmount(
{
IMFS_jnode_t *jnode;
IMFS_jnode_t *next;
- rtems_filesystem_location_info_t loc;
+ rtems_filesystem_location_info_t loc;
int result = 0;
- /*
- * Traverse tree that starts at the mt_fs_root and deallocate memory
+ /*
+ * Traverse tree that starts at the mt_fs_root and deallocate memory
* associated memory space
*/
-
+
jnode = (IMFS_jnode_t *)temp_mt_entry->mt_fs_root.node_access;
loc = temp_mt_entry->mt_fs_root;
-
+
/*
* Set this to null to indicate that it is being unmounted.
*/
diff --git a/cpukit/libfs/src/imfs/imfs_getchild.c b/cpukit/libfs/src/imfs/imfs_getchild.c
index 51b9ddb6cc..67663db8ea 100644
--- a/cpukit/libfs/src/imfs/imfs_getchild.c
+++ b/cpukit/libfs/src/imfs/imfs_getchild.c
@@ -26,7 +26,7 @@ static char dotname[2] = ".";
static char dotdotname[3] = "..";
IMFS_jnode_t *IMFS_find_match_in_dir(
- IMFS_jnode_t *directory,
+ IMFS_jnode_t *directory,
char *name
)
{
diff --git a/cpukit/libfs/src/imfs/imfs_gtkn.c b/cpukit/libfs/src/imfs/imfs_gtkn.c
index ad6a1f8d5e..09f1ab0174 100644
--- a/cpukit/libfs/src/imfs/imfs_gtkn.c
+++ b/cpukit/libfs/src/imfs/imfs_gtkn.c
@@ -1,5 +1,5 @@
/*
- * IMFS_get_token
+ * IMFS_get_token
*
* Routine to get a token (name or separator) from the path
* the length of the token is returned in token_len.
@@ -34,7 +34,7 @@ IMFS_token_types IMFS_get_token(
IMFS_token_types type = IMFS_NAME;
register char c;
- /*
+ /*
* Copy a name into token. (Remember NULL is a token.)
*/
c = path[i];
@@ -46,7 +46,7 @@ IMFS_token_types IMFS_get_token(
return IMFS_INVALID_TOKEN;
if ( !IMFS_is_valid_name_char(c) )
- type = IMFS_INVALID_TOKEN;
+ type = IMFS_INVALID_TOKEN;
c = path [++i];
}
diff --git a/cpukit/libfs/src/imfs/imfs_init.c b/cpukit/libfs/src/imfs/imfs_init.c
index 0f6d4fda6c..6582e72614 100644
--- a/cpukit/libfs/src/imfs/imfs_init.c
+++ b/cpukit/libfs/src/imfs/imfs_init.c
@@ -29,7 +29,7 @@
#include <stdio.h>
#endif
-/*
+/*
* IMFS file system operations table
*/
diff --git a/cpukit/libfs/src/imfs/imfs_link.c b/cpukit/libfs/src/imfs/imfs_link.c
index e38259ad7e..43c1613cfc 100644
--- a/cpukit/libfs/src/imfs/imfs_link.c
+++ b/cpukit/libfs/src/imfs/imfs_link.c
@@ -1,5 +1,5 @@
/*
- * IMFS_link
+ * IMFS_link
*
* The following rouine creates a new link node under parent with the
* name given in name. The link node is set to point to the node at
@@ -42,7 +42,7 @@ int IMFS_link(
info.hard_link.link_node = to_loc->node_access;
if ( info.hard_link.link_node->st_nlink >= LINK_MAX )
rtems_set_errno_and_return_minus_one( EMLINK );
-
+
/*
* Remove any separators at the end of the string.
*/
@@ -56,7 +56,7 @@ int IMFS_link(
new_node = IMFS_create_node(
parent_loc,
IMFS_HARD_LINK,
- new_name,
+ new_name,
( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )),
&info
);
diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c
index 80f93f1dfa..fd9d226003 100644
--- a/cpukit/libfs/src/imfs/imfs_load_tar.c
+++ b/cpukit/libfs/src/imfs/imfs_load_tar.c
@@ -47,7 +47,7 @@
* 345 167 bytes Padding
* 512 (s+p)bytes File contents (s+p) := (((s) + 511) & ~511),
* round up to 512 bytes
- *
+ *
* Checksum:
* int i, sum;
* char* header = tar_header_pointer;
@@ -81,7 +81,7 @@ static int compute_tar_header_checksum(char *bufr);
* tar image and perform as follows:
* - For directories, simply call mkdir(). The IMFS creates nodes as
* needed.
- * - For files, we make our own calls to IMFS eval_for_make and
+ * - For files, we make our own calls to IMFS eval_for_make and
* create_node.
*************************************************************************/
int
@@ -141,7 +141,7 @@ rtems_tarfs_load(char *mountpoint,
/******************************************************************
* Generate an IMFS node depending on the file type.
- * - For directories, just create directories as usual. IMFS
+ * - For directories, just create directories as usual. IMFS
* will take care of the rest.
* - For files, create a file node with special tarfs properties.
*****************************************************************/
@@ -225,7 +225,7 @@ octal2ulong(char *octascii, int len)
mult = 1;
for (i=len-1; i>=0; i--)
{
- if (octascii[i] < '0')
+ if (octascii[i] < '0')
continue;
if (octascii[i] > '9')
continue;
@@ -238,7 +238,7 @@ octal2ulong(char *octascii, int len)
/************************************************************************
- * Compute the TAR checksum and check with the value in
+ * Compute the TAR checksum and check with the value in
* the archive. The checksum is computed over the entire
* header, but the checksum field is substituted with blanks.
************************************************************************/
diff --git a/cpukit/libfs/src/imfs/imfs_mknod.c b/cpukit/libfs/src/imfs/imfs_mknod.c
index 3a6ea477a7..abb9ab4052 100644
--- a/cpukit/libfs/src/imfs/imfs_mknod.c
+++ b/cpukit/libfs/src/imfs/imfs_mknod.c
@@ -30,7 +30,7 @@
int IMFS_mknod(
const char *token, /* IN */
- mode_t mode, /* IN */
+ mode_t mode, /* IN */
dev_t dev, /* IN */
rtems_filesystem_location_info_t *pathloc /* IN/OUT */
)
@@ -40,7 +40,7 @@ int IMFS_mknod(
int result;
char new_name[ IMFS_NAME_MAX + 1 ];
IMFS_types_union info;
-
+
IMFS_get_token( token, new_name, &result );
/*
@@ -57,7 +57,7 @@ int IMFS_mknod(
} else {
rtems_set_errno_and_return_minus_one( EINVAL );
}
-
+
/*
* Allocate and fill in an IMFS jnode
*/
@@ -65,7 +65,7 @@ int IMFS_mknod(
new_node = IMFS_create_node(
pathloc,
type,
- new_name,
+ new_name,
mode,
&info
);
diff --git a/cpukit/libfs/src/imfs/imfs_mount.c b/cpukit/libfs/src/imfs/imfs_mount.c
index 798ab7baa0..3ec16da3f7 100644
--- a/cpukit/libfs/src/imfs/imfs_mount.c
+++ b/cpukit/libfs/src/imfs/imfs_mount.c
@@ -1,6 +1,6 @@
/*
* IMFS_mount
- *
+ *
* This routine will look at a mount table entry that we are going to
* add to the mount table. If the mount point rtems_filesystem
* location_info_t struct refers to a node that is a directory,
@@ -39,7 +39,7 @@ int IMFS_mount(
/*
* Is the node that we are mounting onto a directory node ?
*/
-
+
if ( node->type != IMFS_DIRECTORY )
rtems_set_errno_and_return_minus_one( ENOTDIR );
diff --git a/cpukit/libfs/src/imfs/imfs_ntype.c b/cpukit/libfs/src/imfs/imfs_ntype.c
index 15bbe8cc3f..f80182b144 100644
--- a/cpukit/libfs/src/imfs/imfs_ntype.c
+++ b/cpukit/libfs/src/imfs/imfs_ntype.c
@@ -1,7 +1,7 @@
/*
* IMFS_node_type
*
- * The following verifies that returns the type of node that the
+ * The following verifies that returns the type of node that the
* loc refers to.
*
* COPYRIGHT (c) 1989-1999.
diff --git a/cpukit/libfs/src/imfs/imfs_readlink.c b/cpukit/libfs/src/imfs/imfs_readlink.c
index 1025947787..6b3d1acafe 100644
--- a/cpukit/libfs/src/imfs/imfs_readlink.c
+++ b/cpukit/libfs/src/imfs/imfs_readlink.c
@@ -1,7 +1,7 @@
/*
* IMFS_readlink
*
- * The following rouine puts the symblic links destination name into
+ * The following rouine puts the symblic links destination name into
* buff.
*
* COPYRIGHT (c) 1989-1999.
@@ -26,12 +26,12 @@
int IMFS_readlink(
rtems_filesystem_location_info_t *loc,
char *buf, /* OUT */
- size_t bufsize
+ size_t bufsize
)
{
IMFS_jnode_t *node;
int i;
-
+
node = loc->node_access;
if ( node->type != IMFS_SYM_LINK )
diff --git a/cpukit/libfs/src/imfs/imfs_rmnod.c b/cpukit/libfs/src/imfs/imfs_rmnod.c
index 5941703238..d5e32378ad 100644
--- a/cpukit/libfs/src/imfs/imfs_rmnod.c
+++ b/cpukit/libfs/src/imfs/imfs_rmnod.c
@@ -34,12 +34,12 @@ int IMFS_rmnod(
rtems_filesystem_location_info_t *pathloc /* IN */
)
{
- IMFS_jnode_t *the_jnode;
+ IMFS_jnode_t *the_jnode;
the_jnode = (IMFS_jnode_t *) pathloc->node_access;
- /*
- * Take the node out of the parent's chain that contains this node
+ /*
+ * Take the node out of the parent's chain that contains this node
*/
if ( the_jnode->Parent != NULL ) {
@@ -60,7 +60,7 @@ int IMFS_rmnod(
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
- /*
+ /*
* Is rtems_filesystem_current this node?
*/
diff --git a/cpukit/libfs/src/imfs/imfs_stat.c b/cpukit/libfs/src/imfs/imfs_stat.c
index 4122d14774..422e954ed1 100644
--- a/cpukit/libfs/src/imfs/imfs_stat.c
+++ b/cpukit/libfs/src/imfs/imfs_stat.c
@@ -1,6 +1,6 @@
/*
* IMFS_stat
- *
+ *
* This routine provides a stat for the IMFS file system.
*
* COPYRIGHT (c) 1989-1999.
@@ -44,11 +44,11 @@ int IMFS_stat(
case IMFS_MEMORY_FILE:
buf->st_size = the_jnode->info.file.size;
break;
-
+
case IMFS_SYM_LINK:
buf->st_size = 0;
break;
-
+
default:
rtems_set_errno_and_return_minus_one( ENOTSUP );
break;
diff --git a/cpukit/libfs/src/imfs/imfs_symlink.c b/cpukit/libfs/src/imfs/imfs_symlink.c
index 9ecd3ea831..38072b9f69 100644
--- a/cpukit/libfs/src/imfs/imfs_symlink.c
+++ b/cpukit/libfs/src/imfs/imfs_symlink.c
@@ -1,7 +1,7 @@
/*
* IMFS_symlink
*
- * The following rouine creates a new symbolic link node under parent
+ * The following rouine creates a new symbolic link node under parent
* with the name given in name. The node is set to point to the node at
* to_loc.
*
diff --git a/cpukit/libfs/src/imfs/imfs_unixstub.c b/cpukit/libfs/src/imfs/imfs_unixstub.c
index 47d389b7e5..d642b260d5 100644
--- a/cpukit/libfs/src/imfs/imfs_unixstub.c
+++ b/cpukit/libfs/src/imfs/imfs_unixstub.c
@@ -27,7 +27,7 @@
#include <stdio.h>
-/*
+/*
* IMFS file system operations table
*/
@@ -50,7 +50,7 @@ rtems_filesystem_operations_table IMFS_ops = {
NULL
};
-/*
+/*
* IMFS file system operations table
*/
diff --git a/cpukit/libfs/src/imfs/imfs_unlink.c b/cpukit/libfs/src/imfs/imfs_unlink.c
index e34d93dd02..b416a09b8e 100644
--- a/cpukit/libfs/src/imfs/imfs_unlink.c
+++ b/cpukit/libfs/src/imfs/imfs_unlink.c
@@ -1,6 +1,6 @@
/*
- * IMFS_unlink
- *
+ * IMFS_unlink
+ *
* Routine to remove a link node from the tree.
*
* COPYRIGHT (c) 1989-1999.
@@ -31,7 +31,7 @@ int IMFS_unlink(
IMFS_jnode_t *node;
rtems_filesystem_location_info_t the_link;
int result = 0;
-
+
node = loc->node_access;
/*
diff --git a/cpukit/libfs/src/imfs/imfs_unmount.c b/cpukit/libfs/src/imfs/imfs_unmount.c
index e312c9704e..ee1482bfa5 100644
--- a/cpukit/libfs/src/imfs/imfs_unmount.c
+++ b/cpukit/libfs/src/imfs/imfs_unmount.c
@@ -37,26 +37,26 @@ int IMFS_unmount(
node = mt_entry->mt_point_node.node_access;
- /*
- * Is the node that we are mounting onto a directory node ?
+ /*
+ * Is the node that we are mounting onto a directory node ?
*/
if ( node->type != IMFS_DIRECTORY )
rtems_set_errno_and_return_minus_one( ENOTDIR );
- /*
- * Did the node indicate that there was a directory mounted here?
+ /*
+ * Did the node indicate that there was a directory mounted here?
*/
if ( node->info.directory.mt_fs == NULL )
rtems_set_errno_and_return_minus_one( EINVAL ); /* XXX */
- /*
- * Set the mt_fs pointer to indicate that there is no longer
+ /*
+ * Set the mt_fs pointer to indicate that there is no longer
* a file system mounted to this point.
*/
-
+
node->info.directory.mt_fs = NULL;
- return 0;
+ return 0;
}
diff --git a/cpukit/libfs/src/imfs/imfs_utime.c b/cpukit/libfs/src/imfs/imfs_utime.c
index f796572a94..0a120f02d3 100644
--- a/cpukit/libfs/src/imfs/imfs_utime.c
+++ b/cpukit/libfs/src/imfs/imfs_utime.c
@@ -1,7 +1,7 @@
/*
* IMFS_utime
*
- * This routine is the implementation of the utime() system
+ * This routine is the implementation of the utime() system
* call for the IMFS.
*
* COPYRIGHT (c) 1989-1999.
diff --git a/cpukit/libfs/src/imfs/ioman.c b/cpukit/libfs/src/imfs/ioman.c
index 1d0dc84953..08e56292c1 100644
--- a/cpukit/libfs/src/imfs/ioman.c
+++ b/cpukit/libfs/src/imfs/ioman.c
@@ -33,7 +33,7 @@
#define S_IFCHR __S_IFCHR
#endif
-/*
+/*
* rtems_io_register_name
*
* This assumes that all registered devices are character devices.
@@ -55,17 +55,17 @@ rtems_status_code rtems_io_register_name(
/* this is the only error returned by the old version */
if ( status )
return RTEMS_TOO_MANY;
-
+
#endif
return RTEMS_SUCCESSFUL;
}
-/*
+/*
* rtems_io_lookup_name
*
* This version is reentrant.
*
- * XXX - This is dependent upon IMFS and should not be.
+ * XXX - This is dependent upon IMFS and should not be.
* Suggest adding a filesystem routine to fill in the device_info.
*/
@@ -101,7 +101,7 @@ rtems_status_code rtems_io_lookup_name(
device_info->minor = the_jnode->info.device.minor;
rtems_filesystem_freenode( &loc );
-
+
#endif
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c
index d5a33c97eb..531caaa1fb 100644
--- a/cpukit/libfs/src/imfs/memfile.c
+++ b/cpukit/libfs/src/imfs/memfile.c
@@ -4,7 +4,7 @@
* This file contains the set of handlers used to process operations on
* IMFS memory file nodes. The memory files are created in memory using
* malloc'ed memory. Thus any data stored in one of these files is lost
- * at system shutdown unless special arrangements to copy the data to
+ * at system shutdown unless special arrangements to copy the data to
* some type of non-volailte storage are made by the application.
*
* COPYRIGHT (c) 1989-1999.
@@ -32,10 +32,10 @@
#include <rtems/libio_.h>
#include <rtems/seterr.h>
-#define MEMFILE_STATIC
+#define MEMFILE_STATIC
/*
- * Prototypes of private routines
+ * Prototypes of private routines
*/
MEMFILE_STATIC int IMFS_memfile_extend(
@@ -268,7 +268,7 @@ int memfile_ftruncate(
* IMFS_memfile_extend
*
* This routine insures that the in-memory file is of the length
- * specified. If necessary, it will allocate memory blocks to
+ * specified. If necessary, it will allocate memory blocks to
* extend the file.
*/
@@ -431,7 +431,7 @@ void memfile_free_blocks_in_table(
}
/*
- * Now that all the blocks in the block table are free, we can
+ * Now that all the blocks in the block table are free, we can
* free the block table itself.
*/
@@ -444,7 +444,7 @@ void memfile_free_blocks_in_table(
*
* This routine frees all memory associated with an in memory file.
*
- * NOTE: This is an exceptionally conservative implementation.
+ * NOTE: This is an exceptionally conservative implementation.
* It will check EVERY pointer which is non-NULL and insure
* any child non-NULL pointers are freed. Optimistically, all that
* is necessary is to scan until a NULL pointer is found. There
@@ -511,7 +511,7 @@ int IMFS_memfile_remove(
memfile_free_blocks_in_table( &info->doubly_indirect, to_free );
}
-
+
if ( info->triply_indirect ) {
for ( i=0 ; i<IMFS_MEMFILE_BLOCK_SLOTS ; i++ ) {
p = (block_p *) info->triply_indirect[i];
@@ -539,7 +539,7 @@ int IMFS_memfile_remove(
* the specified data buffer specified by destination. The file
* is NOT extended. An offset greater than the length of the file
* is considered an error. Read from an offset for more bytes than
- * are between the offset and the end of the file will result in
+ * are between the offset and the end of the file will result in
* reading the data between offset and the end of the file (truncated
* read).
*/
@@ -962,7 +962,7 @@ fflush(stdout);
return 0;
p = (block_p *)p[ doubly ];
- if ( !p )
+ if ( !p )
return 0;
#if 0
@@ -1083,7 +1083,7 @@ fflush(stdout);
/*
* memfile_rmnod
*
- * This routine is available from the optable to remove a node
+ * This routine is available from the optable to remove a node
* from the IMFS file system.
*/
@@ -1091,12 +1091,12 @@ int memfile_rmnod(
rtems_filesystem_location_info_t *pathloc /* IN */
)
{
- IMFS_jnode_t *the_jnode;
+ IMFS_jnode_t *the_jnode;
the_jnode = (IMFS_jnode_t *) pathloc->node_access;
- /*
- * Take the node out of the parent's chain that contains this node
+ /*
+ * Take the node out of the parent's chain that contains this node
*/
if ( the_jnode->Parent != NULL ) {
@@ -1123,7 +1123,7 @@ int memfile_check_rmnod( IMFS_jnode_t *the_jnode ){
if ( !rtems_libio_is_file_open( the_jnode ) && (the_jnode->st_nlink < 1) ) {
- /*
+ /*
* Is the rtems_filesystem_current is this node?
*/