#4541 closed enhancement (worksforme)

rtems_jffs2_rmnod function problem

Reported by: chenjin_zhong Owned by:
Priority: normal Milestone: 5.1
Component: fs/jffs2 Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Hi, the dir_i->i_mode must be S_IFDIR in this situation.therefore, I want to know when the dir_i->i_mode is S_IFREG? this function can it be optimized? the code is listed below.

static int rtems_jffs2_rmnod(

const rtems_filesystem_location_info_t *parentloc,
const rtems_filesystem_location_info_t *loc)

{

struct _inode *dir_i =
rtems_jffs2_get_inode_by_location(parentloc);
struct _inode *entry_i = rtems_jffs2_get_inode_by_location(loc);
char *name;
size_t namelen;
int eno = rtems_jffs2_cache_fd_name(entry_i, &name, &namelen);
if (eno == 0) {

switch (dir_i->i_mode & S_IFMT) {

case S_IFDIR:

eno = -jffs2_rmdir(dir_i, entry_i, name,

namelen);

break;

case S_IFREG:

eno = -jffs2_unlink(dir_i, entry_i,

name,namelen);

break;

default:

eno = EINVAL;
break;

}

}

return rtems_jffs2_eno_to_rv_and_errno(eno);

}

Change History (2)

comment:1 Changed on 11/12/21 at 13:49:58 by Sebastian Huber

Resolution: worksforme
Status: newclosed

The rmnod_h file system operation is used by unlink() and rmdir().

comment:2 Changed on 11/12/21 at 13:50:17 by Sebastian Huber

Component: adminfs/jaffs2
Note: See TracTickets for help on using tickets.