forked from Imagelibrary/rtems
Added const qualifier to various pointers and data tables to
reduce size of data area. IMFS: Fixed creation of symbolic links to avoid a compiler warning. DOSFS: Use LibBlock instead of read() to read the boot record.
This commit is contained in:
@@ -1,3 +1,69 @@
|
||||
|
||||
2008-05-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* score/include/rtems/score/object.h,
|
||||
rtems/include/rtems/rtems/types.h: Added new defines OBJECTS_ID_NONE
|
||||
and RTEMS_ID_NONE. No object can have this ID.
|
||||
|
||||
2008-05-27 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* include/rtems/fs.h,
|
||||
libblock/include/rtems/diskdevs.h,
|
||||
libblock/src/diskdevs.c,
|
||||
libcsupport/include/rtems/libio.h,
|
||||
libcsupport/src/base_fs.c,
|
||||
libcsupport/src/error.c,
|
||||
libcsupport/src/libio.c,
|
||||
libcsupport/src/mount.c,
|
||||
libfs/src/dosfs/fat.c,
|
||||
libfs/src/dosfs/msdos.h,
|
||||
libfs/src/dosfs/msdos_handlers_dir.c,
|
||||
libfs/src/dosfs/msdos_handlers_file.c,
|
||||
libfs/src/dosfs/msdos_init.c,
|
||||
libfs/src/dosfs/msdos_initsupp.c,
|
||||
libfs/src/imfs/deviceio.c,
|
||||
libfs/src/imfs/imfs.h,
|
||||
libfs/src/imfs/imfs_config.c,
|
||||
libfs/src/imfs/imfs_creat.c,
|
||||
libfs/src/imfs/imfs_getchild.c,
|
||||
libfs/src/imfs/imfs_handlers_device.c,
|
||||
libfs/src/imfs/imfs_handlers_directory.c,
|
||||
libfs/src/imfs/imfs_handlers_link.c,
|
||||
libfs/src/imfs/imfs_handlers_memfile.c,
|
||||
libfs/src/imfs/imfs_init.c,
|
||||
libfs/src/imfs/imfs_initsupp.c,
|
||||
libfs/src/imfs/imfs_symlink.c,
|
||||
libfs/src/imfs/imfs_unixstub.c,
|
||||
libfs/src/imfs/miniimfs_init.c,
|
||||
posix/include/rtems/posix/psignal.h,
|
||||
posix/src/psignal.c,
|
||||
rtems/include/rtems/rtems/status.h,
|
||||
rtems/src/semtranslatereturncode.c,
|
||||
sapi/include/confdefs.h,
|
||||
sapi/include/rtems/io.h,
|
||||
sapi/src/ioregisterdriver.c,
|
||||
sapi/src/itronapi.c,
|
||||
sapi/src/posixapi.c:
|
||||
Added const qualifier to various pointers and data tables to
|
||||
reduce size of data area.
|
||||
IMFS: Fixed creation of symbolic links to avoid a compiler warning.
|
||||
DOSFS: Use LibBlock instead of read() to read the boot record.
|
||||
|
||||
2008-05-27 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* libcsupport/include/console.h:
|
||||
New define: CONSOLE_DEVICE_NAME.
|
||||
|
||||
2008-05-27 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* libcsupport/src/printk.c:
|
||||
Bugfix: String output without width option.
|
||||
|
||||
2008-05-27 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* libnetworking/net/if_ppp.c, libnetworking/net/if_pppvar.h:
|
||||
Bugfix: Moved definition of ppp_softc into source file.
|
||||
|
||||
2008-05-23 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* libnetworking/netinet/ip_output.c: when fragmenting
|
||||
|
||||
@@ -45,10 +45,10 @@ typedef struct _rtems_filesystem_operations_table
|
||||
|
||||
struct rtems_filesystem_location_info_tt
|
||||
{
|
||||
void *node_access;
|
||||
rtems_filesystem_file_handlers_r *handlers;
|
||||
rtems_filesystem_operations_table *ops;
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry;
|
||||
void *node_access;
|
||||
const rtems_filesystem_file_handlers_r *handlers;
|
||||
const rtems_filesystem_operations_table *ops;
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -85,7 +85,7 @@ typedef struct disk_device {
|
||||
rtems_status_code
|
||||
rtems_disk_create_phys(dev_t dev, int block_size, int disk_size,
|
||||
block_device_ioctl handler,
|
||||
char *name);
|
||||
const char *name);
|
||||
|
||||
/* rtems_disk_create_log --
|
||||
* Create logical disk entry. Logical disk is contiguous area on physical
|
||||
|
||||
@@ -171,7 +171,7 @@ get_disk_entry(dev_t dev)
|
||||
* no memory available).
|
||||
*/
|
||||
static rtems_status_code
|
||||
create_disk(dev_t dev, char *name, disk_device **diskdev)
|
||||
create_disk(dev_t dev, const char *name, disk_device **diskdev)
|
||||
{
|
||||
disk_device *dd;
|
||||
char *n;
|
||||
@@ -235,7 +235,7 @@ create_disk(dev_t dev, char *name, disk_device **diskdev)
|
||||
rtems_status_code
|
||||
rtems_disk_create_phys(dev_t dev, int block_size, int disk_size,
|
||||
block_device_ioctl handler,
|
||||
char *name)
|
||||
const char *name)
|
||||
{
|
||||
int bs_log2;
|
||||
int i;
|
||||
|
||||
@@ -345,16 +345,16 @@ typedef enum
|
||||
*/
|
||||
|
||||
struct rtems_libio_tt {
|
||||
rtems_driver_name_t *driver;
|
||||
off_t size; /* size of file */
|
||||
off_t offset; /* current offset into file */
|
||||
uint32_t flags;
|
||||
rtems_filesystem_location_info_t pathinfo;
|
||||
rtems_id sem;
|
||||
uint32_t data0; /* private to "driver" */
|
||||
void *data1; /* ... */
|
||||
void *file_info; /* used by file handlers */
|
||||
rtems_filesystem_file_handlers_r *handlers; /* type specific handlers */
|
||||
rtems_driver_name_t *driver;
|
||||
off_t size; /* size of file */
|
||||
off_t offset; /* current offset into file */
|
||||
uint32_t flags;
|
||||
rtems_filesystem_location_info_t pathinfo;
|
||||
rtems_id sem;
|
||||
uint32_t data0; /* private to "driver" */
|
||||
void *data1; /* ... */
|
||||
void *file_info; /* used by file handlers */
|
||||
const rtems_filesystem_file_handlers_r *handlers; /* type specific handlers */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -612,11 +612,11 @@ int unmount(
|
||||
);
|
||||
|
||||
int mount(
|
||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||
rtems_filesystem_operations_table *fs_ops,
|
||||
rtems_filesystem_options_t fsoptions,
|
||||
char *device,
|
||||
char *mount_point
|
||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||
const rtems_filesystem_operations_table *fs_ops,
|
||||
rtems_filesystem_options_t fsoptions,
|
||||
const char *device,
|
||||
const char *mount_point
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -624,14 +624,14 @@ int mount(
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_filesystem_operations_table *fs_ops;
|
||||
rtems_filesystem_options_t fsoptions;
|
||||
char *device;
|
||||
char *mount_point;
|
||||
const rtems_filesystem_operations_table *fs_ops;
|
||||
rtems_filesystem_options_t fsoptions;
|
||||
const char *device;
|
||||
const char *mount_point;
|
||||
} rtems_filesystem_mount_table_t;
|
||||
|
||||
extern rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
|
||||
extern int rtems_filesystem_mount_table_size;
|
||||
extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
|
||||
extern const int rtems_filesystem_mount_table_size;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ void rtems_filesystem_initialize( void )
|
||||
#if !defined(RTEMS_UNIX)
|
||||
int status;
|
||||
rtems_filesystem_mount_table_entry_t *entry;
|
||||
rtems_filesystem_mount_table_t *mt;
|
||||
rtems_filesystem_location_info_t loc;
|
||||
const rtems_filesystem_mount_table_t *mt;
|
||||
rtems_filesystem_location_info_t loc;
|
||||
|
||||
/*
|
||||
* Set the default umask to "022".
|
||||
|
||||
@@ -63,7 +63,7 @@ char *strerror(int);
|
||||
|
||||
int rtems_panic_in_progress;
|
||||
|
||||
rtems_assoc_t rtems_status_assoc[] = {
|
||||
const rtems_assoc_t rtems_status_assoc[] = {
|
||||
{ "successful completion", RTEMS_SUCCESSFUL, },
|
||||
{ "returned from a thread", RTEMS_TASK_EXITTED, },
|
||||
{ "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, },
|
||||
|
||||
@@ -62,14 +62,14 @@ extern rtems_libio_t *rtems_libio_iop_freelist;
|
||||
* Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
|
||||
*/
|
||||
|
||||
rtems_assoc_t access_modes_assoc[] = {
|
||||
const rtems_assoc_t access_modes_assoc[] = {
|
||||
{ "READ", LIBIO_FLAGS_READ, O_RDONLY },
|
||||
{ "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY },
|
||||
{ "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
rtems_assoc_t status_flags_assoc[] = {
|
||||
const rtems_assoc_t status_flags_assoc[] = {
|
||||
#ifdef ACCEPT_O_NDELAY_ALIAS
|
||||
{ "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY },
|
||||
#endif
|
||||
|
||||
@@ -68,11 +68,11 @@ static int Is_node_fs_root(
|
||||
*/
|
||||
|
||||
int mount(
|
||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||
rtems_filesystem_operations_table *fs_ops,
|
||||
rtems_filesystem_options_t options,
|
||||
char *device,
|
||||
char *mount_point
|
||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||
const rtems_filesystem_operations_table *fs_ops,
|
||||
rtems_filesystem_options_t options,
|
||||
const char *device,
|
||||
const char *mount_point
|
||||
)
|
||||
{
|
||||
rtems_filesystem_location_info_t loc;
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* Convert RTEMS status to a UNIX errno
|
||||
*/
|
||||
|
||||
rtems_assoc_t errno_assoc[] = {
|
||||
const rtems_assoc_t errno_assoc[] = {
|
||||
{ "OK", RTEMS_SUCCESSFUL, 0 },
|
||||
{ "BUSY", RTEMS_RESOURCE_IN_USE, EBUSY },
|
||||
{ "INVALID NAME", RTEMS_INVALID_NAME, EINVAL },
|
||||
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
} IMFS_link_t;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
char *name;
|
||||
} IMFS_sym_link_t;
|
||||
|
||||
/*
|
||||
@@ -205,9 +205,9 @@ struct IMFS_jnode_tt {
|
||||
} while (0)
|
||||
|
||||
typedef struct {
|
||||
ino_t ino_count;
|
||||
rtems_filesystem_file_handlers_r *memfile_handlers;
|
||||
rtems_filesystem_file_handlers_r *directory_handlers;
|
||||
ino_t ino_count;
|
||||
const rtems_filesystem_file_handlers_r *memfile_handlers;
|
||||
const rtems_filesystem_file_handlers_r *directory_handlers;
|
||||
} IMFS_fs_info_t;
|
||||
|
||||
/*
|
||||
@@ -226,13 +226,13 @@ typedef enum {
|
||||
* Shared Data
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_file_handlers_r IMFS_directory_handlers;
|
||||
extern rtems_filesystem_file_handlers_r IMFS_device_handlers;
|
||||
extern rtems_filesystem_file_handlers_r IMFS_link_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 const rtems_filesystem_file_handlers_r IMFS_directory_handlers;
|
||||
extern const rtems_filesystem_file_handlers_r IMFS_device_handlers;
|
||||
extern const rtems_filesystem_file_handlers_r IMFS_link_handlers;
|
||||
extern const rtems_filesystem_file_handlers_r IMFS_memfile_handlers;
|
||||
extern const rtems_filesystem_operations_table IMFS_ops;
|
||||
extern const rtems_filesystem_operations_table miniIMFS_ops;
|
||||
extern const rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS;
|
||||
|
||||
/*
|
||||
* Routines
|
||||
@@ -247,10 +247,10 @@ int miniIMFS_initialize(
|
||||
);
|
||||
|
||||
int IMFS_initialize_support(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
rtems_filesystem_operations_table *op_table,
|
||||
rtems_filesystem_file_handlers_r *memfile_handlers,
|
||||
rtems_filesystem_file_handlers_r *directory_handlers
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const rtems_filesystem_operations_table *op_table,
|
||||
const rtems_filesystem_file_handlers_r *memfile_handlers,
|
||||
const rtems_filesystem_file_handlers_r *directory_handlers
|
||||
);
|
||||
|
||||
int IMFS_fsunmount(
|
||||
@@ -340,11 +340,11 @@ int IMFS_mknod(
|
||||
);
|
||||
|
||||
IMFS_jnode_t *IMFS_create_node(
|
||||
rtems_filesystem_location_info_t *parent_loc, /* IN */
|
||||
IMFS_jnode_types_t type, /* IN */
|
||||
char *name, /* IN */
|
||||
mode_t mode, /* IN */
|
||||
IMFS_types_union *info /* IN */
|
||||
rtems_filesystem_location_info_t *parent_loc, /* IN */
|
||||
IMFS_jnode_types_t type, /* IN */
|
||||
const char *name, /* IN */
|
||||
mode_t mode, /* IN */
|
||||
const IMFS_types_union *info /* IN */
|
||||
);
|
||||
|
||||
int IMFS_evaluate_for_make(
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
/* XXX this structure should use real constants */
|
||||
|
||||
rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS = {
|
||||
const rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS = {
|
||||
5, /* link_max */
|
||||
6, /* max_canon */
|
||||
7, /* max_input */
|
||||
|
||||
@@ -24,18 +24,17 @@
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
IMFS_jnode_t *IMFS_create_node(
|
||||
rtems_filesystem_location_info_t *parent_loc,
|
||||
IMFS_jnode_types_t type,
|
||||
char *name,
|
||||
mode_t mode,
|
||||
IMFS_types_union *info
|
||||
rtems_filesystem_location_info_t *parent_loc,
|
||||
IMFS_jnode_types_t type,
|
||||
const char *name,
|
||||
mode_t mode,
|
||||
const IMFS_types_union *info
|
||||
)
|
||||
{
|
||||
IMFS_jnode_t *node;
|
||||
struct timeval tv;
|
||||
IMFS_jnode_t *parent = NULL;
|
||||
IMFS_fs_info_t *fs_info;
|
||||
char *sym_name;
|
||||
|
||||
if ( parent_loc != NULL )
|
||||
parent = parent_loc->node_access;
|
||||
@@ -94,9 +93,7 @@ IMFS_jnode_t *IMFS_create_node(
|
||||
break;
|
||||
|
||||
case IMFS_SYM_LINK:
|
||||
sym_name = calloc( 1, strlen( info->sym_link.name ) + 1 );
|
||||
strcpy( sym_name, info->sym_link.name );
|
||||
node->info.sym_link.name = sym_name;
|
||||
node->info.sym_link.name = info->sym_link.name;
|
||||
break;
|
||||
|
||||
case IMFS_DEVICE:
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <string.h>
|
||||
#include "imfs.h"
|
||||
|
||||
static char dotname[2] = ".";
|
||||
static char dotdotname[3] = "..";
|
||||
static const char dotname[2] = ".";
|
||||
static const char dotdotname[3] = "..";
|
||||
|
||||
IMFS_jnode_t *IMFS_find_match_in_dir(
|
||||
IMFS_jnode_t *directory,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* Handler table for IMFS device nodes
|
||||
*/
|
||||
|
||||
rtems_filesystem_file_handlers_r IMFS_device_handlers = {
|
||||
const rtems_filesystem_file_handlers_r IMFS_device_handlers = {
|
||||
device_open,
|
||||
device_close,
|
||||
device_read,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* Set of operations handlers for operations on directories.
|
||||
*/
|
||||
|
||||
rtems_filesystem_file_handlers_r IMFS_directory_handlers = {
|
||||
const rtems_filesystem_file_handlers_r IMFS_directory_handlers = {
|
||||
imfs_dir_open,
|
||||
imfs_dir_close,
|
||||
imfs_dir_read,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* Handler table for IMFS device nodes
|
||||
*/
|
||||
|
||||
rtems_filesystem_file_handlers_r IMFS_link_handlers = {
|
||||
const rtems_filesystem_file_handlers_r IMFS_link_handlers = {
|
||||
NULL, /* open */
|
||||
NULL, /* close */
|
||||
NULL, /* read */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* Set of operations handlers for operations on memfile entities.
|
||||
*/
|
||||
|
||||
rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {
|
||||
const rtems_filesystem_file_handlers_r IMFS_memfile_handlers = {
|
||||
memfile_open,
|
||||
memfile_close,
|
||||
memfile_read,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* IMFS file system operations table
|
||||
*/
|
||||
|
||||
rtems_filesystem_operations_table IMFS_ops = {
|
||||
const rtems_filesystem_operations_table IMFS_ops = {
|
||||
IMFS_eval_path,
|
||||
IMFS_evaluate_for_make,
|
||||
IMFS_link,
|
||||
|
||||
@@ -66,10 +66,10 @@ static int IMFS_determine_bytes_per_block(
|
||||
*/
|
||||
|
||||
int IMFS_initialize_support(
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry,
|
||||
rtems_filesystem_operations_table *op_table,
|
||||
rtems_filesystem_file_handlers_r *memfile_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 *memfile_handlers,
|
||||
const rtems_filesystem_file_handlers_r *directory_handlers
|
||||
)
|
||||
{
|
||||
IMFS_fs_info_t *fs_info;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "imfs.h"
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/seterr.h>
|
||||
@@ -41,7 +43,14 @@ int IMFS_symlink(
|
||||
|
||||
IMFS_get_token( node_name, new_name, &i );
|
||||
|
||||
info.sym_link.name = link_name;
|
||||
/*
|
||||
* Duplicate link name
|
||||
*/
|
||||
|
||||
info.sym_link.name = strdup( link_name);
|
||||
if (info.sym_link.name == NULL) {
|
||||
rtems_set_errno_and_return_minus_one( ENOMEM);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new link node.
|
||||
@@ -55,8 +64,10 @@ int IMFS_symlink(
|
||||
&info
|
||||
);
|
||||
|
||||
if ( !new_node )
|
||||
rtems_set_errno_and_return_minus_one( ENOMEM );
|
||||
if (new_node == NULL) {
|
||||
free( info.sym_link.name);
|
||||
rtems_set_errno_and_return_minus_one( ENOMEM);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* IMFS file system operations table
|
||||
*/
|
||||
|
||||
rtems_filesystem_operations_table IMFS_ops = {
|
||||
const rtems_filesystem_operations_table IMFS_ops = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -54,7 +54,7 @@ rtems_filesystem_operations_table IMFS_ops = {
|
||||
* IMFS file system operations table
|
||||
*/
|
||||
|
||||
rtems_filesystem_operations_table miniIMFS_ops = {
|
||||
const rtems_filesystem_operations_table miniIMFS_ops = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* miniIMFS file system operations table
|
||||
*/
|
||||
|
||||
rtems_filesystem_operations_table miniIMFS_ops = {
|
||||
const rtems_filesystem_operations_table miniIMFS_ops = {
|
||||
IMFS_eval_path,
|
||||
IMFS_evaluate_for_make,
|
||||
NULL, /* XXX IMFS_link, */
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
extern sigset_t _POSIX_signals_Pending;
|
||||
|
||||
extern struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ];
|
||||
extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ];
|
||||
|
||||
extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ void _POSIX_signals_Abnormal_termination_handler( int signo )
|
||||
}
|
||||
|
||||
#define SIG_ARRAY_MAX (SIGRTMAX + 1)
|
||||
struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ] = {
|
||||
const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ] = {
|
||||
/* NO SIGNAL 0 */ SIGACTION_IGNORE,
|
||||
/* SIGHUP 1 */ SIGACTION_TERMINATE,
|
||||
/* SIGINT 2 */ SIGACTION_TERMINATE,
|
||||
|
||||
@@ -187,7 +187,7 @@ typedef enum {
|
||||
* codes to Classic API status codes.
|
||||
*/
|
||||
#ifdef RTEMS_API_INIT
|
||||
rtems_status_code _Status_Object_name_errors_to_status[] = {
|
||||
const rtems_status_code _Status_Object_name_errors_to_status[] = {
|
||||
/** This maps OBJECTS_SUCCESSFUL to RTEMS_SUCCESSFUL. */
|
||||
RTEMS_SUCCESSFUL,
|
||||
/** This maps OBJECTS_INVALID_NAME to RTEMS_INVALID_NAME. */
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
|
||||
const rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = {
|
||||
RTEMS_SUCCESSFUL, /* CORE_MUTEX_STATUS_SUCCESSFUL */
|
||||
RTEMS_UNSATISFIED, /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */
|
||||
RTEMS_UNSATISFIED, /* CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED */
|
||||
@@ -109,7 +109,7 @@ rtems_status_code _Semaphore_Translate_core_mutex_return_code (
|
||||
*
|
||||
*/
|
||||
|
||||
rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
|
||||
const rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = {
|
||||
RTEMS_SUCCESSFUL, /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */
|
||||
RTEMS_UNSATISFIED, /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */
|
||||
RTEMS_OBJECT_WAS_DELETED, /* CORE_SEMAPHORE_WAS_DELETED */
|
||||
|
||||
@@ -133,7 +133,7 @@ extern int rtems_telnetd_maximum_ptys;
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
#ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
|
||||
rtems_filesystem_mount_table_t configuration_mount_table = {
|
||||
const rtems_filesystem_mount_table_t configuration_mount_table = {
|
||||
#ifdef CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
|
||||
&IMFS_ops,
|
||||
#else /* using miniIMFS as base filesystem */
|
||||
@@ -144,9 +144,9 @@ extern int rtems_telnetd_maximum_ptys;
|
||||
NULL
|
||||
};
|
||||
|
||||
rtems_filesystem_mount_table_t
|
||||
const rtems_filesystem_mount_table_t
|
||||
*rtems_filesystem_mount_table = &configuration_mount_table;
|
||||
int rtems_filesystem_mount_table_size = 1;
|
||||
const int rtems_filesystem_mount_table_size = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ void _IO_Manager_initialization(
|
||||
|
||||
rtems_status_code rtems_io_register_driver(
|
||||
rtems_device_major_number major,
|
||||
rtems_driver_address_table *driver_table,
|
||||
const rtems_driver_address_table *driver_table,
|
||||
rtems_device_major_number *registered_major
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
rtems_status_code rtems_io_register_driver(
|
||||
rtems_device_major_number major,
|
||||
rtems_driver_address_table *driver_table,
|
||||
const rtems_driver_address_table *driver_table,
|
||||
rtems_device_major_number *registered_major
|
||||
)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* XXX
|
||||
*/
|
||||
|
||||
itron_api_configuration_table _ITRON_Default_configuration = {
|
||||
const itron_api_configuration_table _ITRON_Default_configuration = {
|
||||
0, /* maximum_tasks */
|
||||
0, /* maximum_semaphores */
|
||||
0, /* maximum_eventflags */
|
||||
@@ -70,7 +70,7 @@ void _ITRON_API_Initialize(
|
||||
rtems_configuration_table *configuration_table
|
||||
)
|
||||
{
|
||||
itron_api_configuration_table *api_configuration;
|
||||
const itron_api_configuration_table *api_configuration;
|
||||
|
||||
/* XXX need to assert here based on size assumptions */
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
* XXX
|
||||
*/
|
||||
|
||||
posix_api_configuration_table _POSIX_Default_configuration = {
|
||||
const posix_api_configuration_table _POSIX_Default_configuration = {
|
||||
0, /* maximum_threads */
|
||||
0, /* maximum_mutexes */
|
||||
0, /* maximum_condition_variables */
|
||||
@@ -78,7 +78,7 @@ void _POSIX_API_Initialize(
|
||||
rtems_configuration_table *configuration_table
|
||||
)
|
||||
{
|
||||
posix_api_configuration_table *api_configuration;
|
||||
const posix_api_configuration_table *api_configuration;
|
||||
|
||||
/* XXX need to assert here based on size assumptions */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user