fix: same file mode for procfs files

close: #I4ACTC

Signed-off-by: Leon Chan <chenwei26@huawei.com>
This commit is contained in:
Leon Chan 2021-09-16 16:18:02 +08:00
parent 38a6b804e9
commit c79bcd028e
4 changed files with 5 additions and 4 deletions

View File

@ -53,6 +53,9 @@ extern "C" {
typedef unsigned short fmode_t;
#define PROC_ERROR (-1)
/* Default file mode for procfs */
#define PROCFS_DEFAULT_MODE 0555
/* 64bit hashes as llseek() offset (for directories) */
#define FMODE_64BITHASH ((fmode_t)0x400)
/* 32bit hashes as llseek() offset (for directories) */

View File

@ -45,7 +45,7 @@ void ProcFsInit(void)
{
int ret;
ret = mkdir(PROCFS_MOUNT_POINT, 0);
ret = mkdir(PROCFS_MOUNT_POINT, PROCFS_DEFAULT_MODE);
if (ret < 0) {
PRINT_ERR("failed to mkdir %s, errno = %d\n", PROCFS_MOUNT_POINT, get_errno());
return;

View File

@ -41,8 +41,6 @@
#include "los_tables.h"
#include "internal.h"
#define PROCFS_DEFAULT_MODE 0555
#ifdef LOSCFG_FS_PROC
static struct VnodeOps g_procfsVops;
static struct file_operations_vfs g_procfsFops;

View File

@ -49,7 +49,7 @@ static struct ProcFile g_procPf = {
static struct ProcDirEntry g_procRootDirEntry = {
.nameLen = 5,
.mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH,
.mode = S_IFDIR | PROCFS_DEFAULT_MODE,
.count = ATOMIC_INIT(1),
.procFileOps = NULL,
.parent = &g_procRootDirEntry,