source: rtems/cpukit/libfs/src/pipe/pipe.h @ f11858ac

4.115
Last change on this file since f11858ac was 11109ea, checked in by Alex Ivanov <alexivanov97@…>, on 12/18/12 at 20:46:38

libfs: Doxygen Enhancement Task #2

http://www.google-melange.com/gci/task/view/google/gci2012/8032207

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 * @file rtems/pipe.h
3 *
4 * This include file defines the interface to the POSIX FIFO/pipe file system
5 * support.
6 */
7
8/*
9 * Author: Wei Shen <cquark@gmail.com>
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.com/license/LICENSE.
14 */
15
16#ifndef _RTEMS_PIPE_H
17#define _RTEMS_PIPE_H
18
19#include <rtems/libio.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/**
26 * @defgroup FIFO_PIPE FIFO/pipe File System Support
27 *
28 * @brief Interface to the POSIX FIFO/pipe File System
29 */
30
31/* Control block to manage each pipe */
32typedef struct pipe_control {
33  char *Buffer;
34  unsigned int Size;
35  unsigned int Start;
36  unsigned int Length;
37  unsigned int Readers;
38  unsigned int Writers;
39  unsigned int waitingReaders;
40  unsigned int waitingWriters;
41  unsigned int readerCounter;     /* incremental counters */
42  unsigned int writerCounter;     /* for differentiation of successive opens */
43  rtems_id Semaphore;
44  rtems_id readBarrier;   /* wait queues */
45  rtems_id writeBarrier;
46#if 0
47  boolean Anonymous;      /* anonymous pipe or FIFO */
48#endif
49} pipe_control_t;
50
51/**
52 * @brief Create an Anonymous Pipe
53 *
54 * Called by pipe() to create an anonymous pipe.
55 */
56extern int pipe_create(
57  int filsdes[2]
58);
59
60/**
61 * @brief Release a Pipe
62 *
63 * Interface to file system close.
64 *
65 * *pipep points to pipe control structure. When the last user releases pipe,
66 * it will be set to NULL.
67 */
68extern void pipe_release(
69  pipe_control_t **pipep,
70  rtems_libio_t *iop
71);
72
73/**
74 * @brief FIFO Open
75 * Interface to file system open.
76 *
77 * *pipep points to pipe control structure. If called with *pipep = NULL,
78 * fifo_open will try allocating and initializing a control structure. If the
79 * call succeeds, *pipep will be set to address of new control structure.
80 */
81extern int fifo_open(
82  pipe_control_t **pipep,
83  rtems_libio_t *iop
84);
85
86/**
87 * @brief Pipe Read
88 *
89 * Interface to file system read.
90 */
91extern ssize_t pipe_read(
92  pipe_control_t *pipe,
93  void           *buffer,
94  size_t          count,
95  rtems_libio_t  *iop
96);
97
98/**
99 * @brief Pipe Write
100 *
101 * Interface to file system write.
102 */
103extern ssize_t pipe_write(
104  pipe_control_t *pipe,
105  const void     *buffer,
106  size_t          count,
107  rtems_libio_t  *iop
108);
109
110/**
111 * @brief Pipe IO Control
112 *
113 * Interface to file system ioctl.
114 */
115extern int pipe_ioctl(
116  pipe_control_t  *pipe,
117  ioctl_command_t  cmd,
118  void            *buffer,
119  rtems_libio_t   *iop
120);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif
Note: See TracBrowser for help on using the repository browser.