Commit Graph

68 Commits

Author SHA1 Message Date
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