<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-07-01)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* 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().
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2477&r2=text&tr2=1.2478&diff_format=h">M</a></td><td width='1%'>1.2478</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/include/rtems/libio.h.diff?r1=text&tr1=1.74&r2=text&tr2=1.75&diff_format=h">M</a></td><td width='1%'>1.75</td><td width='100%'>cpukit/libcsupport/include/rtems/libio.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/include/rtems/libio_.h.diff?r1=text&tr1=1.38&r2=text&tr2=1.39&diff_format=h">M</a></td><td width='1%'>1.39</td><td width='100%'>cpukit/libcsupport/include/rtems/libio_.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/mount-mgr.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>cpukit/libcsupport/src/mount-mgr.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/mount.c.diff?r1=text&tr1=1.37&r2=text&tr2=1.38&diff_format=h">M</a></td><td width='1%'>1.38</td><td width='100%'>cpukit/libcsupport/src/mount.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/statvfs.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>cpukit/libcsupport/src/statvfs.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/unmount.c.diff?r1=text&tr1=1.26&r2=text&tr2=1.27&diff_format=h">M</a></td><td width='1%'>1.27</td><td width='100%'>cpukit/libcsupport/src/unmount.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/shell/main_mount.c.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>cpukit/libmisc/shell/main_mount.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2477 rtems/cpukit/ChangeLog:1.2478
--- rtems/cpukit/ChangeLog:1.2477 Thu Jul 1 04:49:05 2010
+++ rtems/cpukit/ChangeLog Thu Jul 1 08:05:15 2010
</font><font color='#997700'>@@ -1,5 +1,17 @@
</font> 2010-07-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
<font color='#000088'>+ * 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@embedded-brains.de>
+
</font> * 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().
<font color='#006600'>diff -u rtems/cpukit/libcsupport/include/rtems/libio.h:1.74 rtems/cpukit/libcsupport/include/rtems/libio.h:1.75
--- rtems/cpukit/libcsupport/include/rtems/libio.h:1.74 Wed Jun 30 08:58:56 2010
+++ rtems/cpukit/libcsupport/include/rtems/libio.h Thu Jul 1 08:05:18 2010
</font><font color='#997700'>@@ -1039,46 +1039,6 @@
</font> );
/**
<font color='#880000'>- * @brief File system table entry.
- */
-typedef struct rtems_filesystem_table_t {
- const char *type;
- rtems_filesystem_fsmount_me_t mount_h;
-} rtems_filesystem_table_t;
-
-/**
- * @brief Static table of file systems.
- *
- * Externally defined by confdefs.h or the user.
- */
-extern const rtems_filesystem_table_t rtems_filesystem_table [];
-
-/**
- * @brief Per file system table entry routine type.
- *
- * @see rtems_filesystem_iterate().
- *
- * @retval true Continue the iteration.
- * @retval false Stop the iteration.
- */
-typedef bool (*rtems_per_filesystem_routine)(
- const rtems_filesystem_table_t *entry,
- void *arg
-);
-
-/**
- * @brief Iterates over the file system table.
- *
- * For each file system table entry the @a routine will be called with the
- * table entry and the @a routine_arg parameter.
- */
-void
-rtems_filesystem_iterate(
- rtems_per_filesystem_routine routine,
- void *routine_arg
-);
-
-/**
</font> * @brief Gets the mount handler for the file system @a type.
*
* @return The file system mount handler associated with the @a type, or
<font color='#997700'>@@ -1089,35 +1049,6 @@
</font> const char *type
);
<font color='#880000'>-/*
- * Get the first entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t*
-rtems_filesystem_mounts_first( void );
-
-/*
- * Get the next entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t*
-rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry );
-
-/*
- * Register a file system.
- */
-int
-rtems_filesystem_register(
- const char *type,
- rtems_filesystem_fsmount_me_t mount_h
-);
-
-/*
- * Unregister a file system.
- */
-int
-rtems_filesystem_unregister(
- const char *type
-);
-
</font> /**
* @brief Contain file system specific information which is required to support
* fpathconf().
<font color='#997700'>@@ -1145,67 +1076,6 @@
</font> extern const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf;
/**
<font color='#880000'>- * @brief Mount table entry.
- */
-struct rtems_filesystem_mount_table_entry_tt {
- rtems_chain_node Node;
- rtems_filesystem_location_info_t mt_point_node;
- rtems_filesystem_location_info_t mt_fs_root;
- int options;
- void *fs_info;
-
- rtems_filesystem_limits_and_options_t pathconf_limits_and_options;
-
- /*
- * The target or mount point of the file system.
- */
- const char *target;
-
- /*
- * The type of filesystem or the name of the filesystem.
- */
- const char *type;
-
- /*
- * When someone adds a mounted filesystem on a real device,
- * this will need to be used.
- *
- * The lower layers can manage how this is managed. Leave as a
- * string.
- */
- char *dev;
-};
-
-/**
- * @brief The pathconf setting for a file system.
- */
-#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
-
-/**
- * @brief The type of file system. Its name.
- */
-#define rtems_filesystem_type(_mte) ((_mte)->type)
-
-/**
- * @brief The mount point of a file system.
- */
-#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
-
-/**
- * @brief The device entry of a file system.
- */
-#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
-
-/**
- * @brief File systems options.
- */
-typedef enum {
- RTEMS_FILESYSTEM_READ_ONLY,
- RTEMS_FILESYSTEM_READ_WRITE,
- RTEMS_FILESYSTEM_BAD_OPTIONS
-} rtems_filesystem_options_t;
-
-/**
</font> * @brief An open file data structure.
*
* It will be indexed by 'fd'.
<font color='#997700'>@@ -1394,6 +1264,46 @@
</font> #define rtems_libio_is_valid_perms( _perm ) \
(~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
<font color='#000088'>+/*
+ * Prototypes for filesystem
+ */
+
+void rtems_filesystem_initialize( void );
+
+typedef void (*rtems_libio_init_functions_t)(void);
+extern rtems_libio_init_functions_t rtems_libio_init_helper;
+
+void open_dev_console(void);
+
+typedef void (*rtems_libio_supp_functions_t)(void);
+extern rtems_libio_supp_functions_t rtems_libio_supp_helper;
+
+typedef void (*rtems_fs_init_functions_t)(void);
+extern rtems_fs_init_functions_t rtems_fs_init_helper;
+
+/**
+ * @brief Creates a directory and all its parent directories according to
+ * @a path.
+ *
+ * The @a mode value selects the access permissions of the directory.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
+extern int rtems_mkdir(const char *path, mode_t mode);
+
+/** @} */
+
+/**
+ * @defgroup FileSystemTypesAndMount File System Types and Mount
+ *
+ * @ingroup LibIO
+ *
+ * @brief File system types and mount.
+ *
+ * @{
+ */
+
</font> /**
* @name File System Types
*
<font color='#997700'>@@ -1411,16 +1321,132 @@
</font>
/** @} */
<font color='#880000'>-/*
- * Prototypes for filesystem
</font><font color='#000088'>+/**
+ * @brief Mount table entry.
</font> */
<font color='#000088'>+struct rtems_filesystem_mount_table_entry_tt {
+ rtems_chain_node Node;
+ rtems_filesystem_location_info_t mt_point_node;
+ rtems_filesystem_location_info_t mt_fs_root;
+ int options;
+ void *fs_info;
</font>
<font color='#880000'>-void rtems_filesystem_initialize( void );
</font><font color='#000088'>+ rtems_filesystem_limits_and_options_t pathconf_limits_and_options;
+
+ /*
+ * The target or mount point of the file system.
+ */
+ const char *target;
+
+ /*
+ * The type of filesystem or the name of the filesystem.
+ */
+ const char *type;
+
+ /*
+ * When someone adds a mounted filesystem on a real device,
+ * this will need to be used.
+ *
+ * The lower layers can manage how this is managed. Leave as a
+ * string.
+ */
+ char *dev;
+};
+
+/**
+ * @brief File system options.
+ */
+typedef enum {
+ RTEMS_FILESYSTEM_READ_ONLY,
+ RTEMS_FILESYSTEM_READ_WRITE,
+ RTEMS_FILESYSTEM_BAD_OPTIONS
+} rtems_filesystem_options_t;
+
+/**
+ * @brief File system table entry.
+ */
+typedef struct rtems_filesystem_table_t {
+ const char *type;
+ rtems_filesystem_fsmount_me_t mount_h;
+} rtems_filesystem_table_t;
</font>
<font color='#000088'>+/**
+ * @brief Static table of file systems.
+ *
+ * Externally defined by confdefs.h or the user.
+ */
+extern const rtems_filesystem_table_t rtems_filesystem_table [];
+
+/**
+ * @brief Registers a file system @a type.
+ *
+ * The @a mount_h handler will be used to mount a file system of this @a type.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
+int rtems_filesystem_register(
+ const char *type,
+ rtems_filesystem_fsmount_me_t mount_h
+);
+
+/**
+ * @brief Unregisters a file system @a type.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
+int rtems_filesystem_unregister(
+ const char *type
+);
+
+/**
+ * @brief Unmounts the file system at @a mount_path.
+ *
+ * @todo Due to file system implementation shortcomings it is possible to
+ * unmount file systems in use. This likely leads to heap corruption. Unmount
+ * only file systems which are not in use by the application.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
</font> int unmount(
const char *mount_path
);
<font color='#000088'>+/**
+ * @brief Mounts a file system at @a target.
+ *
+ * The @a source may be a path to the corresponding device file, or @c NULL.
+ * The @a target path must lead to an existing directory, or @c NULL. In case
+ * @a target is @c NULL, the root file system will be mounted. The @a data
+ * parameter will be forwarded to the file system initialization handler. The
+ * file system type is selected by @a filesystemtype and may be one of
+ * - RTEMS_FILESYSTEM_TYPE_DEVFS,
+ * - RTEMS_FILESYSTEM_TYPE_DOSFS,
+ * - RTEMS_FILESYSTEM_TYPE_FTPFS,
+ * - RTEMS_FILESYSTEM_TYPE_IMFS,
+ * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
+ * - RTEMS_FILESYSTEM_TYPE_NFS,
+ * - RTEMS_FILESYSTEM_TYPE_RFS, or
+ * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
+ *
+ * Only configured or registered file system types are available. You can add
+ * file system types to your application configuration with
+ * - CONFIGURE_FILESYSTEM_DEVFS,
+ * - CONFIGURE_FILESYSTEM_DOSFS,
+ * - CONFIGURE_FILESYSTEM_FTPFS,
+ * - CONFIGURE_FILESYSTEM_IMFS,
+ * - CONFIGURE_FILESYSTEM_MINIIMFS,
+ * - CONFIGURE_FILESYSTEM_NFS,
+ * - CONFIGURE_FILESYSTEM_RFS, and
+ * - CONFIGURE_FILESYSTEM_TFTPFS.
+ *
+ * @see rtems_filesystem_register() and mount_and_make_target_path().
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured. The @c errno indicates the error.
+ */
</font> int mount(
const char *source,
const char *target,
<font color='#997700'>@@ -1448,10 +1474,72 @@
</font> const void *data
);
<font color='#880000'>-/*
- * Boot Time Mount Table Structure
</font><font color='#000088'>+/**
+ * @brief Per file system type routine.
+ *
+ * @see rtems_filesystem_iterate().
+ *
+ * @retval true Stop the iteration.
+ * @retval false Continue the iteration.
+ */
+typedef bool (*rtems_per_filesystem_routine)(
+ const rtems_filesystem_table_t *fs_entry,
+ void *arg
+);
+
+/**
+ * @brief Iterates over all file system types.
+ *
+ * For each file system type the @a routine will be called with the entry and
+ * the @a routine_arg parameter.
+ *
+ * Do not register or unregister file system types in @a routine.
+ *
+ * The iteration is protected by the IO library mutex.
+ *
+ * @retval true Iteration stopped due to @a routine return status.
+ * @retval false Iteration through all entries.
</font> */
<font color='#000088'>+bool rtems_filesystem_iterate(
+ rtems_per_filesystem_routine routine,
+ void *routine_arg
+);
</font>
<font color='#000088'>+/**
+ * @brief Per file system mount routine.
+ *
+ * @see rtems_filesystem_mount_iterate().
+ *
+ * @retval true Stop the iteration.
+ * @retval false Continue the iteration.
+ */
+typedef bool (*rtems_per_filesystem_mount_routine)(
+ const rtems_filesystem_mount_table_entry_t *mt_entry,
+ void *arg
+);
+
+/**
+ * @brief Iterates over all file system mounts.
+ *
+ * For each file system mount the @a routine will be called with the entry and
+ * the @a routine_arg parameter.
+ *
+ * Do not mount or unmount file systems in @a routine.
+ *
+ * The iteration is protected by the IO library mutex.
+ *
+ * @retval true Iteration stopped due to @a routine return status.
+ * @retval false Iteration through all entries.
+ */
+bool
+rtems_filesystem_mount_iterate(
+ rtems_per_filesystem_mount_routine routine,
+ void *routine_arg
+);
+
+/**
+ * @brief Boot time mount table entry.
+ */
</font> typedef struct {
const char *type;
rtems_filesystem_options_t fsoptions;
<font color='#997700'>@@ -1459,30 +1547,19 @@
</font> const char *mount_point;
} rtems_filesystem_mount_table_t;
<font color='#000088'>+/**
+ * @brief Boot time mount table.
+ *
+ * @todo Only the first entry will be evaluated. Why do we need a table?
+ */
</font> extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
<font color='#880000'>-extern const int rtems_filesystem_mount_table_size;
-
-typedef void (*rtems_libio_init_functions_t)(void);
-extern rtems_libio_init_functions_t rtems_libio_init_helper;
-
-void open_dev_console(void);
-
-typedef void (*rtems_libio_supp_functions_t)(void);
-extern rtems_libio_supp_functions_t rtems_libio_supp_helper;
-
-typedef void (*rtems_fs_init_functions_t)(void);
-extern rtems_fs_init_functions_t rtems_fs_init_helper;
</font>
/**
<font color='#880000'>- * @brief Creates a directory and all its parent directories according to
- * @a path.
- *
- * The @a mode value selects the access permissions of the directory.
</font><font color='#000088'>+ * @brief Boot time mount table entry count.
</font> *
<font color='#880000'>- * @retval 0 Successful operation.
- * @retval -1 An error occured. The @c errno indicates the error.
</font><font color='#000088'>+ * @todo Only the first entry will be evaluated. Why do we need a table?
</font> */
<font color='#880000'>-extern int rtems_mkdir(const char *path, mode_t mode);
</font><font color='#000088'>+extern const int rtems_filesystem_mount_table_size;
</font>
/** @} */
<font color='#997700'>@@ -1556,6 +1633,26 @@
</font>
/** @} */
<font color='#000088'>+/**
+ * @brief The pathconf setting for a file system.
+ */
+#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
+
+/**
+ * @brief The type of file system. Its name.
+ */
+#define rtems_filesystem_type(_mte) ((_mte)->type)
+
+/**
+ * @brief The mount point of a file system.
+ */
+#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
+
+/**
+ * @brief The device entry of a file system.
+ */
+#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
+
</font> #ifdef __cplusplus
}
#endif
<font color='#006600'>diff -u rtems/cpukit/libcsupport/include/rtems/libio_.h:1.38 rtems/cpukit/libcsupport/include/rtems/libio_.h:1.39
--- rtems/cpukit/libcsupport/include/rtems/libio_.h:1.38 Tue Jun 22 15:03:41 2010
+++ rtems/cpukit/libcsupport/include/rtems/libio_.h Thu Jul 1 08:05:18 2010
</font><font color='#997700'>@@ -40,11 +40,6 @@
</font> extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
/*
<font color='#880000'>- * Mount table list.
- */
-extern rtems_chain_control rtems_filesystem_mount_table_control;
-
-/*
</font> * File descriptor Table Information
*/
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/mount-mgr.c:1.3 rtems/cpukit/libcsupport/src/mount-mgr.c:1.4
--- rtems/cpukit/libcsupport/src/mount-mgr.c:1.3 Mon Jun 7 10:35:24 2010
+++ rtems/cpukit/libcsupport/src/mount-mgr.c Thu Jul 1 08:05:17 2010
</font><font color='#997700'>@@ -37,38 +37,37 @@
</font> rtems_filesystem_table_t entry;
} filesystem_node;
<font color='#880000'>-RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
</font><font color='#000088'>+static RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
</font>
<font color='#880000'>-void
-rtems_filesystem_iterate(
</font><font color='#000088'>+bool rtems_filesystem_iterate(
</font> rtems_per_filesystem_routine routine,
void *routine_arg
)
{
const rtems_filesystem_table_t *table_entry = &rtems_filesystem_table [0];
rtems_chain_node *node = NULL;
<font color='#000088'>+ bool stop = false;
</font>
<font color='#880000'>- while ( table_entry->type ) {
- if ( !(*routine)( table_entry, routine_arg ) ) {
- break;
- }
-
</font><font color='#000088'>+ while ( table_entry->type && !stop ) {
+ stop = (*routine)( table_entry, routine_arg );
</font> ++table_entry;
}
<font color='#880000'>- rtems_libio_lock();
- for (
- node = rtems_chain_first( &filesystem_chain );
- !rtems_chain_is_tail( &filesystem_chain, node );
- node = rtems_chain_next( node )
- ) {
- const filesystem_node *fsn = (filesystem_node *) node;
</font><font color='#000088'>+ if ( !stop ) {
+ rtems_libio_lock();
+ for (
+ node = rtems_chain_first( &filesystem_chain );
+ !rtems_chain_is_tail( &filesystem_chain, node ) && !stop;
+ node = rtems_chain_next( node )
+ ) {
+ const filesystem_node *fsn = (filesystem_node *) node;
</font>
<font color='#880000'>- if ( !(*routine)( &fsn->entry, routine_arg ) ) {
- break;
</font><font color='#000088'>+ stop = (*routine)( &fsn->entry, routine_arg );
</font> }
<font color='#000088'>+ rtems_libio_unlock();
</font> }
<font color='#880000'>- rtems_libio_unlock();
</font><font color='#000088'>+
+ return stop;
</font> }
typedef struct {
<font color='#997700'>@@ -81,7 +80,7 @@
</font> find_arg *fa = arg;
if ( strcmp( entry->type, fa->type ) != 0 ) {
<font color='#880000'>- return true;
</font><font color='#000088'>+ return false;
</font> } else {
fa->mount_h = entry->mount_h;
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/mount.c:1.37 rtems/cpukit/libcsupport/src/mount.c:1.38
--- rtems/cpukit/libcsupport/src/mount.c:1.37 Tue Jun 22 09:20:49 2010
+++ rtems/cpukit/libcsupport/src/mount.c Thu Jul 1 08:05:17 2010
</font><font color='#997700'>@@ -36,10 +36,7 @@
</font>
#include <rtems/libio_.h>
<font color='#880000'>-/*
- * Mount table list.
- */
-RTEMS_CHAIN_DEFINE_EMPTY(rtems_filesystem_mount_table_control);
</font><font color='#000088'>+static RTEMS_CHAIN_DEFINE_EMPTY(mount_chain);
</font>
/*
* Default pathconfs.
<font color='#997700'>@@ -59,37 +56,12 @@
</font> 0 /* posix_vdisable: special char processing, 0=no, 1=yes */
};
<font color='#880000'>-/*
- * Is_node_fs_root
- *
- * This routine will run through the entries that currently exist in the
- * mount table chain. For each entry in the mount table chain it will
- * compare the mount tables root node to the node describing the selected
- * mount point. If any match is found true is returned else false is
- * returned.
- *
- */
-
-static bool Is_node_fs_root(
- rtems_filesystem_location_info_t *loc
</font><font color='#000088'>+static bool is_node_fs_root(
+ const rtems_filesystem_mount_table_entry_t *mt_entry,
+ void *arg
</font> )
{
<font color='#880000'>- rtems_chain_node *node = NULL;
-
- /*
- * For each mount table entry
- */
- for ( node = rtems_chain_first( &rtems_filesystem_mount_table_control );
- !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, node );
- node = rtems_chain_next( node ) ) {
- rtems_filesystem_mount_table_entry_t *mount_table_entry =
- (rtems_filesystem_mount_table_entry_t *) node;
-
- if ( mount_table_entry->mt_fs_root.node_access == loc->node_access )
- return true;
- }
-
- return false;
</font><font color='#000088'>+ return arg == mt_entry->mt_fs_root.node_access;
</font> }
static rtems_filesystem_mount_table_entry_t *alloc_mount_table_entry(
<font color='#997700'>@@ -225,7 +197,7 @@
</font> * You can only mount one file system onto a single mount point.
*/
<font color='#880000'>- if ( Is_node_fs_root( &loc ) ){
</font><font color='#000088'>+ if ( rtems_filesystem_mount_iterate( is_node_fs_root, loc.node_access ) ) {
</font> errno = EBUSY;
goto cleanup_and_bail;
}
<font color='#997700'>@@ -260,7 +232,7 @@
</font> /*
* Do we already have a base file system ?
*/
<font color='#880000'>- if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) ) {
</font><font color='#000088'>+ if ( !rtems_chain_is_empty( &mount_chain ) ) {
</font> errno = EINVAL;
goto cleanup_and_bail;
}
<font color='#997700'>@@ -285,8 +257,9 @@
</font> /*
* Add the mount table entry to the mount table chain
*/
<font color='#880000'>- rtems_chain_append( &rtems_filesystem_mount_table_control,
- &mt_entry->Node );
</font><font color='#000088'>+ rtems_libio_lock();
+ rtems_chain_append( &mount_chain, &mt_entry->Node );
+ rtems_libio_unlock();
</font>
if ( !has_target )
rtems_filesystem_root = mt_entry->mt_fs_root;
<font color='#997700'>@@ -303,33 +276,26 @@
</font> return -1;
}
<font color='#880000'>-/*
- * Get the first entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t *
-rtems_filesystem_mounts_first(
- void
</font><font color='#000088'>+bool rtems_filesystem_mount_iterate(
+ rtems_per_filesystem_mount_routine routine,
+ void *routine_arg
</font> )
{
<font color='#880000'>- rtems_filesystem_mount_table_entry_t *entry = NULL;
</font><font color='#000088'>+ rtems_chain_node *node = NULL;
+ bool stop = false;
</font>
<font color='#880000'>- if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) )
- entry = (rtems_filesystem_mount_table_entry_t *)
- rtems_chain_first( &rtems_filesystem_mount_table_control );
</font><font color='#000088'>+ rtems_libio_lock();
+ for (
+ node = rtems_chain_first( &mount_chain );
+ !rtems_chain_is_tail( &mount_chain, node ) && !stop;
+ node = rtems_chain_next( node )
+ ) {
+ const rtems_filesystem_mount_table_entry_t *mt_entry =
+ (rtems_filesystem_mount_table_entry_t *) node;
</font>
<font color='#880000'>- return entry;
-}
</font><font color='#000088'>+ stop = (*routine)( mt_entry, routine_arg );
+ }
+ rtems_libio_unlock();
</font>
<font color='#880000'>-/*
- * Get the next entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t *
-rtems_filesystem_mounts_next(
- rtems_filesystem_mount_table_entry_t *entry
-)
-{
- if ( !entry )
- return NULL;
- return (rtems_filesystem_mount_table_entry_t *)
- rtems_chain_next( &entry->Node );
</font><font color='#000088'>+ return stop;
</font> }
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/statvfs.c:1.2 rtems/cpukit/libcsupport/src/statvfs.c:1.3
--- rtems/cpukit/libcsupport/src/statvfs.c:1.2 Sun Nov 29 07:35:32 2009
+++ rtems/cpukit/libcsupport/src/statvfs.c Thu Jul 1 08:05:18 2010
</font><font color='#997700'>@@ -21,11 +21,6 @@
</font>
#include <sys/statvfs.h>
<font color='#880000'>-/*
- * Data structures and routines private to mount/unmount pair.
- */
-extern rtems_chain_control rtems_filesystem_mount_table_control;
-
</font> int
statvfs (const char *path, struct statvfs *sb)
{
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/unmount.c:1.26 rtems/cpukit/libcsupport/src/unmount.c:1.27
--- rtems/cpukit/libcsupport/src/unmount.c:1.26 Thu Jun 10 05:12:28 2010
+++ rtems/cpukit/libcsupport/src/unmount.c Thu Jul 1 08:05:18 2010
</font><font color='#997700'>@@ -22,7 +22,6 @@
</font>
#include <sys/types.h>
#include <sys/stat.h>
<font color='#880000'>-#include <rtems/chain.h>
</font> #include <fcntl.h>
#include <unistd.h>
#include <errno.h>
<font color='#997700'>@@ -32,51 +31,14 @@
</font>
#include <rtems/libio_.h>
#include <rtems/seterr.h>
<font color='#000088'>+#include <rtems/chain.h>
</font>
<font color='#880000'>-bool rtems_filesystem_nodes_equal(
- const rtems_filesystem_location_info_t *loc1,
- const rtems_filesystem_location_info_t *loc2
-){
- return ( loc1->node_access == loc2->node_access );
-}
-
-
-/*
- * file_systems_below_this_mountpoint
- *
- * This routine will run through the entries that currently exist in the
- * mount table chain. For each entry in the mount table chain it will
- * compare the mount tables mt_fs_root to the new_fs_root_node. If any of the
- * mount table file system root nodes matches the new file system root node
- * this indicates that we are trying to mount a file system that has already
- * been mounted. This is not a permitted operation. temp_loc is set to
- * the root node of the file system being unmounted.
- */
-
-bool file_systems_below_this_mountpoint(
- const char *path __attribute__((unused)),
- rtems_filesystem_location_info_t *fs_root_loc,
- rtems_filesystem_mount_table_entry_t *fs_to_unmount __attribute__((unused))
</font><font color='#000088'>+static bool is_fs_below_mount_point(
+ const rtems_filesystem_mount_table_entry_t *mt_entry,
+ void *arg
</font> )
{
<font color='#880000'>- rtems_chain_node *the_node;
- rtems_filesystem_mount_table_entry_t *the_mount_entry;
-
- /*
- * Search the mount table for any mount entries referencing this
- * mount entry.
- */
-
- for ( the_node = rtems_filesystem_mount_table_control.first;
- !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
- the_node = the_node->next ) {
- the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
- if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
- return true;
- }
- }
-
- return false;
</font><font color='#000088'>+ return arg == mt_entry->mt_point_node.mt_entry;
</font> }
/*
<font color='#997700'>@@ -114,7 +76,7 @@
</font> * Verify this is the root node for the file system to be unmounted.
*/
<font color='#880000'>- if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){
</font><font color='#000088'>+ if ( fs_root_loc->node_access != loc.node_access ){
</font> rtems_filesystem_freenode( &loc );
rtems_set_errno_and_return_minus_one( EACCES );
}
<font color='#997700'>@@ -151,7 +113,8 @@
</font> * Verify there are no file systems below the path specified
*/
<font color='#880000'>- if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 )
</font><font color='#000088'>+ if ( rtems_filesystem_mount_iterate( is_fs_below_mount_point,
+ fs_root_loc->mt_entry ) )
</font> rtems_set_errno_and_return_minus_one( EBUSY );
/*
<font color='#997700'>@@ -195,7 +158,9 @@
</font> * Extract the mount table entry from the chain
*/
<font color='#880000'>- rtems_chain_extract( ( rtems_chain_node * ) mt_entry );
</font><font color='#000088'>+ rtems_libio_lock();
+ rtems_chain_extract( &mt_entry->Node );
+ rtems_libio_unlock();
</font>
/*
* Free the memory node that was allocated in mount
<font color='#006600'>diff -u rtems/cpukit/libmisc/shell/main_mount.c:1.9 rtems/cpukit/libmisc/shell/main_mount.c:1.10
--- rtems/cpukit/libmisc/shell/main_mount.c:1.9 Mon Jun 7 10:35:24 2010
+++ rtems/cpukit/libmisc/shell/main_mount.c Thu Jul 1 08:05:18 2010
</font><font color='#997700'>@@ -31,7 +31,7 @@
</font> {
printf("%s ", entry->type);
<font color='#880000'>- return true;
</font><font color='#000088'>+ return false;
</font> }
int rtems_shell_main_mount(
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>