mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
More testing, bugfixes and integration of VFS-based named semaphores
This commit is contained in:
parent
11a33801c4
commit
1b2729e35e
10 changed files with 48 additions and 14 deletions
|
@ -645,7 +645,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
|||
CONFIG_FS_READABLE=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
ONFIG_FS_NAMED_SEMAPHORES=y
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/sem"
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/lock"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
|
|
|
@ -645,7 +645,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
|||
CONFIG_FS_READABLE=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
ONFIG_FS_NAMED_SEMAPHORES=y
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/sem"
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/lock"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
|
|
|
@ -609,7 +609,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
|||
CONFIG_FS_READABLE=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
ONFIG_FS_NAMED_SEMAPHORES=y
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/sem"
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/lock"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
|
|
|
@ -599,7 +599,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
|||
CONFIG_FS_READABLE=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
ONFIG_FS_NAMED_SEMAPHORES=y
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/sem"
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/lock"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
CONFIG_FS_FAT=y
|
||||
# CONFIG_FAT_LCNAMES is not set
|
||||
|
|
|
@ -619,7 +619,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
|
|||
CONFIG_FS_READABLE=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
ONFIG_FS_NAMED_SEMAPHORES=y
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/sem"
|
||||
CONFIG_FS_NAMED_SEMPATH="/var/lock"
|
||||
# CONFIG_FS_RAMMAP is not set
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
|
|
|
@ -13,7 +13,7 @@ if FS_NAMED_SEMAPHORES
|
|||
|
||||
config FS_NAMED_SEMPATH
|
||||
string "Path to semaphore storage"
|
||||
default "/var/sem"
|
||||
default "/var/lock"
|
||||
---help---
|
||||
The path to where named semaphores will exist in the VFS namespace.
|
||||
|
||||
|
|
|
@ -135,8 +135,9 @@ int open(const char *path, int oflags, ...)
|
|||
goto errout;
|
||||
}
|
||||
|
||||
/* Verify that the inode is valid and either a "normal" or a mountpoint. We
|
||||
* specifically exclude block drivers.
|
||||
/* Verify that the inode is valid and either a "normal" character driver or a
|
||||
* mountpoint. We specifically exclude block drivers and and "special"
|
||||
* inodes (semaphores, message queues, shared memory).
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
|
|
|
@ -59,7 +59,34 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
|
|||
/* Most of the stat entries just do not apply */
|
||||
|
||||
memset(buf, 0, sizeof(struct stat) );
|
||||
if (inode->u.i_ops)
|
||||
|
||||
if (INODE_IS_SPECIAL(inode))
|
||||
{
|
||||
#if defined(CONFIG_FS_NAMED_SEMAPHORES)
|
||||
if (INODE_IS_NAMEDSEM(inode))
|
||||
{
|
||||
buf->st_mode = S_IFSEM;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if !defined(CONFIG_DISABLE_MQUEUE)
|
||||
if (INODE_IS_MQUEUE(inode))
|
||||
{
|
||||
buf->st_mode = S_IFMQ;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(CONFIG_FS_SHM)
|
||||
if (INODE_IS_SHM(inode)) */
|
||||
{
|
||||
buf->st_mode | S_IFSHM;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
}
|
||||
}
|
||||
else if (inode->u.i_ops)
|
||||
{
|
||||
if (inode->u.i_ops->read)
|
||||
{
|
||||
|
@ -81,7 +108,7 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
|
|||
|
||||
buf->st_mode |= S_IFBLK;
|
||||
}
|
||||
else
|
||||
else /* if (INODE_IS_DRIVER(inode)) */
|
||||
{
|
||||
/* What is it if it also has child inodes? */
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ int unlink(FAR const char *pathname)
|
|||
* should remove the node.
|
||||
*/
|
||||
|
||||
if (inode->u.i_ops)
|
||||
if (!INODE_IS_SPECIAL(inode) && inode->u.i_ops)
|
||||
{
|
||||
/* If this is a pseudo-file node (i.e., it has no operations)
|
||||
* then rmdir should remove the node.
|
||||
|
@ -183,12 +183,12 @@ int unlink(FAR const char *pathname)
|
|||
goto errout_with_inode;
|
||||
}
|
||||
}
|
||||
#else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
errcode = ENXIO;
|
||||
goto errout_with_inode;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Successfully unlinked */
|
||||
|
||||
|
|
|
@ -71,13 +71,16 @@
|
|||
#define S_ISGID 0002000 /* Set group ID bit */
|
||||
#define S_ISUID 0004000 /* Set UID bit */
|
||||
|
||||
#define S_IFIFO 0010000 /* File type bites */
|
||||
#define S_IFIFO 0010000 /* File type bytes */
|
||||
#define S_IFCHR 0020000
|
||||
#define S_IFDIR 0040000
|
||||
#define S_IFBLK 0060000
|
||||
#define S_IFREG 0100000
|
||||
#define S_IFLNK 0120000
|
||||
#define S_IFSOCK 0140000
|
||||
#define S_IFMQ 0150000
|
||||
#define S_IFSEM 0160000
|
||||
#define S_IFSHM 0170000
|
||||
#define S_IFMT 0170000
|
||||
|
||||
/* File type macros that operate on an instance of mode_t */
|
||||
|
@ -89,6 +92,9 @@
|
|||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
#define S_ISMQ(m) (((m) & S_IFMT) == S_IFMQ)
|
||||
#define S_ISSSEM(m) (((m) & S_IFMT) == S_IFSEM)
|
||||
#define S_ISSHM(m) (((m) & S_IFMT) == S_IFSHM)
|
||||
|
||||
/****************************************************************************
|
||||
* Type Definitions
|
||||
|
|
Loading…
Reference in a new issue