2011-11-03 Chris Johns <chrisj@rtems.org>

PR 1948/filesystem
        * libfs/src/rfs/rtems-rfs-file-system.c,
        libfs/src/rfs/rtems-rfs-file-system.h,
        libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-rtems.c:
        Add support for mount passing an ASCIIZ string containing
        configuration options.
        * libblock/src/bdbuf.c: Fix state labels in trace output.
This commit is contained in:
Chris Johns
2011-11-03 04:23:07 +00:00
parent 478fb7eb99
commit 4c5e2fcf7e
6 changed files with 52 additions and 4 deletions

View File

@@ -1,3 +1,13 @@
2011-11-03 Chris Johns <chrisj@rtems.org>
PR 1948/filesystem
* libfs/src/rfs/rtems-rfs-file-system.c,
libfs/src/rfs/rtems-rfs-file-system.h,
libfs/src/rfs/rtems-rfs-format.c, libfs/src/rfs/rtems-rfs-rtems.c:
Add support for mount passing an ASCIIZ string containing
configuration options.
* libblock/src/bdbuf.c: Fix state labels in trace output.
2011-10-09 Ralf Corsépius <ralf.corsepius@rtems.org> 2011-10-09 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/serdbg/serdbg.h (putDebugChar, getDebugChar): * libmisc/serdbg/serdbg.h (putDebugChar, getDebugChar):

View File

@@ -291,7 +291,7 @@ void
rtems_bdbuf_show_users (const char* where, rtems_bdbuf_buffer* bd) rtems_bdbuf_show_users (const char* where, rtems_bdbuf_buffer* bd)
{ {
const char* states[] = const char* states[] =
{ "EM", "FR", "CH", "AC", "AM", "MD", "SY", "TR" }; { "FR", "EM", "CH", "AC", "AM", "MD", "SY", "TR" };
printf ("bdbuf:users: %15s: [%" PRIu32 " (%s)] %td:%td = %" PRIu32 " %s\n", printf ("bdbuf:users: %15s: [%" PRIu32 " (%s)] %td:%td = %" PRIu32 " %s\n",
where, where,

View File

@@ -196,6 +196,7 @@ int
rtems_rfs_fs_open (const char* name, rtems_rfs_fs_open (const char* name,
void* user, void* user,
uint32_t flags, uint32_t flags,
uint32_t max_held_buffers,
rtems_rfs_file_system** fs) rtems_rfs_file_system** fs)
{ {
rtems_rfs_group* group; rtems_rfs_group* group;
@@ -224,7 +225,7 @@ rtems_rfs_fs_open (const char* name,
rtems_chain_initialize_empty (&(*fs)->release_modified); rtems_chain_initialize_empty (&(*fs)->release_modified);
rtems_chain_initialize_empty (&(*fs)->file_shares); rtems_chain_initialize_empty (&(*fs)->file_shares);
(*fs)->max_held_buffers = RTEMS_RFS_FS_MAX_HELD_BUFFERS; (*fs)->max_held_buffers = max_held_buffers;
(*fs)->buffers_count = 0; (*fs)->buffers_count = 0;
(*fs)->release_count = 0; (*fs)->release_count = 0;
(*fs)->release_modified_count = 0; (*fs)->release_modified_count = 0;

View File

@@ -384,11 +384,14 @@ uint64_t rtems_rfs_fs_media_size (rtems_rfs_file_system* fs);
* @param name The device to open. * @param name The device to open.
* @param fs The file system data filled in by this call. * @param fs The file system data filled in by this call.
* @param user A pointer to user data. * @param user A pointer to user data.
* @param flags The initial set of user flags for the file system.
* @param max_held_buffers The maximum number of buffers the RFS holds.
* @return int The error number (errno). No error if 0. * @return int The error number (errno). No error if 0.
*/ */
int rtems_rfs_fs_open (const char* name, int rtems_rfs_fs_open (const char* name,
void* user, void* user,
uint32_t flags, uint32_t flags,
uint32_t max_held_buffers,
rtems_rfs_file_system** fs); rtems_rfs_file_system** fs);
/** /**

View File

@@ -465,7 +465,9 @@ rtems_rfs_write_root_dir (const char* name)
/* /*
* External API so returns -1. * External API so returns -1.
*/ */
rc = rtems_rfs_fs_open (name, NULL, RTEMS_RFS_FS_FORCE_OPEN, &fs); rc = rtems_rfs_fs_open (name, NULL,
RTEMS_RFS_FS_FORCE_OPEN | RTEMS_RFS_FS_NO_LOCAL_CACHE,
0, &fs);
if (rc < 0) if (rc < 0)
{ {
printf ("rtems-rfs: format: file system open failed: %d: %s\n", printf ("rtems-rfs: format: file system open failed: %d: %s\n",

View File

@@ -1268,8 +1268,40 @@ rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t* mt_entry,
{ {
rtems_rfs_rtems_private* rtems; rtems_rfs_rtems_private* rtems;
rtems_rfs_file_system* fs; rtems_rfs_file_system* fs;
uint32_t flags = 0;
uint32_t max_held_buffers = RTEMS_RFS_FS_MAX_HELD_BUFFERS;
const char* options = data;
int rc; int rc;
/*
* Parse the options the user specifiies.
*/
while (options)
{
printf ("options=%s\n", options);
if (strncmp (options, "hold-bitmaps",
sizeof ("hold-bitmaps") - 1) == 0)
flags |= RTEMS_RFS_FS_BITMAPS_HOLD;
else if (strncmp (options, "no-local-cache",
sizeof ("no-local-cache") - 1) == 0)
flags |= RTEMS_RFS_FS_NO_LOCAL_CACHE;
else if (strncmp (options, "max-held-bufs",
sizeof ("max-held-bufs") - 1) == 0)
{
max_held_buffers = strtoul (options + sizeof ("max-held-bufs"), 0, 0);
}
else
return rtems_rfs_rtems_error ("initialise: invalid option", EINVAL);
options = strchr (options, ',');
if (options)
{
++options;
if (*options == '\0')
options = NULL;
}
}
rtems = malloc (sizeof (rtems_rfs_rtems_private)); rtems = malloc (sizeof (rtems_rfs_rtems_private));
if (!rtems) if (!rtems)
return rtems_rfs_rtems_error ("initialise: local data", ENOMEM); return rtems_rfs_rtems_error ("initialise: local data", ENOMEM);
@@ -1291,7 +1323,7 @@ rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t* mt_entry,
return rtems_rfs_rtems_error ("initialise: cannot lock access mutex", rc); return rtems_rfs_rtems_error ("initialise: cannot lock access mutex", rc);
} }
rc = rtems_rfs_fs_open (mt_entry->dev, rtems, 0, &fs); rc = rtems_rfs_fs_open (mt_entry->dev, rtems, flags, max_held_buffers, &fs);
if (rc) if (rc)
{ {
free (rtems); free (rtems);