nuttx/fs: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
parent
aa3e778dc6
commit
884d9355c6
|
@ -53,6 +53,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
@ -61,8 +62,6 @@
|
|||
#include <nuttx/fs/dirent.h>
|
||||
#include <nuttx/regex.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -509,9 +508,9 @@ static int procfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
*/
|
||||
|
||||
#ifndef CONFIG_FS_PROCFS_EXCLUDE_PROCESS
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
sched_foreach(procfs_enum, level0);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
#else
|
||||
level0->base.index = 0;
|
||||
level0->base.nentries = 0;
|
||||
|
@ -752,9 +751,9 @@ static int procfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
|
|||
|
||||
pid = level0->pid[index];
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* fs/procfs/fs_procfsproc.c
|
||||
*
|
||||
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -53,6 +53,7 @@
|
|||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
@ -64,8 +65,6 @@
|
|||
# include <nuttx/clock.h>
|
||||
#endif
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS)
|
||||
#ifndef CONFIG_FS_PROCFS_EXCLUDE_PROCESS
|
||||
|
||||
|
@ -1032,9 +1031,9 @@ static int proc_open(FAR struct file *filep, FAR const char *relpath,
|
|||
|
||||
pid = (pid_t)tmp;
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
|
@ -1122,13 +1121,13 @@ static ssize_t proc_read(FAR struct file *filep, FAR char *buffer,
|
|||
|
||||
/* Verify that the thread is still valid */
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(procfile->pid);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
fdbg("ERROR: PID %d is not valid\n", (int)procfile->pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1165,7 @@ static ssize_t proc_read(FAR struct file *filep, FAR char *buffer,
|
|||
break;
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Update the file offset */
|
||||
|
||||
|
@ -1271,9 +1270,9 @@ static int proc_opendir(FAR const char *relpath, FAR struct fs_dirent_s *dir)
|
|||
|
||||
pid = (pid_t)tmp;
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
|
@ -1403,9 +1402,9 @@ static int proc_readdir(struct fs_dirent_s *dir)
|
|||
|
||||
pid = procdir->pid;
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
|
@ -1513,9 +1512,9 @@ static int proc_stat(const char *relpath, struct stat *buf)
|
|||
|
||||
pid = (pid_t)tmp;
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
tcb = sched_gettcb(pid);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (!tcb)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue