From 884d9355c6aa06b15c019db7dc05fe92c65748fa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 14 Feb 2016 08:43:47 -0600 Subject: [PATCH] nuttx/fs: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() --- fs/procfs/fs_procfs.c | 11 +++++------ fs/procfs/fs_procfsproc.c | 27 +++++++++++++-------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 7f86a17a8d..3db09f68be 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -61,8 +62,6 @@ #include #include -#include - #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) { diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index b01b2cbb8e..e90d46ef08 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -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 * * Redistribution and use in source and binary forms, with or without @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -64,8 +65,6 @@ # include #endif -#include - #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) {