mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
Soft links: Initial, incompete implementation
This commit is contained in:
+18
-7
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/fs/fs.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013, 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2013, 2015-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -66,12 +66,17 @@
|
||||
#define __FS_FLAG_EOF (1 << 0) /* EOF detected by a read operation */
|
||||
#define __FS_FLAG_ERROR (1 << 1) /* Error detected by any operation */
|
||||
|
||||
/* Inode i_flag values */
|
||||
/* Inode i_flag values:
|
||||
*
|
||||
* Bit 0-3: Inode type (Bit 4 indicates internal OS types)
|
||||
* Bit 4: Set if inode has been unlinked and is pending removal.
|
||||
*/
|
||||
|
||||
#define FSNODEFLAG_TYPE_MASK 0x00000007 /* Isolates type field */
|
||||
#define FSNODEFLAG_TYPE_DRIVER 0x00000000 /* Character driver */
|
||||
#define FSNODEFLAG_TYPE_BLOCK 0x00000001 /* Block driver */
|
||||
#define FSNODEFLAG_TYPE_MOUNTPT 0x00000002 /* Mount point */
|
||||
#define FSNODEFLAG_TYPE_SOFTLINK 0x00000003 /* Soft link */
|
||||
#define FSNODEFLAG_TYPE_SPECIAL 0x00000004 /* Special OS type */
|
||||
#define FSNODEFLAG_TYPE_NAMEDSEM 0x00000004 /* Named semaphore */
|
||||
#define FSNODEFLAG_TYPE_MQUEUE 0x00000005 /* Message Queue */
|
||||
@@ -86,6 +91,7 @@
|
||||
#define INODE_IS_DRIVER(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_DRIVER)
|
||||
#define INODE_IS_BLOCK(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_BLOCK)
|
||||
#define INODE_IS_MOUNTPT(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_MOUNTPT)
|
||||
#define INODE_IS_SOFTLINK(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
|
||||
#define INODE_IS_NAMEDSEM(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_NAMEDSEM)
|
||||
#define INODE_IS_MQUEUE(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_MQUEUE)
|
||||
#define INODE_IS_SHM(i) INODE_IS_TYPE(i,FSNODEFLAG_TYPE_SHM)
|
||||
@@ -101,6 +107,7 @@
|
||||
#define INODE_SET_DRIVER(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_DRIVER)
|
||||
#define INODE_SET_BLOCK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_BLOCK)
|
||||
#define INODE_SET_MOUNTPT(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MOUNTPT)
|
||||
#define (i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
|
||||
#define INODE_SET_NAMEDSEM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_NAMEDSEM)
|
||||
#define INODE_SET_MQUEUE(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MQUEUE)
|
||||
#define INODE_SET_SHM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SHM)
|
||||
@@ -309,16 +316,19 @@ struct mountpt_operations
|
||||
|
||||
union inode_ops_u
|
||||
{
|
||||
FAR const struct file_operations *i_ops; /* Driver operations for inode */
|
||||
FAR const struct file_operations *i_ops; /* Driver operations for inode */
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
FAR const struct block_operations *i_bops; /* Block driver operations */
|
||||
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
|
||||
FAR const struct block_operations *i_bops; /* Block driver operations */
|
||||
FAR const struct mountpt_operations *i_mops; /* Operations on a mountpoint */
|
||||
#endif
|
||||
#ifdef CONFIG_FS_NAMED_SEMAPHORES
|
||||
FAR struct nsem_inode_s *i_nsem; /* Named semaphore */
|
||||
FAR struct nsem_inode_s *i_nsem; /* Named semaphore */
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
FAR struct mqueue_inode_s *i_mqueue; /* POSIX message queue */
|
||||
FAR struct mqueue_inode_s *i_mqueue; /* POSIX message queue */
|
||||
#endif
|
||||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
FAR char *i_link; /* Full path to link */
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -337,6 +347,7 @@ struct inode
|
||||
FAR void *i_private; /* Per inode driver private data */
|
||||
char i_name[1]; /* Name of inode (variable) */
|
||||
};
|
||||
|
||||
#define FSNODE_SIZE(n) (sizeof(struct inode) + (n))
|
||||
|
||||
/* This is the underlying representation of an open file. A file
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/unistd.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -190,6 +190,7 @@ FAR char *getcwd(FAR char *buf, size_t size);
|
||||
int access(FAR const char *path, int amode);
|
||||
int rmdir(FAR const char *pathname);
|
||||
int unlink(FAR const char *pathname);
|
||||
int link(FAR const char *path1, FAR const char *path2);
|
||||
|
||||
/* Execution of programs from files */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user