Clean up some naming: fd vs. fildes vs. filedes and filep vs filp

This commit is contained in:
Gregory Nutt 2013-09-28 16:50:07 -06:00
parent 22d0ebeb07
commit 4aaee6fb3c
12 changed files with 144 additions and 144 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************
* c5471/c5471_watchdog.c
* arch/arm/src/c5471/c5471_watchdog.c
*
* Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 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
@ -100,7 +100,7 @@ static int wdt_open(struct file *filep);
static int wdt_close(struct file *filep);
static ssize_t wdt_read(struct file *filep, char *buffer, size_t buflen);
static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen);
static int wdt_ioctl(FAR struct file *filp, int cmd, unsigned long arg);
static int wdt_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
/**************************************************************************
* Private Data
@ -190,7 +190,7 @@ static int wdt_setusec(uint32_t usec)
if (divisor >= 0x10000)
{
if (prescaler == MAX_PRESCALER)
{
{
/* This is the max possible ~2.5 seconds. */
dbg("prescaler=0x%x too big!\n", prescaler);
@ -289,7 +289,7 @@ static ssize_t wdt_write(struct file *filep, const char *buffer, size_t buflen)
* Name: wdt_ioctl
**************************************************************************/
static int wdt_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
static int wdt_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
dbg("ioctl Call: cmd=0x%x arg=0x%x", cmd, arg);

View File

@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -1,101 +1,101 @@
/***********************************************************************
* arch/arm/src/arm/lpc2378/lpc23xx_head.S
*
* Copyright (C) 2010 Rommel Marcelo. All rights reserved.
* Author: Rommel Marcelo
*
* This file is part of the NuttX RTOS:
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
***********************************************************************/
/***********************************************************************
* Included files
***********************************************************************/
#include "up_arch.h"
#include <sys/types.h>
#include "lpc23xx_scb.h"
#include "lpc23xx_pinsel.h"
#include "lpc23xx_uart.h"
#include "lpc23xx_gpio.h"
/***********************************************************************
* Definitions
***********************************************************************/
/***********************************************************************
* Name: IO_Init()
*
* Descriptions: Initialize the target board before running the main()
*
************************************************************************/
void IO_Init( void )
{
uint32_t regval;
/* Reset all GPIO pins to default */
pinsel_putreg(0, PINSEL0_OFFSET);
pinsel_putreg(0, PINSEL1_OFFSET);
pinsel_putreg(0, PINSEL2_OFFSET);
pinsel_putreg(0, PINSEL3_OFFSET);
pinsel_putreg(0, PINSEL4_OFFSET);
pinsel_putreg(0, PINSEL5_OFFSET);
pinsel_putreg(0, PINSEL6_OFFSET);
pinsel_putreg(0, PINSEL7_OFFSET);
pinsel_putreg(0, PINSEL8_OFFSET);
pinsel_putreg(0, PINSEL9_OFFSET);
pinsel_putreg(0, PINSEL10_OFFSET);
/*
regval = scb_getreg(SCB_PCONP_OFFSET) & ~(PCSDC | PCUART1 | PCI2C0 | PCSSP1 | PCEMC | );
scb_getreg(regval, SCB_PCONP_OFFSET );
*/
/* Turn off all peripheral power */
scb_putreg(0, SCB_PCONP_OFFSET );
/* Turn on UART0/2 / Timer0 */
/* regval = PCUART0 | PCUART2 | PCTIM0 | PCRTC ; */
regval = PCUART0 | PCUART2 | PCTIM0 ;
scb_putreg(regval , SCB_PCONP_OFFSET );
/* Status LED P1.19 */
dir_putreg8((1 << 3), FIO1DIR2_OFFSET);
/* other io setup here */
return;
}
/***********************************************************************
* arch/arm/src/arm/lpc2378/lpc23xx_head.S
*
* Copyright (C) 2010 Rommel Marcelo. All rights reserved.
* Author: Rommel Marcelo
*
* This file is part of the NuttX RTOS:
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
***********************************************************************/
/***********************************************************************
* Included files
***********************************************************************/
#include "up_arch.h"
#include <sys/types.h>
#include "lpc23xx_scb.h"
#include "lpc23xx_pinsel.h"
#include "lpc23xx_uart.h"
#include "lpc23xx_gpio.h"
/***********************************************************************
* Definitions
***********************************************************************/
/***********************************************************************
* Name: IO_Init()
*
* Descriptions: Initialize the target board before running the main()
*
************************************************************************/
void IO_Init( void )
{
uint32_t regval;
/* Reset all GPIO pins to default */
pinsel_putreg(0, PINSEL0_OFFSET);
pinsel_putreg(0, PINSEL1_OFFSET);
pinsel_putreg(0, PINSEL2_OFFSET);
pinsel_putreg(0, PINSEL3_OFFSET);
pinsel_putreg(0, PINSEL4_OFFSET);
pinsel_putreg(0, PINSEL5_OFFSET);
pinsel_putreg(0, PINSEL6_OFFSET);
pinsel_putreg(0, PINSEL7_OFFSET);
pinsel_putreg(0, PINSEL8_OFFSET);
pinsel_putreg(0, PINSEL9_OFFSET);
pinsel_putreg(0, PINSEL10_OFFSET);
/*
regval = scb_getreg(SCB_PCONP_OFFSET) & ~(PCSDC | PCUART1 | PCI2C0 | PCSSP1 | PCEMC | );
scb_getreg(regval, SCB_PCONP_OFFSET );
*/
/* Turn off all peripheral power */
scb_putreg(0, SCB_PCONP_OFFSET );
/* Turn on UART0/2 / Timer0 */
/* regval = PCUART0 | PCUART2 | PCTIM0 | PCRTC ; */
regval = PCUART0 | PCUART2 | PCTIM0 ;
scb_putreg(regval , SCB_PCONP_OFFSET );
/* Status LED P1.19 */
dir_putreg8((1 << 3), FIO1DIR2_OFFSET);
/* other io setup here */
return;
}

View File

@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -106,14 +106,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -49,16 +49,17 @@
#include <rgmp/string.h>
#include <rgmp/stdio.h>
struct bridge {
struct bridge
{
struct rgmp_bridge *b;
sem_t rd_lock;
sem_t wr_lock;
};
static ssize_t up_bridge_read(struct file *filp, char *buffer, size_t len)
static ssize_t up_bridge_read(struct file *filep, char *buffer, size_t len)
{
ssize_t ret;
struct bridge *b = filp->f_inode->i_private;
struct bridge *b = filep->f_inode->i_private;
sem_wait(&b->rd_lock);
ret = rgmp_bridge_read(b->b, buffer, len, 0);
@ -66,10 +67,10 @@ static ssize_t up_bridge_read(struct file *filp, char *buffer, size_t len)
return ret;
}
static ssize_t up_bridge_write(struct file *filp, const char *buffer, size_t len)
static ssize_t up_bridge_write(struct file *filep, const char *buffer, size_t len)
{
ssize_t ret;
struct bridge *b = filp->f_inode->i_private;
struct bridge *b = filep->f_inode->i_private;
sem_wait(&b->wr_lock);
ret = rgmp_bridge_write(b->b, (char *)buffer, len, 0);
@ -77,17 +78,18 @@ static ssize_t up_bridge_write(struct file *filp, const char *buffer, size_t len
return ret;
}
static int up_bridge_open(struct file *filp)
static int up_bridge_open(struct file *filep)
{
return 0;
}
static int up_bridge_close(struct file *filp)
static int up_bridge_close(struct file *filep)
{
return 0;
}
static const struct file_operations up_bridge_fops = {
static const struct file_operations up_bridge_fops =
{
.read = up_bridge_read,
.write = up_bridge_write,
.open = up_bridge_open,
@ -127,5 +129,3 @@ err1:
err0:
return -1;
}

View File

@ -105,14 +105,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* up_devconsole.c
* arch/sim/src/up_devconsole.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -78,12 +78,12 @@ static const struct file_operations devconsole_fops =
* Private Functions
****************************************************************************/
static ssize_t devconsole_read(struct file *filp, char *buffer, size_t len)
static ssize_t devconsole_read(struct file *filep, char *buffer, size_t len)
{
return up_hostread(buffer, len);
}
static ssize_t devconsole_write(struct file *filp, const char *buffer, size_t len)
static ssize_t devconsole_write(struct file *filep, const char *buffer, size_t len)
{
return up_hostwrite(buffer, len);
}

View File

@ -104,14 +104,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
sdbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
sdbg(" fd=%d\n", filep->fs_filedes);
sdbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -106,14 +106,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
lldbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
lldbg(" fd=%d\n", filep->fs_filedes);
lldbg(" fd=%d\n", filep->fs_fd);
#endif
}
}

View File

@ -107,14 +107,14 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
for (i = 0; i < CONFIG_NFILE_STREAMS; i++)
{
struct file_struct *filep = &streamlist->sl_streams[i];
if (filep->fs_filedes >= 0)
if (filep->fs_fd >= 0)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
lldbg(" fd=%d nbytes=%d\n",
filep->fs_filedes,
filep->fs_fd,
filep->fs_bufpos - filep->fs_bufstart);
#else
lldbg(" fd=%d\n", filep->fs_filedes);
lldbg(" fd=%d\n", filep->fs_fd);
#endif
}
}