Changeset a9df916 in rtems for cpukit/sapi


Ignore:
Timestamp:
Feb 8, 2015, 6:43:09 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
547c2282
Parents:
a2f5c7e1
git-author:
Sebastian Huber <sebastian.huber@…> (02/08/15 18:43:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/12/15 19:53:36)
Message:

IMFS: Add fine grained configuration

Remove miniIMFS. Statically initialize the root IMFS.

Add configuration options to disable individual
features of the root IMFS, e.g.

o CONFIGURE_IMFS_DISABLE_CHOWN,
o CONFIGURE_IMFS_DISABLE_FCHMOD,
o CONFIGURE_IMFS_DISABLE_LINK,
o CONFIGURE_IMFS_DISABLE_MKNOD,
o CONFIGURE_IMFS_DISABLE_MOUNT,
o CONFIGURE_IMFS_DISABLE_READLINK,
o CONFIGURE_IMFS_DISABLE_RENAME,
o CONFIGURE_IMFS_DISABLE_RMNOD,
o CONFIGURE_IMFS_DISABLE_SYMLINK,
o CONFIGURE_IMFS_DISABLE_UNMOUNT, and
o CONFIGURE_IMFS_DISABLE_UTIME.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/confdefs.h

    ra2f5c7e1 ra9df916  
    126126#endif
    127127
    128 /*
    129  *  If the application disables the filesystem, they will not need
    130  *  a mount table, so do not produce one.
    131  */
    132 #ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
    133   #define CONFIGURE_HAS_OWN_MOUNT_TABLE
    134 #endif
    135 
    136128/**
    137129 * This macro defines the number of POSIX file descriptors allocated
     
    258250 *
    259251 *   List of available file systems. You can define as many as you like:
    260  *     CONFIGURE_FILESYSTEM_MINIIMFS - MiniIMFS, use DEVFS now
    261252 *     CONFIGURE_FILESYSTEM_IMFS     - In Memory File System (IMFS)
    262253 *     CONFIGURE_FILESYSTEM_DEVFS    - Device File System (DSVFS)
     
    272263 *    - If nothing is defined the base file system is the IMFS.
    273264 *
    274  *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystem
    275  *      are disabled by force and an empty DEVFS is created.
    276  *
    277  *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystem
     265 *    - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystems
     266 *      are disabled by force.
     267 *
     268 *    - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystems
    278269 *      are disabled by force and DEVFS is defined.
    279270 */
     
    286277   */
    287278  #ifdef CONFIGURE_FILESYSTEM_ALL
    288     #define CONFIGURE_FILESYSTEM_MINIIMFS
    289279    #define CONFIGURE_FILESYSTEM_IMFS
    290280    #define CONFIGURE_FILESYSTEM_DEVFS
     
    302292   */
    303293  #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
    304      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) || \
    305          defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
    306        #error "Filesystem disabled but a base filesystem configured."
     294     #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     295       #error "Filesystem disabled and a base filesystem configured."
    307296     #endif
    308297
    309     #if defined(CONFIGURE_FILESYSTEM_MINIIMFS) || \
    310         defined(CONFIGURE_FILESYSTEM_IMFS) || \
    311         defined(CONFIGURE_FILESYSTEM_DEVFS) || \
    312         defined(CONFIGURE_FILESYSTEM_TFTPFS) || \
    313         defined(CONFIGURE_FILESYSTEM_FTPFS) || \
    314         defined(CONFIGURE_FILESYSTEM_NFS) || \
    315         defined(CONFIGURE_FILESYSTEM_DOSFS) || \
    316         defined(CONFIGURE_FILESYSTEM_RFS) || \
    317         defined(CONFIGURE_FILESYSTEM_JFFS2)
    318         #error "Configured filesystems but root filesystem was not IMFS!"
    319         #error "Filesystems could be disabled, DEVFS is root, or"
    320         #error "  miniIMFS is root!"
     298     #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
     299       defined(CONFIGURE_FILESYSTEM_DEVFS) || \
     300       defined(CONFIGURE_FILESYSTEM_TFTPFS) || \
     301       defined(CONFIGURE_FILESYSTEM_FTPFS) || \
     302       defined(CONFIGURE_FILESYSTEM_NFS) || \
     303       defined(CONFIGURE_FILESYSTEM_DOSFS) || \
     304       defined(CONFIGURE_FILESYSTEM_RFS) || \
     305       defined(CONFIGURE_FILESYSTEM_JFFS2)
     306       #error "Filesystem disabled and a filesystem configured."
    321307     #endif
    322308  #endif
     
    329315    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
    330316      #define CONFIGURE_FILESYSTEM_DEVFS
    331     #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
    332       #define CONFIGURE_FILESYSTEM_MINIIMFS
    333     #elif !defined(CONFIGURE_FILESYSTEM_IMFS)
    334       #define CONFIGURE_FILESYSTEM_IMFS
    335317    #endif
    336318  #endif
     
    356338
    357339/**
    358  * This defines the miniIMFS file system table entry.
    359  */
    360 #if !defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS) && \
    361     defined(CONFIGURE_FILESYSTEM_MINIIMFS)
    362   #define CONFIGURE_FILESYSTEM_ENTRY_miniIMFS \
    363     { RTEMS_FILESYSTEM_TYPE_MINIIMFS, miniIMFS_initialize }
    364 #endif
    365 #endif
    366 
    367 #ifndef RTEMS_SCHEDSIM
    368 /**
    369340 * This defines the IMFS file system table entry.
    370341 */
    371342#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
    372     defined(CONFIGURE_FILESYSTEM_IMFS)
    373   #if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
    374     #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
    375       { RTEMS_FILESYSTEM_TYPE_IMFS, fifoIMFS_initialize }
    376   #else
    377     #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
    378       { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize }
    379   #endif
     343  defined(CONFIGURE_FILESYSTEM_IMFS)
     344  #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \
     345    { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize }
    380346#endif
    381347#endif
     
    507473  #endif
    508474
    509 #ifndef RTEMS_SCHEDSIM
    510   #if defined(CONFIGURE_FILESYSTEM_IMFS) || \
    511       defined(CONFIGURE_FILESYSTEM_MINIIMFS)
    512     int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
    513   #endif
    514 #endif
    515 
    516475  /**
    517476   * Table termination record.
     
    520479
    521480#ifndef RTEMS_SCHEDSIM
     481  #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) && \
     482    !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     483    int imfs_rq_memfile_bytes_per_block =
     484      CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
     485  #endif
     486
    522487  /**
    523488   * The default file system table. Must be terminated with the NULL entry if
    524489   * you provide your own.
    525490   */
    526   #ifndef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
     491  #if !defined(CONFIGURE_HAS_OWN_FILESYSTEM_TABLE) && \
     492    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
    527493    const rtems_filesystem_table_t rtems_filesystem_table[] = {
    528       #if defined(CONFIGURE_FILESYSTEM_MINIIMFS) && \
    529           defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS)
    530         CONFIGURE_FILESYSTEM_ENTRY_miniIMFS,
     494      #if !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
     495        { "/", IMFS_initialize_support },
    531496      #endif
    532497      #if defined(CONFIGURE_FILESYSTEM_IMFS) && \
     
    566531  #endif
    567532
    568   #ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
     533  #if !defined(CONFIGURE_HAS_OWN_MOUNT_TABLE) && \
     534    !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
    569535    #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
    570536      static devFS_node devFS_root_filesystem_nodes [CONFIGURE_MAXIMUM_DEVICES];
     
    573539        CONFIGURE_MAXIMUM_DEVICES
    574540      };
    575     #endif
     541    #else
     542      static IMFS_fs_info_t _Configure_IMFS_fs_info;
     543
     544      static const rtems_filesystem_operations_table _Configure_IMFS_ops = {
     545        rtems_filesystem_default_lock,
     546        rtems_filesystem_default_unlock,
     547        IMFS_eval_path,
     548        #ifdef CONFIGURE_IMFS_DISABLE_LINK
     549          rtems_filesystem_default_link,
     550        #else
     551          IMFS_link,
     552        #endif
     553        rtems_filesystem_default_are_nodes_equal,
     554        #ifdef CONFIGURE_IMFS_DISABLE_MKNOD
     555          rtems_filesystem_default_mknod,
     556        #else
     557          IMFS_mknod,
     558        #endif
     559        #ifdef CONFIGURE_IMFS_DISABLE_RMNOD
     560          rtems_filesystem_default_rmnod,
     561        #else
     562          IMFS_rmnod,
     563        #endif
     564        #ifdef CONFIGURE_IMFS_DISABLE_FCHMOD
     565          rtems_filesystem_default_fchmod,
     566        #else
     567          IMFS_fchmod,
     568        #endif
     569        #ifdef CONFIGURE_IMFS_DISABLE_CHOWN
     570          rtems_filesystem_default_chown,
     571        #else
     572          IMFS_chown,
     573        #endif
     574        IMFS_node_clone,
     575        IMFS_node_free,
     576        #ifdef CONFIGURE_IMFS_DISABLE_MOUNT
     577          rtems_filesystem_default_mount,
     578        #else
     579          IMFS_mount,
     580        #endif
     581        #ifdef CONFIGURE_IMFS_DISABLE_UNMOUNT
     582          rtems_filesystem_default_unmount,
     583        #else
     584          IMFS_unmount,
     585        #endif
     586        rtems_filesystem_default_fsunmount,
     587        #ifdef CONFIGURE_IMFS_DISABLE_UTIME
     588          rtems_filesystem_default_utime,
     589        #else
     590          IMFS_utime,
     591        #endif
     592        #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK
     593          rtems_filesystem_default_symlink,
     594        #else
     595          IMFS_symlink,
     596        #endif
     597        #ifdef CONFIGURE_IMFS_DISABLE_READLINK
     598          rtems_filesystem_default_readlink,
     599        #else
     600          IMFS_readlink,
     601        #endif
     602        #ifdef CONFIGURE_IMFS_DISABLE_RENAME
     603          rtems_filesystem_default_rename,
     604        #else
     605          IMFS_rename,
     606        #endif
     607        rtems_filesystem_default_statvfs
     608      };
     609
     610      static const IMFS_mknod_controls _Configure_IMFS_mknod_controls = {
     611        &IMFS_mknod_control_directory,
     612        &IMFS_mknod_control_device,
     613        &IMFS_mknod_control_memfile,
     614        #if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0
     615          &IMFS_mknod_control_fifo
     616        #else
     617          &IMFS_mknod_control_enosys
     618        #endif
     619      };
     620
     621      static const IMFS_mount_data _Configure_IMFS_mount_data = {
     622        &_Configure_IMFS_fs_info,
     623        &_Configure_IMFS_ops,
     624        &_Configure_IMFS_mknod_controls
     625      };
     626    #endif
     627
    576628    const rtems_filesystem_mount_configuration
    577629      rtems_filesystem_root_configuration = {
     
    580632      #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
    581633        RTEMS_FILESYSTEM_TYPE_DEVFS,
    582       #elif defined(CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM)
    583         RTEMS_FILESYSTEM_TYPE_MINIIMFS,
    584634      #else
    585         RTEMS_FILESYSTEM_TYPE_IMFS,
     635        "/",
    586636      #endif
    587637      RTEMS_FILESYSTEM_READ_WRITE,
     
    589639        &devFS_root_filesystem_data
    590640      #else
    591         NULL
     641        &_Configure_IMFS_mount_data
    592642      #endif
    593643    };
Note: See TracChangeset for help on using the changeset viewer.