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/drivers | |
parent | e735773fe5ea269b43dbecb246cec846b3a0368e (diff) | |
download | nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.tar.gz nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.tar.bz2 nuttx-4c24c7c4a741eaeffc76339f07076cdad7a36c56.zip |
Clean up some naming: fd vs. fildes vs. filedes and filep vs filp
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/bch/bchdev_driver.c | 41 | ||||
-rw-r--r-- | nuttx/drivers/dev_null.c | 10 | ||||
-rw-r--r-- | nuttx/drivers/dev_zero.c | 14 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe.c | 24 |
4 files changed, 47 insertions, 42 deletions
diff --git a/nuttx/drivers/bch/bchdev_driver.c b/nuttx/drivers/bch/bchdev_driver.c index 262a0af46..597710d99 100644 --- a/nuttx/drivers/bch/bchdev_driver.c +++ b/nuttx/drivers/bch/bchdev_driver.c @@ -68,11 +68,14 @@ * Private Function Prototypes ****************************************************************************/ -static int bch_open(FAR struct file *filp); -static int bch_close(FAR struct file *filp); -static ssize_t bch_read(FAR struct file *, FAR char *, size_t); -static ssize_t bch_write(FAR struct file *, FAR const char *, size_t); -static int bch_ioctl(FAR struct file *filp, int cmd, unsigned long arg); +static int bch_open(FAR struct file *filep); +static int bch_close(FAR struct file *filep); +static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static int bch_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); /**************************************************************************** * Public Data @@ -102,9 +105,9 @@ const struct file_operations bch_fops = * ****************************************************************************/ -static int bch_open(FAR struct file *filp) +static int bch_open(FAR struct file *filep) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; DEBUGASSERT(inode && inode->i_private); @@ -133,9 +136,9 @@ static int bch_open(FAR struct file *filp) * ****************************************************************************/ -static int bch_close(FAR struct file *filp) +static int bch_close(FAR struct file *filep) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = OK; @@ -168,9 +171,9 @@ static int bch_close(FAR struct file *filp) * Name:bch_read ****************************************************************************/ -static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, size_t len) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret; @@ -178,10 +181,10 @@ static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) bch = (FAR struct bchlib_s *)inode->i_private; bchlib_semtake(bch); - ret = bchlib_read(bch, buffer, filp->f_pos, len); + ret = bchlib_read(bch, buffer, filep->f_pos, len); if (ret > 0) { - filp->f_pos += len; + filep->f_pos += len; } bchlib_semgive(bch); return ret; @@ -191,9 +194,9 @@ static ssize_t bch_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name:bch_write ****************************************************************************/ -static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, size_t len) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = -EACCES; @@ -203,10 +206,10 @@ static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t l if (!bch->readonly) { bchlib_semtake(bch); - ret = bchlib_write(bch, buffer, filp->f_pos, len); + ret = bchlib_write(bch, buffer, filep->f_pos, len); if (ret > 0) { - filp->f_pos += len; + filep->f_pos += len; } bchlib_semgive(bch); } @@ -221,9 +224,9 @@ static ssize_t bch_write(FAR struct file *filp, FAR const char *buffer, size_t l * ****************************************************************************/ -static int bch_ioctl(FAR struct file *filp, int cmd, unsigned long arg) +static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { - FAR struct inode *inode = filp->f_inode; + FAR struct inode *inode = filep->f_inode; FAR struct bchlib_s *bch; int ret = -ENOTTY; diff --git a/nuttx/drivers/dev_null.c b/nuttx/drivers/dev_null.c index c70370e1e..1a405d7cf 100644 --- a/nuttx/drivers/dev_null.c +++ b/nuttx/drivers/dev_null.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/dev_null.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ static ssize_t devnull_read(FAR struct file *, FAR char *, size_t); static ssize_t devnull_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif @@ -82,7 +82,7 @@ static const struct file_operations devnull_fops = * Name: devnull_read ****************************************************************************/ -static ssize_t devnull_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, size_t len) { return 0; /* Return EOF */ } @@ -91,7 +91,7 @@ static ssize_t devnull_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: devnull_write ****************************************************************************/ -static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer, size_t len) { return len; /* Say that everything was written */ } @@ -101,7 +101,7 @@ static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/nuttx/drivers/dev_zero.c b/nuttx/drivers/dev_zero.c index 5435f80ea..a1374101a 100644 --- a/nuttx/drivers/dev_zero.c +++ b/nuttx/drivers/dev_zero.c @@ -1,7 +1,7 @@ /**************************************************************************** - * drivers/dev_null.c + * drivers/dev_zero.c * - * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ static ssize_t devzero_read(FAR struct file *, FAR char *, size_t); static ssize_t devzero_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); #endif @@ -82,7 +82,8 @@ static const struct file_operations devzero_fops = * Name: devzero_read ****************************************************************************/ -static ssize_t devzero_read(FAR struct file *filp, FAR char *buffer, size_t len) +static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer, + size_t len) { memset(buffer, 0, len); return len; @@ -92,7 +93,8 @@ static ssize_t devzero_read(FAR struct file *filp, FAR char *buffer, size_t len) * Name: devzero_write ****************************************************************************/ -static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size_t len) +static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer, + size_t len) { return len; } @@ -102,7 +104,7 @@ static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, +static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) { if (setup) diff --git a/nuttx/drivers/pipes/pipe.c b/nuttx/drivers/pipes/pipe.c index 20c160475..ce4a7dbe1 100644 --- a/nuttx/drivers/pipes/pipe.c +++ b/nuttx/drivers/pipes/pipe.c @@ -172,11 +172,11 @@ static int pipe_close(FAR struct file *filep) * * Description: * pipe() creates a pair of file descriptors, pointing to a pipe inode, and - * places them in the array pointed to by 'filedes'. filedes[0] is for reading, - * filedes[1] is for writing. + * places them in the array pointed to by 'fd'. fd[0] is for reading, + * fd[1] is for writing. * * Inputs: - * filedes[2] - The user provided array in which to catch the pipe file + * fd[2] - The user provided array in which to catch the pipe file * descriptors * * Return: @@ -185,7 +185,7 @@ static int pipe_close(FAR struct file *filep) * ****************************************************************************/ -int pipe(int filedes[2]) +int pipe(int fd[2]) { struct pipe_dev_s *dev = NULL; char devname[16]; @@ -249,29 +249,29 @@ int pipe(int filedes[2]) } (void)sem_post(&g_pipesem); - + /* Get a write file descriptor */ - filedes[1] = open(devname, O_WRONLY); - if (filedes[1] < 0) + fd[1] = open(devname, O_WRONLY); + if (fd[1] < 0) { - err = -filedes[1]; + err = -fd[1]; goto errout_with_driver; } /* Get a read file descriptor */ - filedes[0] = open(devname, O_RDONLY); - if (filedes[0] < 0) + fd[0] = open(devname, O_RDONLY); + if (fd[0] < 0) { - err = -filedes[0]; + err = -fd[0]; goto errout_with_wrfd; } return OK; errout_with_wrfd: - close(filedes[1]); + close(fd[1]); errout_with_driver: unregister_driver(devname); errout_with_dev: |