Ignore:
Timestamp:
Jul 1, 2010, 3:18:06 PM (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
df719841
Parents:
c114654
Message:

2010-07-01 Sebastian Huber <sebastian.huber@…>

  • libcsupport/include/rtems/libio_.h: Removed rtems_filesystem_mount_table_control.
  • libcsupport/include/rtems/libio.h, libcsupport/src/mount-mgr.c, libcsupport/src/mount.c libcsupport/src/statvfs.c, libcsupport/src/unmount.c, libmisc/shell/main_mount.c: Documentation. Removed rtems_filesystem_mounts_first() and rtems_filesystem_mounts_next(). Added rtems_filesystem_mount_iterate(). Changed return type of rtems_filesystem_iterate(). Removed rtems_filesystem_nodes_equal().

2010-07-01 Sebastian Huber <sebastian.huber@…>

  • libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/librtemsNfs.h: Renamed rtems_nfsfs_initialize() in rtems_nfs_initialize().
  • sapi/include/confdefs.h: Reflect changes above. Renamed *_miniIMFS in *_MINIIMFS. Renamed *_NFSFS in *_NFS.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/include/rtems/libio.h

    rc114654 r955a34b5  
    315315
    316316/**
    317  * @brief File system table entry.
    318  */
    319 typedef struct rtems_filesystem_table_t {
    320   const char                    *type;
    321   rtems_filesystem_fsmount_me_t  mount_h;
    322 } rtems_filesystem_table_t;
    323 
    324 /**
    325  * @brief Static table of file systems.
    326  *
    327  * Externally defined by confdefs.h or the user.
    328  */
    329 extern const rtems_filesystem_table_t rtems_filesystem_table [];
    330 
    331 /**
    332  * @brief Per file system table entry routine type.
    333  *
    334  * @see rtems_filesystem_iterate().
    335  *
    336  * @retval true Continue the iteration.
    337  * @retval false Stop the iteration.
    338  */
    339 typedef bool (*rtems_per_filesystem_routine)(
    340   const rtems_filesystem_table_t *entry,
    341   void *arg
    342 );
    343 
    344 /**
    345  * @brief Iterates over the file system table.
    346  *
    347  * For each file system table entry the @a routine will be called with the
    348  * table entry and the @a routine_arg parameter.
    349  */
    350 void
    351 rtems_filesystem_iterate(
    352   rtems_per_filesystem_routine routine,
    353   void *routine_arg
    354 );
    355 
    356 /**
    357317 * @brief Gets the mount handler for the file system @a type.
    358318 *
     
    362322rtems_filesystem_fsmount_me_t
    363323rtems_filesystem_get_mount_handler(
    364   const char *type
    365 );
    366 
    367 /*
    368  * Get the first entry in the mount table.
    369  */
    370 rtems_filesystem_mount_table_entry_t*
    371 rtems_filesystem_mounts_first( void );
    372 
    373 /*
    374  * Get the next entry in the mount table.
    375  */
    376 rtems_filesystem_mount_table_entry_t*
    377 rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry );
    378 
    379 /*
    380  * Register a file system.
    381  */
    382 int
    383 rtems_filesystem_register(
    384   const char                    *type,
    385   rtems_filesystem_fsmount_me_t  mount_h
    386 );
    387 
    388 /*
    389  * Unregister a file system.
    390  */
    391 int
    392 rtems_filesystem_unregister(
    393324  const char *type
    394325);
     
    421352
    422353/**
    423  * @brief Mount table entry.
    424  */
    425 struct rtems_filesystem_mount_table_entry_tt {
    426   rtems_chain_node                       Node;
    427   rtems_filesystem_location_info_t       mt_point_node;
    428   rtems_filesystem_location_info_t       mt_fs_root;
    429   int                                    options;
    430   void                                  *fs_info;
    431 
    432   rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
    433 
    434   /*
    435    * The target or mount point of the file system.
    436    */
    437   const char                            *target;
    438 
    439   /*
    440    * The type of filesystem or the name of the filesystem.
    441    */
    442   const char                            *type;
    443 
    444   /*
    445    *  When someone adds a mounted filesystem on a real device,
    446    *  this will need to be used.
    447    *
    448    *  The lower layers can manage how this is managed. Leave as a
    449    *  string.
    450    */
    451   char                                  *dev;
    452 };
    453 
    454 /**
    455  * @brief The pathconf setting for a file system.
    456  */
    457 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
    458 
    459 /**
    460  * @brief The type of file system. Its name.
    461  */
    462 #define rtems_filesystem_type(_mte) ((_mte)->type)
    463 
    464 /**
    465  * @brief The mount point of a file system.
    466  */
    467 #define rtems_filesystem_mount_point(_mte) ((_mte)->target)
    468 
    469 /**
    470  * @brief The device entry of a file system.
    471  */
    472 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
    473 
    474 /**
    475  * @brief File systems options.
    476  */
    477 typedef enum {
    478   RTEMS_FILESYSTEM_READ_ONLY,
    479   RTEMS_FILESYSTEM_READ_WRITE,
    480   RTEMS_FILESYSTEM_BAD_OPTIONS
    481 } rtems_filesystem_options_t;
    482 
    483 /**
    484354 * @brief An open file data structure.
    485355 *
     
    670540 (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
    671541
     542/*
     543 *  Prototypes for filesystem
     544 */
     545
     546void rtems_filesystem_initialize( void );
     547
     548typedef void (*rtems_libio_init_functions_t)(void);
     549extern  rtems_libio_init_functions_t rtems_libio_init_helper;
     550
     551void    open_dev_console(void);
     552
     553typedef void (*rtems_libio_supp_functions_t)(void);
     554extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
     555
     556typedef void (*rtems_fs_init_functions_t)(void);
     557extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
     558
     559/**
     560 * @brief Creates a directory and all its parent directories according to
     561 * @a path.
     562 *
     563 * The @a mode value selects the access permissions of the directory.
     564 *
     565 * @retval 0 Successful operation.
     566 * @retval -1 An error occured.  The @c errno indicates the error.
     567 */
     568extern int rtems_mkdir(const char *path, mode_t mode);
     569
     570/** @} */
     571
     572/**
     573 * @defgroup FileSystemTypesAndMount File System Types and Mount
     574 *
     575 * @ingroup LibIO
     576 *
     577 * @brief File system types and mount.
     578 *
     579 * @{
     580 */
     581
    672582/**
    673583 * @name File System Types
     
    687597/** @} */
    688598
    689 /*
    690  *  Prototypes for filesystem
    691  */
    692 
    693 void rtems_filesystem_initialize( void );
    694 
     599/**
     600 * @brief Mount table entry.
     601 */
     602struct rtems_filesystem_mount_table_entry_tt {
     603  rtems_chain_node                       Node;
     604  rtems_filesystem_location_info_t       mt_point_node;
     605  rtems_filesystem_location_info_t       mt_fs_root;
     606  int                                    options;
     607  void                                  *fs_info;
     608
     609  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
     610
     611  /*
     612   * The target or mount point of the file system.
     613   */
     614  const char                            *target;
     615
     616  /*
     617   * The type of filesystem or the name of the filesystem.
     618   */
     619  const char                            *type;
     620
     621  /*
     622   *  When someone adds a mounted filesystem on a real device,
     623   *  this will need to be used.
     624   *
     625   *  The lower layers can manage how this is managed. Leave as a
     626   *  string.
     627   */
     628  char                                  *dev;
     629};
     630
     631/**
     632 * @brief File system options.
     633 */
     634typedef enum {
     635  RTEMS_FILESYSTEM_READ_ONLY,
     636  RTEMS_FILESYSTEM_READ_WRITE,
     637  RTEMS_FILESYSTEM_BAD_OPTIONS
     638} rtems_filesystem_options_t;
     639
     640/**
     641 * @brief File system table entry.
     642 */
     643typedef struct rtems_filesystem_table_t {
     644  const char                    *type;
     645  rtems_filesystem_fsmount_me_t  mount_h;
     646} rtems_filesystem_table_t;
     647
     648/**
     649 * @brief Static table of file systems.
     650 *
     651 * Externally defined by confdefs.h or the user.
     652 */
     653extern const rtems_filesystem_table_t rtems_filesystem_table [];
     654
     655/**
     656 * @brief Registers a file system @a type.
     657 *
     658 * The @a mount_h handler will be used to mount a file system of this @a type.
     659 *
     660 * @retval 0 Successful operation.
     661 * @retval -1 An error occured.  The @c errno indicates the error.
     662 */
     663int rtems_filesystem_register(
     664  const char                    *type,
     665  rtems_filesystem_fsmount_me_t  mount_h
     666);
     667
     668/**
     669 * @brief Unregisters a file system @a type.
     670 *
     671 * @retval 0 Successful operation.
     672 * @retval -1 An error occured.  The @c errno indicates the error.
     673 */
     674int rtems_filesystem_unregister(
     675  const char *type
     676);
     677
     678/**
     679 * @brief Unmounts the file system at @a mount_path.
     680 *
     681 * @todo Due to file system implementation shortcomings it is possible to
     682 * unmount file systems in use.  This likely leads to heap corruption.  Unmount
     683 * only file systems which are not in use by the application.
     684 *
     685 * @retval 0 Successful operation.
     686 * @retval -1 An error occured.  The @c errno indicates the error.
     687 */
    695688int unmount(
    696689  const char *mount_path
    697690);
    698691
     692/**
     693 * @brief Mounts a file system at @a target.
     694 *
     695 * The @a source may be a path to the corresponding device file, or @c NULL.
     696 * The @a target path must lead to an existing directory, or @c NULL.  In case
     697 * @a target is @c NULL, the root file system will be mounted.  The @a data
     698 * parameter will be forwarded to the file system initialization handler.  The
     699 * file system type is selected by @a filesystemtype and may be one of
     700 * - RTEMS_FILESYSTEM_TYPE_DEVFS,
     701 * - RTEMS_FILESYSTEM_TYPE_DOSFS,
     702 * - RTEMS_FILESYSTEM_TYPE_FTPFS,
     703 * - RTEMS_FILESYSTEM_TYPE_IMFS,
     704 * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
     705 * - RTEMS_FILESYSTEM_TYPE_NFS,
     706 * - RTEMS_FILESYSTEM_TYPE_RFS, or
     707 * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
     708 *
     709 * Only configured or registered file system types are available.  You can add
     710 * file system types to your application configuration with
     711 * - CONFIGURE_FILESYSTEM_DEVFS,
     712 * - CONFIGURE_FILESYSTEM_DOSFS,
     713 * - CONFIGURE_FILESYSTEM_FTPFS,
     714 * - CONFIGURE_FILESYSTEM_IMFS,
     715 * - CONFIGURE_FILESYSTEM_MINIIMFS,
     716 * - CONFIGURE_FILESYSTEM_NFS,
     717 * - CONFIGURE_FILESYSTEM_RFS, and
     718 * - CONFIGURE_FILESYSTEM_TFTPFS.
     719 *
     720 * @see rtems_filesystem_register() and mount_and_make_target_path().
     721 *
     722 * @retval 0 Successful operation.
     723 * @retval -1 An error occured.  The @c errno indicates the error.
     724 */
    699725int mount(
    700726  const char                 *source,
     
    724750);
    725751
    726 /*
    727  *  Boot Time Mount Table Structure
    728  */
    729 
     752/**
     753 * @brief Per file system type routine.
     754 *
     755 * @see rtems_filesystem_iterate().
     756 *
     757 * @retval true Stop the iteration.
     758 * @retval false Continue the iteration.
     759 */
     760typedef bool (*rtems_per_filesystem_routine)(
     761  const rtems_filesystem_table_t *fs_entry,
     762  void *arg
     763);
     764
     765/**
     766 * @brief Iterates over all file system types.
     767 *
     768 * For each file system type the @a routine will be called with the entry and
     769 * the @a routine_arg parameter.
     770 *
     771 * Do not register or unregister file system types in @a routine.
     772 *
     773 * The iteration is protected by the IO library mutex.
     774 *
     775 * @retval true Iteration stopped due to @a routine return status.
     776 * @retval false Iteration through all entries.
     777 */
     778bool rtems_filesystem_iterate(
     779  rtems_per_filesystem_routine routine,
     780  void *routine_arg
     781);
     782
     783/**
     784 * @brief Per file system mount routine.
     785 *
     786 * @see rtems_filesystem_mount_iterate().
     787 *
     788 * @retval true Stop the iteration.
     789 * @retval false Continue the iteration.
     790 */
     791typedef bool (*rtems_per_filesystem_mount_routine)(
     792  const rtems_filesystem_mount_table_entry_t *mt_entry,
     793  void *arg
     794);
     795
     796/**
     797 * @brief Iterates over all file system mounts.
     798 *
     799 * For each file system mount the @a routine will be called with the entry and
     800 * the @a routine_arg parameter.
     801 *
     802 * Do not mount or unmount file systems in @a routine.
     803 *
     804 * The iteration is protected by the IO library mutex.
     805 *
     806 * @retval true Iteration stopped due to @a routine return status.
     807 * @retval false Iteration through all entries.
     808 */
     809bool
     810rtems_filesystem_mount_iterate(
     811  rtems_per_filesystem_mount_routine routine,
     812  void *routine_arg
     813);
     814
     815/**
     816 * @brief Boot time mount table entry.
     817 */
    730818typedef struct {
    731819  const char                              *type;
     
    737825extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
    738826extern const int                             rtems_filesystem_mount_table_size;
    739 
    740 typedef void (*rtems_libio_init_functions_t)(void);
    741 extern  rtems_libio_init_functions_t rtems_libio_init_helper;
    742 
    743 void    open_dev_console(void);
    744 
    745 typedef void (*rtems_libio_supp_functions_t)(void);
    746 extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
    747 
    748 typedef void (*rtems_fs_init_functions_t)(void);
    749 extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
    750827
    751828/**
     
    832909/** @} */
    833910
     911/**
     912 * @brief The pathconf setting for a file system.
     913 */
     914#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
     915
     916/**
     917 * @brief The type of file system. Its name.
     918 */
     919#define rtems_filesystem_type(_mte) ((_mte)->type)
     920
     921/**
     922 * @brief The mount point of a file system.
     923 */
     924#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
     925
     926/**
     927 * @brief The device entry of a file system.
     928 */
     929#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
     930
    834931#ifdef __cplusplus
    835932}
Note: See TracChangeset for help on using the changeset viewer.