#1521 closed defect (fixed)

Change mount to be like the Linux mount.

Reported by: Chris Johns Owned by: Chris Johns
Priority: normal Milestone: 4.10
Component: fs Version: 4.10
Severity: normal Keywords:
Cc: joel.sherrill@…, strauman@…, sebastian.huber@… Blocked By:


The mount function is not covered by any standard and varies between different operating systems. This PR is to discuss changing the current mount command to the Linux one. This was raised in PR 1517. The new mount command is:

int mount(const char *source,

const char *target,
const char *filesystemtype,
unsigned long mountflags,
const void *data);

This interface does not return the mount table entry. This was only ever used in the base file system initialisation to set the root file system and that code can be moved to the mount function. If the mount point or target is NULL the mount table chain must be empty and therefore rtems_filesystem_root can be set.

The source can be a device path, an NFS mount path or what-ever. The target is an existing directory that can be used as a mount point.

This interface adds a data pointer that can contain file system specific configuration information. This allows a better user way to allow specific file system configuration on a per file system instance basis.

The filesystemtype is a string label for the file system. Implementing this requires a table of present file system be created. In RTEMS this is normally a static table and a run-time list. The static table is implemented using confdefs.h. A user requests the file systems they wish to have in the target just like they set the number of semaphores or message queues. The benefit is the removal of ops table handlers being global and being passed around the code.

Implementing this change raises some issues. There is a number of "mount me" type helper functions. These are very close to each other. They all create the mount point and the NFS helper does some extra processing. I wish to remove all these helpers and to have initialisation become part of the normal file system initialisation. This reduces the exported interface of a file system to the single initialise call. I how-ever suspect this will break some applications that rely on the helpers to create the mount points. If this is an issue a user who is effected can provide a generic helper function for libmisc. The benefit is to remove the common code from RTEMS, to limit the file system interface, and to remove the need for special initialisations in-order to use a file system.

The specific initialisations seem to be mostly in the networked file systems. For example rpcInitialize and nfsInit need to be called before mounting an NFS file system. These interfaces can stay so specific non-default initialisation can occur but they can also be called the NFSFS initialise.

NFS also has the host processing split between the helper function and the initialise function. The helper function performs a non-thread safe host-by-name look-up. I suggest we move this code into the initialise. It does make mounting not thread safe while the host look up call is not thread safe, how-ever it was never safe when in the helper function. The network call is not not safe and should be fixed.

Comments ?

Change History (3)

comment:1 Changed on May 19, 2010 at 10:53:46 AM by Joel Sherrill

Cc: joel.sherrill@… strauman@… added

comment:2 Changed on May 20, 2010 at 2:33:34 AM by Chris Johns

Status: newassigned

comment:3 Changed on Mar 13, 2012 at 11:07:00 AM by Sebastian Huber

Resolution: fixed
Status: assignedclosed, sebastian.huber@embedded-brains.de

Fixed in 4.10.

Note: See TracTickets for help on using tickets.