diff options
Diffstat (limited to 'cpukit/libfs/src/dosfs')
-rw-r--r-- | cpukit/libfs/src/dosfs/fat.c | 22 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos.h | 36 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_handlers_dir.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_handlers_file.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_init.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_initsupp.c | 8 |
6 files changed, 38 insertions, 34 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c index aa390d64cb..65bf30e624 100644 --- a/cpukit/libfs/src/dosfs/fat.c +++ b/cpukit/libfs/src/dosfs/fat.c @@ -205,6 +205,7 @@ fat_cluster_write( int fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry) { + rtems_status_code sc = RTEMS_SUCCESSFUL; int rc = RC_OK; fat_fs_info_t *fs_info = mt_entry->fs_info; register fat_vol_t *vol = &fs_info->vol; @@ -212,9 +213,9 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry) char boot_rec[FAT_MAX_BPB_SIZE]; char fs_info_sector[FAT_USEFUL_INFO_SIZE]; ssize_t ret = 0; - int fd; struct stat stat_buf; int i = 0; + bdbuf_buffer *block = NULL; rc = stat(mt_entry->dev, &stat_buf); if (rc == -1) @@ -231,22 +232,25 @@ fat_init_volume_info(rtems_filesystem_mount_table_entry_t *mt_entry) vol->dev = stat_buf.st_dev; - fd = open(mt_entry->dev, O_RDONLY); - if (fd == -1) + /* Read boot record */ + /* FIXME: Asserts FAT_MAX_BPB_SIZE < bdbuf block size */ + sc = rtems_bdbuf_read( vol->dev, 0, &block); + if (sc != RTEMS_SUCCESSFUL) { rtems_disk_release(vol->dd); - return -1; + set_errno_and_return_minus_one( EIO); } - ret = read(fd, (void *)boot_rec, FAT_MAX_BPB_SIZE); - if ( ret != FAT_MAX_BPB_SIZE ) + memcpy( boot_rec, block->buffer, FAT_MAX_BPB_SIZE); + + sc = rtems_bdbuf_release( block); + if (sc != RTEMS_SUCCESSFUL) { - close(fd); rtems_disk_release(vol->dd); - set_errno_and_return_minus_one( EIO ); + set_errno_and_return_minus_one( EIO); } - close(fd); + /* Evaluate boot record */ vol->bps = FAT_GET_BR_BYTES_PER_SECTOR(boot_rec); if ( (vol->bps != 512) && diff --git a/cpukit/libfs/src/dosfs/msdos.h b/cpukit/libfs/src/dosfs/msdos.h index 2fec769446..050b283863 100644 --- a/cpukit/libfs/src/dosfs/msdos.h +++ b/cpukit/libfs/src/dosfs/msdos.h @@ -37,18 +37,18 @@ typedef struct msdos_fs_info_s * volume * description */ - rtems_filesystem_file_handlers_r *directory_handlers; /* - * a set of routines - * that handles the - * nodes of directory - * type - */ - rtems_filesystem_file_handlers_r *file_handlers; /* - * a set of routines - * that handles the - * nodes of file - * type - */ + const rtems_filesystem_file_handlers_r *directory_handlers; /* + * a set of routines + * that handles the + * nodes of directory + * type + */ + const rtems_filesystem_file_handlers_r *file_handlers; /* + * a set of routines + * that handles the + * nodes of file + * type + */ rtems_id vol_sema; /* * semaphore * associated with @@ -61,10 +61,10 @@ typedef struct msdos_fs_info_s } msdos_fs_info_t; /* a set of routines that handle the nodes which are directories */ -extern rtems_filesystem_file_handlers_r msdos_dir_handlers; +extern const rtems_filesystem_file_handlers_r msdos_dir_handlers; /* a set of routines that handle the nodes which are files */ -extern rtems_filesystem_file_handlers_r msdos_file_handlers; +extern const rtems_filesystem_file_handlers_r msdos_file_handlers; /* Volume semaphore timeout value. This value can be changed to a number * of ticks to help debugging or if you need such a */ @@ -231,10 +231,10 @@ int msdos_utime( ); int msdos_initialize_support( - rtems_filesystem_mount_table_entry_t *temp_mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *file_handlers, - rtems_filesystem_file_handlers_r *directory_handlers + rtems_filesystem_mount_table_entry_t *temp_mt_entry, + const rtems_filesystem_operations_table *op_table, + const rtems_filesystem_file_handlers_r *file_handlers, + const rtems_filesystem_file_handlers_r *directory_handlers ); int msdos_file_open( diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c index 4a6d098b8e..e42f72ab16 100644 --- a/cpukit/libfs/src/dosfs/msdos_handlers_dir.c +++ b/cpukit/libfs/src/dosfs/msdos_handlers_dir.c @@ -18,7 +18,7 @@ #include <rtems/libio.h> #include "msdos.h" -rtems_filesystem_file_handlers_r msdos_dir_handlers = { +const rtems_filesystem_file_handlers_r msdos_dir_handlers = { msdos_dir_open, msdos_dir_close, msdos_dir_read, diff --git a/cpukit/libfs/src/dosfs/msdos_handlers_file.c b/cpukit/libfs/src/dosfs/msdos_handlers_file.c index 857c5ad7a6..6ad6d1850d 100644 --- a/cpukit/libfs/src/dosfs/msdos_handlers_file.c +++ b/cpukit/libfs/src/dosfs/msdos_handlers_file.c @@ -18,7 +18,7 @@ #include <rtems/libio.h> #include "msdos.h" -rtems_filesystem_file_handlers_r msdos_file_handlers = { +const rtems_filesystem_file_handlers_r msdos_file_handlers = { msdos_file_open, msdos_file_close, msdos_file_read, diff --git a/cpukit/libfs/src/dosfs/msdos_init.c b/cpukit/libfs/src/dosfs/msdos_init.c index d5d61d9103..8642cead0a 100644 --- a/cpukit/libfs/src/dosfs/msdos_init.c +++ b/cpukit/libfs/src/dosfs/msdos_init.c @@ -18,7 +18,7 @@ #include <rtems/libio_.h> #include "msdos.h" -rtems_filesystem_operations_table msdos_ops = { +const rtems_filesystem_operations_table msdos_ops = { msdos_eval_path, msdos_eval4make, #if 0 diff --git a/cpukit/libfs/src/dosfs/msdos_initsupp.c b/cpukit/libfs/src/dosfs/msdos_initsupp.c index 73a76f00c3..ce86fa22b0 100644 --- a/cpukit/libfs/src/dosfs/msdos_initsupp.c +++ b/cpukit/libfs/src/dosfs/msdos_initsupp.c @@ -47,10 +47,10 @@ */ int msdos_initialize_support( - rtems_filesystem_mount_table_entry_t *temp_mt_entry, - rtems_filesystem_operations_table *op_table, - rtems_filesystem_file_handlers_r *file_handlers, - rtems_filesystem_file_handlers_r *directory_handlers + rtems_filesystem_mount_table_entry_t *temp_mt_entry, + const rtems_filesystem_operations_table *op_table, + const rtems_filesystem_file_handlers_r *file_handlers, + const rtems_filesystem_file_handlers_r *directory_handlers ) { int rc = RC_OK; |