Opened on 01/23/21 at 23:41:29
Closed on 02/08/21 at 02:12:49
#4222 closed enhancement (fixed)
Add a per mount flag to not create a node on O_CREAT in open
Reported by: | Chris Johns | Owned by: | Chris Johns |
---|---|---|---|
Priority: | normal | Milestone: | 6.1 |
Component: | fs | Version: | 6 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
The libio rtems_filesystem_eval_path_context_t
context uses a token left after a path evaluation to indicate the path to the leaf node is valid and the path leaf does not exist. System calls such as mknod
, mkdir
and open
uses this to return EEXIST
or in the case of open
to create a S_IFREG
node for a file. Some file systems do not support creating an S_IFREG
node and the open
handler is required to do this.
[ An aside, libio should leave the EEXIST
detection to the file system and its evaluation handlers. The EEXIST
error is one of many that could be returned yet it is specifically singled out using a fragile interface of a path token remaining. Anyway back to the change ... ]
The open
call has:
if ( rtems_filesystem_eval_path_has_token( &ctx ) ) { create_regular_file( &ctx, mode ); }
and create_regular_file
makes a node:
rv = rtems_filesystem_mknod( currentloc, token, tokenlen, S_IFREG | mode, 0 );
then wipes the evaluation context of any real and valid flags and settings:
rtems_filesystem_eval_path_set_flags( ctx, 0 ); rtems_filesystem_eval_path_set_path( ctx, token, tokenlen ); rtems_filesystem_eval_path_continue( ctx );
then continues the path evaluation. The continues path evaluation is suppose to find the new node. If a file system does not support making a regular file node and the mknod
call is stubbed out to lie about making the node continuing the path evaluation fails with a not found error. I cannot see a way to code around this with the current libio code.
I propose adding a bool
flag called no_reg_make_node
to the rtems_filesystem_mount_table_entry_t
struct that defaults to false
. If true
open does not call create_regular_file
.
Change History (2)
comment:1 Changed on 01/25/21 at 02:06:21 by Chris Johns
Owner: | set to Chris Johns |
---|---|
Status: | new → accepted |
comment:2 Changed on 02/08/21 at 02:12:49 by Chris Johns <chrisj@…>
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
In 822cad89/rtems: