[RTEMS Project] #4541: rtems_jffs2_rmnod function problem
RTEMS trac
trac at rtems.org
Mon Nov 1 14:54:19 UTC 2021
#4541: rtems_jffs2_rmnod function problem
----------------------------+--------------------
Reporter: chenjin_zhong | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.1
Component: admin | Version: 5
Severity: normal | Keywords:
Blocked By: | Blocking:
----------------------------+--------------------
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);
}
--
Ticket URL: <http://devel.rtems.org/ticket/4541>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list