You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/07/15 09:04:38 UTC
[incubator-nuttx] 02/03: Revert "fs: Move umask to task_info_s"
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch revert-4118-attr
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 222f2cd56fe74bc5685479e6a8d22d06e1f03541
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Thu Jul 15 18:04:24 2021 +0900
Revert "fs: Move umask to task_info_s"
This reverts commit a0f2f6c36243ea6afabcae3138128b790c1f8577.
---
fs/mqueue/mq_open.c | 3 ---
fs/semaphore/sem_open.c | 5 ++---
fs/vfs/fs_mkdir.c | 2 --
fs/vfs/fs_open.c | 3 ---
include/nuttx/tls.h | 11 ++++++-----
include/sys/stat.h | 1 -
libs/libc/misc/lib_umask.c | 27 ++++++++-------------------
7 files changed, 16 insertions(+), 36 deletions(-)
diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index bd6feee..7895aba 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -24,7 +24,6 @@
#include <nuttx/config.h>
-#include <sys/stat.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdio.h>
@@ -189,8 +188,6 @@ static int file_mq_vopen(FAR struct file *mq, FAR const char *mq_name,
attr = va_arg(ap, FAR struct mq_attr *);
}
- mode &= ~getumask();
-
/* Skip over any leading '/'. All message queue paths are relative to
* CONFIG_FS_MQUEUE_MPATH.
*/
diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c
index ad5246a..3e34d1e 100644
--- a/fs/semaphore/sem_open.c
+++ b/fs/semaphore/sem_open.c
@@ -24,7 +24,6 @@
#include <nuttx/config.h>
-#include <sys/stat.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
@@ -87,7 +86,7 @@
*
****************************************************************************/
-FAR sem_t *sem_open(FAR const char *name, int oflags, ...)
+FAR sem_t *sem_open (FAR const char *name, int oflags, ...)
{
FAR struct inode *inode;
FAR struct nsem_inode_s *nsem;
@@ -175,7 +174,7 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...)
*/
va_start(ap, oflags);
- mode = va_arg(ap, mode_t) & ~getumask();
+ mode = va_arg(ap, mode_t);
value = va_arg(ap, unsigned);
va_end(ap);
diff --git a/fs/vfs/fs_mkdir.c b/fs/vfs/fs_mkdir.c
index aae409a..0ecf95e 100644
--- a/fs/vfs/fs_mkdir.c
+++ b/fs/vfs/fs_mkdir.c
@@ -63,8 +63,6 @@ int mkdir(const char *pathname, mode_t mode)
int errcode;
int ret;
- mode &= ~getumask();
-
/* Find the inode that includes this path */
SETUP_SEARCH(&desc, pathname, false);
diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c
index 201875e..2804c2c 100644
--- a/fs/vfs/fs_open.c
+++ b/fs/vfs/fs_open.c
@@ -25,7 +25,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <stdbool.h>
#include <fcntl.h>
#include <sched.h>
@@ -70,8 +69,6 @@ static int file_vopen(FAR struct file *filep,
{
mode = va_arg(ap, mode_t);
}
-
- mode &= ~getumask();
#endif
/* Get an inode for this file */
diff --git a/include/nuttx/tls.h b/include/nuttx/tls.h
index d893059..a7d28f3 100644
--- a/include/nuttx/tls.h
+++ b/include/nuttx/tls.h
@@ -63,14 +63,15 @@
struct task_info_s
{
- sem_t ta_sem;
- mode_t ta_umask; /* File mode creation mask */
+ sem_t ta_sem;
+
#if CONFIG_TLS_NELEM > 0
- tls_ndxset_t ta_tlsset; /* Set of TLS indexes allocated */
- tls_dtor_t ta_tlsdtor[CONFIG_TLS_NELEM]; /* List of TLS destructors */
+ tls_ndxset_t ta_tlsset; /* Set of TLS indexes allocated */
+ tls_dtor_t ta_tlsdtor[CONFIG_TLS_NELEM]; /* List of TLS destructors */
#endif
+
#ifndef CONFIG_BUILD_KERNEL
- struct getopt_s ta_getopt; /* Globals used by getopt() */
+ struct getopt_s ta_getopt; /* Globals used by getopt() */
#endif
};
diff --git a/include/sys/stat.h b/include/sys/stat.h
index b1e8bcc..61e2afd 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -166,7 +166,6 @@ int fchmod(int fd, mode_t mode);
int futimens(int fd, const struct timespec times[2]);
mode_t umask(mode_t mask);
-mode_t getumask(void);
#undef EXTERN
#if defined(__cplusplus)
diff --git a/libs/libc/misc/lib_umask.c b/libs/libc/misc/lib_umask.c
index 995046c..6cf6214 100644
--- a/libs/libc/misc/lib_umask.c
+++ b/libs/libc/misc/lib_umask.c
@@ -23,7 +23,12 @@
****************************************************************************/
#include <sys/stat.h>
-#include <nuttx/tls.h>
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static mode_t g_mask;
/****************************************************************************
* Public Functions
@@ -45,24 +50,8 @@
mode_t umask(mode_t mask)
{
- FAR struct task_info_s *info;
- mode_t prev;
-
- info = task_get_info();
- prev = info->ta_umask;
- info->ta_umask = mask;
+ mode_t prev = g_mask;
+ g_mask = mask & 0777;
return prev;
}
-
-/****************************************************************************
- * Name: getumask
- ****************************************************************************/
-
-mode_t getumask(void)
-{
- FAR struct task_info_s *info;
-
- info = task_get_info();
- return info->ta_umask;
-}