mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
FS: Remove inode_find_nofollow. Instead provide a bool nofollow argument to inode_find.
This commit is contained in:
+2
-1
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@@ -105,7 +106,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
||||
* does not lie on a mounted volume.
|
||||
*/
|
||||
|
||||
inode = inode_find(path2, NULL);
|
||||
inode = inode_find(path2, NULL, false);
|
||||
if (inode != NULL)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
|
||||
+5
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_mkdir.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007, 2008, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,9 +38,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -87,7 +90,7 @@ int mkdir(const char *pathname, mode_t mode)
|
||||
|
||||
/* Find the inode that includes this path */
|
||||
|
||||
inode = inode_find(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, false);
|
||||
if (inode)
|
||||
{
|
||||
/* An inode was found that includes this path and possibly refers to a
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_open.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
@@ -120,7 +121,7 @@ int open(const char *path, int oflags, ...)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find(path, &relpath);
|
||||
inode = inode_find(path, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* "O_CREAT is not set and the named file does not exist. Or, a
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@@ -91,7 +92,7 @@ ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize)
|
||||
* symbolic link node.
|
||||
*/
|
||||
|
||||
node = inode_find_nofollow(path, &relpath);
|
||||
node = inode_find(path, &relpath, true);
|
||||
if (node == NULL)
|
||||
{
|
||||
errcode = ENOENT;
|
||||
|
||||
+6
-4
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_rename.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -101,7 +103,7 @@ int rename(FAR const char *oldpath, FAR const char *newpath)
|
||||
|
||||
/* Get an inode that includes the oldpath */
|
||||
|
||||
oldinode = inode_find(oldpath, &oldrelpath);
|
||||
oldinode = inode_find(oldpath, &oldrelpath, true);
|
||||
if (!oldinode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
@@ -115,11 +117,11 @@ int rename(FAR const char *oldpath, FAR const char *newpath)
|
||||
|
||||
if (INODE_IS_MOUNTPT(oldinode) && oldinode->u.i_mops)
|
||||
{
|
||||
/* Get an inode for the new relpath -- it should like on the same
|
||||
/* Get an inode for the new relpath -- it should lie on the same
|
||||
* mountpoint
|
||||
*/
|
||||
|
||||
newinode = inode_find(newpath, &newrelpath);
|
||||
newinode = inode_find(newpath, &newrelpath, true);
|
||||
if (!newinode)
|
||||
{
|
||||
/* There is no mountpoint that includes in this path */
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_rmdir.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -89,7 +91,7 @@ int rmdir(FAR const char *pathname)
|
||||
* on the inode if one is found.
|
||||
*/
|
||||
|
||||
inode = inode_find(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
+2
-1
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
@@ -233,7 +234,7 @@ int stat(FAR const char *path, FAR struct stat *buf)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find_nofollow(path, &relpath);
|
||||
inode = inode_find(path, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* This name does not refer to a psudeo-inode and there is no
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_statfs.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -105,7 +105,7 @@ int statfs(FAR const char *path, FAR struct statfs *buf)
|
||||
|
||||
/* Get an inode for this file */
|
||||
|
||||
inode = inode_find(path, &relpath);
|
||||
inode = inode_find(path, &relpath, false);
|
||||
if (!inode)
|
||||
{
|
||||
/* This name does not refer to a psudeo-inode and there is no
|
||||
|
||||
+4
-2
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/vfs/fs_unlink.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,8 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
@@ -89,7 +91,7 @@ int unlink(FAR const char *pathname)
|
||||
* which may be a symbolic link)
|
||||
*/
|
||||
|
||||
inode = inode_find_nofollow(pathname, &relpath);
|
||||
inode = inode_find(pathname, &relpath, true);
|
||||
if (!inode)
|
||||
{
|
||||
/* There is no inode that includes in this path */
|
||||
|
||||
Reference in New Issue
Block a user