Commit Graph

176 Commits

Author SHA1 Message Date
Juha Niskanen 1577726f05 fs/inode/fs_fileopen.c: use nx_close instead of close
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-10-28 09:11:50 -07:00
Xiang Xiao b422f49fa7 fs: Skip the enumeration of root directory in foreach_inode
ensure the behaviour same before:
commit b76c4672d6 (origin/root)
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Tue Sep 15 17:42:42 2020 +0800

    vfs: Create a node as the root of pseudo file system

    to remove the special process for root

    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-30 12:26:57 +02:00
Xiang Xiao 66057a4612 fs: Add the relative path support
all functions which accept the path argument should support the relative path:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-24 03:13:27 -07:00
Xiang Xiao 43f0070582 fs: Simplify the symbol link process in inode_search
avoid the recursive call by moving the path catenation into _inode_search

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-22 16:39:47 +08:00
Xiang Xiao b76c4672d6 vfs: Create a node as the root of pseudo file system
to remove the special process for root

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-16 11:44:57 -07:00
Xiang Xiao b598ab43d7 fs: Implement lstat function
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/lstat.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iefc23a02d425ff84fa4027aea7da1181b01eced7
2020-06-30 13:09:58 -06:00
Gregory Nutt a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Xiang Xiao 4a3d28a957 fs: Move inode_checkflags from include/nuttx/fs/fs.h to fs/inode/inode.h
since this function is only used inside fs subsystem

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
YAMAMOTO Takashi e811677747 Fix a fatal typo in a recent change
A typo in:
    commit ae401cecdd
    ("Check return from nxsem_wait_initialize()")
2020-04-01 11:30:45 +01:00
Gregory Nutt ae401cecdd Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under fs/driver, fs/aio, fs/nfs, crypto/, and boards/.

Please note:  The modified file under fs/nfs generates several " Mixed case identifier found" errors.  Please ignore these.  These cannot be fixed without changes to numerous other files.  They also follow a non-standard convention that is used many files:  Using lower case structure names in custom SIZEOF_ definitions.
2020-03-30 17:09:45 +01:00
Gregory Nutt a4d6af8343 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under fs/inode.  Utility functions under fs/incode were modified so the changes do extend to other fs/ sub-directories as well.
2020-03-30 01:33:31 +01:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt 0ef5500e01 /fs/inode: Add checks for NULL pointers as recommended by Junmin Kim <trimind0210@gmail.com>. 2019-12-10 07:50:27 -06:00
Gregory Nutt d2af57169b tools/nxstyle.c: Fix a rare false alarm that could occur if a variable or function name begins with the sub-string 'union' or 'struct'. misc fixes under fs/ and sched/ from application of current version of nxstyle. 2019-12-01 13:01:16 -06:00
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt 7ec13a3b4f Fix a few typos and wrap some long lines. 2019-02-09 10:00:37 -06:00
Gregory Nutt 94f26c0220 fs/inode/fs_fileclose.c: Move file_close() a separate file. It no longer makes since for it to cohabitate with file_detach(). 2018-09-15 13:19:14 -06:00
Gregory Nutt 3a4984a40b Rename file_close_detached() to juse file_close() for better consistency in naming. 2018-09-15 13:04:56 -06:00
Gregory Nutt a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
Gregory Nutt d88cb93d95 fs/vfs and fs/inode: Trivial typo fixes gleaned from the fileopen branch. 2018-08-29 16:01:56 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt 42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt 83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt e4dd33280d Squashed commit of the following:
psock_close() and net_close() are internal OS functions and should not set the errno variable.

    psock_ioctl() and netdev_ioctl() are internal OS functions and should not set the errno variable.

    net_dupsd() and net_dupsd2() are internal OS functions and should not set the errno variable.

    net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2() are all internal OS interfaces and should not modify the errno value.
2017-09-30 10:41:21 -06:00
Gregory Nutt 41680d376d Replace 'the the' with 'the' 2017-05-11 13:15:13 -06:00
Gregory Nutt bae367c7c4 fstat(): Rethink procfs fstat(). If write method is supported, then should report file s writeable. 2017-02-15 09:32:42 -06:00
Gregory Nutt a2e74f2583 fs/inode/inode.h: Fix a warning 'inode/inode.h:264:45: error: 'struct stat' declared inside parameter list' by adding a forward reference to struct stat. Noted by David Sidrane. 2017-02-13 17:19:49 -06:00
Gregory Nutt c5a8e96dbc Add basic fstat() support. Now all that is needed is to modify ALL of the file systems. 2017-02-12 12:48:24 -06:00
Gregory Nutt 3055025e00 rename(): Correct more issues. (1) Move to the root directory in the pseudo file system, (2) Fix path naming calculation when the path is the root directory of a mounted file system, and (3) dont't do the rename if the source and destination of the rename are the same. 2017-02-12 08:37:28 -06:00
David Sidrane d9044058b5 There is a return path with node not set
inode/fs_inoderemove.c: In function 'inode_unlink':
inode/fs_inoderemove.c:74:17: warning: 'node' may be used uninitialized in this function [-Wmaybe-uninitialized]
   FAR struct inode *node;
2017-02-07 21:41:02 +00:00
Gregory Nutt 1b32cb67cb Soft link: Change how a value is returned so that _inode_linktarget will function in all of its use contexts. 2017-02-06 10:06:46 -06:00
Gregory Nutt 94e4d58fd2 Soft links: Fix a error in follow a link to a link to a mountpoint. 2017-02-06 08:46:43 -06:00
Gregory Nutt 47ddfa346d Soft links: Eliminate in-stack allocation of path working buffer needed for traversal fo paths with soft links. 2017-02-05 14:57:38 -06:00
Gregory Nutt 45fd98da88 Add macros support that will eventually allow dynamic allocation of strings need to support soft links. 2017-02-05 14:25:45 -06:00
Gregory Nutt 8f2c7198ed inode_find: Now takes struct inode_desc_s type as input. This was necessary before that structure includes some data storage. It was used within inode_find(), but that means that the life of the data was the life of inode_find(). That data must persist longer. It is now provided by the caller so that the life of the data persists for the entire life of the caller. 2017-02-05 09:51:42 -06:00
Gregory Nutt 990bed903e Soft link: First cut fix for some soft link issues. The fix still has some issues of its own. 2017-02-04 16:35:49 -06:00
Gregory Nutt 4c68324d82 FS: Remove inode_search_nofollow(). That logic is no handled with a new field in the input argument structure. 2017-02-04 12:51:14 -06:00
Gregory Nutt 0c9935f8ac FS: Remove inode_find_nofollow. Instead provide a bool nofollow argument to inode_find. 2017-02-04 11:46:54 -06:00
Gregory Nutt 36704b7d9c FS: Argument is now a structure describing the search. 2017-02-04 11:21:44 -06:00
Gregory Nutt 8437650fc2 Soft links: Another fix to tree traveral logic 2017-02-03 16:34:50 -06:00
Gregory Nutt 982cfea490 Remove some unnecessary (and inappropriate) soft link logic 2017-02-03 15:50:41 -06:00
Gregory Nutt 60ba5a5261 Soft links: Fix logic and remove kludge of last commit. Rename inode_dereference() as inode_linktarget() and make global. 2017-02-03 13:22:33 -06:00
Gregory Nutt 7c59e05305 FS: Separate inode_search() and inode_free() from fs_inode.c and put in separate files. Flesh out symbolic link logic in stat() and readdir(). There are still some issues with stat(). 2017-02-03 11:23:57 -06:00
Gregory Nutt d833144869 Soft Links: Fix several issues in initial testing 2017-02-02 19:37:58 -06:00
Gregory Nutt 35d738d85f Soft links: Fix compile problems on first build with soft links enabled. 2017-02-02 15:24:39 -06:00
Gregory Nutt bdc002fadc Finish implementation of soft links. 2017-02-02 13:01:21 -06:00
Gregory Nutt 92305e400a Soft links: Initial, incompete implementation 2017-02-02 10:39:41 -06:00
Gregory Nutt 8b5af8bf50 FS: Fix typo. Latent bug but innocuous in its current usage 2017-01-27 08:50:01 -06:00
Gregory Nutt 82c890db23 syslog_dev_flush() needs to check if the inode is a mountpoint before calling the flush() method. Noted by David Sidrane. 2016-06-22 05:58:33 -06:00
Gregory Nutt 485aa6b231 SIM: Comment out skip scheduler debug output that can hang the simulation. 2016-06-21 08:59:01 -06:00
Gregory Nutt 86b79b33cf Reserver the name 'err' for other purposes 2016-06-11 14:40:07 -06:00
Gregory Nutt 001715d57b FS: Add logic to detach a file structure from a file descriptor. This is for use only within the OS. It permits an open file or driver to be used across multiple threads. 2016-05-26 09:41:50 -06:00
Gregory Nutt 3f731241cb fs/inode/, fs/vfs/, and sched/task/: File and socket descriptors are no longer allocated for kernel threads. They must use SYSLOG for output and the low-level psock interfaces for network I/O. This saves a little memory which might be important for small footprint configurations. 2016-04-14 10:14:38 -06:00
Gregory Nutt 9008308b64 Remove some block comments before empty code sections 2016-04-11 18:16:04 -06:00
Gregory Nutt 0fb035f76b Standardize some naming in code section comments 2016-02-21 18:09:04 -06:00
Gregory Nutt 7be7579f59 Back out 522f95abe87d71c7025f2f358a8f350134e284b2: What was I thinking? 2015-12-02 10:47:32 -06:00
Gregory Nutt c70987e551 nuttx/fs: Fix some spacing and alignment issues 2015-10-11 11:39:29 -06:00
Gregory Nutt cb9e27c3b0 Standardize naming used for public data and function groupings 2015-10-02 16:30:35 -06:00
Gregory Nutt cc7130b836 Correct a reference counting error in mq_open() 2015-09-23 10:34:08 -06:00
Gregory Nutt 8293a5e773 Minor file system clean-up 2015-06-18 10:16:49 -06:00
Gregory Nutt f753d3320b Trivial cleanup of some parameter sanity checks 2015-06-11 07:47:26 -06:00
Gregory Nutt 92f1f7c12e Fix test for root directory in inode_reserve 2015-06-11 07:18:44 -06:00
Gregory Nutt 68038211c1 FS: Add a check for a NULL pathname. 2014-12-13 13:05:54 -06:00
Gregory Nutt d914f3ceec Major structure of file system functions to better support asynchronous I/O. Respository should not be trusted until I have a chance to verify everything 2014-10-06 10:53:25 -06:00
Gregory Nutt d2797bf482 Modify FS initialization logic to handle AIO container initialization. 2014-10-06 08:11:37 -06:00
Gregory Nutt ae90309b36 Move fs/fs.h to fs/inode/inode.h and some to fs/driver/driver.h 2014-09-29 07:14:38 -06:00
Gregory Nutt 650a0d0615 Completes VFS-based named semaphore implemetation. Still a little buggy 2014-09-28 15:58:56 -06:00
Gregory Nutt 7679e6f2bc Forgot to add files from previous commits 2014-09-28 11:16:58 -06:00
Gregory Nutt a470a8cbd0 Move drive from fs/. to fs/driver/. 2014-09-28 11:06:21 -06:00
Gregory Nutt 39ff9d626e Move inode and VFS utils from fs/. to fs/inode/. 2014-09-28 10:53:40 -06:00