diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-28 16:50:07 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-28 16:50:07 -0600 |
commit | 4c24c7c4a741eaeffc76339f07076cdad7a36c56 (patch) | |
tree | 337a94000f0e849884e81e8ac2ee188bf0a38179 /nuttx/fs | |
parent | e735773fe5ea269b43dbecb246cec846b3a0368e (diff) | |
download | px4-nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.tar.gz px4-nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.tar.bz2 px4-nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.zip |
Clean up some naming: fd vs. fildes vs. filedes and filep vs filp
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fs_dup.c | 10 | ||||
-rw-r--r-- | nuttx/fs/fs_dup2.c | 12 | ||||
-rw-r--r-- | nuttx/fs/fs_fdopen.c | 4 | ||||
-rw-r--r-- | nuttx/fs/fs_filedup.c | 26 | ||||
-rw-r--r-- | nuttx/fs/fs_filedup2.c | 20 | ||||
-rw-r--r-- | nuttx/fs/fs_files.c | 17 | ||||
-rw-r--r-- | nuttx/fs/fs_internal.h | 40 | ||||
-rw-r--r-- | nuttx/fs/fs_lseek.c | 6 |
8 files changed, 67 insertions, 68 deletions
diff --git a/nuttx/fs/fs_dup.c b/nuttx/fs/fs_dup.c index 890da039b..1cb1b1674 100644 --- a/nuttx/fs/fs_dup.c +++ b/nuttx/fs/fs_dup.c @@ -66,7 +66,7 @@ * ****************************************************************************/ -int dup(int fildes) +int dup(int fd) { int ret = OK; @@ -74,12 +74,12 @@ int dup(int fildes) * descriptor. */ #if CONFIG_NFILE_DESCRIPTORS > 0 - if ((unsigned int)fildes < CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS) { /* Its a valid file descriptor.. dup the file descriptor using any * other file descriptor*/ - ret = file_dup(fildes, 0); + ret = file_dup(fd, 0); } else #endif @@ -87,11 +87,11 @@ int dup(int fildes) /* Not a vailid file descriptor. Did we get a valid socket descriptor? */ #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 - if ((unsigned int)fildes < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) + if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { /* Yes.. dup the socket descriptor */ - ret = net_dup(fildes, CONFIG_NFILE_DESCRIPTORS); + ret = net_dup(fd, CONFIG_NFILE_DESCRIPTORS); } else #endif diff --git a/nuttx/fs/fs_dup2.c b/nuttx/fs/fs_dup2.c index 45ff2bb73..14171fe47 100644 --- a/nuttx/fs/fs_dup2.c +++ b/nuttx/fs/fs_dup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_dup2.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -73,21 +73,21 @@ * ****************************************************************************/ -int dup2(int fildes1, int fildes2) +int dup2(int fd1, int fd2) { /* Check the range of the descriptor to see if we got a file or a socket * descriptor. */ - if ((unsigned int)fildes1 >= CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd1 >= CONFIG_NFILE_DESCRIPTORS) { /* Not a valid file descriptor. Did we get a valid socket descriptor? */ - if ((unsigned int)fildes1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) + if ((unsigned int)fd1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { /* Yes.. dup the socket descriptor */ - return net_dup2(fildes1, fildes2); + return net_dup2(fd1, fd2); } else { @@ -101,7 +101,7 @@ int dup2(int fildes1, int fildes2) { /* Its a valid file descriptor.. dup the file descriptor */ - return file_dup2(fildes1, fildes2); + return file_dup2(fd1, fd2); } } diff --git a/nuttx/fs/fs_fdopen.c b/nuttx/fs/fs_fdopen.c index 58ea043c5..6544ee2b8 100644 --- a/nuttx/fs/fs_fdopen.c +++ b/nuttx/fs/fs_fdopen.c @@ -210,7 +210,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) for (i = 0 ; i < CONFIG_NFILE_STREAMS; i++) { stream = &slist->sl_streams[i]; - if (stream->fs_filedes < 0) + if (stream->fs_fd < 0) { /* Zero the structure */ @@ -245,7 +245,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) * file descriptor locks this stream. */ - stream->fs_filedes = fd; + stream->fs_fd = fd; stream->fs_oflags = (uint16_t)oflags; sem_post(&slist->sl_sem); diff --git a/nuttx/fs/fs_filedup.c b/nuttx/fs/fs_filedup.c index dcc229ab3..53cdc1b0a 100644 --- a/nuttx/fs/fs_filedup.c +++ b/nuttx/fs/fs_filedup.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -77,19 +77,19 @@ * ****************************************************************************/ -int file_dup(int fildes, int minfd) +int file_dup(int fd, int minfd) { FAR struct filelist *list; - int fildes2; + int fd2; /* Get the thread-specific file list */ list = sched_getfiles(); DEBUGASSERT(list); - /* Verify that fildes is a valid, open file descriptor */ + /* Verify that fd is a valid, open file descriptor */ - if (!DUP_ISOPEN(fildes, list)) + if (!DUP_ISOPEN(fd, list)) { set_errno(EBADF); return ERROR; @@ -97,22 +97,22 @@ int file_dup(int fildes, int minfd) /* Increment the reference count on the contained inode */ - inode_addref(list->fl_files[fildes].f_inode); + inode_addref(list->fl_files[fd].f_inode); /* Then allocate a new file descriptor for the inode */ - fildes2 = files_allocate(list->fl_files[fildes].f_inode, - list->fl_files[fildes].f_oflags, - list->fl_files[fildes].f_pos, - minfd); - if (fildes2 < 0) + fd2 = files_allocate(list->fl_files[fd].f_inode, + list->fl_files[fd].f_oflags, + list->fl_files[fd].f_pos, + minfd); + if (fd2 < 0) { set_errno(EMFILE); - inode_release(list->fl_files[fildes].f_inode); + inode_release(list->fl_files[fd].f_inode); return ERROR; } - return fildes2; + return fd2; } #endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ diff --git a/nuttx/fs/fs_filedup2.c b/nuttx/fs/fs_filedup2.c index d064aa08b..7b94cb569 100644 --- a/nuttx/fs/fs_filedup2.c +++ b/nuttx/fs/fs_filedup2.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_filedup2.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ ****************************************************************************/ #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 -int file_dup2(int fildes1, int fildes2) +int file_dup2(int fd1, int fd2) #else -int dup2(int fildes1, int fildes2) +int dup2(int fd1, int fd2) #endif { FAR struct filelist *list; @@ -91,9 +91,9 @@ int dup2(int fildes1, int fildes2) return ERROR; } - /* Verify that fildes is a valid, open file descriptor */ + /* Verify that fd is a valid, open file descriptor */ - if (!DUP_ISOPEN(fildes1, list)) + if (!DUP_ISOPEN(fd1, list)) { set_errno(EBADF); return ERROR; @@ -101,20 +101,20 @@ int dup2(int fildes1, int fildes2) /* Handle a special case */ - if (fildes1 == fildes2) + if (fd1 == fd2) { - return fildes1; + return fd1; } - /* Verify fildes2 */ + /* Verify fd2 */ - if ((unsigned int)fildes2 >= CONFIG_NFILE_DESCRIPTORS) + if ((unsigned int)fd2 >= CONFIG_NFILE_DESCRIPTORS) { set_errno(EBADF); return ERROR; } - return files_dup(&list->fl_files[fildes1], &list->fl_files[fildes2]); + return files_dup(&list->fl_files[fd1], &list->fl_files[fd2]); } #endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ diff --git a/nuttx/fs/fs_files.c b/nuttx/fs/fs_files.c index 739947a7d..e20e0e9ef 100644 --- a/nuttx/fs/fs_files.c +++ b/nuttx/fs/fs_files.c @@ -344,7 +344,7 @@ int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd) * ****************************************************************************/ -int files_close(int filedes) +int files_close(int fd) { FAR struct filelist *list; int ret; @@ -356,7 +356,7 @@ int files_close(int filedes) /* If the file was properly opened, there should be an inode assigned */ - if (filedes < 0 || filedes >= CONFIG_NFILE_DESCRIPTORS || !list->fl_files[filedes].f_inode) + if (fd < 0 || fd >= CONFIG_NFILE_DESCRIPTORS || !list->fl_files[fd].f_inode) { return -EBADF; } @@ -364,7 +364,7 @@ int files_close(int filedes) /* Perform the protected close operation */ _files_semtake(list); - ret = _files_close(&list->fl_files[filedes]); + ret = _files_close(&list->fl_files[fd]); _files_semgive(list); return ret; } @@ -378,20 +378,19 @@ int files_close(int filedes) * ****************************************************************************/ -void files_release(int filedes) +void files_release(int fd) { FAR struct filelist *list; list = sched_getfiles(); DEBUGASSERT(list); - if (filedes >=0 && filedes < CONFIG_NFILE_DESCRIPTORS) + if (fd >=0 && fd < CONFIG_NFILE_DESCRIPTORS) { _files_semtake(list); - list->fl_files[filedes].f_oflags = 0; - list->fl_files[filedes].f_pos = 0; - list->fl_files[filedes].f_inode = NULL; + list->fl_files[fd].f_oflags = 0; + list->fl_files[fd].f_pos = 0; + list->fl_files[fd].f_inode = NULL; _files_semgive(list); } } - diff --git a/nuttx/fs/fs_internal.h b/nuttx/fs/fs_internal.h index 786c683dc..648f02704 100644 --- a/nuttx/fs/fs_internal.h +++ b/nuttx/fs/fs_internal.h @@ -119,7 +119,7 @@ extern "C" { * ****************************************************************************/ -EXTERN void inode_semtake(void); +void inode_semtake(void); /**************************************************************************** * Name: inode_semgive @@ -129,7 +129,7 @@ EXTERN void inode_semtake(void); * ****************************************************************************/ -EXTERN void inode_semgive(void); +void inode_semgive(void); /**************************************************************************** * Name: inode_search @@ -143,10 +143,10 @@ EXTERN void inode_semgive(void); * ****************************************************************************/ -EXTERN FAR struct inode *inode_search(FAR const char **path, - FAR struct inode **peer, - FAR struct inode **parent, - FAR const char **relpath); +FAR struct inode *inode_search(FAR const char **path, + FAR struct inode **peer, + FAR struct inode **parent, + FAR const char **relpath); /**************************************************************************** * Name: inode_free @@ -156,7 +156,7 @@ EXTERN FAR struct inode *inode_search(FAR const char **path, * ****************************************************************************/ -EXTERN void inode_free(FAR struct inode *node); +void inode_free(FAR struct inode *node); /**************************************************************************** * Name: inode_nextname @@ -167,7 +167,7 @@ EXTERN void inode_free(FAR struct inode *node); * ****************************************************************************/ -EXTERN const char *inode_nextname(FAR const char *name); +const char *inode_nextname(FAR const char *name); /* fs_inodereserver.c *******************************************************/ /**************************************************************************** @@ -192,7 +192,7 @@ EXTERN const char *inode_nextname(FAR const char *name); * ****************************************************************************/ -EXTERN int inode_reserve(FAR const char *path, FAR struct inode **inode); +int inode_reserve(FAR const char *path, FAR struct inode **inode); /* fs_inoderemove.c *********************************************************/ /**************************************************************************** @@ -205,7 +205,7 @@ EXTERN int inode_reserve(FAR const char *path, FAR struct inode **inode); * ****************************************************************************/ -EXTERN int inode_remove(FAR const char *path); +int inode_remove(FAR const char *path); /* fs_inodefind.c ***********************************************************/ /**************************************************************************** @@ -217,15 +217,15 @@ EXTERN int inode_remove(FAR const char *path); * ****************************************************************************/ -EXTERN FAR struct inode *inode_find(FAR const char *path, const char **relpath); +FAR struct inode *inode_find(FAR const char *path, const char **relpath); /* fs_inodeaddref.c *********************************************************/ -EXTERN void inode_addref(FAR struct inode *inode); +void inode_addref(FAR struct inode *inode); /* fs_inoderelease.c ********************************************************/ -EXTERN void inode_release(FAR struct inode *inode); +void inode_release(FAR struct inode *inode); /* fs_foreachinode.c ********************************************************/ /**************************************************************************** @@ -244,7 +244,7 @@ EXTERN void inode_release(FAR struct inode *inode); * ****************************************************************************/ -EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg); +int foreach_inode(foreach_inode_t handler, FAR void *arg); /* fs_files.c ***************************************************************/ /**************************************************************************** @@ -255,7 +255,7 @@ EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg); * ****************************************************************************/ -EXTERN void weak_function files_initialize(void); +void weak_function files_initialize(void); /**************************************************************************** * Name: files_allocate @@ -266,7 +266,7 @@ EXTERN void weak_function files_initialize(void); * ****************************************************************************/ -EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd); +int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int minfd); /**************************************************************************** * Name: files_close @@ -279,7 +279,7 @@ EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos, int m * ****************************************************************************/ -EXTERN int files_close(int filedes); +int files_close(int fd); /**************************************************************************** * Name: files_release @@ -290,7 +290,7 @@ EXTERN int files_close(int filedes); * ****************************************************************************/ -EXTERN void files_release(int filedes); +void files_release(int fd); /* fs_findblockdriver.c *****************************************************/ /**************************************************************************** @@ -316,8 +316,8 @@ EXTERN void files_release(int filedes); * ****************************************************************************/ -EXTERN int find_blockdriver(FAR const char *pathname, int mountflags, - FAR struct inode **ppinode); +int find_blockdriver(FAR const char *pathname, int mountflags, + FAR struct inode **ppinode); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/fs/fs_lseek.c b/nuttx/fs/fs_lseek.c index d2a2a8ca7..c59461052 100644 --- a/nuttx/fs/fs_lseek.c +++ b/nuttx/fs/fs_lseek.c @@ -138,7 +138,7 @@ errout: * * Description: * The lseek() function repositions the offset of the open file associated - * with the file descriptor fildes to the argument 'offset' according to the + * with the file descriptor fd to the argument 'offset' according to the * directive 'whence' as follows: * * SEEK_SET @@ -161,12 +161,12 @@ errout: * Return: * The resulting offset on success. -1 on failure withi errno set properly: * - * EBADF fildes is not an open file descriptor. + * EBADF fd is not an open file descriptor. * EINVAL whence is not one of SEEK_SET, SEEK_CUR, SEEK_END; or the * resulting file offset would be negative, or beyond the end of a * seekable device. * EOVERFLOW The resulting file offset cannot be represented in an off_t. - * ESPIPE fildes is associated with a pipe, socket, or FIFO. + * ESPIPE fd is associated with a pipe, socket, or FIFO. * ****************************************************************************/ |