diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-15 14:56:25 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-15 14:56:25 +0000 |
commit | 9b26924fbfabc53ef5736aa2b94912571a19ba4d (patch) | |
tree | a09708d5a73cc49088e565913d8742a27fc8cbce /nuttx/drivers/pipes | |
parent | 57a3793bb9a43aebc7d2c0396b8c85483367d7dc (diff) | |
download | px4-nuttx-9b26924fbfabc53ef5736aa2b94912571a19ba4d.tar.gz px4-nuttx-9b26924fbfabc53ef5736aa2b94912571a19ba4d.tar.bz2 px4-nuttx-9b26924fbfabc53ef5736aa2b94912571a19ba4d.zip |
drivers/, drivers/pipes, and drivers/serial file clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4944 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/pipes')
-rw-r--r-- | nuttx/drivers/pipes/Make.defs | 2 | ||||
-rw-r--r-- | nuttx/drivers/pipes/fifo.c | 5 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe.c | 8 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe_common.c | 9 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe_common.h | 8 |
5 files changed, 21 insertions, 11 deletions
diff --git a/nuttx/drivers/pipes/Make.defs b/nuttx/drivers/pipes/Make.defs index 15930627a..836505481 100644 --- a/nuttx/drivers/pipes/Make.defs +++ b/nuttx/drivers/pipes/Make.defs @@ -2,7 +2,7 @@ # drivers/pipes/Make.defs # # Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <spudmonkey@racsa.co.cr> +# Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/nuttx/drivers/pipes/fifo.c b/nuttx/drivers/pipes/fifo.c index 951a4e04e..03aafd0f0 100644 --- a/nuttx/drivers/pipes/fifo.c +++ b/nuttx/drivers/pipes/fifo.c @@ -2,7 +2,7 @@ * drivers/pipes/fifo.c * * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -113,6 +113,7 @@ static const struct file_operations fifo_fops = * appropriately. * ****************************************************************************/ + int mkfifo(FAR const char *pathname, mode_t mode) { struct pipe_dev_s *dev; @@ -131,6 +132,8 @@ int mkfifo(FAR const char *pathname, mode_t mode) { pipecommon_freedev(dev); } + return ret; } + #endif /* CONFIG_DEV_PIPE_SIZE > 0 */ diff --git a/nuttx/drivers/pipes/pipe.c b/nuttx/drivers/pipes/pipe.c index 5ca72e640..20c160475 100644 --- a/nuttx/drivers/pipes/pipe.c +++ b/nuttx/drivers/pipes/pipe.c @@ -2,7 +2,7 @@ * drivers/pipes/pipe.c * * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -114,6 +114,7 @@ static inline int pipe_allocate(void) break; } } + return ret; } @@ -145,7 +146,7 @@ static int pipe_close(FAR struct file *filep) #if CONFIG_DEBUG if (!dev) { - return -EBADF; + return -EBADF; } #endif @@ -158,6 +159,7 @@ static int pipe_close(FAR struct file *filep) pipe_free(dev->d_pipeno); } + return ret; } @@ -228,6 +230,7 @@ int pipe(int filedes[2]) err = ENOMEM; goto errout_with_pipe; } + dev->d_pipeno = pipeno; /* Register the pipe device */ @@ -244,6 +247,7 @@ int pipe(int filedes[2]) g_pipecreated |= (1 << pipeno); } + (void)sem_post(&g_pipesem); /* Get a write file descriptor */ diff --git a/nuttx/drivers/pipes/pipe_common.c b/nuttx/drivers/pipes/pipe_common.c index 0282d8acd..5f61fdd8e 100644 --- a/nuttx/drivers/pipes/pipe_common.c +++ b/nuttx/drivers/pipes/pipe_common.c @@ -2,7 +2,7 @@ * drivers/pipes/pipe_common.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -161,6 +161,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void) sem_init(&dev->d_rdsem, 0, 0); sem_init(&dev->d_wrsem, 0, 0); } + return dev; } @@ -194,6 +195,7 @@ int pipecommon_open(FAR struct file *filep) return -EBADF; } #endif + /* Make sure that we have exclusive access to the device structure. The * sem_wait() call should fail only if we are awakened by a signal. */ @@ -306,9 +308,9 @@ int pipecommon_close(FAR struct file *filep) if (dev->d_refs > 1) { - /* No.. then just decrement the reference count */ + /* No.. then just decrement the reference count */ - dev->d_refs--; + dev->d_refs--; /* If opened for writing, decrement the count of writers on on the pipe instance */ @@ -459,6 +461,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t return -ENODEV; } #endif + pipe_dumpbuffer("To PIPE:", (uint8_t*)buffer, len); /* At present, this method cannot be called from interrupt handlers. That is diff --git a/nuttx/drivers/pipes/pipe_common.h b/nuttx/drivers/pipes/pipe_common.h index 16bf285b5..44822e07f 100644 --- a/nuttx/drivers/pipes/pipe_common.h +++ b/nuttx/drivers/pipes/pipe_common.h @@ -2,7 +2,7 @@ * drivers/pipe/pipe_common.h * * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __DRIVERS_PIPE_COMMON_H -#define __DRIVERS_PIPE_COMMON_H +#ifndef __DRIVERS_PIPES_PIPE_COMMON_H +#define __DRIVERS_PIPES_PIPE_COMMON_H /**************************************************************************** * Included Files @@ -136,4 +136,4 @@ EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, #endif #endif /* CONFIG_DEV_PIPE_SIZE > 0 */ -#endif /* __DRIVERS_PIPE_COMMON_H */ +#endif /* __DRIVERS_PIPES_PIPE_COMMON_H */ |