mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
fs/: Run all .c files under fs/ through tools/nxstyle.
This commit is contained in:
+47
-39
@@ -125,12 +125,13 @@ int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
|
||||
break;
|
||||
|
||||
case F_GETFL:
|
||||
/* Get the file status flags and file access modes, defined in <fcntl.h>,
|
||||
* for the file description associated with fd. The file access modes
|
||||
* can be extracted from the return value using the mask O_ACCMODE, which is
|
||||
* defined in <fcntl.h>. File status flags and file access modes are associated
|
||||
* with the file description and do not affect other file descriptors that
|
||||
* refer to the same file with different open file descriptions.
|
||||
/* Get the file status flags and file access modes, defined in
|
||||
* <fcntl.h>, for the file description associated with fd. The file
|
||||
* access modes can be extracted from the return value using the
|
||||
* mask O_ACCMODE, which is defined in <fcntl.h>. File status flags
|
||||
* and file access modes are associated with the file description
|
||||
* and do not affect other file descriptors that refer to the same
|
||||
* file with different open file descriptions.
|
||||
*/
|
||||
|
||||
{
|
||||
@@ -139,12 +140,13 @@ int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
|
||||
break;
|
||||
|
||||
case F_SETFL:
|
||||
/* Set the file status flags, defined in <fcntl.h>, for the file description
|
||||
* associated with fd from the corresponding bits in the third argument,
|
||||
* arg, taken as type int. Bits corresponding to the file access mode and
|
||||
* the file creation flags, as defined in <fcntl.h>, that are set in arg shall
|
||||
* be ignored. If any bits in arg other than those mentioned here are changed
|
||||
* by the application, the result is unspecified.
|
||||
/* Set the file status flags, defined in <fcntl.h>, for the file
|
||||
* description associated with fd from the corresponding bits in
|
||||
* the third argument, arg, taken as type int. Bits corresponding
|
||||
* to the file access mode and the file creation flags, as defined
|
||||
* in <fcntl.h>, that are set in arg shall be ignored. If any bits
|
||||
* in arg other than those mentioned here are changed by the
|
||||
* application, the result is unspecified.
|
||||
*/
|
||||
|
||||
{
|
||||
@@ -158,48 +160,54 @@ int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
|
||||
break;
|
||||
|
||||
case F_GETOWN:
|
||||
/* If fd refers to a socket, get the process or process group ID specified
|
||||
* to receive SIGURG signals when out-of-band data is available. Positive values
|
||||
* indicate a process ID; negative values, other than -1, indicate a process group
|
||||
* ID. If fd does not refer to a socket, the results are unspecified.
|
||||
/* If fd refers to a socket, get the process or process group ID
|
||||
* specified to receive SIGURG signals when out-of-band data is
|
||||
* available. Positive values indicate a process ID; negative
|
||||
* values, other than -1, indicate a process group ID. If fd does
|
||||
* not refer to a socket, the results are unspecified.
|
||||
*/
|
||||
|
||||
case F_SETOWN:
|
||||
/* If fd refers to a socket, set the process or process group ID specified
|
||||
* to receive SIGURG signals when out-of-band data is available, using the value
|
||||
* of the third argument, arg, taken as type int. Positive values indicate a
|
||||
* process ID; negative values, other than -1, indicate a process group ID. If
|
||||
* fd does not refer to a socket, the results are unspecified.
|
||||
/* If fd refers to a socket, set the process or process group ID
|
||||
* specified to receive SIGURG signals when out-of-band data is
|
||||
* available, using the value of the third argument, arg, taken as
|
||||
* type int. Positive values indicate a process ID; negative values,
|
||||
* other than -1, indicate a process group ID. If fd does not refer
|
||||
* to a socket, the results are unspecified.
|
||||
*/
|
||||
|
||||
ret = -EBADF; /* Only valid on socket descriptors */
|
||||
break;
|
||||
|
||||
case F_GETLK:
|
||||
/* Get the first lock which blocks the lock description pointed to by the third
|
||||
* argument, arg, taken as a pointer to type struct flock, defined in <fcntl.h>.
|
||||
* The information retrieved shall overwrite the information passed to fcntl() in
|
||||
* the structure flock. If no lock is found that would prevent this lock from being
|
||||
* created, then the structure shall be left unchanged except for the lock type
|
||||
* which shall be set to F_UNLCK.
|
||||
/* Get the first lock which blocks the lock description pointed to
|
||||
* by the third argument, arg, taken as a pointer to type struct
|
||||
* flock, defined in <fcntl.h>. The information retrieved shall
|
||||
* overwrite the information passed to fcntl() in the structure
|
||||
* flock. If no lock is found that would prevent this lock from
|
||||
* being created, then the structure shall be left unchanged except
|
||||
* for the lock type which shall be set to F_UNLCK.
|
||||
*/
|
||||
|
||||
case F_SETLK:
|
||||
/* Set or clear a file segment lock according to the lock description pointed to
|
||||
* by the third argument, arg, taken as a pointer to type struct flock, defined in
|
||||
* <fcntl.h>. F_SETLK can establish shared (or read) locks (F_RDLCK) or exclusive
|
||||
* (or write) locks (F_WRLCK), as well as to remove either type of lock (F_UNLCK).
|
||||
* F_RDLCK, F_WRLCK, and F_UNLCK are defined in <fcntl.h>. If a shared or exclusive
|
||||
* lock cannot be set, fcntl() shall return immediately with a return value of -1.
|
||||
/* Set or clear a file segment lock according to the lock
|
||||
* description pointed to by the third argument, arg, taken as a
|
||||
* pointer to type struct flock, defined in <fcntl.h>. F_SETLK can
|
||||
* establish shared (or read) locks (F_RDLCK) or exclusive (or
|
||||
* write) locks (F_WRLCK), as well as to remove either type of lock
|
||||
* (F_UNLCK). F_RDLCK, F_WRLCK, and F_UNLCK are defined in
|
||||
* <fcntl.h>. If a shared or exclusive lock cannot be set, fcntl()
|
||||
* shall return immediately with a return value of -1.
|
||||
*/
|
||||
|
||||
case F_SETLKW:
|
||||
/* This command shall be equivalent to F_SETLK except that if a shared or exclusive
|
||||
* lock is blocked by other locks, the thread shall wait until the request can be
|
||||
* satisfied. If a signal that is to be caught is received while fcntl() is waiting
|
||||
* for a region, fcntl() shall be interrupted. Upon return from the signal handler,
|
||||
* fcntl() shall return -1 with errno set to [EINTR], and the lock operation shall
|
||||
* not be done.
|
||||
/* This command shall be equivalent to F_SETLK except that if a
|
||||
* shared or exclusive lock is blocked by other locks, the thread
|
||||
* shall wait until the request can be satisfied. If a signal that
|
||||
* is to be caught is received while fcntl() is waiting for a
|
||||
* region, fcntl() shall be interrupted. Upon return from the signal
|
||||
* handler, fcntl() shall return -1 with errno set to [EINTR], and
|
||||
* the lock operation shall not be done.
|
||||
*/
|
||||
|
||||
ret = -ENOSYS; /* Not implemented */
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ off_t lseek(int fd, off_t offset, int whence)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
return newpos;
|
||||
return newpos;
|
||||
|
||||
errout:
|
||||
set_errno(errcode);
|
||||
|
||||
+16
-16
@@ -157,27 +157,27 @@ int nx_vopen(FAR const char *path, int oflags, va_list ap)
|
||||
* NOTE: This will recurse to open the character driver proxy.
|
||||
*/
|
||||
|
||||
if (INODE_IS_BLOCK(inode) || INODE_IS_MTD(inode))
|
||||
{
|
||||
/* Release the inode reference */
|
||||
if (INODE_IS_BLOCK(inode) || INODE_IS_MTD(inode))
|
||||
{
|
||||
/* Release the inode reference */
|
||||
|
||||
inode_release(inode);
|
||||
inode_release(inode);
|
||||
|
||||
/* Get the file descriptor of the opened character driver proxy */
|
||||
/* Get the file descriptor of the opened character driver proxy */
|
||||
|
||||
fd = block_proxy(path, oflags);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = fd;
|
||||
goto errout_with_search;
|
||||
}
|
||||
fd = block_proxy(path, oflags);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = fd;
|
||||
goto errout_with_search;
|
||||
}
|
||||
|
||||
/* Return the file descriptor */
|
||||
/* Return the file descriptor */
|
||||
|
||||
RELEASE_SEARCH(&desc);
|
||||
return fd;
|
||||
}
|
||||
else
|
||||
RELEASE_SEARCH(&desc);
|
||||
return fd;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
/* Verify that the inode is either a "normal" character driver or a
|
||||
|
||||
+10
-10
@@ -501,18 +501,18 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
* will return immediately.
|
||||
*/
|
||||
|
||||
ret = nxsem_tickwait(&sem, clock_systimer(), ticks);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret == -ETIMEDOUT)
|
||||
{
|
||||
/* Return zero (OK) in the event of a timeout */
|
||||
ret = nxsem_tickwait(&sem, clock_systimer(), ticks);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (ret == -ETIMEDOUT)
|
||||
{
|
||||
/* Return zero (OK) in the event of a timeout */
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
/* EINTR is the only other error expected in normal operation */
|
||||
}
|
||||
/* EINTR is the only other error expected in normal operation */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -160,6 +160,7 @@ next_subdir:
|
||||
goto errout;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We found it and it appears to be a "normal" inode. Is it a
|
||||
* directory (i.e, an operation-less inode or an inode with children)?
|
||||
*/
|
||||
|
||||
+3
-3
@@ -174,7 +174,7 @@ int stat_recursive(FAR const char *path, FAR struct stat *buf)
|
||||
RELEASE_SEARCH(&desc);
|
||||
return OK;
|
||||
|
||||
/* Failure conditions always set the errno appropriately */
|
||||
/* Failure conditions always set the errno appropriately */
|
||||
|
||||
errout_with_inode:
|
||||
inode_release(inode);
|
||||
@@ -290,14 +290,14 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf)
|
||||
else
|
||||
#endif
|
||||
#if defined(CONFIG_FS_SHM)
|
||||
if (INODE_IS_SHM(inode))
|
||||
if (INODE_IS_SHM(inode))
|
||||
{
|
||||
buf->st_mode = S_IFSHM;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if defined(CONFIG_MTD)
|
||||
if (INODE_IS_MTD(inode))
|
||||
if (INODE_IS_MTD(inode))
|
||||
{
|
||||
buf->st_mode = S_IFMTD;
|
||||
buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR;
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ int statfs(FAR const char *path, FAR struct statfs *buf)
|
||||
RELEASE_SEARCH(&desc);
|
||||
return OK;
|
||||
|
||||
/* Failure conditions always set the errno appropriately */
|
||||
/* Failure conditions always set the errno appropriately */
|
||||
|
||||
errout_with_inode:
|
||||
inode_release(inode);
|
||||
|
||||
Reference in New Issue
Block a user