diff options
Diffstat (limited to 'cpukit/include')
-rw-r--r-- | cpukit/include/rtems/confdefs/bsp.h | 1 | ||||
-rw-r--r-- | cpukit/include/rtems/confdefs/libio.h | 102 | ||||
-rw-r--r-- | cpukit/include/rtems/confdefs/obsolete.h | 4 | ||||
-rw-r--r-- | cpukit/include/rtems/devfs.h | 255 | ||||
-rw-r--r-- | cpukit/include/rtems/imfs.h | 7 |
5 files changed, 49 insertions, 320 deletions
diff --git a/cpukit/include/rtems/confdefs/bsp.h b/cpukit/include/rtems/confdefs/bsp.h index 9af46a8d29..7237c03522 100644 --- a/cpukit/include/rtems/confdefs/bsp.h +++ b/cpukit/include/rtems/confdefs/bsp.h @@ -48,7 +48,6 @@ #undef BSP_IDLE_TASK_STACK_SIZE #undef BSP_INITIAL_EXTENSION #undef BSP_INTERRUPT_STACK_SIZE - #undef BSP_MAXIMUM_DEVICES #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK #else diff --git a/cpukit/include/rtems/confdefs/libio.h b/cpukit/include/rtems/confdefs/libio.h index 3c45771952..603b2882c1 100644 --- a/cpukit/include/rtems/confdefs/libio.h +++ b/cpukit/include/rtems/confdefs/libio.h @@ -47,7 +47,6 @@ #include <rtems/sysinit.h> #ifdef CONFIGURE_FILESYSTEM_ALL - #define CONFIGURE_FILESYSTEM_DEVFS #define CONFIGURE_FILESYSTEM_DOSFS #define CONFIGURE_FILESYSTEM_FTPFS #define CONFIGURE_FILESYSTEM_IMFS @@ -57,12 +56,6 @@ #define CONFIGURE_FILESYSTEM_TFTPFS #endif -#ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM - #define CONFIGURE_FILESYSTEM_DEVFS -#elif !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) - #define _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -#endif - #ifdef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM #error "CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM cannot be used together with CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM" @@ -78,6 +71,21 @@ #define CONFIGURE_IMFS_DISABLE_UTIME #endif +#ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM + #define CONFIGURE_IMFS_DISABLE_CHMOD + #define CONFIGURE_IMFS_DISABLE_CHOWN + #define CONFIGURE_IMFS_DISABLE_LINK + #define CONFIGURE_IMFS_DISABLE_MKNOD_FILE + #define CONFIGURE_IMFS_DISABLE_MOUNT + #define CONFIGURE_IMFS_DISABLE_READDIR + #define CONFIGURE_IMFS_DISABLE_READLINK + #define CONFIGURE_IMFS_DISABLE_RENAME + #define CONFIGURE_IMFS_DISABLE_RMNOD + #define CONFIGURE_IMFS_DISABLE_SYMLINK + #define CONFIGURE_IMFS_DISABLE_UNMOUNT + #define CONFIGURE_IMFS_DISABLE_UTIME +#endif + #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM" @@ -87,10 +95,6 @@ #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM" #endif - #ifdef CONFIGURE_FILESYSTEM_DEVFS - #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_DEVFS" - #endif - #ifdef CONFIGURE_FILESYSTEM_DOSFS #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_DOSFS" #endif @@ -118,13 +122,9 @@ #ifdef CONFIGURE_FILESYSTEM_TFTPFS #error "CONFIGURE_APPLICATION_DISABLE_FILESYSTEM cannot be used together with CONFIGURE_FILESYSTEM_TFTPFS" #endif -#else - #define _CONFIGURE_FILESYSTEM_INITIALIZE #endif -#ifdef CONFIGURE_FILESYSTEM_DEVFS -#include <rtems/devfs.h> -#endif +#include <rtems/imfs.h> #ifdef CONFIGURE_FILESYSTEM_DOSFS #include <rtems/dosfs.h> @@ -134,11 +134,6 @@ #include <rtems/ftpfs.h> #endif -#if defined(CONFIGURE_FILESYSTEM_IMFS) \ - || defined(_CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM) -#include <rtems/imfs.h> -#endif - #ifdef CONFIGURE_FILESYSTEM_JFFS2 #include <rtems/jffs2.h> #endif @@ -159,28 +154,7 @@ extern "C" { #endif -#ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM - -#ifndef CONFIGURE_MAXIMUM_DEVICES - #ifdef BSP_MAXIMUM_DEVICES - #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES - #else - #define CONFIGURE_MAXIMUM_DEVICES 4 - #endif -#endif - -static devFS_node devFS_root_filesystem_nodes[ CONFIGURE_MAXIMUM_DEVICES ]; - -static const devFS_data _Filesystem_Root_data = { - devFS_root_filesystem_nodes, - CONFIGURE_MAXIMUM_DEVICES -}; - -#define _CONFIGURE_FILESYSTEM_ROOT_TYPE RTEMS_FILESYSTEM_TYPE_DEVFS - -#endif /* CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM */ - -#ifdef _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM #ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \ @@ -198,12 +172,16 @@ static const devFS_data _Filesystem_Root_data = { const int imfs_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK; -static IMFS_fs_info_t _IMFS_fs_info; +static IMFS_fs_info_t IMFS_root_fs_info; -static const rtems_filesystem_operations_table _IMFS_ops = { +static const rtems_filesystem_operations_table IMFS_root_ops = { rtems_filesystem_default_lock, rtems_filesystem_default_unlock, - IMFS_eval_path, + #ifdef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM + IMFS_eval_path_devfs, + #else + IMFS_eval_path, + #endif #ifdef CONFIGURE_IMFS_DISABLE_LINK rtems_filesystem_default_link, #else @@ -266,13 +244,17 @@ static const rtems_filesystem_operations_table _IMFS_ops = { rtems_filesystem_default_statvfs }; -static const IMFS_mknod_controls _IMFS_mknod_controls = { +static const IMFS_mknod_controls IMFS_root_mknod_controls = { #ifdef CONFIGURE_IMFS_DISABLE_READDIR &IMFS_mknod_control_dir_minimal, #else &IMFS_mknod_control_dir_default, #endif - &IMFS_mknod_control_device, + #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_DEVICE + &IMFS_mknod_control_enosys, + #else + &IMFS_mknod_control_device, + #endif #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_FILE &IMFS_mknod_control_enosys, #else @@ -285,18 +267,12 @@ static const IMFS_mknod_controls _IMFS_mknod_controls = { #endif }; -static const IMFS_mount_data _Filesystem_Root_data = { - &_IMFS_fs_info, - &_IMFS_ops, - &_IMFS_mknod_controls +static const IMFS_mount_data IMFS_root_mount_data = { + &IMFS_root_fs_info, + &IMFS_root_ops, + &IMFS_root_mknod_controls }; -#define _CONFIGURE_FILESYSTEM_ROOT_TYPE "/" - -#endif /* _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM */ - -#ifdef _CONFIGURE_FILESYSTEM_INITIALIZE - #if defined(CONFIGURE_FILESYSTEM_DEVFS) \ && !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \ @@ -346,9 +322,7 @@ static const IMFS_mount_data _Filesystem_Root_data = { #endif const rtems_filesystem_table_t rtems_filesystem_table[] = { - #ifdef _CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM - { "/", IMFS_initialize_support }, - #endif + { "/", IMFS_initialize_support }, #ifdef CONFIGURE_FILESYSTEM_ENTRY_DEVFS CONFIGURE_FILESYSTEM_ENTRY_DEVFS, #endif @@ -380,9 +354,9 @@ const rtems_filesystem_mount_configuration rtems_filesystem_root_configuration = { NULL, NULL, - _CONFIGURE_FILESYSTEM_ROOT_TYPE, + "/", RTEMS_FILESYSTEM_READ_WRITE, - &_Filesystem_Root_data + &IMFS_root_mount_data }; RTEMS_SYSINIT_ITEM( @@ -391,7 +365,7 @@ RTEMS_SYSINIT_ITEM( RTEMS_SYSINIT_ORDER_MIDDLE ); -#endif /* _CONFIGURE_FILESYSTEM_INITIALIZE */ +#endif /* !CONFIGURE_APPLICATION_DISABLE_FILESYSTEM */ #ifndef CONFIGURE_MAXIMUM_FILE_DESCRIPTORS #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 3 diff --git a/cpukit/include/rtems/confdefs/obsolete.h b/cpukit/include/rtems/confdefs/obsolete.h index 50293bce23..4e85fb679f 100644 --- a/cpukit/include/rtems/confdefs/obsolete.h +++ b/cpukit/include/rtems/confdefs/obsolete.h @@ -65,6 +65,10 @@ #error "The CONFIGURE_BDBUF_BUFFER_COUNT configuration option is obsolete since RTEMS 4.10.0" #endif +#ifdef CONFIGURE_MAXIMUM_DEVICES + #warning "The CONFIGURE_MAXIMUM_DEVICES configuration option is obsolete since RTEMS 5.1" +#endif + #ifdef CONFIGURE_ENABLE_GO #warning "The CONFIGURE_ENABLE_GO configuration option is obsolete since RTEMS 5.1" #endif diff --git a/cpukit/include/rtems/devfs.h b/cpukit/include/rtems/devfs.h deleted file mode 100644 index ff4dfe09bc..0000000000 --- a/cpukit/include/rtems/devfs.h +++ /dev/null @@ -1,255 +0,0 @@ -/** -* @file -* -* @brief Device Only File System -* -* This include file contains all constants and structures associated -* with the 'device-only' filesystem. -*/ - -#ifndef _RTEMS_DEVFS_H -#define _RTEMS_DEVFS_H - -#include <rtems/libio_.h> - -/** - * @defgroup DevFsDeviceTable Device Only File System - * - * @ingroup FileSystemTypesAndMount - * - * @brief This structure defines the type of device table - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Per Device Node Control Structure - * - * This structure is instanced per device node and contains all information - * used by this file system implementation to manage that device node. - */ -typedef struct { - /** This member points to device name which is not a null-terminated string */ - const char *name; - /** This member is the name length of a device */ - size_t namelen; - /** major number of a device */ - rtems_device_major_number major; - /** minor number of a device */ - rtems_device_minor_number minor; - /** device creation mode, only device file can be created */ - mode_t mode; -} devFS_node; - -typedef struct { - devFS_node *nodes; - size_t count; -} devFS_data; - -/** - * The following defines the device-only filesystem operating - * operations. - */ -extern const rtems_filesystem_operations_table devFS_ops; - -/** - * The following defines the device-only filesystem operating - * handlers. - */ -extern const rtems_filesystem_file_handlers_r devFS_file_handlers; - -/** - * @brief Obtain Immutable Pointer to Immutable File System Data - * - * This methods returns the immutable file system specific information - * associated with this file. - */ -static inline const devFS_data *devFS_get_data( - const rtems_filesystem_location_info_t *loc -) -{ - return (const devFS_data *) loc->mt_entry->immutable_fs_info; -} - -/** - * @brief Evaluate Path - */ -extern void devFS_eval_path( - rtems_filesystem_eval_path_context_t *ctx -); - -/** - * @brief Maps Open Operation to rtems_io_open - * - * This handler maps open operation to rtems_io_open. - * - * @param iop This is the RTEMS's internal representation of file. - * @param pathname a null-terminated string that starts with /dev. - * @param oflag access flags - * @param mode access mode - * - * @retval the same as open - */ -extern int devFS_open( - rtems_libio_t *iop, - const char *pathname, - int oflag, - mode_t mode -); - - -/** - * @brief Maps Close Operation to rtems_io_close - * - * This handler maps close operation to rtems_io_close. - * - * @param iop This is the RTEMS's internal representation of file - * - * @retval the same as close - */ -extern int devFS_close( - rtems_libio_t *iop -); - -/** - * @brief Maps Read Operation to rtems_io_read - * - * This handler maps read operation to rtems_io_read. - * - * @param iop This is the RTEMS's internal representation of file - * @param buffer memory location to store read data - * @param count how many bytes to read - * - * @retval On successful, this routine returns total bytes read. On error - * it returns -1 and errno is set to proper value. - */ -extern ssize_t devFS_read( - rtems_libio_t *iop, - void *buffer, - size_t count -); - -/** - * @brief Writes Operation to rtems_io_write - * - * This handler maps write operation to rtems_io_write. - * - * @param iop This is the RTEMS's internal representation of file - * @param buffer data to be written - * @param count how many bytes to write - * - * @retval On successful, this routine returns total bytes written. On error - * it returns -1 and errno is set to proper value. - */ -extern ssize_t devFS_write( - rtems_libio_t *iop, - const void *buffer, - size_t count -); - -/** - * @brief Maps ioctl Operation to rtems_io_ioctl - * - * This handler maps ioctl operation to rtems_io_ioctl. - * - * @param iop This is the RTEMS's internal representation of file - * @param command io control command - * @param buffer io control parameters - * - * @retval On successful, this routine returns total bytes written. On error - * it returns -1 and errno is set to proper value. - */ -extern int devFS_ioctl( - rtems_libio_t *iop, - ioctl_command_t command, - void *buffer -); - -/** - * @brief Gets the Device File Information - * - * This handler gets the device file information. This routine only - * set the following member of struct stat: - * - * - st_dev: device number - * - st_mode: device file creation mode, only two mode are accepted: - * + S_IFCHR: character device file - * + S_IFBLK: block device file - * - * @param loc contains filesystem access information - * @param buf buffer to hold the device file's information - * - * @retval On successful, this routine returns 0. On error - * it returns -1 and errno is set to proper value. - */ -extern int devFS_stat( - const rtems_filesystem_location_info_t *loc, - struct stat *buf -); - -/** - * @brief Creates an item in the main device table. - * - * This routine is invoked upon registration of a new device - * file. It is responsible for creating a item in the main - * device table. This routine searches the device table in - * sequential order, when found a empty slot, it fills the slot - * with proper values. - * - * @see rtems_filesystem_mknod_t. - */ -extern int devFS_mknod( - const rtems_filesystem_location_info_t *parentloc, - const char *name, - size_t namelen, - mode_t mode, - dev_t dev -); - -/** - * @brief Creates the Main Device Table - * - * This routine is invoked upon rtems filesystem initialization. - * It is responsible for creating the main device table, - * initializing it to a known state, and set device file operation - * handlers. After this, the device-only filesytem is ready for use - * - * @param mt_entry The filesystem mount table entry. - * @param data Filesystem specific data. - * - * @retval upon success, this routine returns 0; otherwise it returns - * -1 and errno is set to proper value. The only error is when malloc - * failed, and errno is set to NOMEM. - */ -extern int devFS_initialize( - rtems_filesystem_mount_table_entry_t *mt_entry, - const void *data -); - -/** - * @brief Retrieves and Prints all the Device Registered in System - * - * This routine retrieves all the device registered in system, and - * prints out their detail information. For example, on one system, - * devFS_show will print out following message: - * - * @code - * /dev/console 0 0 - * /dev/clock 1 0 - * /dev/tty0 0 0 - * /flash 2 0 - * @endcode - * - * This routine is intended for debugging, and can be used by shell - * program to provide user with the system information. - */ -extern void devFS_Show(void); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif - diff --git a/cpukit/include/rtems/imfs.h b/cpukit/include/rtems/imfs.h index 09e8bd4a9d..b2a9868b38 100644 --- a/cpukit/include/rtems/imfs.h +++ b/cpukit/include/rtems/imfs.h @@ -537,6 +537,13 @@ extern void IMFS_eval_path( ); /** + * @brief IMFS device filesystem evaluation node support. + */ +extern void IMFS_eval_path_devfs( + rtems_filesystem_eval_path_context_t *ctx +); + +/** * @brief Create a new IMFS link node. * * The following rouine creates a new link node under parent with the |