summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-12-23 18:18:56 +1100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-25 08:45:26 +0100
commit2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch)
tree44759efe9374f13200a97e96d91bd9a2b7e5ce2a /cpukit/libcsupport
parentMAINTAINERS: Add myself to Write After Approval. (diff)
downloadrtems-2afb22b7e1ebcbe40373ff7e0efae7d207c655a9.tar.bz2
Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step. It copied header files from arbitrary locations into the build tree. The header files were included via the -Bsome/build/tree/path GCC command line option. This has at least seven problems: * The make preinstall step itself needs time and disk space. * Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error. * There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult. * The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit. * An introduction of a new build system is difficult. * Include paths specified by the -B option are system headers. This may suppress warnings. * The parallel build had sporadic failures on some hosts. This patch removes the make preinstall step. All installed header files are moved to dedicated include directories in the source tree. Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc, etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g. erc32, imx, qoriq, etc. The new cpukit include directories are: * cpukit/include * cpukit/score/cpu/@RTEMS_CPU@/include * cpukit/libnetworking The new BSP include directories are: * bsps/include * bsps/@RTEMS_CPU@/include * bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include There are build tree include directories for generated files. The include directory order favours the most general header file, e.g. it is not possible to override general header files via the include path order. The "bootstrap -p" option was removed. The new "bootstrap -H" option should be used to regenerate the "headers.am" files. Update #3254.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/Makefile.am26
-rw-r--r--cpukit/libcsupport/include/iosupp.h46
-rw-r--r--cpukit/libcsupport/include/machine/_kernel_cpuset.h0
-rw-r--r--cpukit/libcsupport/include/machine/_kernel_param.h29
-rw-r--r--cpukit/libcsupport/include/machine/_kernel_time.h173
-rw-r--r--cpukit/libcsupport/include/machine/_kernel_types.h34
-rw-r--r--cpukit/libcsupport/include/machine/_timecounter.h53
-rw-r--r--cpukit/libcsupport/include/ringbuf.h63
-rw-r--r--cpukit/libcsupport/include/rtems/assoc.h204
-rw-r--r--cpukit/libcsupport/include/rtems/deviceio.h88
-rw-r--r--cpukit/libcsupport/include/rtems/error.h135
-rw-r--r--cpukit/libcsupport/include/rtems/gxx_wrappers.h80
-rw-r--r--cpukit/libcsupport/include/rtems/libcsupport.h193
-rw-r--r--cpukit/libcsupport/include/rtems/libio.h1967
-rw-r--r--cpukit/libcsupport/include/rtems/libio_.h1049
-rw-r--r--cpukit/libcsupport/include/rtems/malloc.h201
-rw-r--r--cpukit/libcsupport/include/rtems/termiostypes.h602
-rw-r--r--cpukit/libcsupport/include/rtems/tod.h70
-rw-r--r--cpukit/libcsupport/include/spurious.h42
-rw-r--r--cpukit/libcsupport/include/sys/event.h303
-rw-r--r--cpukit/libcsupport/include/sys/poll.h104
-rw-r--r--cpukit/libcsupport/include/sys/statvfs.h60
-rw-r--r--cpukit/libcsupport/include/sys/utsname.h76
-rw-r--r--cpukit/libcsupport/include/vmeintr.h59
-rw-r--r--cpukit/libcsupport/preinstall.am101
25 files changed, 0 insertions, 5758 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index 038ac93548..253c2c9924 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -5,32 +5,7 @@ noinst_LIBRARIES = libcsupport.a libcalloc.a
libcsupport_a_CPPFLAGS = $(AM_CPPFLAGS)
libcalloc_a_CPPFLAGS = $(AM_CPPFLAGS)
-include_rtemsdir = $(includedir)/rtems
-include_rtems_HEADERS = include/iosupp.h
-include_rtems_HEADERS += include/ringbuf.h
-include_rtems_HEADERS += include/rtems/tod.h
-include_rtems_HEADERS += include/spurious.h
-include_rtems_HEADERS += include/vmeintr.h
-
## rtems
-include_rtems_HEADERS += include/rtems/assoc.h
-include_rtems_HEADERS += include/rtems/deviceio.h
-include_rtems_HEADERS += include/rtems/error.h
-include_rtems_HEADERS += include/rtems/libcsupport.h
-include_rtems_HEADERS += include/rtems/libio.h
-include_rtems_HEADERS += include/rtems/libio_.h
-include_rtems_HEADERS += include/rtems/malloc.h
-include_rtems_HEADERS += include/rtems/termiostypes.h
-include_rtems_HEADERS += include/rtems/gxx_wrappers.h
-
-include_machinedir = $(includedir)/machine
-include_machine_HEADERS =
-include_machine_HEADERS += include/machine/_kernel_cpuset.h
-include_machine_HEADERS += include/machine/_kernel_param.h
-include_machine_HEADERS += include/machine/_kernel_time.h
-include_machine_HEADERS += include/machine/_kernel_types.h
-include_machine_HEADERS += include/machine/_timecounter.h
-
## General stuff
ERROR_C_FILES = src/error.c src/__assert.c
@@ -157,5 +132,4 @@ libcalloc_a_CFLAGS = -fno-builtin
EXTRA_DIST = src/TODO src/CASES src/README
-include $(srcdir)/preinstall.am
include $(top_srcdir)/automake/local.am
diff --git a/cpukit/libcsupport/include/iosupp.h b/cpukit/libcsupport/include/iosupp.h
deleted file mode 100644
index 9fe8a6ab1d..0000000000
--- a/cpukit/libcsupport/include/iosupp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file rtems/iosupp.h
- *
- * This include file defines some special characters of interest.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_IOSUPP_H
-#define _RTEMS_IOSUPP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* character constants */
-
-#define BS 0x08 /* backspace */
-#define LF 0x0a /* line feed */
-#define CR 0x0d /* carriage return */
-#define XON 0x11 /* control-Q */
-#define XOFF 0x13 /* control-S */
-
-/* structures */
-
-#ifdef IOSUPP_INIT
-#define IOSUPP_EXTERN
-#else
-#undef IOSUPP_EXTERN
-#define IOSUPP_EXTERN extern
-#endif
-
-/* functions */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cpukit/libcsupport/include/machine/_kernel_cpuset.h b/cpukit/libcsupport/include/machine/_kernel_cpuset.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/cpukit/libcsupport/include/machine/_kernel_cpuset.h
+++ /dev/null
diff --git a/cpukit/libcsupport/include/machine/_kernel_param.h b/cpukit/libcsupport/include/machine/_kernel_param.h
deleted file mode 100644
index 183bb895a2..0000000000
--- a/cpukit/libcsupport/include/machine/_kernel_param.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <sys/cdefs.h>
-#include <sys/errno.h>
-#include <sys/time.h>
-#include <sys/priority.h>
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef _BYTEORDER_PROTOTYPED
-#define _BYTEORDER_PROTOTYPED
-__BEGIN_DECLS
-__uint32_t htonl(__uint32_t);
-__uint16_t htons(__uint16_t);
-__uint32_t ntohl(__uint32_t);
-__uint16_t ntohs(__uint16_t);
-__END_DECLS
-#endif
-
-#ifndef _BYTEORDER_FUNC_DEFINED
-#define _BYTEORDER_FUNC_DEFINED
-#define htonl(x) __htonl(x)
-#define htons(x) __htons(x)
-#define ntohl(x) __ntohl(x)
-#define ntohs(x) __ntohs(x)
-#endif /* !_BYTEORDER_FUNC_DEFINED */
diff --git a/cpukit/libcsupport/include/machine/_kernel_time.h b/cpukit/libcsupport/include/machine/_kernel_time.h
deleted file mode 100644
index 8200b6a73e..0000000000
--- a/cpukit/libcsupport/include/machine/_kernel_time.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*-
- * Copyright (c) 2016 embedded brains GmbH
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-#if !defined(_SYS_TIME_H_) || !defined(_KERNEL)
-#error "must be included via <sys/time.h> in kernel space"
-#endif
-
-#include <machine/_timecounter.h>
-
-/* Operations on timespecs */
-#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
-#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
-#define timespeccmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-#define timespecadd(vvp, uvp) \
- do { \
- (vvp)->tv_sec += (uvp)->tv_sec; \
- (vvp)->tv_nsec += (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec >= 1000000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_nsec -= 1000000000; \
- } \
- } while (0)
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
-/* Operations on timevals. */
-
-#define timevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
-#define timevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
-#define timevalcmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-
-/* timevaladd and timevalsub are not inlined */
-
-/*
- * Kernel to clock driver interface.
- */
-void inittodr(time_t base);
-void resettodr(void);
-
-#define time_second _Timecounter_Time_second
-#define time_uptime _Timecounter_Time_uptime
-extern struct timeval boottime;
-extern struct bintime tc_tick_bt;
-extern sbintime_t tc_tick_sbt;
-extern struct bintime tick_bt;
-extern sbintime_t tick_sbt;
-extern int tc_precexp;
-extern int tc_timepercentage;
-extern struct bintime bt_timethreshold;
-extern struct bintime bt_tickthreshold;
-extern sbintime_t sbt_timethreshold;
-extern sbintime_t sbt_tickthreshold;
-
-/*
- * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
- *
- * Functions without the "get" prefix returns the best timestamp
- * we can produce in the given format.
- *
- * "bin" == struct bintime == seconds + 64 bit fraction of seconds.
- * "nano" == struct timespec == seconds + nanoseconds.
- * "micro" == struct timeval == seconds + microseconds.
- *
- * Functions containing "up" returns time relative to boot and
- * should be used for calculating time intervals.
- *
- * Functions without "up" returns UTC time.
- *
- * Functions with the "get" prefix returns a less precise result
- * much faster than the functions without "get" prefix and should
- * be used where a precision of 1/hz seconds is acceptable or where
- * performance is priority. (NB: "precision", _not_ "resolution" !)
- */
-
-#define binuptime(_bt) _Timecounter_Binuptime(_bt)
-#define nanouptime(_tsp) _Timecounter_Nanouptime(_tsp)
-#define microuptime(_tvp) _Timecounter_Microuptime(_tvp)
-
-static __inline sbintime_t
-sbinuptime(void)
-{
- struct bintime _bt;
-
- binuptime(&_bt);
- return (bttosbt(_bt));
-}
-
-#define bintime(_bt) _Timecounter_Bintime(_bt)
-#define nanotime(_tsp) _Timecounter_Nanotime(_tsp)
-#define microtime(_tvp) _Timecounter_Microtime(_tvp)
-
-#define getbinuptime(_bt) _Timecounter_Getbinuptime(_bt)
-#define getnanouptime(_tsp) _Timecounter_Getnanouptime(_tsp)
-#define getmicrouptime(_tvp) _Timecounter_Getmicrouptime(_tvp)
-
-static __inline sbintime_t
-getsbinuptime(void)
-{
- struct bintime _bt;
-
- getbinuptime(&_bt);
- return (bttosbt(_bt));
-}
-
-#define getbintime(_bt) _Timecounter_Getbintime(_bt)
-#define getnanotime(_tsp) _Timecounter_Getnanotime(_tsp)
-#define getmicrotime(_tvp) _Timecounter_Getmicrotime(_tvp)
-
-#define getboottime(_tvp) _Timecounter_Getboottime(_tvp)
-#define getboottimebin(_bt) _Timecounter_Getboottimebin(_bt)
-
-/* Other functions */
-int itimerdecr(struct itimerval *itp, int usec);
-int itimerfix(struct timeval *tv);
-int ppsratecheck(struct timeval *, int *, int);
-int ratecheck(struct timeval *, const struct timeval *);
-void timevaladd(struct timeval *t1, const struct timeval *t2);
-void timevalsub(struct timeval *t1, const struct timeval *t2);
-int tvtohz(struct timeval *tv);
-
-#define TC_DEFAULTPERC 5
-
-#define BT2FREQ(bt) \
- (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \
- ((bt)->frac >> 1))
-
-#define SBT2FREQ(sbt) ((SBT_1S + ((sbt) >> 1)) / (sbt))
-
-#define FREQ2BT(freq, bt) \
-{ \
- (bt)->sec = 0; \
- (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \
-}
-
-#define TIMESEL(sbt, sbt2) \
- (((sbt2) >= sbt_timethreshold) ? \
- ((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0))
diff --git a/cpukit/libcsupport/include/machine/_kernel_types.h b/cpukit/libcsupport/include/machine/_kernel_types.h
deleted file mode 100644
index 892ec413d5..0000000000
--- a/cpukit/libcsupport/include/machine/_kernel_types.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * Copyright (c) 2016 embedded brains GmbH
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-#if !defined(_SYS_TYPES_H) || !defined(_KERNEL)
-#error "must be included via <sys/types.h> in kernel space"
-#endif
-
-typedef int boolean_t;
-typedef struct device *device_t;
-typedef char vm_memattr_t; /* memory attribute codes */
-typedef struct vm_page *vm_page_t;
diff --git a/cpukit/libcsupport/include/machine/_timecounter.h b/cpukit/libcsupport/include/machine/_timecounter.h
deleted file mode 100644
index fb974f13c1..0000000000
--- a/cpukit/libcsupport/include/machine/_timecounter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2016 embedded brains GmbH
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-#ifndef _SYS_TIME_H_
-#error "<sys/time.h> must be included first"
-#endif /* !_SYS_TIME_H_ */
-
-#ifndef _MACHINE__TIMECOUNTER_H_
-#define _MACHINE__TIMECOUNTER_H_
-
-__BEGIN_DECLS
-extern volatile time_t _Timecounter_Time_second;
-extern volatile int32_t _Timecounter_Time_uptime;
-extern struct bintime _Timecounter_Boottimebin;
-
-void _Timecounter_Binuptime(struct bintime *);
-void _Timecounter_Nanouptime(struct timespec *);
-void _Timecounter_Microuptime(struct timeval *);
-void _Timecounter_Bintime(struct bintime *);
-void _Timecounter_Nanotime(struct timespec *);
-void _Timecounter_Microtime(struct timeval *);
-void _Timecounter_Getbinuptime(struct bintime *);
-void _Timecounter_Getnanouptime(struct timespec *);
-void _Timecounter_Getmicrouptime(struct timeval *);
-void _Timecounter_Getbintime(struct bintime *);
-void _Timecounter_Getnanotime(struct timespec *);
-void _Timecounter_Getmicrotime(struct timeval *);
-__END_DECLS
-
-#endif /* _MACHINE__TIMECOUNTER_H_ */
diff --git a/cpukit/libcsupport/include/ringbuf.h b/cpukit/libcsupport/include/ringbuf.h
deleted file mode 100644
index c16a79d1ae..0000000000
--- a/cpukit/libcsupport/include/ringbuf.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @file
- *
- * @brief Simple Ring Buffer Functionality
- *
- * This file provides simple ring buffer functionality.
- */
-
-
-#ifndef _RTEMS_RINGBUF_H
-#define _RTEMS_RINGBUF_H
-
-#include <rtems.h>
-
-#ifndef RINGBUF_QUEUE_LENGTH
-#define RINGBUF_QUEUE_LENGTH 128
-#endif
-
-typedef struct {
- uint8_t buffer[RINGBUF_QUEUE_LENGTH];
- volatile int head;
- volatile int tail;
- rtems_interrupt_lock lock;
-} Ring_buffer_t;
-
-#define Ring_buffer_Initialize( _buffer ) \
- do { \
- (_buffer)->head = (_buffer)->tail = 0; \
- rtems_interrupt_lock_initialize(&(_buffer)->lock, "ring buffer"); \
- } while ( 0 )
-
-#define Ring_buffer_Destory( _buffer ) \
- do { \
- rtems_interrupt_lock_destroy(&(_buffer)->lock); \
- } while ( 0 )
-
-#define Ring_buffer_Is_empty( _buffer ) \
- ( (_buffer)->head == (_buffer)->tail )
-
-#define Ring_buffer_Is_full( _buffer ) \
- ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH )
-
-#define Ring_buffer_Add_character( _buffer, _ch ) \
- do { \
- rtems_interrupt_lock_context lock_context; \
- \
- rtems_interrupt_lock_acquire( &(_buffer)->lock, &lock_context ); \
- (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \
- (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \
- rtems_interrupt_lock_release( &(_buffer)->lock, &lock_context ); \
- } while ( 0 )
-
-#define Ring_buffer_Remove_character( _buffer, _ch ) \
- do { \
- rtems_interrupt_lock_context lock_context; \
- \
- rtems_interrupt_lock_acquire( &(_buffer)->lock, &lock_context ); \
- (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \
- (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \
- rtems_interrupt_lock_release( &(_buffer)->lock, &lock_context ); \
- } while ( 0 )
-
-#endif
diff --git a/cpukit/libcsupport/include/rtems/assoc.h b/cpukit/libcsupport/include/rtems/assoc.h
deleted file mode 100644
index 345761758a..0000000000
--- a/cpukit/libcsupport/include/rtems/assoc.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * @file rtems/assoc.h
- *
- * @brief RTEMS Associativity Routines
- *
- * RTEMS associativity routines. Mainly used to convert a value from
- * one space to another (eg: our errno's to host errno's and vice-versa)
- */
-
-
-#ifndef _RTEMS_RTEMS_ASSOC_H
-#define _RTEMS_RTEMS_ASSOC_H
-
-/**
- * @defgroup Associativity Associativity Routines
- */
-/**@{*/
-
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- const char *name;
- uint32_t local_value;
- uint32_t remote_value;
-} rtems_assoc_t;
-
-/*
- * Flag/marker for optional default value in each table
- */
-
-#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
-
-/**
- * @brief RTEMS Associate Pointer by Name
- */
-const rtems_assoc_t *rtems_assoc_ptr_by_name(
- const rtems_assoc_t *,
- const char *
-);
-
-/**
- * @brief RTEMS Associate Pointer by Remote
- */
-const rtems_assoc_t *rtems_assoc_ptr_by_remote(
- const rtems_assoc_t *,
- uint32_t
-);
-
-uint32_t rtems_assoc_remote_by_local(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Associate Local by Remote
- */
-uint32_t rtems_assoc_local_by_remote(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Associate Remote by Name
- */
-uint32_t rtems_assoc_remote_by_name(
- const rtems_assoc_t *,
- const char *
-);
-
-/**
- * @brief RTEMS Associate Local by Name
- */
-uint32_t rtems_assoc_local_by_name(
- const rtems_assoc_t *,
- const char *
-);
-
-/**
- * @brief RTEMS Associate Name by Local
- */
-const char *rtems_assoc_name_by_local(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Associate Name by Remote
- */
-const char *rtems_assoc_name_by_remote(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Assoc Routines
- */
-uint32_t rtems_assoc_remote_by_local_bitfield(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Associate Name by Local Bitfield
- */
-char *rtems_assoc_name_by_local_bitfield(
- const rtems_assoc_t *,
- uint32_t ,
- char *
-);
-
-/**
- * @brief RTEMS Associate Name by Remote Bitfield
- */
-char *rtems_assoc_name_by_remote_bitfield(
- const rtems_assoc_t *,
- uint32_t ,
- char *
-);
-
-uint32_t rtems_assoc_local_by_remote_bitfield(
- const rtems_assoc_t *,
- uint32_t
-);
-
-/**
- * @brief RTEMS Associate Pointer by Local
- */
-const rtems_assoc_t *rtems_assoc_ptr_by_local(
- const rtems_assoc_t *ap,
- uint32_t local_value
-);
-
-#if defined(INSIDE_ASSOC)
-
-#define rtems_assoc_is_default(_ap) \
- ((_ap)->name && !strcmp((_ap)->name, RTEMS_ASSOC_DEFAULT_NAME))
-
-/**
- * @brief RTEMS Associate Bad Name
- *
- * what to return if a value is not found
- * this is not reentrant, but it really shouldn't be invoked anyway
- */
-const char *rtems_assoc_name_bad(
- uint32_t bad_value
-);
-#endif
-
-typedef struct {
- uint32_t bits;
- const char *name;
-} rtems_assoc_32_pair;
-
-/**
- * @brief Converts the specified value into a text representation.
- *
- * @param[in] value The value to convert.
- * @param[in] buffer The buffer for the text representation.
- * @param[in] buffer_size The buffer size in characters.
- * @param[in] pairs Names for particular bits.
- * @param[in] pair_count Count of pairs.
- * @param[in] separator Separator between individual names.
- * @param[in] fallback Fallback value in case no bits contained in the pairs
- * are set in the value.
- *
- * @retval The length of the text representation. May be greater than or equal
- * to the buffer size if truncation occurred.
- */
-size_t rtems_assoc_32_to_string(
- uint32_t value,
- char *buffer,
- size_t buffer_size,
- const rtems_assoc_32_pair *pairs,
- size_t pair_count,
- const char *separator,
- const char *fallback
-);
-
-/**
- * @brief Converts the specified thread states into a text representation.
- *
- * @param[in] states The thread states to convert.
- * @param[in] buffer The buffer for the text representation.
- * @param[in] buffer_size The buffer size in characters.
- *
- * @retval The length of the text representation. May be greater than or equal
- * to the buffer size if truncation occurred.
- */
-size_t rtems_assoc_thread_states_to_string(
- uint32_t states,
- char *buffer,
- size_t buffer_size
-);
-
-#ifdef __cplusplus
-}
-#endif
-/**@}*/
-#endif /* ! _RTEMS_RTEMS_ASSOC_H */
diff --git a/cpukit/libcsupport/include/rtems/deviceio.h b/cpukit/libcsupport/include/rtems/deviceio.h
deleted file mode 100644
index a448fc7bb4..0000000000
--- a/cpukit/libcsupport/include/rtems/deviceio.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- *
- * @brief Operations on IMFS Device Nodes
- */
-
-/*
- * COPYRIGHT (c) 1989-2012.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_DEVICEIO_H
-#define _RTEMS_DEVICEIO_H
-
-#include <rtems/libio.h>
-
-/**
- * @defgroup IMFSDevices IMFS Device IO Handler
- *
- * @ingroup IMFS
- *
- * This contains the interface to device drivers using the RTEMS Classic API.
- */
-/**@{*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @brief IMFS device node handlers.
- *
- * IMFS Device Node Handlers
- *
- * This file contains the set of handlers used to map operations on
- * IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
- */
-int rtems_deviceio_open(
- rtems_libio_t *iop,
- const char *path,
- int oflag,
- mode_t mode,
- rtems_device_major_number major,
- rtems_device_minor_number minor
-);
-
-int rtems_deviceio_close(
- rtems_libio_t *iop,
- rtems_device_major_number major,
- rtems_device_minor_number minor
-);
-
-ssize_t rtems_deviceio_read(
- rtems_libio_t *iop,
- void *buf,
- size_t nbyte,
- rtems_device_major_number major,
- rtems_device_minor_number minor
-);
-
-ssize_t rtems_deviceio_write(
- rtems_libio_t *iop,
- const void *buf,
- size_t nbyte,
- rtems_device_major_number major,
- rtems_device_minor_number minor
-);
-
-int rtems_deviceio_control(
- rtems_libio_t *iop,
- ioctl_command_t command,
- void *buffer,
- rtems_device_major_number major,
- rtems_device_minor_number minor
-);
-
-#ifdef __cplusplus
-}
-#endif
-/* __cplusplus */
-
-/**@}*/
-
-#endif /* _RTEMS_DEVICEIO_H */
diff --git a/cpukit/libcsupport/include/rtems/error.h b/cpukit/libcsupport/include/rtems/error.h
deleted file mode 100644
index 617f59642b..0000000000
--- a/cpukit/libcsupport/include/rtems/error.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @file rtems/error.h
- *
- * @brief RTEMS Error Reporting
- *
- * Defines and externs for rtems error reporting
- *
- * These routines provide general purpose error reporting.
- * rtems_error reports an error to stderr and allows use of
- * printf style formatting. A newline is appended to all messages.
- *
- * error_flag can be specified as any of the following:
- *
- * RTEMS_ERROR_ERRNO -- include errno text in output
- * RTEMS_ERROR_PANIC -- halts local system after output
- * RTEMS_ERROR_ABORT -- abort after output
- *
- * It can also include a rtems_status value which can be OR'd
- * with the above flags. *
- *
- * Example 1:
- * @code
- * #include <rtems.h>
- * #include <rtems/error.h>
- * rtems_error(0, "stray interrupt %d", intr);
- * @endcode
- *
- * Example 2:
- * @code
- * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
- * {
- * rtems_error(status | RTEMS_ERROR_ABORT,
- * "could not create task");
- * }
- * @endcode
- *
- * Example 3:
- * @code
- * if ((fd = open(pathname, O_RDNLY)) < 0)
- * {
- * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
- * goto failed;
- * }
- * @endcode
- */
-
-#ifndef _RTEMS_RTEMS_ERROR_H
-#define _RTEMS_RTEMS_ERROR_H
-
-#include <rtems/rtems/status.h>
-#include <rtems/fatal.h>
-
-#include <stdarg.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup ErrorPanicSupport Error And Panic Support
- *
- * @ingroup libcsupport
- *
- * @brief Defines and externs for rtems error reporting
- *
- */
-typedef Internal_errors_t rtems_error_code_t;
-
-/*
- * rtems_error(), rtems_verror() and rtems_panic() support
- */
-
-#if 0
-/* not 16bit-int host clean */
-#define RTEMS_ERROR_ERRNO (1<<((sizeof(rtems_error_code_t) * CHAR_BIT) - 2)) /* hi bit; use 'errno' */
-#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
-#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
-#else
-#define RTEMS_ERROR_ERRNO (0x40000000) /* hi bit; use 'errno' */
-#define RTEMS_ERROR_PANIC (0x20000000) /* err fatal; no return */
-#define RTEMS_ERROR_ABORT (0x10000000) /* err is fatal; panic */
-#endif
-
-#define RTEMS_ERROR_MASK \
- (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | RTEMS_ERROR_PANIC) /* all */
-
-/**
- * @brief Report an Error
- *
- * @param[in] error_code can be specified as any of the following:
- * RTEMS_ERROR_ERRNO -- include errno text in output
- * RTEMS_ERROR_PANIC -- halts local system after output
- * RTEMS_ERROR_ABORT -- abort after output
- *
- * @param[in] printf_format is a normal printf(3) format string,
- * with its concommitant arguments
- *
- * @return the number of characters written.
- */
-int rtems_error(
- rtems_error_code_t error_code,
- const char *printf_format,
- ...
-);
-
-/**
- * @brief Report an Error
- *
- * @param[in] error_code can be specified as any of the following:
- * RTEMS_ERROR_ERRNO -- include errno text in output
- * RTEMS_ERROR_PANIC -- halts local system after output
- * RTEMS_ERROR_ABORT -- abort after output
- *
- * @param[in] printf_format is a normal printf(3) format string,
- * with its concommitant arguments
- * @param[in] arglist is a varargs list corresponding to
- * printf_format
- *
- * @return the number of characters written.
- */
-int rtems_verror(
- rtems_error_code_t error_code,
- const char *printf_format,
- va_list arglist
-);
-
-extern int rtems_panic_in_progress;
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-/* end of include file */
diff --git a/cpukit/libcsupport/include/rtems/gxx_wrappers.h b/cpukit/libcsupport/include/rtems/gxx_wrappers.h
deleted file mode 100644
index 94502b937f..0000000000
--- a/cpukit/libcsupport/include/rtems/gxx_wrappers.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * @file rtems/gxx_wrappers.h
- *
- * RTEMS threads compatibility routines for libgcc2.
- */
-
-/*
- * by: Rosimildo da Silva (rdasilva@connecttel.com)
- *
- * Used ideas from:
- * W. Eric Norum
- * Canadian Light Source
- * University of Saskatchewan
- * Saskatoon, Saskatchewan, CANADA
- * eric@cls.usask.ca
- *
- * Eric sent some e-mail in the rtems-list as a start point for this
- * module implementation.
- */
-
-#ifndef __GCC_WRAPPERS_h
-#define __GCC_WRAPPERS_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @defgroup GxxWrappersSupport Gxx Wrappers Support
- *
- * @ingroup libcsupport
- *
- * @brief RTEMS Threads Compatibility Routines for Libgcc2
- */
-
-/*
- * These typedefs should match with the ones defined in the file
- * gcc/gthr-rtems.h in the gcc distribution.
- */
-typedef void *__gthread_key_t;
-typedef int __gthread_once_t;
-typedef void *__gthread_mutex_t;
-typedef void *__gthread_recursive_mutex_t;
-
-int rtems_gxx_once(__gthread_once_t *once, void (*func) (void));
-
-int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *));
-
-int rtems_gxx_key_delete (__gthread_key_t key);
-
-void *rtems_gxx_getspecific(__gthread_key_t key);
-
-int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr);
-
-/*
- * MUTEX support
- */
-void rtems_gxx_mutex_init (__gthread_mutex_t *mutex);
-
-int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex);
-
-int rtems_gxx_mutex_destroy (__gthread_mutex_t *mutex);
-
-int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex);
-
-int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex);
-
-void rtems_gxx_recursive_mutex_init(__gthread_recursive_mutex_t *mutex);
-
-int rtems_gxx_recursive_mutex_lock(__gthread_recursive_mutex_t *mutex);
-
-int rtems_gxx_recursive_mutex_trylock(__gthread_recursive_mutex_t *mutex);
-
-int rtems_gxx_recursive_mutex_unlock(__gthread_recursive_mutex_t *mutex);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __GCC_WRAPPERS_h */
diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h
deleted file mode 100644
index 51607f9ea1..0000000000
--- a/cpukit/libcsupport/include/rtems/libcsupport.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * @file
- *
- * @brief Standard C Library Support
- *
- * This include file contains the information regarding the
- * RTEMS specific support for the standard C library.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_RTEMS_LIBCSUPPORT_H
-#define _RTEMS_RTEMS_LIBCSUPPORT_H
-
-#include <sys/types.h>
-#include <stdint.h>
-
-#include <rtems/score/heap.h>
-#include <rtems/rtems/tasks.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup libcsupport Standard C Library Support
- *
- * @brief RTEMS Specific Support for the Standard C Library
- *
- */
-/**@{**/
-
-extern void malloc_dump(void);
-
-/**
- * @brief Malloc walk.
- */
-extern bool malloc_walk(int source, bool printf_enabled);
-
-/**
- * @brief Set malloc heap pointer.
- *
- * This routine is primarily used for debugging.
- */
-void malloc_set_heap_pointer(Heap_Control *new_heap);
-
-/**
- * @brief Get malloc heap pointer.
- *
- * This routine is primarily used for debugging.
- */
-Heap_Control *malloc_get_heap_pointer( void );
-
-/**
- * @brief Get free malloc information.
- *
- * Find amount of free heap remaining
- */
-extern size_t malloc_free_space(void);
-
-/**
- * @brief Get malloc status information.
- *
- * Find amount of free heap remaining.
- */
-extern int malloc_info(Heap_Information_block *the_info);
-
-/*
- * Prototypes required to install newlib reentrancy user extension
- */
-bool newlib_create_hook(
- rtems_tcb *current_task,
- rtems_tcb *creating_task
-);
-
-void newlib_terminate_hook(
- rtems_tcb *current_task
-);
-
-#define RTEMS_NEWLIB_EXTENSION \
-{ \
- newlib_create_hook, /* rtems_task_create */ \
- 0, /* rtems_task_start */ \
- 0, /* rtems_task_restart */ \
- 0, /* rtems_task_delete */ \
- 0, /* task_switch */ \
- 0, /* task_begin */ \
- 0, /* task_exitted */ \
- 0, /* fatal */ \
- newlib_terminate_hook /* thread terminate */ \
-}
-
-typedef struct {
- uint32_t active_barriers;
- uint32_t active_extensions;
- uint32_t active_message_queues;
- uint32_t active_partitions;
- uint32_t active_periods;
- uint32_t active_ports;
- uint32_t active_regions;
- uint32_t active_semaphores;
- uint32_t active_tasks;
- uint32_t active_timers;
-} rtems_resource_rtems_api;
-
-typedef struct {
- uint32_t active_message_queues;
- uint32_t active_semaphores;
- uint32_t active_threads;
- uint32_t active_timers;
-} rtems_resource_posix_api;
-
-typedef struct {
- Heap_Information_block workspace_info;
- Heap_Information_block heap_info;
- uint32_t active_posix_key_value_pairs;
- uint32_t active_posix_keys;
- rtems_resource_rtems_api rtems_api;
- rtems_resource_posix_api posix_api;
- int open_files;
-} rtems_resource_snapshot;
-
-/**
- * @brief Tasks a snapshot of the resource usage of the system.
- *
- * @param[out] snapshot The snapshot of used resources.
- *
- * @see rtems_resource_snapshot_equal() and rtems_resource_snapshot_check().
- *
- * @code
- * #include <assert.h>
- *
- * #include <rtems/libcsupport.h>
- *
- * void example(void)
- * {
- * rtems_resource_snapshot before;
- *
- * test_setup();
- * rtems_resource_snapshot_take(&before);
- * test();
- * assert(rtems_resource_snapshot_check(&before));
- * test_cleanup();
- * }
- * @endcode
- */
-void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot);
-
-/**
- * @brief Compares two resource snapshots for equality.
- *
- * @param[in] a One resource snapshot.
- * @param[in] b Another resource snapshot.
- *
- * @retval true The resource snapshots are equal.
- * @retval false Otherwise.
- *
- * @see rtems_resource_snapshot_take().
- */
-bool rtems_resource_snapshot_equal(
- const rtems_resource_snapshot *a,
- const rtems_resource_snapshot *b
-);
-
-/**
- * @brief Takes a new resource snapshot and checks that it is equal to the
- * given resource snapshot.
- *
- * @param[in] snapshot The resource snapshot used for comparison with the new
- * resource snapshot.
- *
- * @retval true The resource snapshots are equal.
- * @retval false Otherwise.
- *
- * @see rtems_resource_snapshot_take().
- */
-bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
deleted file mode 100644
index 9d30dafddf..0000000000
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ /dev/null
@@ -1,1967 +0,0 @@
-/**
- * @file
- *
- * @ingroup LibIO
- *
- * @brief Basic IO API
- *
- * This file contains the support infrastructure used to manage the
- * table of integer style file descriptors used by the low level
- * POSIX system calls like open(), read, fstat(), etc.
- */
-
-/*
- * COPYRIGHT (c) 1989-2008.
- * On-Line Applications Research Corporation (OAR).
- *
- * Modifications to support reference counting in the file system are
- * Copyright (c) 2012 embedded brains GmbH.
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_RTEMS_LIBIO_H
-#define _RTEMS_RTEMS_LIBIO_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioccom.h>
-#include <sys/statvfs.h>
-#include <sys/uio.h>
-
-#include <unistd.h>
-#include <termios.h>
-
-#include <rtems.h>
-#include <rtems/fs.h>
-#include <rtems/chain.h>
-#include <rtems/score/atomic.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct knote;
-
-/**
- * @defgroup LibIOFSOps File System Operations
- *
- * @ingroup LibIO
- *
- * @brief File system operations.
- */
-/**@{**/
-
-/**
- * @brief Locks a file system instance.
- *
- * This lock must allow nesting.
- *
- * @param[in, out] mt_entry The mount table entry of the file system instance.
- *
- * @see rtems_filesystem_default_lock().
- */
-typedef void (*rtems_filesystem_mt_entry_lock_t)(
- const rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Unlocks a file system instance.
- *
- * @param[in, out] mt_entry The mount table entry of the file system instance.
- *
- * @see rtems_filesystem_default_unlock().
- */
-typedef void (*rtems_filesystem_mt_entry_unlock_t)(
- const rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Path evaluation context.
- */
-typedef struct {
- /**
- * The contents of the remaining path to be evaluated.
- */
- const char *path;
-
- /**
- * The length of the remaining path to be evaluated.
- */
- size_t pathlen;
-
- /**
- * The contents of the token to be evaluated with respect to the current
- * location.
- */
- const char *token;
-
- /**
- * The length of the token to be evaluated with respect to the current
- * location.
- */
- size_t tokenlen;
-
- /**
- * The path evaluation is controlled by the following flags
- * - RTEMS_FS_PERMS_READ,
- * - RTEMS_FS_PERMS_WRITE,
- * - RTEMS_FS_PERMS_EXEC,
- * - RTEMS_FS_FOLLOW_HARD_LINK,
- * - RTEMS_FS_FOLLOW_SYM_LINK,
- * - RTEMS_FS_MAKE,
- * - RTEMS_FS_EXCLUSIVE,
- * - RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS, and
- * - RTEMS_FS_REJECT_TERMINAL_DOT.
- */
- int flags;
-
- /**
- * Symbolic link evaluation is a recursive operation. This field helps to
- * limit the recursion level and thus prevents a stack overflow. The
- * recursion level is limited by RTEMS_FILESYSTEM_SYMLOOP_MAX.
- */
- int recursionlevel;
-
- /**
- * This is the current file system location of the evaluation process.
- * Tokens are evaluated with respect to the current location. The token
- * interpretation may change the current location. The purpose of the path
- * evaluation is to change the start location into a final current location
- * according to the path.
- */
- rtems_filesystem_location_info_t currentloc;
-
- /**
- * The location of the root directory of the user environment during the
- * evaluation start.
- */
- rtems_filesystem_global_location_t *rootloc;
-
- /**
- * The start location of the evaluation process. The start location my
- * change during symbolic link evaluation.
- */
- rtems_filesystem_global_location_t *startloc;
-} rtems_filesystem_eval_path_context_t;
-
-/**
- * @brief Path evaluation.
- *
- * @param[in, out] ctx The path evaluation context.
- *
- * @see rtems_filesystem_default_eval_path().
- */
-typedef void (*rtems_filesystem_eval_path_t)(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-/**
- * @brief Creates a new link for the existing file.
- *
- * @param[in] parentloc The location of the parent of the new link.
- * @param[in] targetloc The location of the target file.
- * @param[in] name Name for the new link.
- * @param[in] namelen Length of the name for the new link in characters.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_link().
- */
-typedef int (*rtems_filesystem_link_t)(
- const rtems_filesystem_location_info_t *parentloc,
- const rtems_filesystem_location_info_t *targetloc,
- const char *name,
- size_t namelen
-);
-
-/**
- * @brief Changes the mode of a node.
- *
- * @param[in] loc The location of the node.
- * @param[in] mode The new mode of the node
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_fchmod().
- */
-typedef int (*rtems_filesystem_fchmod_t)(
- const rtems_filesystem_location_info_t *loc,
- mode_t mode
-);
-
-/**
- * @brief Changes owner and group of a node.
- *
- * @param[in] loc The location of the node.
- * @param[in] owner User ID for the node.
- * @param[in] group Group ID for the node.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_chown().
- */
-typedef int (*rtems_filesystem_chown_t)(
- const rtems_filesystem_location_info_t *loc,
- uid_t owner,
- gid_t group
-);
-
-/**
- * @brief Clones a location.
- *
- * The location is initialized with a bitwise copy of an existing location.
- * The caller must ensure that this location is protected from a release during
- * the clone operation. After a successful clone operation the clone will be
- * added to the location chain of the corresponding mount table entry.
- *
- * @param[in, out] loc Location to clone.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_clonenode().
- */
-typedef int (*rtems_filesystem_clonenode_t)(
- rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @brief Frees the location of a node.
- *
- * @param[in] loc The location of the node.
- *
- * @see rtems_filesystem_default_freenode().
- */
-typedef void (*rtems_filesystem_freenode_t)(
- const rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @brief Mounts a file system instance in a mount point (directory).
- *
- * The mount point belongs to the file system instance of the handler and is
- * specified by a field of the mount table entry. The handler must check that
- * the mount point is capable of mounting a file system instance. This is the
- * last step during the mount process. The file system instance is fully
- * initialized at this point.
- *
- * @param[in] mt_entry The mount table entry.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_mount().
- */
-typedef int (*rtems_filesystem_mount_t) (
- rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Initializes a file system instance.
- *
- * This function must initialize the file system root node in the mount table
- * entry.
- *
- * @param[in] mt_entry The mount table entry.
- * @param[in] data The data provided by the user.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- */
-typedef int (*rtems_filesystem_fsmount_me_t)(
- rtems_filesystem_mount_table_entry_t *mt_entry,
- const void *data
-);
-
-/**
- * @brief Unmounts a file system instance in a mount point (directory).
- *
- * In case this function is successful the file system instance will be marked
- * as unmounted. The file system instance will be destroyed when the last
- * reference to it vanishes.
- *
- * @param[in] mt_entry The mount table entry.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_unmount().
- */
-typedef int (*rtems_filesystem_unmount_t) (
- rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Destroys a file system instance.
- *
- * The mount point node location of the mount table entry is invalid. This
- * handler must free the file system root location and all remaining resources
- * of the file system instance.
- *
- * @param[in] mt_entry The mount table entry.
- *
- * @see rtems_filesystem_default_fsunmount().
- */
-typedef void (*rtems_filesystem_fsunmount_me_t)(
- rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Tests if the node of one location is equal to the node of the other
- * location.
- *
- * The caller ensures that both nodes are within the same file system instance.
- *
- * @param[in] a The one location.
- * @param[in] b The other location.
- *
- * @retval true The nodes of the locations are equal.
- * @retval false Otherwise.
- *
- * @see rtems_filesystem_default_are_nodes_equal().
- */
-typedef bool (*rtems_filesystem_are_nodes_equal_t)(
- const rtems_filesystem_location_info_t *a,
- const rtems_filesystem_location_info_t *b
-);
-
-/**
- * @brief Creates a new node.
- *
- * This handler should create a new node according to the parameters.
- *
- * @param[in] parentloc The location of the parent of the new node.
- * @param[in] name Name for the new node.
- * @param[in] namelen Length of the name for the new node in characters.
- * @param[in] mode Mode for the new node.
- * @param[in] dev Optional device identifier for the new node.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_mknod().
- */
-typedef int (*rtems_filesystem_mknod_t)(
- const rtems_filesystem_location_info_t *parentloc,
- const char *name,
- size_t namelen,
- mode_t mode,
- dev_t dev
-);
-
-/**
- * @brief Removes a node.
- *
- * @param[in] parentloc The location of the parent of the node.
- * @param[in] loc The location of the node.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_rmnod().
- */
-typedef int (*rtems_filesystem_rmnod_t)(
- const rtems_filesystem_location_info_t *parentloc,
- const rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @brief Set node access and modification times.
- *
- * @param[in] loc The location of the node.
- * @param[in] actime Access time for the node.
- * @param[in] modtime Modification for the node.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_utime().
- */
-typedef int (*rtems_filesystem_utime_t)(
- const rtems_filesystem_location_info_t *loc,
- time_t actime,
- time_t modtime
-);
-
-/**
- * @brief Makes a symbolic link to a node.
- *
- * @param[in] parentloc The location of the parent of the new symbolic link.
- * @param[in] name Name for the new symbolic link.
- * @param[in] namelen Length of the name for the new symbolic link in
- * characters.
- * @param[in] target Contents for the symbolic link.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_symlink().
- */
-typedef int (*rtems_filesystem_symlink_t)(
- const rtems_filesystem_location_info_t *parentloc,
- const char *name,
- size_t namelen,
- const char *target
-);
-
-/**
- * @brief Reads the contents of a symbolic link.
- *
- * @param[in] loc The location of the symbolic link.
- * @param[out] buf The buffer for the contents.
- * @param[in] bufsize The size of the buffer in characters.
- *
- * @retval non-negative Size of the actual contents in characters.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_readlink().
- */
-typedef ssize_t (*rtems_filesystem_readlink_t)(
- const rtems_filesystem_location_info_t *loc,
- char *buf,
- size_t bufsize
-);
-
-/**
- * @brief Renames a node.
- *
- * @param[in] oldparentloc The location of the parent of the old node.
- * @param[in] oldloc The location of the old node.
- * @param[in] newparentloc The location of the parent of the new node.
- * @param[in] name Name for the new node.
- * @param[in] namelen Length of the name for the new node in characters.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_rename().
- */
-typedef int (*rtems_filesystem_rename_t)(
- const rtems_filesystem_location_info_t *oldparentloc,
- const rtems_filesystem_location_info_t *oldloc,
- const rtems_filesystem_location_info_t *newparentloc,
- const char *name,
- size_t namelen
-);
-
-/**
- * @brief Gets file system information.
- *
- * @param[in] loc The location of a node.
- * @param[out] buf Buffer for file system information.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_statvfs().
- */
-typedef int (*rtems_filesystem_statvfs_t)(
- const rtems_filesystem_location_info_t *loc,
- struct statvfs *buf
-);
-
-/**
- * @brief File system operations table.
- */
-struct _rtems_filesystem_operations_table {
- rtems_filesystem_mt_entry_lock_t lock_h;
- rtems_filesystem_mt_entry_unlock_t unlock_h;
- rtems_filesystem_eval_path_t eval_path_h;
- rtems_filesystem_link_t link_h;
- rtems_filesystem_are_nodes_equal_t are_nodes_equal_h;
- rtems_filesystem_mknod_t mknod_h;
- rtems_filesystem_rmnod_t rmnod_h;
- rtems_filesystem_fchmod_t fchmod_h;
- rtems_filesystem_chown_t chown_h;
- rtems_filesystem_clonenode_t clonenod_h;
- rtems_filesystem_freenode_t freenod_h;
- rtems_filesystem_mount_t mount_h;
- rtems_filesystem_unmount_t unmount_h;
- rtems_filesystem_fsunmount_me_t fsunmount_me_h;
- rtems_filesystem_utime_t utime_h;
- rtems_filesystem_symlink_t symlink_h;
- rtems_filesystem_readlink_t readlink_h;
- rtems_filesystem_rename_t rename_h;
- rtems_filesystem_statvfs_t statvfs_h;
-};
-
-/**
- * @brief File system operations table with default operations.
- */
-extern const rtems_filesystem_operations_table
- rtems_filesystem_operations_default;
-
-/**
- * @brief Obtains the IO library mutex.
- *
- * @see rtems_filesystem_mt_entry_lock_t.
- */
-void rtems_filesystem_default_lock(
- const rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Releases the IO library mutex.
- *
- * @see rtems_filesystem_mt_entry_unlock_t.
- */
-void rtems_filesystem_default_unlock(
- const rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-/**
- * @brief Terminates the path evaluation and replaces the current location with
- * the null location.
- *
- * @see rtems_filesystem_eval_path_t.
- */
-void rtems_filesystem_default_eval_path(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_link_t.
- */
-int rtems_filesystem_default_link(
- const rtems_filesystem_location_info_t *parentloc,
- const rtems_filesystem_location_info_t *targetloc,
- const char *name,
- size_t namelen
-);
-
-/**
- * @brief Tests if the node access pointer of one location is equal to
- * the node access pointer of the other location.
- *
- * @param[in] a The one location.
- * @param[in] b The other location.
- *
- * @retval true The node access pointers of the locations are equal.
- * @retval false Otherwise.
- *
- * @see rtems_filesystem_are_nodes_equal_t.
- */
-bool rtems_filesystem_default_are_nodes_equal(
- const rtems_filesystem_location_info_t *a,
- const rtems_filesystem_location_info_t *b
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_mknod_t.
- */
-int rtems_filesystem_default_mknod(
- const rtems_filesystem_location_info_t *parentloc,
- const char *name,
- size_t namelen,
- mode_t mode,
- dev_t dev
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_rmnod_t.
- */
-int rtems_filesystem_default_rmnod(
- const rtems_filesystem_location_info_t *parentloc,
- const rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_fchmod_t.
- */
-int rtems_filesystem_default_fchmod(
- const rtems_filesystem_location_info_t *loc,
- mode_t mode
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_chown_t.
- */
-int rtems_filesystem_default_chown(
- const rtems_filesystem_location_info_t *loc,
- uid_t owner,
- gid_t group
-);
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_clonenode_t.
- */
-int rtems_filesystem_default_clonenode(
- rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @see rtems_filesystem_freenode_t.
- */
-void rtems_filesystem_default_freenode(
- const rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_mount_t.
- */
-int rtems_filesystem_default_mount (
- rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_unmount_t.
- */
-int rtems_filesystem_default_unmount(
- rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_fsunmount_me_t.
- */
-void rtems_filesystem_default_fsunmount(
- rtems_filesystem_mount_table_entry_t *mt_entry /* IN */
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_utime_t.
- */
-int rtems_filesystem_default_utime(
- const rtems_filesystem_location_info_t *loc,
- time_t actime,
- time_t modtime
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_symlink_t.
- */
-int rtems_filesystem_default_symlink(
- const rtems_filesystem_location_info_t *parentloc,
- const char *name,
- size_t namelen,
- const char *target
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_readlink_t.
- */
-ssize_t rtems_filesystem_default_readlink(
- const rtems_filesystem_location_info_t *loc,
- char *buf,
- size_t bufsize
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_rename_t.
- */
-int rtems_filesystem_default_rename(
- const rtems_filesystem_location_info_t *oldparentloc,
- const rtems_filesystem_location_info_t *oldloc,
- const rtems_filesystem_location_info_t *newparentloc,
- const char *name,
- size_t namelen
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_statvfs_t.
- */
-int rtems_filesystem_default_statvfs(
- const rtems_filesystem_location_info_t *loc,
- struct statvfs *buf
-);
-
-/** @} */
-
-/**
- * @defgroup LibIOFSHandler File System Node Handler
- *
- * @ingroup LibIO
- *
- * @brief File system node handler.
- */
-/**@{**/
-
-/**
- * @brief Opens a node.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] path The path.
- * @param[in] oflag The open flags.
- * @param[in] mode Optional mode for node creation.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_open().
- */
-typedef int (*rtems_filesystem_open_t)(
- rtems_libio_t *iop,
- const char *path,
- int oflag,
- mode_t mode
-);
-
-/**
- * @brief Closes a node.
- *
- * @param[in, out] iop The IO pointer.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_close().
- */
-typedef int (*rtems_filesystem_close_t)(
- rtems_libio_t *iop
-);
-
-/**
- * @brief Reads from a node.
- *
- * This handler is responsible to update the offset field of the IO descriptor.
- *
- * @param[in, out] iop The IO pointer.
- * @param[out] buffer The buffer for read data.
- * @param[in] count The size of the buffer in characters.
- *
- * @retval non-negative Count of read characters.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_read().
- */
-typedef ssize_t (*rtems_filesystem_read_t)(
- rtems_libio_t *iop,
- void *buffer,
- size_t count
-);
-
-/**
- * @brief Reads an IO vector from a node.
- *
- * This handler is responsible to update the offset field of the IO descriptor.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] iov The IO vector with buffer for read data. The caller must
- * ensure that the IO vector values are valid.
- * @param[in] iovcnt The count of buffers in the IO vector.
- * @param[in] total The total count of bytes in the buffers in the IO vector.
- *
- * @retval non-negative Count of read characters.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_readv().
- */
-typedef ssize_t (*rtems_filesystem_readv_t)(
- rtems_libio_t *iop,
- const struct iovec *iov,
- int iovcnt,
- ssize_t total
-);
-
-/**
- * @brief Writes to a node.
- *
- * This handler is responsible to update the offset field of the IO descriptor.
- *
- * @param[in, out] iop The IO pointer.
- * @param[out] buffer The buffer for write data.
- * @param[in] count The size of the buffer in characters.
- *
- * @retval non-negative Count of written characters.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_write().
- */
-typedef ssize_t (*rtems_filesystem_write_t)(
- rtems_libio_t *iop,
- const void *buffer,
- size_t count
-);
-
-/**
- * @brief Writes an IO vector to a node.
- *
- * This handler is responsible to update the offset field of the IO descriptor.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] iov The IO vector with buffer for write data. The caller must
- * ensure that the IO vector values are valid.
- * @param[in] iovcnt The count of buffers in the IO vector.
- * @param[in] total The total count of bytes in the buffers in the IO vector.
- *
- * @retval non-negative Count of written characters.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_writev().
- */
-typedef ssize_t (*rtems_filesystem_writev_t)(
- rtems_libio_t *iop,
- const struct iovec *iov,
- int iovcnt,
- ssize_t total
-);
-
-/**
- * @brief IO control of a node.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] request The IO control request.
- * @param[in, out] buffer The buffer for IO control request data.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_ioctl().
- */
-typedef int (*rtems_filesystem_ioctl_t)(
- rtems_libio_t *iop,
- ioctl_command_t request,
- void *buffer
-);
-
-/**
- * @brief Moves the read/write file offset.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] offset The offset.
- * @param[in] whence The reference position for the offset.
- *
- * @retval non-negative The new offset from the beginning of the file.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_lseek(),
- * rtems_filesystem_default_lseek_file(), and
- * rtems_filesystem_default_lseek_directory().
- */
-typedef off_t (*rtems_filesystem_lseek_t)(
- rtems_libio_t *iop,
- off_t offset,
- int whence
-);
-
-/**
- * @brief Gets a node status.
- *
- * @param[in, out] iop The IO pointer.
- * @param[out] stat The buffer to status information.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_fstat().
- */
-typedef int (*rtems_filesystem_fstat_t)(
- const rtems_filesystem_location_info_t *loc,
- struct stat *buf
-);
-
-/**
- * @brief Truncates a file to a specified length.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] length The new length in characters.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_ftruncate() and
- * rtems_filesystem_default_ftruncate_directory().
- */
-typedef int (*rtems_filesystem_ftruncate_t)(
- rtems_libio_t *iop,
- off_t length
-);
-
-/**
- * @brief Synchronizes changes to a file.
- *
- * @param[in, out] iop The IO pointer.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_fsync_or_fdatasync() and
- * rtems_filesystem_default_fsync_or_fdatasync_success().
- */
-typedef int (*rtems_filesystem_fsync_t)(
- rtems_libio_t *iop
-);
-
-/**
- * @brief Synchronizes the data of a file.
- *
- * @param[in, out] iop The IO pointer.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The errno is set to indicate the error.
- *
- * @see rtems_filesystem_default_fsync_or_fdatasync() and
- * rtems_filesystem_default_fsync_or_fdatasync_success().
- */
-typedef int (*rtems_filesystem_fdatasync_t)(
- rtems_libio_t *iop
-);
-
-/**
- * @brief File control.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] cmd Control command.
- *
- * @retval 0 Successful operation.
- * @retval errno An error occurred. This value is assigned to errno.
- *
- * @see rtems_filesystem_default_fcntl().
- */
-typedef int (*rtems_filesystem_fcntl_t)(
- rtems_libio_t *iop,
- int cmd
-);
-
-/**
- * @brief Poll and select support.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] events The poll events.
- *
- * @return The poll return events.
- *
- * @see rtems_filesystem_default_poll().
- */
-typedef int (*rtems_filesystem_poll_t)(
- rtems_libio_t *iop,
- int events
-);
-
-/**
- * @brief Kernel event filter support.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in] kn The kernel event note.
- *
- * @retval 0 Successful operation.
- * @retval error An error occurred. This is usually EINVAL.
- *
- * @see rtems_filesystem_default_kqfilter().
- */
-typedef int (*rtems_filesystem_kqfilter_t)(
- rtems_libio_t *iop,
- struct knote *kn
-);
-
-/**
- * @brief MMAP support.
- *
- * @param[in, out] iop The IO pointer.
- * @param[in, out] addr The starting address of the mapped memory.
- * @param[in] len The maximum number of bytes to map.
- * @param[in] prot The desired memory protection.
- * @param[in] off The offset within the file descriptor to map.
- *
- * @retval 0 Successful operation.
- * @retval error An error occurred. This is usually EINVAL.
- *
- * @see rtems_filesystem_default_mmap().
- */
-typedef int (*rtems_filesystem_mmap_t)(
- rtems_libio_t *iop,
- void **addr,
- size_t len,
- int prot,
- off_t off
-);
-
-/**
- * @brief File system node operations table.
- */
-struct _rtems_filesystem_file_handlers_r {
- rtems_filesystem_open_t open_h;
- rtems_filesystem_close_t close_h;
- rtems_filesystem_read_t read_h;
- rtems_filesystem_write_t write_h;
- rtems_filesystem_ioctl_t ioctl_h;
- rtems_filesystem_lseek_t lseek_h;
- rtems_filesystem_fstat_t fstat_h;
- rtems_filesystem_ftruncate_t ftruncate_h;
- rtems_filesystem_fsync_t fsync_h;
- rtems_filesystem_fdatasync_t fdatasync_h;
- rtems_filesystem_fcntl_t fcntl_h;
- rtems_filesystem_poll_t poll_h;
- rtems_filesystem_kqfilter_t kqfilter_h;
- rtems_filesystem_readv_t readv_h;
- rtems_filesystem_writev_t writev_h;
- rtems_filesystem_mmap_t mmap_h;
-};
-
-/**
- * @brief File system node handler table with default node handlers.
- */
-extern const rtems_filesystem_file_handlers_r
- rtems_filesystem_handlers_default;
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_open_t.
- */
-int rtems_filesystem_default_open(
- rtems_libio_t *iop,
- const char *path,
- int oflag,
- mode_t mode
-);
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_close_t.
- */
-int rtems_filesystem_default_close(
- rtems_libio_t *iop
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_read_t.
- */
-ssize_t rtems_filesystem_default_read(
- rtems_libio_t *iop,
- void *buffer,
- size_t count
-);
-
-/**
- * @brief Calls the read handler for each IO vector entry.
- *
- * @see rtems_filesystem_readv_t.
- */
-ssize_t rtems_filesystem_default_readv(
- rtems_libio_t *iop,
- const struct iovec *iov,
- int iovcnt,
- ssize_t total
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTSUP.
- *
- * @see rtems_filesystem_write_t.
- */
-ssize_t rtems_filesystem_default_write(
- rtems_libio_t *iop,
- const void *buffer,
- size_t count
-);
-
-/**
- * @brief Calls the write handler for each IO vector entry.
- *
- * @see rtems_filesystem_write_t.
- */
-ssize_t rtems_filesystem_default_writev(
- rtems_libio_t *iop,
- const struct iovec *iov,
- int iovcnt,
- ssize_t total
-);
-
-/**
- * @retval -1 Always. The errno is set to ENOTTY.
- *
- * @see rtems_filesystem_ioctl_t.
- */
-int rtems_filesystem_default_ioctl(
- rtems_libio_t *iop,
- ioctl_command_t request,
- void *buffer
-);
-
-/**
- * @retval -1 Always. The errno is set to ESPIPE.
- *
- * @see rtems_filesystem_lseek_t.
- */
-off_t rtems_filesystem_default_lseek(
- rtems_libio_t *iop,
- off_t offset,
- int whence
-);
-
-/**
- * @brief An offset 0 with a whence of SEEK_SET will perform a directory rewind
- * operation.
- *
- * This function has no protection against concurrent access.
- *
- * @retval -1 The offset is not zero or the whence is not SEEK_SET.
- * @retval 0 Successful rewind operation.
- *
- * @see rtems_filesystem_lseek_t.
- */
-off_t rtems_filesystem_default_lseek_directory(
- rtems_libio_t *iop,
- off_t offset,
- int whence
-);
-
-/**
- * @brief Default lseek() handler for files.
- *
- * The fstat() handler will be used to obtain the file size in case whence is
- * SEEK_END.
- *
- * This function has no protection against concurrent access.
- *
- * @retval -1 An error occurred. In case an integer overflow occurred, then the
- * errno will be set to EOVERFLOW. In case the new offset is negative, then
- * the errno will be set to EINVAL. In case the whence is SEEK_END and the
- * fstat() handler to obtain the current file size returned an error status,
- * then the errno will be set by the fstat() handler.
- * @retval offset The new offset.
- *
- * @see rtems_filesystem_lseek_t.
- */
-off_t rtems_filesystem_default_lseek_file(
- rtems_libio_t *iop,
- off_t offset,
- int whence
-);
-
-/**
- * @brief Sets the mode to S_IRWXU | S_IRWXG | S_IRWXO.
- *
- * @retval 0 Always.
- *
- * @see rtems_filesystem_fstat_t.
- */
-int rtems_filesystem_default_fstat(
- const rtems_filesystem_location_info_t *loc,
- struct stat *buf
-);
-
-/**
- * @retval -1 Always. The errno is set to EINVAL.
- *
- * @see rtems_filesystem_ftruncate_t.
- */
-int rtems_filesystem_default_ftruncate(
- rtems_libio_t *iop,
- off_t length
-);
-
-/**
- * @retval -1 Always. The errno is set to EISDIR.
- *
- * @see rtems_filesystem_ftruncate_t.
- */
-int rtems_filesystem_default_ftruncate_directory(
- rtems_libio_t *iop,
- off_t length
-);
-
-/**
- * @retval -1 Always. The errno is set to EINVAL.
- *
- * @see rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t.
- */
-int rtems_filesystem_default_fsync_or_fdatasync(
- rtems_libio_t *iop
-);
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t.
- */
-int rtems_filesystem_default_fsync_or_fdatasync_success(
- rtems_libio_t *iop
-);
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_fcntl_t.
- */
-int rtems_filesystem_default_fcntl(
- rtems_libio_t *iop,
- int cmd
-);
-
-/**
- * @brief Default poll handler.
- *
- * @retval POLLERR Always.
- *
- * @see rtems_filesystem_poll_t.
- */
-int rtems_filesystem_default_poll(
- rtems_libio_t *iop,
- int events
-);
-
-/**
- * @brief Default kernel event filter handler.
- *
- * @retval EINVAL Always.
- *
- * @see rtems_filesystem_kqfilter_t.
- */
-int rtems_filesystem_default_kqfilter(
- rtems_libio_t *iop,
- struct knote *kn
-);
-
-/**
- * @brief Default MMAP handler.
- *
- * @retval ENOTSUP Always.
- *
- * @see rtems_filesystem_mmap_t.
- */
-int rtems_filesystem_default_mmap(
- rtems_libio_t *iop,
- void **addr,
- size_t len,
- int prot,
- off_t off
-);
-
-/** @} */
-
-/**
- * @defgroup LibIO IO Library
- *
- * @brief Provides system call and file system interface definitions.
- *
- * General purpose communication channel for RTEMS to allow UNIX/POSIX
- * system call behavior under RTEMS. Initially this supported only
- * IO to devices but has since been enhanced to support networking
- * and support for mounted file systems.
- */
-/**@{**/
-
-typedef off_t rtems_off64_t __attribute__((deprecated));
-
-/**
- * @brief Gets the mount handler for the file system @a type.
- *
- * @return The file system mount handler associated with the @a type, or
- * @c NULL if no such association exists.
- */
-rtems_filesystem_fsmount_me_t
-rtems_filesystem_get_mount_handler(
- const char *type
-);
-
-/**
- * @brief Contain file system specific information which is required to support
- * fpathconf().
- */
-typedef struct {
- int link_max; /* count */
- int max_canon; /* max formatted input line size */
- int max_input; /* max input line size */
- int name_max; /* max name length */
- int path_max; /* max path */
- int pipe_buf; /* pipe buffer size */
- int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */
- int posix_chown_restrictions; /* can chown: 0=no, 1=yes */
- int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */
- int posix_prio_io; /* priority IO, 0=no, 1=yes */
- int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */
- int posix_vdisable; /* special char processing, 0=no, 1=yes */
-} rtems_filesystem_limits_and_options_t;
-
-/**
- * @brief Default pathconf settings.
- *
- * Override in a filesystem.
- */
-extern const rtems_filesystem_limits_and_options_t
- rtems_filesystem_default_pathconf;
-
-/**
- * @brief An open file data structure.
- *
- * It will be indexed by 'fd'.
- *
- * @todo Should really have a separate per/file data structure that this points
- * to (eg: offset, driver, pathname should be in that)
- */
-struct rtems_libio_tt {
- off_t offset; /* current offset into file */
- Atomic_Uint flags;
- rtems_filesystem_location_info_t pathinfo;
- uint32_t data0; /* private to "driver" */
- void *data1; /* ... */
-};
-
-/**
- * @brief Paramameter block for read/write.
- *
- * It must include 'offset' instead of using iop's offset since we can have
- * multiple outstanding i/o's on a device.
- */
-typedef struct {
- rtems_libio_t *iop;
- off_t offset;
- char *buffer;
- uint32_t count;
- uint32_t flags;
- uint32_t bytes_moved;
-} rtems_libio_rw_args_t;
-
-/**
- * @brief Parameter block for open/close.
- */
-typedef struct {
- rtems_libio_t *iop;
- uint32_t flags;
- uint32_t mode;
-} rtems_libio_open_close_args_t;
-
-/**
- * @brief Parameter block for ioctl.
- */
-typedef struct {
- rtems_libio_t *iop;
- ioctl_command_t command;
- void *buffer;
- int ioctl_return;
-} rtems_libio_ioctl_args_t;
-
-/**
- * @name Flag Values
- */
-/**@{**/
-
-#define LIBIO_FLAGS_NO_DELAY 0x0001U /* return immediately if no data */
-#define LIBIO_FLAGS_READ 0x0002U /* reading */
-#define LIBIO_FLAGS_WRITE 0x0004U /* writing */
-#define LIBIO_FLAGS_OPEN 0x0100U /* device is open */
-#define LIBIO_FLAGS_APPEND 0x0200U /* all writes append */
-#define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */
-#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
-#define LIBIO_FLAGS_REFERENCE_INC 0x1000U
-
-/** @} */
-
-static inline unsigned int rtems_libio_iop_flags( const rtems_libio_t *iop )
-{
- return _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
-}
-
-/**
- * @brief Returns true if this is a no delay iop, otherwise returns false.
- *
- * @param[in] iop The iop.
- */
-static inline bool rtems_libio_iop_is_no_delay( const rtems_libio_t *iop )
-{
- return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_NO_DELAY ) != 0;
-}
-
-/**
- * @brief Returns true if this is a readable iop, otherwise returns false.
- *
- * @param[in] iop The iop.
- */
-static inline bool rtems_libio_iop_is_readable( const rtems_libio_t *iop )
-{
- return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_READ ) != 0;
-}
-
-/**
- * @brief Returns true if this is a writeable iop, otherwise returns false.
- *
- * @param[in] iop The iop.
- */
-static inline bool rtems_libio_iop_is_writeable( const rtems_libio_t *iop )
-{
- return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_WRITE ) != 0;
-}
-
-/**
- * @brief Returns true if this is an append iop, otherwise returns false.
- *
- * @param[in] iop The iop.
- */
-static inline bool rtems_libio_iop_is_append( const rtems_libio_t *iop )
-{
- return ( rtems_libio_iop_flags( iop ) & LIBIO_FLAGS_APPEND ) != 0;
-}
-
-/**
- * @name External I/O Handlers
- */
-/**@{**/
-
-typedef int (*rtems_libio_open_t)(
- const char *pathname,
- uint32_t flag,
- uint32_t mode
-);
-
-typedef int (*rtems_libio_close_t)(
- int fd
-);
-
-typedef ssize_t (*rtems_libio_read_t)(
- int fd,
- void *buffer,
- size_t count
-);
-
-typedef ssize_t (*rtems_libio_write_t)(
- int fd,
- const void *buffer,
- size_t count
-);
-
-typedef int (*rtems_libio_ioctl_t)(
- int fd,
- uint32_t command,
- void *buffer
-);
-
-typedef off_t (*rtems_libio_lseek_t)(
- int fd,
- off_t offset,
- int whence
-);
-
-/** @} */
-
-/**
- * @name Permission Macros
- */
-/**@{**/
-
-/*
- * The following macros are used to build up the permissions sets
- * used to check permissions. These are similar in style to the
- * mode_t bits and should stay compatible with them.
- */
-#define RTEMS_FS_PERMS_READ 0x4
-#define RTEMS_FS_PERMS_WRITE 0x2
-#define RTEMS_FS_PERMS_EXEC 0x1
-#define RTEMS_FS_PERMS_RWX \
- (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC)
-#define RTEMS_FS_FOLLOW_HARD_LINK 0x8
-#define RTEMS_FS_FOLLOW_SYM_LINK 0x10
-#define RTEMS_FS_FOLLOW_LINK \
- (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK)
-#define RTEMS_FS_MAKE 0x20
-#define RTEMS_FS_EXCLUSIVE 0x40
-#define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80
-#define RTEMS_FS_REJECT_TERMINAL_DOT 0x100
-
-/** @} */
-
-union __rtems_dev_t {
- dev_t device;
- struct {
- rtems_device_major_number major;
- rtems_device_minor_number minor;
- } __overlay;
-};
-
-static inline dev_t rtems_filesystem_make_dev_t(
- rtems_device_major_number _major,
- rtems_device_minor_number _minor
-)
-{
- union __rtems_dev_t temp;
-
- temp.__overlay.major = _major;
- temp.__overlay.minor = _minor;
- return temp.device;
-}
-
-static inline dev_t rtems_filesystem_make_dev_t_from_pointer(
- const void *pointer
-)
-{
- uint64_t temp = (((uint64_t) 1) << 63) | (((uintptr_t) pointer) >> 1);
-
- return rtems_filesystem_make_dev_t((uint32_t) (temp >> 32), (uint32_t) temp);
-}
-
-static inline rtems_device_major_number rtems_filesystem_dev_major_t(
- dev_t device
-)
-{
- union __rtems_dev_t temp;
-
- temp.device = device;
- return temp.__overlay.major;
-}
-
-
-static inline rtems_device_minor_number rtems_filesystem_dev_minor_t(
- dev_t device
-)
-{
- union __rtems_dev_t temp;
-
- temp.device = device;
- return temp.__overlay.minor;
-}
-
-#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \
- do { \
- (_major) = rtems_filesystem_dev_major_t ( _dev ); \
- (_minor) = rtems_filesystem_dev_minor_t( _dev ); \
- } while(0)
-
-/*
- * Prototypes for filesystem
- */
-
-/**
- * @brief Base File System Initialization
- *
- * Initialize the foundation of the file system. This is specified
- * by the structure rtems_filesystem_mount_table. The usual
- * configuration is a single instantiation of the IMFS or miniIMFS with
- * a single "/dev" directory in it.
- */
-void rtems_filesystem_initialize( void );
-
-void rtems_libio_post_driver(void);
-
-void rtems_libio_exit(void);
-
-/**
- * @brief Creates a directory and all its parent directories according to
- * @a path.
- *
- * The @a mode value selects the access permissions of the directory.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- */
-extern int rtems_mkdir(const char *path, mode_t mode);
-
-/** @} */
-
-/**
- * @defgroup FileSystemTypesAndMount File System Types and Mount
- *
- * @ingroup LibIO
- *
- * @brief File system types and mount.
- */
-/**@{**/
-
-/**
- * @name File System Types
- */
-/**@{**/
-
-#define RTEMS_FILESYSTEM_TYPE_IMFS "imfs"
-#define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs"
-#define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs"
-#define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs"
-#define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs"
-#define RTEMS_FILESYSTEM_TYPE_NFS "nfs"
-#define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs"
-#define RTEMS_FILESYSTEM_TYPE_RFS "rfs"
-#define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2"
-
-/** @} */
-
-/**
- * @brief Mount table entry.
- */
-struct rtems_filesystem_mount_table_entry_tt {
- rtems_chain_node mt_node;
- void *fs_info;
- const rtems_filesystem_operations_table *ops;
- const void *immutable_fs_info;
- rtems_chain_control location_chain;
- rtems_filesystem_global_location_t *mt_point_node;
- rtems_filesystem_global_location_t *mt_fs_root;
- bool mounted;
- bool writeable;
- const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
-
- /*
- * The target or mount point of the file system.
- */
- const char *target;
-
- /*
- * The type of filesystem or the name of the filesystem.
- */
- const char *type;
-
- /*
- * When someone adds a mounted filesystem on a real device,
- * this will need to be used.
- *
- * The lower layers can manage how this is managed. Leave as a
- * string.
- */
- char *dev;
-
- /**
- * The task that initiated the unmount process. After unmount process
- * completion this task will be notified via the transient event.
- *
- * @see ClassicEventTransient.
- */
- rtems_id unmount_task;
-};
-
-/**
- * @brief File system options.
- */
-typedef enum {
- RTEMS_FILESYSTEM_READ_ONLY,
- RTEMS_FILESYSTEM_READ_WRITE,
- RTEMS_FILESYSTEM_BAD_OPTIONS
-} rtems_filesystem_options_t;
-
-/**
- * @brief File system table entry.
- */
-typedef struct rtems_filesystem_table_t {
- const char *type;
- rtems_filesystem_fsmount_me_t mount_h;
-} rtems_filesystem_table_t;
-
-/**
- * @brief Static table of file systems.
- *
- * Externally defined by confdefs.h or the user.
- */
-extern const rtems_filesystem_table_t rtems_filesystem_table [];
-
-extern rtems_chain_control rtems_filesystem_mount_table;
-
-/**
- * @brief Registers a file system @a type.
- *
- * The @a mount_h handler will be used to mount a file system of this @a type.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- */
-int rtems_filesystem_register(
- const char *type,
- rtems_filesystem_fsmount_me_t mount_h
-);
-
-/**
- * @brief Unregisters a file system @a type.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- */
-int rtems_filesystem_unregister(
- const char *type
-);
-
-/**
- * @brief Unmounts the file system instance at the specified mount path.
- *
- * The function waits for the unmount process completion. In case the calling
- * thread uses resources of the unmounted file system the function may never
- * return. In case the calling thread has its root or current directory in the
- * unmounted file system the function returns with an error status and errno is
- * set to EBUSY.
- *
- * The unmount process completion notification uses the transient event. It is
- * a fatal error to terminate the calling thread while waiting for this event.
- *
- * A concurrent unmount request for the same file system instance has
- * unpredictable effects.
- *
- * @param[in] mount_path The path to the file system instance mount point.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- *
- * @see ClassicEventTransient.
- */
-int unmount(
- const char *mount_path
-);
-
-/**
- * @brief Mounts a file system instance at the specified target path.
- *
- * To mount a standard file system instance one of the following defines should
- * be used to select the file system type
- * - RTEMS_FILESYSTEM_TYPE_DEVFS,
- * - RTEMS_FILESYSTEM_TYPE_DOSFS,
- * - RTEMS_FILESYSTEM_TYPE_FTPFS,
- * - RTEMS_FILESYSTEM_TYPE_IMFS,
- * - RTEMS_FILESYSTEM_TYPE_JFFS2,
- * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
- * - RTEMS_FILESYSTEM_TYPE_NFS,
- * - RTEMS_FILESYSTEM_TYPE_RFS, or
- * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
- *
- * Only configured or registered file system types are available. You can add
- * file system types to your application configuration with the following
- * configuration options
- * - CONFIGURE_FILESYSTEM_DEVFS,
- * - CONFIGURE_FILESYSTEM_DOSFS,
- * - CONFIGURE_FILESYSTEM_FTPFS,
- * - CONFIGURE_FILESYSTEM_IMFS,
- * - CONFIGURE_FILESYSTEM_JFFS2,
- * - CONFIGURE_FILESYSTEM_MINIIMFS,
- * - CONFIGURE_FILESYSTEM_NFS,
- * - CONFIGURE_FILESYSTEM_RFS, and
- * - CONFIGURE_FILESYSTEM_TFTPFS.
- *
- * In addition to these configuration options file system types can be
- * registered with rtems_filesystem_register().
- *
- * @param[in] source The source parameter will be forwarded to the file system
- * initialization handler. Usually the source is a path to the corresponding
- * device file, or @c NULL in case the file system does not use a device file.
- * @param[in] target The target path must lead to an existing directory, or
- * must be @c NULL. In case the target is @c NULL, the root file system will
- * be mounted.
- * @param[in] filesystemtype This string selects the file system type.
- * @param[in] options The options specify if the file system instance allows
- * read-write or read-only access.
- * @param[in] data The data parameter will be forwarded to the file system
- * initialization handler. It can be used to pass file system specific mount
- * options. The data structure for mount options is file system specific. See
- * also in the corresponding file system documentation.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- *
- * @see rtems_filesystem_register(), mount_and_make_target_path(), @ref DOSFS
- * and @ref JFFS2.
- */
-int mount(
- const char *source,
- const char *target,
- const char *filesystemtype,
- rtems_filesystem_options_t options,
- const void *data
-);
-
-/**
- * @brief Mounts a file system and makes the @a target path.
- *
- * The @a target path will be created with rtems_mkdir() and must not be
- * @c NULL.
- *
- * @see mount().
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occurred. The @c errno indicates the error.
- */
-int mount_and_make_target_path(
- const char *source,
- const char *target,
- const char *filesystemtype,
- rtems_filesystem_options_t options,
- const void *data
-);
-
-/**
- * @brief Per file system type routine.
- *
- * @see rtems_filesystem_iterate().
- *
- * @retval true Stop the iteration.
- * @retval false Continue the iteration.
- */
-typedef bool (*rtems_per_filesystem_routine)(
- const rtems_filesystem_table_t *fs_entry,
- void *arg
-);
-
-/**
- * @brief Iterates over all file system types.
- *
- * For each file system type the @a routine will be called with the entry and
- * the @a routine_arg parameter.
- *
- * Do not register or unregister file system types in @a routine.
- *
- * The iteration is protected by the IO library mutex.
- *
- * @retval true Iteration stopped due to @a routine return status.
- * @retval false Iteration through all entries.
- */
-bool rtems_filesystem_iterate(
- rtems_per_filesystem_routine routine,
- void *routine_arg
-);
-
-/**
- * @brief Mount table entry visitor.
- *
- * @retval true Stop the iteration.
- * @retval false Continue the iteration.
- *
- * @see rtems_filesystem_mount_iterate().
- */
-typedef bool (*rtems_filesystem_mt_entry_visitor)(
- const rtems_filesystem_mount_table_entry_t *mt_entry,
- void *arg
-);
-
-/**
- * @brief Iterates over all file system mount entries.
- *
- * The iteration is protected by the IO library mutex. Do not mount or unmount
- * file systems in the visitor function.
- *
- * @param[in] visitor For each file system mount entry the visitor function
- * will be called with the entry and the visitor argument as parameters.
- * @param[in] visitor_arg The second parameter for the visitor function.
- *
- * @retval true Iteration stopped due to visitor function return status.
- * @retval false Iteration through all entries.
- */
-bool rtems_filesystem_mount_iterate(
- rtems_filesystem_mt_entry_visitor visitor,
- void *visitor_arg
-);
-
-typedef struct {
- const char *source;
- const char *target;
- const char *filesystemtype;
- rtems_filesystem_options_t options;
- const void *data;
-} rtems_filesystem_mount_configuration;
-
-extern const rtems_filesystem_mount_configuration
- rtems_filesystem_root_configuration;
-
-/** @} */
-
-/**
- * @defgroup Termios Termios
- *
- * @ingroup LibIO
- *
- * @brief Termios
- */
-/**@{**/
-
-typedef struct rtems_termios_callbacks {
- int (*firstOpen)(int major, int minor, void *arg);
- int (*lastClose)(int major, int minor, void *arg);
- int (*pollRead)(int minor);
- ssize_t (*write)(int minor, const char *buf, size_t len);
- int (*setAttributes)(int minor, const struct termios *t);
- int (*stopRemoteTx)(int minor);
- int (*startRemoteTx)(int minor);
- int outputUsesInterrupts;
-} rtems_termios_callbacks;
-
-void rtems_termios_initialize (void);
-
-/*
- * CCJ: Change before opening a tty. Newer code from Eric is coming
- * so extra work to handle an open tty is not worth it. If the tty
- * is open, close then open it again.
- */
-rtems_status_code rtems_termios_bufsize (
- size_t cbufsize, /* cooked buffer size */
- size_t raw_input, /* raw input buffer size */
- size_t raw_output /* raw output buffer size */
-);
-
-rtems_status_code rtems_termios_open (
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg,
- const rtems_termios_callbacks *callbacks
-);
-
-rtems_status_code rtems_termios_close(
- void *arg
-);
-
-rtems_status_code rtems_termios_read(
- void *arg
-);
-
-rtems_status_code rtems_termios_write(
- void *arg
-);
-
-rtems_status_code rtems_termios_ioctl(
- void *arg
-);
-
-int rtems_termios_enqueue_raw_characters(
- void *ttyp,
- const char *buf,
- int len
-);
-
-int rtems_termios_dequeue_characters(
- void *ttyp,
- int len
-);
-
-/** @} */
-
-/**
- * @brief The pathconf setting for a file system.
- */
-#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
-
-/**
- * @brief The type of file system. Its name.
- */
-#define rtems_filesystem_type(_mte) ((_mte)->type)
-
-/**
- * @brief The mount point of a file system.
- */
-#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
-
-/**
- * @brief The device entry of a file system.
- */
-#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTEMS_LIBIO_H */
diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
deleted file mode 100644
index 414e8a20fc..0000000000
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ /dev/null
@@ -1,1049 +0,0 @@
-/**
- * @file
- *
- * @brief LibIO Internal Interface
- *
- * This file is the libio internal interface.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * Modifications to support reference counting in the file system are
- * Copyright (c) 2012 embedded brains GmbH.
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_RTEMS_LIBIO__H
-#define _RTEMS_RTEMS_LIBIO__H
-
-#include <sys/uio.h>
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-
-#include <rtems.h>
-#include <rtems/libio.h>
-#include <rtems/seterr.h>
-#include <rtems/score/assert.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup LibIOInternal IO Internal Library
- *
- * @brief Internal IO library API and implementation.
- *
- */
-/**@{**/
-
-#define RTEMS_FILESYSTEM_SYMLOOP_MAX 32
-
-/*
- * Not defined in newlib so provide here. Users should use dup2 and
- * not this non-portable fcntl command. Provided here to allow the
- * RTEMS implementation to work.
- */
-#define F_DUP2FD 20
-
-/*
- * File descriptor Table Information
- */
-
-extern const uint32_t rtems_libio_number_iops;
-extern rtems_libio_t rtems_libio_iops[];
-extern void *rtems_libio_iop_free_head;
-extern void **rtems_libio_iop_free_tail;
-
-extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
-
-extern rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry;
-
-/**
- * @brief The global null location.
- *
- * Every operation and the open and fstat handlers of this location returns an
- * error status. The errno is not touched by these operations and handlers.
- * The purpose of this location is to deliver the error return status for a
- * previous error condition which must set the errno accordingly.
- *
- * The usage of this null location instead of the NULL pointer eliminates
- * a lot of branches.
- *
- * The user environment root and current directory are statically initialized
- * with the null location. Due to that all file system services are in a
- * defined state even if no root file system was mounted.
- */
-extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
-
-/**
- * @brief Sets the iop flags to the specified flags together with
- * LIBIO_FLAGS_OPEN.
- *
- * Use this once a file descriptor allocated via rtems_libio_allocate() is
- * fully initialized.
- *
- * @param[in] iop The iop.
- * @param[in] flags The flags.
- */
-static inline void rtems_libio_iop_flags_initialize(
- rtems_libio_t *iop,
- uint32_t flags
-)
-{
- _Atomic_Store_uint(
- &iop->flags,
- LIBIO_FLAGS_OPEN | flags,
- ATOMIC_ORDER_RELEASE
- );
-}
-
-/**
- * @brief Sets the specified flags in the iop.
- *
- * @param[in] iop The iop.
- * @param[in] set The flags to set.
- *
- * @return The previous flags.
- */
-static inline unsigned int rtems_libio_iop_flags_set(
- rtems_libio_t *iop,
- unsigned int set
-)
-{
- return _Atomic_Fetch_or_uint( &iop->flags, set, ATOMIC_ORDER_RELAXED );
-}
-
-/**
- * @brief Clears the specified flags in the iop.
- *
- * @param[in] iop The iop.
- * @param[in] clear The flags to clear.
- *
- * @return The previous flags.
- */
-static inline unsigned int rtems_libio_iop_flags_clear(
- rtems_libio_t *iop,
- unsigned int clear
-)
-{
- return _Atomic_Fetch_and_uint( &iop->flags, ~clear, ATOMIC_ORDER_RELAXED );
-}
-
-/**
- * @brief Maps a file descriptor to the iop.
- *
- * The file descriptor must be a valid index into the iop table.
- *
- * @param[in] fd The file descriptor.
- *
- * @return The iop corresponding to the specified file descriptor.
- */
-static inline rtems_libio_t *rtems_libio_iop( int fd )
-{
- return &rtems_libio_iops[ fd ];
-}
-
-/**
- * @brief Holds a refernece to the iop.
- *
- * @param[in] iop The iop.
- *
- * @return The flags corresponding to the specified iop.
- */
-static inline unsigned int rtems_libio_iop_hold( rtems_libio_t *iop )
-{
- return _Atomic_Fetch_add_uint(
- &iop->flags,
- LIBIO_FLAGS_REFERENCE_INC,
- ATOMIC_ORDER_ACQUIRE
- );
-}
-
-/**
- * @brief Drops a refernece to the iop.
- *
- * @param[in] iop The iop.
- */
-static inline void rtems_libio_iop_drop( rtems_libio_t *iop )
-{
-#if defined(RTEMS_DEBUG)
- unsigned int flags;
- bool success;
-
- flags = _Atomic_Load_uint( &iop->flags, ATOMIC_ORDER_RELAXED );
-
- do {
- unsigned int desired;
-
- _Assert( flags >= LIBIO_FLAGS_REFERENCE_INC );
-
- desired = flags - LIBIO_FLAGS_REFERENCE_INC;
- success = _Atomic_Compare_exchange_uint(
- &iop->flags,
- &flags,
- desired,
- ATOMIC_ORDER_RELEASE,
- ATOMIC_ORDER_RELAXED
- );
- } while ( !success );
-#else
- _Atomic_Fetch_sub_uint(
- &iop->flags,
- LIBIO_FLAGS_REFERENCE_INC,
- ATOMIC_ORDER_RELEASE
- );
-#endif
-}
-
-/*
- * rtems_libio_iop_to_descriptor
- *
- * Macro to convert an internal file descriptor pointer (iop) into
- * the integer file descriptor used by the "section 2" system calls.
- */
-
-#define rtems_libio_iop_to_descriptor(_iop) \
- ((_iop) - &rtems_libio_iops[0])
-
-/*
- * rtems_libio_check_is_open
- *
- * Macro to check if a file descriptor is actually open.
- */
-
-#define rtems_libio_check_is_open(_iop) \
- do { \
- if (((_iop)->flags & LIBIO_FLAGS_OPEN) == 0) { \
- errno = EBADF; \
- return -1; \
- } \
- } while (0)
-
-/**
- * @brief Macro to get the iop for the specified file descriptor.
- *
- * Checks that the file descriptor is in the valid range and open.
- */
-#define LIBIO_GET_IOP( _fd, _iop ) \
- do { \
- unsigned int _flags; \
- if ( (uint32_t) ( _fd ) >= rtems_libio_number_iops ) { \
- rtems_set_errno_and_return_minus_one( EBADF ); \
- } \
- _iop = rtems_libio_iop( _fd ); \
- _flags = rtems_libio_iop_hold( _iop ); \
- if ( ( _flags & LIBIO_FLAGS_OPEN ) == 0 ) { \
- rtems_libio_iop_drop( _iop ); \
- rtems_set_errno_and_return_minus_one( EBADF ); \
- } \
- } while ( 0 )
-
-/**
- * @brief Macro to get the iop for the specified file descriptor with access
- * flags and error.
- *
- * Checks that the file descriptor is in the valid range and open.
- */
-#define LIBIO_GET_IOP_WITH_ACCESS( _fd, _iop, _access_flags, _access_error ) \
- do { \
- unsigned int _flags; \
- unsigned int _mandatory; \
- if ( (uint32_t) ( _fd ) >= rtems_libio_number_iops ) { \
- rtems_set_errno_and_return_minus_one( EBADF ); \
- } \
- _iop = rtems_libio_iop( _fd ); \
- _flags = rtems_libio_iop_hold( _iop ); \
- _mandatory = LIBIO_FLAGS_OPEN | ( _access_flags ); \
- if ( ( _flags & _mandatory ) != _mandatory ) { \
- int _error; \
- rtems_libio_iop_drop( _iop ); \
- if ( ( _flags & LIBIO_FLAGS_OPEN ) == 0 ) { \
- _error = EBADF; \
- } else { \
- _error = _access_error; \
- } \
- rtems_set_errno_and_return_minus_one( _error ); \
- } \
- } while ( 0 )
-
-/*
- * rtems_libio_check_buffer
- *
- * Macro to check if a buffer pointer is valid.
- */
-
-#define rtems_libio_check_buffer(_buffer) \
- do { \
- if ((_buffer) == 0) { \
- errno = EINVAL; \
- return -1; \
- } \
- } while (0)
-
-/*
- * rtems_libio_check_count
- *
- * Macro to check if a count or length is valid.
- */
-
-#define rtems_libio_check_count(_count) \
- do { \
- if ((_count) == 0) { \
- return 0; \
- } \
- } while (0)
-
-/**
- * @brief Clones a node.
- *
- * The caller must hold the file system instance lock.
- *
- * @param[out] clone The cloned location.
- * @param[in] master The master location.
- *
- * @see rtems_filesystem_instance_lock().
- */
-void rtems_filesystem_location_clone(
- rtems_filesystem_location_info_t *clone,
- const rtems_filesystem_location_info_t *master
-);
-
-/**
- * @brief Releases all resources of a location.
- *
- * This function may block on a mutex and may complete an unmount process.
- *
- * @param[in] loc The location to free.
- *
- * @note The file system root location is released by the file system
- * instance destruction handler (see @ref rtems_filesystem_fsunmount_me_t).
- *
- * @see rtems_filesystem_freenode_t.
- */
-void rtems_filesystem_location_free( rtems_filesystem_location_info_t *loc );
-
-/*
- * External structures
- */
-#include <rtems/userenv.h>
-
-void rtems_libio_free_user_env( void *env );
-
-extern pthread_key_t rtems_current_user_env_key;
-
-void rtems_libio_lock( void );
-
-void rtems_libio_unlock( void );
-
-static inline void rtems_filesystem_mt_lock( void )
-{
- rtems_libio_lock();
-}
-
-static inline void rtems_filesystem_mt_unlock( void )
-{
- rtems_libio_unlock();
-}
-
-extern rtems_interrupt_lock rtems_filesystem_mt_entry_lock_control;
-
-#define rtems_filesystem_mt_entry_declare_lock_context( ctx ) \
- rtems_interrupt_lock_context ctx
-
-#define rtems_filesystem_mt_entry_lock( ctx ) \
- rtems_interrupt_lock_acquire( &rtems_filesystem_mt_entry_lock_control, &ctx )
-
-#define rtems_filesystem_mt_entry_unlock( ctx ) \
- rtems_interrupt_lock_release( &rtems_filesystem_mt_entry_lock_control, &ctx )
-
-static inline void rtems_filesystem_instance_lock(
- const rtems_filesystem_location_info_t *loc
-)
-{
- const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
-
- (*mt_entry->ops->lock_h)( mt_entry );
-}
-
-static inline void rtems_filesystem_instance_unlock(
- const rtems_filesystem_location_info_t *loc
-)
-{
- const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
-
- (*mt_entry->ops->unlock_h)( mt_entry );
-}
-
-/*
- * File Descriptor Routine Prototypes
- */
-
-/**
- * This routine searches the IOP Table for an unused entry. If it
- * finds one, it returns it. Otherwise, it returns NULL.
- */
-rtems_libio_t *rtems_libio_allocate(void);
-
-/**
- * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand
- */
-unsigned int rtems_libio_fcntl_flags( int fcntl_flags );
-
-/**
- * Convert RTEMS internal flags to UNIX fnctl(2) flags
- */
-int rtems_libio_to_fcntl_flags( unsigned int flags );
-
-/**
- * This routine frees the resources associated with an IOP (file descriptor)
- * and clears the slot in the IOP Table.
- */
-void rtems_libio_free(
- rtems_libio_t *iop
-);
-
-/*
- * File System Routine Prototypes
- */
-
-rtems_filesystem_location_info_t *
-rtems_filesystem_eval_path_start(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *path,
- int eval_flags
-);
-
-rtems_filesystem_location_info_t *
-rtems_filesystem_eval_path_start_with_parent(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *path,
- int eval_flags,
- rtems_filesystem_location_info_t *parentloc,
- int parent_eval_flags
-);
-
-rtems_filesystem_location_info_t *
-rtems_filesystem_eval_path_start_with_root_and_current(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *path,
- size_t pathlen,
- int eval_flags,
- rtems_filesystem_global_location_t *const *global_root_ptr,
- rtems_filesystem_global_location_t *const *global_current_ptr
-);
-
-void rtems_filesystem_eval_path_continue(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-void rtems_filesystem_eval_path_cleanup(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-void rtems_filesystem_eval_path_recursive(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *path,
- size_t pathlen
-);
-
-void rtems_filesystem_eval_path_cleanup_with_parent(
- rtems_filesystem_eval_path_context_t *ctx,
- rtems_filesystem_location_info_t *parentloc
-);
-
-/**
- * @brief Requests a path evaluation restart.
- *
- * Sets the start and current location to the new start location. The caller
- * must terminate its current evaluation process. The path evaluation
- * continues in the next loop iteration within
- * rtems_filesystem_eval_path_continue(). This avoids recursive invocations.
- * The function obtains the new start location and clones it to set the new
- * current location. The previous start and current locations are released.
- *
- * @param[in, out] ctx The path evaluation context.
- * @param[in, out] newstartloc_ptr Pointer to the new start location.
- */
-void rtems_filesystem_eval_path_restart(
- rtems_filesystem_eval_path_context_t *ctx,
- rtems_filesystem_global_location_t **newstartloc_ptr
-);
-
-typedef enum {
- RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_CONTINUE,
- RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_DONE,
- RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_NO_ENTRY
-} rtems_filesystem_eval_path_generic_status;
-
-/**
- * @brief Tests if the current location is a directory.
- *
- * @param[in, out] ctx The path evaluation context.
- * @param[in, out] arg The handler argument.
- *
- * @retval true The current location is a directory.
- * @retval false Otherwise.
- *
- * @see rtems_filesystem_eval_path_generic().
- */
-typedef bool (*rtems_filesystem_eval_path_is_directory)(
- rtems_filesystem_eval_path_context_t *ctx,
- void *arg
-);
-
-/**
- * @brief Evaluates a token.
- *
- * @param[in, out] ctx The path evaluation context.
- * @param[in, out] arg The handler argument.
- * @param[in] token The token contents.
- * @param[in] tokenlen The token length in characters.
- *
- * @retval status The generic path evaluation status.
- *
- * @see rtems_filesystem_eval_path_generic().
- */
-typedef rtems_filesystem_eval_path_generic_status
-(*rtems_filesystem_eval_path_eval_token)(
- rtems_filesystem_eval_path_context_t *ctx,
- void *arg,
- const char *token,
- size_t tokenlen
-);
-
-typedef struct {
- rtems_filesystem_eval_path_is_directory is_directory;
- rtems_filesystem_eval_path_eval_token eval_token;
-} rtems_filesystem_eval_path_generic_config;
-
-void rtems_filesystem_eval_path_generic(
- rtems_filesystem_eval_path_context_t *ctx,
- void *arg,
- const rtems_filesystem_eval_path_generic_config *config
-);
-
-void rtems_filesystem_initialize(void);
-
-/**
- * @brief Copies a location.
- *
- * A bitwise copy is performed. The destination location will be added to the
- * corresponding mount entry.
- *
- * @param[out] dst The destination location.
- * @param[in] src The source location.
- *
- * @retval dst The destination location.
- *
- * @see rtems_filesystem_location_clone().
- */
-rtems_filesystem_location_info_t *rtems_filesystem_location_copy(
- rtems_filesystem_location_info_t *dst,
- const rtems_filesystem_location_info_t *src
-);
-
-static inline rtems_filesystem_location_info_t *
-rtems_filesystem_location_initialize_to_null(
- rtems_filesystem_location_info_t *loc
-)
-{
- return rtems_filesystem_location_copy(
- loc,
- &rtems_filesystem_global_location_null.location
- );
-}
-
-rtems_filesystem_global_location_t *
-rtems_filesystem_location_transform_to_global(
- rtems_filesystem_location_info_t *loc
-);
-
-/**
- * @brief Assigns a global file system location.
- *
- * @param[in, out] lhs_global_loc_ptr Pointer to the global left hand side file
- * system location. The current left hand side location will be released.
- * @param[in] rhs_global_loc The global right hand side file system location.
- */
-void rtems_filesystem_global_location_assign(
- rtems_filesystem_global_location_t **lhs_global_loc_ptr,
- rtems_filesystem_global_location_t *rhs_global_loc
-);
-
-/**
- * @brief Obtains a global file system location.
- *
- * Deferred releases will be processed in this function.
- *
- * This function must be called from normal thread context and may block on a
- * mutex. Thread dispatching is disabled to protect some critical sections.
- *
- * @param[in] global_loc_ptr Pointer to the global file system location.
- *
- * @return A global file system location. It returns always a valid object.
- * In case of an error, the global null location will be returned. Each
- * operation or handler of the null location returns an error status. The
- * errno indicates the error. The NULL pointer is never returned.
- *
- * @see rtems_filesystem_location_transform_to_global(),
- * rtems_filesystem_global_location_obtain_null(), and
- * rtems_filesystem_global_location_release().
- */
-rtems_filesystem_global_location_t *rtems_filesystem_global_location_obtain(
- rtems_filesystem_global_location_t *const *global_loc_ptr
-);
-
-/**
- * @brief Releases a global file system location.
- *
- * In case the reference count reaches zero, all associated resources will be
- * released. This may include the complete unmount of the corresponding file
- * system instance.
- *
- * This function may block on a mutex. It may be called within critical
- * sections of the operating system. In this case the release will be
- * deferred. The next obtain call will do the actual release.
- *
- * @param[in] global_loc The global file system location. It must not be NULL.
- * @param[in] deferred If true, then do a deferred release, otherwise release
- * it immediately.
- *
- * @see rtems_filesystem_global_location_obtain().
- */
-void rtems_filesystem_global_location_release(
- rtems_filesystem_global_location_t *global_loc,
- bool deferred
-);
-
-void rtems_filesystem_location_detach(
- rtems_filesystem_location_info_t *detach
-);
-
-void rtems_filesystem_location_copy_and_detach(
- rtems_filesystem_location_info_t *copy,
- rtems_filesystem_location_info_t *detach
-);
-
-static inline rtems_filesystem_global_location_t *
-rtems_filesystem_global_location_obtain_null(void)
-{
- rtems_filesystem_global_location_t *global_loc = NULL;
-
- return rtems_filesystem_global_location_obtain( &global_loc );
-}
-
-static inline bool rtems_filesystem_location_is_null(
- const rtems_filesystem_location_info_t *loc
-)
-{
- return loc->handlers == &rtems_filesystem_null_handlers;
-}
-
-static inline bool rtems_filesystem_global_location_is_null(
- const rtems_filesystem_global_location_t *global_loc
-)
-{
- return rtems_filesystem_location_is_null( &global_loc->location );
-}
-
-static inline void rtems_filesystem_location_error(
- const rtems_filesystem_location_info_t *loc,
- int eno
-)
-{
- if ( !rtems_filesystem_location_is_null( loc ) ) {
- errno = eno;
- }
-}
-
-int rtems_filesystem_mknod(
- const rtems_filesystem_location_info_t *parentloc,
- const char *name,
- size_t namelen,
- mode_t mode,
- dev_t dev
-);
-
-int rtems_filesystem_chdir( rtems_filesystem_location_info_t *loc );
-
-int rtems_filesystem_chmod(
- const rtems_filesystem_location_info_t *loc,
- mode_t mode
-);
-
-int rtems_filesystem_chown(
- const rtems_filesystem_location_info_t *loc,
- uid_t owner,
- gid_t group
-);
-
-static inline bool rtems_filesystem_is_ready_for_unmount(
- rtems_filesystem_mount_table_entry_t *mt_entry
-)
-{
- bool ready = !mt_entry->mounted
- && rtems_chain_has_only_one_node( &mt_entry->location_chain )
- && mt_entry->mt_fs_root->reference_count == 1;
-
- if ( ready ) {
- rtems_chain_initialize_empty( &mt_entry->location_chain );
- }
-
- return ready;
-}
-
-static inline void rtems_filesystem_location_add_to_mt_entry(
- rtems_filesystem_location_info_t *loc
-)
-{
- rtems_filesystem_mt_entry_declare_lock_context( lock_context );
-
- rtems_filesystem_mt_entry_lock( lock_context );
- rtems_chain_append_unprotected(
- &loc->mt_entry->location_chain,
- &loc->mt_entry_node
- );
- rtems_filesystem_mt_entry_unlock( lock_context );
-}
-
-void rtems_filesystem_location_remove_from_mt_entry(
- rtems_filesystem_location_info_t *loc
-);
-
-void rtems_filesystem_do_unmount(
- rtems_filesystem_mount_table_entry_t *mt_entry
-);
-
-static inline bool rtems_filesystem_location_is_instance_root(
- const rtems_filesystem_location_info_t *loc
-)
-{
- const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
-
- return (*mt_entry->ops->are_nodes_equal_h)(
- loc,
- &mt_entry->mt_fs_root->location
- );
-}
-
-static inline const char *rtems_filesystem_eval_path_get_path(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->path;
-}
-
-static inline size_t rtems_filesystem_eval_path_get_pathlen(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->pathlen;
-}
-
-static inline void rtems_filesystem_eval_path_set_path(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *path,
- size_t pathlen
-)
-{
- ctx->path = path;
- ctx->pathlen = pathlen;
-}
-
-static inline void rtems_filesystem_eval_path_clear_path(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- ctx->pathlen = 0;
-}
-
-static inline const char *rtems_filesystem_eval_path_get_token(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->token;
-}
-
-static inline size_t rtems_filesystem_eval_path_get_tokenlen(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->tokenlen;
-}
-
-static inline void rtems_filesystem_eval_path_set_token(
- rtems_filesystem_eval_path_context_t *ctx,
- const char *token,
- size_t tokenlen
-)
-{
- ctx->token = token;
- ctx->tokenlen = tokenlen;
-}
-
-static inline void rtems_filesystem_eval_path_clear_token(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- ctx->tokenlen = 0;
-}
-
-static inline void rtems_filesystem_eval_path_put_back_token(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- size_t tokenlen = ctx->tokenlen;
-
- ctx->path -= tokenlen;
- ctx->pathlen += tokenlen;
- ctx->tokenlen = 0;
-}
-
-void rtems_filesystem_eval_path_eat_delimiter(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-void rtems_filesystem_eval_path_next_token(
- rtems_filesystem_eval_path_context_t *ctx
-);
-
-static inline void rtems_filesystem_eval_path_get_next_token(
- rtems_filesystem_eval_path_context_t *ctx,
- const char **token,
- size_t *tokenlen
-)
-{
- rtems_filesystem_eval_path_next_token(ctx);
- *token = ctx->token;
- *tokenlen = ctx->tokenlen;
-}
-
-static inline rtems_filesystem_location_info_t *
-rtems_filesystem_eval_path_get_currentloc(
- rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return &ctx->currentloc;
-}
-
-static inline bool rtems_filesystem_eval_path_has_path(
- const rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->pathlen > 0;
-}
-
-static inline bool rtems_filesystem_eval_path_has_token(
- const rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->tokenlen > 0;
-}
-
-static inline int rtems_filesystem_eval_path_get_flags(
- const rtems_filesystem_eval_path_context_t *ctx
-)
-{
- return ctx->flags;
-}
-
-static inline void rtems_filesystem_eval_path_set_flags(
- rtems_filesystem_eval_path_context_t *ctx,
- int flags
-)
-{
- ctx->flags = flags;
-}
-
-static inline void rtems_filesystem_eval_path_clear_and_set_flags(
- rtems_filesystem_eval_path_context_t *ctx,
- int clear,
- int set
-)
-{
- int flags = ctx->flags;
-
- flags &= ~clear;
- flags |= set;
-
- ctx->flags = flags;
-}
-
-static inline void rtems_filesystem_eval_path_extract_currentloc(
- rtems_filesystem_eval_path_context_t *ctx,
- rtems_filesystem_location_info_t *get
-)
-{
- rtems_filesystem_location_copy_and_detach(
- get,
- &ctx->currentloc
- );
-}
-
-void rtems_filesystem_eval_path_error(
- rtems_filesystem_eval_path_context_t *ctx,
- int eno
-);
-
-/**
- * @brief Checks that the locations exist in the same file system instance.
- *
- * @retval 0 The locations exist and are in the same file system instance.
- * @retval -1 An error occurred. The @c errno indicates the error.
- */
-int rtems_filesystem_location_exists_in_same_instance_as(
- const rtems_filesystem_location_info_t *a,
- const rtems_filesystem_location_info_t *b
-);
-
-/**
- * @brief Checks if access to an object is allowed for the current user.
- *
- * If the effective UID is zero or equals the UID of the object, then the user
- * permission flags of the object will be used. Otherwise if the effective GID
- * is zero or equals the GID of the object or one of the supplementary group
- * IDs is equal to the GID of the object, then the group permission flags of
- * the object will be used. Otherwise the other permission flags of the object
- * will be used.
- *
- * @param[in] flags The flags determining the access type. It can be
- * RTEMS_FS_PERMS_READ, RTEMS_FS_PERMS_WRITE or RTEMS_FS_PERMS_EXEC.
- * @param[in] object_mode The mode of the object specifying the permission flags.
- * @param[in] object_uid The UID of the object.
- * @param[in] object_gid The GID of the object.
- *
- * @retval true Access is allowed.
- * @retval false Otherwise.
- */
-bool rtems_filesystem_check_access(
- int flags,
- mode_t object_mode,
- uid_t object_uid,
- gid_t object_gid
-);
-
-bool rtems_filesystem_eval_path_check_access(
- rtems_filesystem_eval_path_context_t *ctx,
- int eval_flags,
- mode_t node_mode,
- uid_t node_uid,
- gid_t node_gid
-);
-
-static inline bool rtems_filesystem_is_delimiter(char c)
-{
- return c == '/' || c == '\\';
-}
-
-static inline bool rtems_filesystem_is_current_directory(
- const char *token,
- size_t tokenlen
-)
-{
- return tokenlen == 1 && token [0] == '.';
-}
-
-static inline bool rtems_filesystem_is_parent_directory(
- const char *token,
- size_t tokenlen
-)
-{
- return tokenlen == 2 && token [0] == '.' && token [1] == '.';
-}
-
-typedef ssize_t ( *rtems_libio_iovec_adapter )(
- rtems_libio_t *iop,
- const struct iovec *iov,
- int iovcnt,
- ssize_t total
-);
-
-static inline ssize_t rtems_libio_iovec_eval(
- int fd,
- const struct iovec *iov,
- int iovcnt,
- unsigned int flags,
- rtems_libio_iovec_adapter adapter
-)
-{
- ssize_t total;
- int v;
- rtems_libio_t *iop;
-
- /*
- * Argument validation on IO vector
- */
- if ( iov == NULL )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- if ( iovcnt <= 0 )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- if ( iovcnt > IOV_MAX )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- /*
- * OpenGroup says that you are supposed to return EINVAL if the
- * sum of the iov_len values in the iov array would overflow a
- * ssize_t.
- */
- total = 0;
- for ( v = 0 ; v < iovcnt ; ++v ) {
- size_t len = iov[ v ].iov_len;
-
- if ( len > ( size_t ) ( SSIZE_MAX - total ) ) {
- rtems_set_errno_and_return_minus_one( EINVAL );
- }
-
- total += ( ssize_t ) len;
-
- if ( iov[ v ].iov_base == NULL && len != 0 ) {
- rtems_set_errno_and_return_minus_one( EINVAL );
- }
- }
-
- LIBIO_GET_IOP_WITH_ACCESS( fd, iop, flags, EBADF );
-
- if ( total > 0 ) {
- total = ( *adapter )( iop, iov, iovcnt, total );
- }
-
- rtems_libio_iop_drop( iop );
- return total;
-}
-
-/**
- * @brief Returns the file type of the file referenced by the filesystem
- * location.
- *
- * @brief[in] loc The filesystem location.
- *
- * @return The type of the file or an invalid file type in case of an error.
- */
-static inline mode_t rtems_filesystem_location_type(
- const rtems_filesystem_location_info_t *loc
-)
-{
- struct stat st;
-
- st.st_mode = 0;
- (void) ( *loc->handlers->fstat_h )( loc, &st );
-
- return st.st_mode;
-}
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/libcsupport/include/rtems/malloc.h b/cpukit/libcsupport/include/rtems/malloc.h
deleted file mode 100644
index 7c00f21e77..0000000000
--- a/cpukit/libcsupport/include/rtems/malloc.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/**
- * @file rtems/malloc.h
- *
- * This file defines the interface to RTEMS extensions to the Malloc Family.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may in
- * the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_MALLOC_H
-#define _RTEMS_MALLOC_H
-
-#include <rtems.h>
-#include <rtems/bspIo.h>
-#include <rtems/libcsupport.h> /* for malloc_walk() */
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup MallocSupport Malloc Support
- *
- * @ingroup libcsupport
- *
- * @brief RTEMS extensions to the Malloc Family
- */
-
-/**
- * @brief C program heap control.
- *
- * This is the pointer to the heap control structure used to manage the C
- * program heap.
- */
-extern Heap_Control *RTEMS_Malloc_Heap;
-
-void RTEMS_Malloc_Initialize(
- const Heap_Area *areas,
- size_t area_count,
- Heap_Initialization_or_extend_handler extend
-);
-
-extern ptrdiff_t RTEMS_Malloc_Sbrk_amount;
-
-static inline void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount )
-{
- RTEMS_Malloc_Sbrk_amount = sbrk_amount;
-}
-
-typedef void *(*rtems_heap_extend_handler)(
- Heap_Control *heap,
- size_t alloc_size
-);
-
-/**
- * @brief RTEMS Extend Heap via Sbrk
- */
-void *rtems_heap_extend_via_sbrk(
- Heap_Control *heap,
- size_t alloc_size
-);
-
-void *rtems_heap_null_extend(
- Heap_Control *heap,
- size_t alloc_size
-);
-
-extern const rtems_heap_extend_handler rtems_malloc_extend_handler;
-
-/*
- * Malloc Plugin to Dirty Memory at Allocation Time
- */
-typedef void (*rtems_malloc_dirtier_t)(void *, size_t);
-extern rtems_malloc_dirtier_t rtems_malloc_dirty_helper;
-
-/**
- * @brief Dirty Memory Function
- *
- * This method fills the specified area with a non-zero pattern
- * to aid in debugging programs which do not initialize their
- * memory allocated from the heap.
- */
-void rtems_malloc_dirty_memory(
- void *start,
- size_t size
-);
-
-/**
- * @brief RTEMS Variation on Aligned Memory Allocation
- *
- * This method is a help memalign implementation which does all
- * error checking done by posix_memalign() EXCEPT it does NOT
- * place numeric restrictions on the alignment value.
- *
- * @param[in] pointer points to the user pointer
- * @param[in] alignment is the desired alignment
- * @param[in] size is the allocation request size in bytes
- *
- * @return This methods returns zero on success and a POSIX errno
- * value to indicate the failure condition. On success
- * *pointer will contain the address of the allocated memory.
- */
-int rtems_memalign(
- void **pointer,
- size_t alignment,
- size_t size
-);
-
-/**
- * @brief Allocates a memory area of size @a size bytes from the heap.
- *
- * If the alignment parameter @a alignment is not equal to zero, the allocated
- * memory area will begin at an address aligned by this value.
- *
- * If the boundary parameter @a boundary is not equal to zero, the allocated
- * memory area will comply with a boundary constraint. The boundary value
- * specifies the set of addresses which are aligned by the boundary value. The
- * interior of the allocated memory area will not contain an element of this
- * set. The begin or end address of the area may be a member of the set.
- *
- * A size value of zero will return a unique address which may be freed with
- * free().
- *
- * The memory allocated by this function can be released with a call to free().
- *
- * @return A pointer to the begin of the allocated memory area, or @c NULL if
- * no memory is available or the parameters are inconsistent.
- */
-void *rtems_heap_allocate_aligned_with_boundary(
- size_t size,
- uintptr_t alignment,
- uintptr_t boundary
-);
-
-/**
- * @brief Extends the memory available for the heap using the memory area
- * starting at @a area_begin of size @a area_size bytes.
- *
- * There are no alignment requirements. The memory area must be big enough to
- * contain some maintenance blocks. It must not overlap parts of the current
- * heap areas. Disconnected subordinate heap areas will lead to used blocks
- * which cover the gaps. Extending with an inappropriate memory area will
- * corrupt the heap.
- *
- * @retval RTEMS_SUCCESSFUL Successful operation.
- * @retval RTEMS_INVALID_ADDRESS Invalid memory area.
- */
-rtems_status_code rtems_heap_extend(
- void *area_begin,
- uintptr_t area_size
-);
-
-/**
- * @brief Greedy allocate that empties the heap.
- *
- * Afterwards the heap has at most @a block_count allocatable blocks of sizes
- * specified by @a block_sizes. The @a block_sizes must point to an array with
- * @a block_count members. All other blocks are used.
- *
- * @see rtems_heap_greedy_free().
- */
-void *rtems_heap_greedy_allocate(
- const uintptr_t *block_sizes,
- size_t block_count
-);
-
-/**
- * @brief Greedy allocate all blocks except the largest free block.
- *
- * Afterwards the heap has at most one allocatable block. This block is the
- * largest free block if it exists. The allocatable size of this block is
- * stored in @a allocatable_size. All other blocks are used.
- *
- * @see rtems_heap_greedy_free().
- */
-void *rtems_heap_greedy_allocate_all_except_largest(
- uintptr_t *allocatable_size
-);
-
-/**
- * @brief Frees space of a greedy allocation.
- *
- * The @a opaque argument must be the return value of
- * rtems_heap_greedy_allocate() or
- * rtems_heap_greedy_allocate_all_except_largest().
- */
-void rtems_heap_greedy_free( void *opaque );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
deleted file mode 100644
index b3cac66e92..0000000000
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ /dev/null
@@ -1,602 +0,0 @@
-/**
- * @file rtems/termiostypes.h
- *
- * RTEMS termios device support internal data structures
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef __TERMIOSTYPES_H
-#define __TERMIOSTYPES_H
-
-#include <rtems.h>
-#include <rtems/libio.h>
-#include <rtems/assoc.h>
-#include <rtems/chain.h>
-#include <sys/ioccom.h>
-#include <stdint.h>
-#include <termios.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup TermiostypesSupport RTEMS Termios Device Support
- *
- * @ingroup libcsupport
- *
- * @brief RTEMS Termios Device Support Internal Data Structures
- */
-
-/*
- * Wakeup callback data structure
- */
-struct ttywakeup {
- void (*sw_pfn)(struct termios *tty, void *arg);
- void *sw_arg;
-};
-
-/*
- * Variables associated with the character buffer
- */
-struct rtems_termios_rawbuf {
- char *theBuf;
- volatile unsigned int Head;
- volatile unsigned int Tail;
- volatile unsigned int Size;
- rtems_id Semaphore;
-};
-
-typedef enum {
- TERMIOS_POLLED,
- TERMIOS_IRQ_DRIVEN,
- TERMIOS_TASK_DRIVEN,
- TERMIOS_IRQ_SERVER_DRIVEN
-} rtems_termios_device_mode;
-
-struct rtems_termios_tty;
-
-/**
- * @brief Termios device context.
- *
- * @see RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER(),
- * rtems_termios_device_context_initialize() and
- * rtems_termios_device_install().
- */
-typedef struct rtems_termios_device_context {
- union {
- /* Used for TERMIOS_POLLED and TERMIOS_IRQ_DRIVEN */
- rtems_interrupt_lock interrupt;
-
- /* Used for TERMIOS_IRQ_SERVER_DRIVEN or TERMIOS_TASK_DRIVEN */
- rtems_id mutex;
- } lock;
-
- void ( *lock_acquire )(
- struct rtems_termios_device_context *,
- rtems_interrupt_lock_context *
- );
-
- void ( *lock_release )(
- struct rtems_termios_device_context *,
- rtems_interrupt_lock_context *
- );
-} rtems_termios_device_context;
-
-void rtems_termios_device_lock_acquire_default(
- rtems_termios_device_context *ctx,
- rtems_interrupt_lock_context *lock_context
-);
-
-void rtems_termios_device_lock_release_default(
- rtems_termios_device_context *ctx,
- rtems_interrupt_lock_context *lock_context
-);
-
-/**
- * @brief Initializes a device context.
- *
- * @param[in] context The Termios device context.
- * @param[in] name The name for the interrupt lock. This name must be a
- * string persistent throughout the life time of this lock. The name is only
- * used if profiling is enabled.
- */
-RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize(
- rtems_termios_device_context *context,
- const char *name
-)
-{
- rtems_interrupt_lock_initialize( &context->lock.interrupt, name );
- context->lock_acquire = rtems_termios_device_lock_acquire_default;
- context->lock_release = rtems_termios_device_lock_release_default;
-}
-
-/**
- * @brief Initializer for static initialization of Termios device contexts.
- *
- * @param name The name for the interrupt lock. It must be a string. The name
- * is only used if profiling is enabled.
- */
-#define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( name ) \
- { \
- { RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) }, \
- rtems_termios_device_lock_acquire_default, \
- rtems_termios_device_lock_release_default \
- }
-
-/**
- * @brief Termios device handler.
- *
- * @see rtems_termios_device_install().
- */
-typedef struct {
- /**
- * @brief First open of this device.
- *
- * @param[in] tty The Termios control. This parameter may be passed to
- * interrupt service routines since it must be provided for the
- * rtems_termios_enqueue_raw_characters() and
- * rtems_termios_dequeue_characters() functions.
- * @param[in] context The Termios device context.
- * @param[in] term The current Termios attributes.
- * @param[in] args The open/close arguments. This is parameter provided to
- * support legacy drivers. It must not be used by new drivers.
- *
- * @retval true Successful operation.
- * @retval false Cannot open device.
- *
- * @see rtems_termios_get_device_context() and rtems_termios_set_best_baud().
- */
- bool (*first_open)(
- struct rtems_termios_tty *tty,
- rtems_termios_device_context *context,
- struct termios *term,
- rtems_libio_open_close_args_t *args
- );
-
- /**
- * @brief Last close of this device.
- *
- * @param[in] tty The Termios control.
- * @param[in] context The Termios device context.
- * @param[in] args The open/close arguments. This is parameter provided to
- * support legacy drivers. It must not be used by new drivers.
- */
- void (*last_close)(
- struct rtems_termios_tty *tty,
- rtems_termios_device_context *context,
- rtems_libio_open_close_args_t *args
- );
-
- /**
- * @brief Polled read.
- *
- * In case mode is TERMIOS_IRQ_DRIVEN, TERMIOS_IRQ_SERVER_DRIVEN or
- * TERMIOS_TASK_DRIVEN, then data is received via
- * rtems_termios_enqueue_raw_characters().
- *
- * @param[in] context The Termios device context.
- *
- * @retval char The received data encoded as unsigned char.
- * @retval -1 No data currently available.
- */
- int (*poll_read)(rtems_termios_device_context *context);
-
- /**
- * @brief Polled write in case mode is TERMIOS_POLLED or write support
- * otherwise.
- *
- * @param[in] context The Termios device context.
- * @param[in] buf The output buffer.
- * @param[in] len The output buffer length in characters.
- */
- void (*write)(
- rtems_termios_device_context *context,
- const char *buf,
- size_t len
- );
-
- /**
- * @brief Set attributes after a Termios settings change.
- *
- * @param[in] context The Termios device context.
- * @param[in] term The new Termios attributes.
- *
- * @retval true Successful operation.
- * @retval false Invalid attributes.
- */
- bool (*set_attributes)(
- rtems_termios_device_context *context,
- const struct termios *term
- );
-
- /**
- * @brief IO control handler.
- *
- * Invoked in case the Termios layer cannot deal with the IO request.
- *
- * @param[in] context The Termios device context.
- * @param[in] request The IO control request.
- * @param[in] buffer The IO control buffer.
- */
- int (*ioctl)(
- rtems_termios_device_context *context,
- ioctl_command_t request,
- void *buffer
- );
-
- /**
- * @brief Termios device mode.
- */
- rtems_termios_device_mode mode;
-} rtems_termios_device_handler;
-
-/**
- * @brief Termios device flow control handler.
- *
- * @see rtems_termios_device_install().
- */
-typedef struct {
- /**
- * @brief Indicate to stop remote transmitter.
- *
- * @param[in] context The Termios device context.
- */
- void (*stop_remote_tx)(rtems_termios_device_context *context);
-
- /**
- * @brief Indicate to start remote transmitter.
- *
- * @param[in] context The Termios device context.
- */
- void (*start_remote_tx)(rtems_termios_device_context *context);
-} rtems_termios_device_flow;
-
-/**
- * @brief Termios device node for installed devices.
- *
- * @see rtems_termios_device_install().
- */
-typedef struct rtems_termios_device_node {
- rtems_chain_node node;
- rtems_device_major_number major;
- rtems_device_minor_number minor;
- const rtems_termios_device_handler *handler;
- const rtems_termios_device_flow *flow;
- rtems_termios_device_context *context;
- struct rtems_termios_tty *tty;
-} rtems_termios_device_node;
-
-/*
- * Variables associated with each termios instance.
- * One structure for each hardware I/O device.
- */
-typedef struct rtems_termios_tty {
- /*
- * Linked-list of active TERMIOS devices
- */
- struct rtems_termios_tty *forw;
- struct rtems_termios_tty *back;
-
- /*
- * How many times has this device been opened
- */
- int refcount;
-
- /*
- * This device
- */
- rtems_device_major_number major;
- rtems_device_minor_number minor;
-
- /*
- * Mutual-exclusion semaphores
- */
- rtems_id isem;
- rtems_id osem;
-
- /*
- * The canonical (cooked) character buffer
- */
- char *cbuf;
- int ccount;
- int cindex;
-
- /*
- * Keep track of cursor (printhead) position
- */
- int column;
- int read_start_column;
-
- /*
- * The ioctl settings
- */
- struct termios termios;
- rtems_interval vtimeTicks;
-
- /*
- * Raw input character buffer
- */
- struct rtems_termios_rawbuf rawInBuf;
- uint32_t rawInBufSemaphoreOptions;
- rtems_interval rawInBufSemaphoreTimeout;
- rtems_interval rawInBufSemaphoreFirstTimeout;
- unsigned int rawInBufDropped; /* Statistics */
-
- /*
- * Raw output character buffer
- */
- struct rtems_termios_rawbuf rawOutBuf;
- int t_dqlen; /* count of characters dequeued from device */
- enum {rob_idle, rob_busy, rob_wait } rawOutBufState;
-
- /*
- * Callbacks to device-specific routines
- */
- rtems_termios_callbacks device;
-
- /**
- * @brief Context for legacy devices using the callbacks.
- */
- rtems_termios_device_context legacy_device_context;
-
- /**
- * @brief The device handler.
- */
- rtems_termios_device_handler handler;
-
- /**
- * @brief The device flow control handler.
- */
- rtems_termios_device_flow flow;
-
- volatile unsigned int flow_ctrl;
- unsigned int lowwater,highwater;
-
- /*
- * I/O task IDs (for task-driven drivers)
- */
- rtems_id rxTaskId;
- rtems_id txTaskId;
-
- /*
- * line discipline related stuff
- */
- int t_line; /* id of line discipline */
- void *t_sc; /* hook for discipline-specific data structure */
-
- /*
- * Wakeup callback variables
- */
- struct ttywakeup tty_snd;
- struct ttywakeup tty_rcv;
- bool tty_rcvwakeup;
-
- /**
- * @brief Corresponding device node.
- */
- rtems_termios_device_node *device_node;
-
- /**
- * @brief Context for device driver.
- */
- rtems_termios_device_context *device_context;
-} rtems_termios_tty;
-
-/**
- * @brief Installs a Termios device.
- *
- * The installed Termios device may be removed via unlink().
- *
- * @param[in] device_file The device file path.
- * @param[in] handler The device handler. It must be persistent throughout the
- * installed time of the device.
- * @param[in] flow The device flow control handler. The device flow control
- * handler are optional and may be @c NULL. If present must be persistent
- * throughout the installed time of the device.
- * @param[in] context The device context. It must be persistent throughout the
- * installed time of the device.
- *
- * @retval RTEMS_SUCCESSFUL Successful operation.
- * @retval RTEMS_NO_MEMORY Not enough memory to create a device node.
- * @retval RTEMS_UNSATISFIED Creation of the device file failed.
- * @retval RTEMS_INCORRECT_STATE Termios is not initialized.
- *
- * @see rtems_termios_get_device_context().
- */
-rtems_status_code rtems_termios_device_install(
- const char *device_file,
- const rtems_termios_device_handler *handler,
- const rtems_termios_device_flow *flow,
- rtems_termios_device_context *context
-);
-
-/**
- * @brief Returns the device context of an installed Termios device.
- *
- * @param[in] tty The Termios control.
- */
-RTEMS_INLINE_ROUTINE void *rtems_termios_get_device_context(
- const rtems_termios_tty *tty
-)
-{
- return tty->device_context;
-}
-
-/**
- * @brief Acquires the device lock.
- *
- * @param[in] context The device context.
- * @param[in] lock_context The local interrupt lock context for an acquire and
- * release pair.
- */
-RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_acquire(
- rtems_termios_device_context *context,
- rtems_interrupt_lock_context *lock_context
-)
-{
- ( *context->lock_acquire )( context, lock_context );
-}
-
-/**
- * @brief Releases the device lock.
- *
- * @param[in] context The device context.
- * @param[in] lock_context The local interrupt lock context for an acquire and
- * release pair.
- */
-RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_release(
- rtems_termios_device_context *context,
- rtems_interrupt_lock_context *lock_context
-)
-{
- ( *context->lock_release )( context, lock_context );
-}
-
-/**
- * @brief Sets the best baud value in the Termios control.
- *
- * The valid Termios baud values are between 0 and 460800. The Termios baud
- * value is chosen which minimizes the difference to the value specified.
- *
- * @param[in] term The Termios attributes.
- * @param[in] baud The current baud setting of the device.
- */
-void rtems_termios_set_best_baud(
- struct termios *term,
- uint32_t baud
-);
-
-struct rtems_termios_linesw {
- int (*l_open) (struct rtems_termios_tty *tp);
- int (*l_close)(struct rtems_termios_tty *tp);
- int (*l_read )(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
- int (*l_write)(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
- int (*l_rint )(int c,struct rtems_termios_tty *tp);
- int (*l_start)(struct rtems_termios_tty *tp);
- int (*l_ioctl)(struct rtems_termios_tty *tp,rtems_libio_ioctl_args_t *args);
- int (*l_modem)(struct rtems_termios_tty *tp,int flags);
-};
-
-/*
- * FIXME: this should move to termios.h!
- */
-void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty);
-
-/*
- * FIXME: this should move to termios.h!
- * put a string to output ring buffer
- */
-void rtems_termios_puts (
- const void *buf,
- size_t len,
- struct rtems_termios_tty *tty
-);
-
-/*
- * global hooks for line disciplines
- */
-extern struct rtems_termios_linesw rtems_termios_linesw[];
-extern int rtems_termios_nlinesw;
-
-#define TTYDISC 0 /* termios tty line discipline */
-#define TABLDISC 3 /* tablet discipline */
-#define SLIPDISC 4 /* serial IP discipline */
-#define PPPDISC 5 /* PPP discipline */
-#define MAXLDISC 8
-
-/* baudrate xxx integer type */
-typedef uint32_t rtems_termios_baud_t;
-
-/**
- * @brief RTEMS Termios Baud Table
- */
-extern const rtems_assoc_t rtems_termios_baud_table [];
-
-/**
- * @brief Converts the Integral Baud value @a baud to the Termios Control Flag
- * Representation
- *
- * @retval B0 Invalid baud value or a baud value of 0.
- * @retval other Baud constant according to @a baud.
- */
-speed_t rtems_termios_number_to_baud(rtems_termios_baud_t baud);
-
-/**
- * @brief Converts the baud flags to an integral baud value.
- *
- * @retval 0 Invalid baud value or a baud value of @c B0.
- * @retval other Integral baud value.
- */
-rtems_termios_baud_t rtems_termios_baud_to_number(speed_t baud);
-
-/**
- * @brief Convert Bxxx Constant to Index
- */
-int rtems_termios_baud_to_index(rtems_termios_baud_t termios_baud);
-
-/**
- * @brief Sets the initial @a baud in the Termios context @a tty.
- *
- * @retval 0 Successful operation.
- * @retval -1 Invalid baud value.
- */
-int rtems_termios_set_initial_baud(
- struct rtems_termios_tty *tty,
- rtems_termios_baud_t baud
-);
-
-/**
- * @brief Termios kqueue() filter filesystem node handler
- *
- * Real implementation is provided by libbsd.
- */
-int rtems_termios_kqfilter(
- rtems_libio_t *iop,
- struct knote *kn
-);
-
-/**
- * @brief Termios mmap() filter filesystem node handler
- *
- * Real implementation is provided by libbsd.
- */
-int rtems_termios_mmap(
- rtems_libio_t *iop,
- void **addr,
- size_t len,
- int prot,
- off_t off
-);
-
-/**
- * @brief Termios poll() filesystem node handler.
- *
- * Real implementation is provided by libbsd.
- */
-int rtems_termios_poll(
- rtems_libio_t *iop,
- int events
-);
-
-#define RTEMS_IO_SNDWAKEUP _IOW('t', 11, struct ttywakeup ) /* send tty wakeup */
-#define RTEMS_IO_RCVWAKEUP _IOW('t', 12, struct ttywakeup ) /* recv tty wakeup */
-
-#define OLCUC 0x00000100 /* map lower case to upper case on output */
-#define IUCLC 0x00004000 /* map upper case to lower case on input */
-
-#define RTEMS_TERMIOS_NUMBER_BAUD_RATES 25
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TERMIOSTYPES_H */
diff --git a/cpukit/libcsupport/include/rtems/tod.h b/cpukit/libcsupport/include/rtems/tod.h
deleted file mode 100644
index 971e8548e8..0000000000
--- a/cpukit/libcsupport/include/rtems/tod.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- *
- * @ingroup shared_tod
- *
- * @brief Real Time Clock Time of Day API Definition
- */
-
-/*
- *
- * Based on MVME162 TOD by:
- * COPYRIGHT (C) 1997
- * by Katsutoshi Shibuya - BU Denken Co.,Ltd. - Sapporo - JAPAN
- * ALL RIGHTS RESERVED
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef TOD_H
-#define TOD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup shared_tod RTC
- *
- * @ingroup bsp_shared
- *
- * @brief Set the RTC
- */
-int setRealTime(
- const rtems_time_of_day *tod
-);
-
-/*
- * Get the time from the RTC.
- */
-
-void getRealTime(
- rtems_time_of_day *tod
-);
-
-/*
- * Read real time from RTC and set it to RTEMS' clock manager
- */
-
-void setRealTimeToRTEMS(void);
-
-/*
- * Read time from RTEMS' clock manager and set it to RTC
- */
-
-void setRealTimeFromRTEMS(void);
-
-/*
- * Return the difference between RTC and RTEMS' clock manager time in minutes.
- * If the difference is greater than 1 day, this returns 9999.
- */
-
-int checkRealTime(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cpukit/libcsupport/include/spurious.h b/cpukit/libcsupport/include/spurious.h
deleted file mode 100644
index 049f3bf3a0..0000000000
--- a/cpukit/libcsupport/include/spurious.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file rtems/spurious.h
- *
- * This file describes the Spurious Interrupt Driver for all boards.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_SPURIOUS_H
-#define _RTEMS_SPURIOUS_H
-
-#include <rtems/rtems/types.h> /* rtems_id */
-#include <rtems/io.h> /* rtems_device_driver */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SPURIOUS_DRIVER_TABLE_ENTRY \
- { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL }
-
-rtems_device_driver Spurious_Initialize(
- rtems_device_major_number,
- rtems_device_minor_number,
- void *,
- rtems_id,
- uint32_t *
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/libcsupport/include/sys/event.h b/cpukit/libcsupport/include/sys/event.h
deleted file mode 100644
index bc18aa90ea..0000000000
--- a/cpukit/libcsupport/include/sys/event.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/*-
- * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD: head/sys/sys/event.h 313704 2017-02-13 19:00:09Z ed $
- */
-
-#ifndef _SYS_EVENT_H_
-#define _SYS_EVENT_H_
-
-#include <sys/_types.h>
-#include <sys/queue.h>
-
-#define EVFILT_READ (-1)
-#define EVFILT_WRITE (-2)
-#define EVFILT_AIO (-3) /* attached to aio requests */
-#define EVFILT_VNODE (-4) /* attached to vnodes */
-#define EVFILT_PROC (-5) /* attached to struct proc */
-#define EVFILT_SIGNAL (-6) /* attached to struct proc */
-#define EVFILT_TIMER (-7) /* timers */
-#define EVFILT_PROCDESC (-8) /* attached to process descriptors */
-#define EVFILT_FS (-9) /* filesystem events */
-#define EVFILT_LIO (-10) /* attached to lio requests */
-#define EVFILT_USER (-11) /* User events */
-#define EVFILT_SENDFILE (-12) /* attached to sendfile requests */
-#define EVFILT_EMPTY (-13) /* empty send socket buf */
-#define EVFILT_SYSCOUNT 13
-
-#define EV_SET(kevp_, a, b, c, d, e, f) do { \
- struct kevent *kevp = (kevp_); \
- (kevp)->ident = (a); \
- (kevp)->filter = (b); \
- (kevp)->flags = (c); \
- (kevp)->fflags = (d); \
- (kevp)->data = (e); \
- (kevp)->udata = (f); \
-} while(0)
-
-struct kevent {
- __uintptr_t ident; /* identifier for this event */
- short filter; /* filter for event */
- unsigned short flags;
- unsigned int fflags;
- __intptr_t data;
- void *udata; /* opaque user data identifier */
-};
-
-/* actions */
-#define EV_ADD 0x0001 /* add event to kq (implies enable) */
-#define EV_DELETE 0x0002 /* delete event from kq */
-#define EV_ENABLE 0x0004 /* enable event */
-#define EV_DISABLE 0x0008 /* disable event (not reported) */
-#define EV_FORCEONESHOT 0x0100 /* enable _ONESHOT and force trigger */
-
-/* flags */
-#define EV_ONESHOT 0x0010 /* only report one occurrence */
-#define EV_CLEAR 0x0020 /* clear event state after reporting */
-#define EV_RECEIPT 0x0040 /* force EV_ERROR on success, data=0 */
-#define EV_DISPATCH 0x0080 /* disable event after reporting */
-
-#define EV_SYSFLAGS 0xF000 /* reserved by system */
-#define EV_DROP 0x1000 /* note should be dropped */
-#define EV_FLAG1 0x2000 /* filter-specific flag */
-#define EV_FLAG2 0x4000 /* filter-specific flag */
-
-/* returned values */
-#define EV_EOF 0x8000 /* EOF detected */
-#define EV_ERROR 0x4000 /* error, data contains errno */
-
- /*
- * data/hint flags/masks for EVFILT_USER, shared with userspace
- *
- * On input, the top two bits of fflags specifies how the lower twenty four
- * bits should be applied to the stored value of fflags.
- *
- * On output, the top two bits will always be set to NOTE_FFNOP and the
- * remaining twenty four bits will contain the stored fflags value.
- */
-#define NOTE_FFNOP 0x00000000 /* ignore input fflags */
-#define NOTE_FFAND 0x40000000 /* AND fflags */
-#define NOTE_FFOR 0x80000000 /* OR fflags */
-#define NOTE_FFCOPY 0xc0000000 /* copy fflags */
-#define NOTE_FFCTRLMASK 0xc0000000 /* masks for operations */
-#define NOTE_FFLAGSMASK 0x00ffffff
-
-#define NOTE_TRIGGER 0x01000000 /* Cause the event to be
- triggered for output. */
-
-/*
- * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
- */
-#define NOTE_LOWAT 0x0001 /* low water mark */
-#define NOTE_FILE_POLL 0x0002 /* behave like poll() */
-
-/*
- * data/hint flags for EVFILT_VNODE, shared with userspace
- */
-#define NOTE_DELETE 0x0001 /* vnode was removed */
-#define NOTE_WRITE 0x0002 /* data contents changed */
-#define NOTE_EXTEND 0x0004 /* size increased */
-#define NOTE_ATTRIB 0x0008 /* attributes changed */
-#define NOTE_LINK 0x0010 /* link count changed */
-#define NOTE_RENAME 0x0020 /* vnode was renamed */
-#define NOTE_REVOKE 0x0040 /* vnode access was revoked */
-#define NOTE_OPEN 0x0080 /* vnode was opened */
-#define NOTE_CLOSE 0x0100 /* file closed, fd did not
- allowed write */
-#define NOTE_CLOSE_WRITE 0x0200 /* file closed, fd did allowed
- write */
-#define NOTE_READ 0x0400 /* file was read */
-
-/*
- * data/hint flags for EVFILT_PROC and EVFILT_PROCDESC, shared with userspace
- */
-#define NOTE_EXIT 0x80000000 /* process exited */
-#define NOTE_FORK 0x40000000 /* process forked */
-#define NOTE_EXEC 0x20000000 /* process exec'd */
-#define NOTE_PCTRLMASK 0xf0000000 /* mask for hint bits */
-#define NOTE_PDATAMASK 0x000fffff /* mask for pid */
-
-/* additional flags for EVFILT_PROC */
-#define NOTE_TRACK 0x00000001 /* follow across forks */
-#define NOTE_TRACKERR 0x00000002 /* could not track child */
-#define NOTE_CHILD 0x00000004 /* am a child process */
-
-/* additional flags for EVFILT_TIMER */
-#define NOTE_SECONDS 0x00000001 /* data is seconds */
-#define NOTE_MSECONDS 0x00000002 /* data is milliseconds */
-#define NOTE_USECONDS 0x00000004 /* data is microseconds */
-#define NOTE_NSECONDS 0x00000008 /* data is nanoseconds */
-
-struct knote;
-SLIST_HEAD(klist, knote);
-struct kqueue;
-TAILQ_HEAD(kqlist, kqueue);
-struct knlist {
- struct klist kl_list;
- void (*kl_lock)(void *); /* lock function */
- void (*kl_unlock)(void *);
- void (*kl_assert_locked)(void *);
- void (*kl_assert_unlocked)(void *);
- void *kl_lockarg; /* argument passed to lock functions */
- int kl_autodestroy;
-};
-
-
-#ifdef _KERNEL
-
-/*
- * Flags for knote call
- */
-#define KNF_LISTLOCKED 0x0001 /* knlist is locked */
-#define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */
-
-#define KNOTE(list, hist, flags) knote(list, hist, flags)
-#define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED)
-#define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0)
-
-#define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list)
-
-/*
- * Flag indicating hint is a signal. Used by EVFILT_SIGNAL, and also
- * shared by EVFILT_PROC (all knotes attached to p->p_klist)
- */
-#define NOTE_SIGNAL 0x08000000
-
-/*
- * Hint values for the optional f_touch event filter. If f_touch is not set
- * to NULL and f_isfd is zero the f_touch filter will be called with the type
- * argument set to EVENT_REGISTER during a kevent() system call. It is also
- * called under the same conditions with the type argument set to EVENT_PROCESS
- * when the event has been triggered.
- */
-#define EVENT_REGISTER 1
-#define EVENT_PROCESS 2
-
-struct filterops {
- int f_isfd; /* true if ident == filedescriptor */
- int (*f_attach)(struct knote *kn);
- void (*f_detach)(struct knote *kn);
- int (*f_event)(struct knote *kn, long hint);
- void (*f_touch)(struct knote *kn, struct kevent *kev, u_long type);
-};
-
-/*
- * An in-flux knote cannot be dropped from its kq while the kq is
- * unlocked. If the KN_SCAN flag is not set, a thread can only set
- * kn_influx when it is exclusive owner of the knote state, and can
- * modify kn_status as if it had the KQ lock. KN_SCAN must not be set
- * on a knote which is already in flux.
- *
- * kn_sfflags, kn_sdata, and kn_kevent are protected by the knlist lock.
- */
-struct knote {
- SLIST_ENTRY(knote) kn_link; /* for kq */
- SLIST_ENTRY(knote) kn_selnext; /* for struct selinfo */
- struct knlist *kn_knlist; /* f_attach populated */
- TAILQ_ENTRY(knote) kn_tqe;
- struct kqueue *kn_kq; /* which queue we are on */
- struct kevent kn_kevent;
- void *kn_hook;
- int kn_hookid;
- int kn_status; /* protected by kq lock */
-#define KN_ACTIVE 0x01 /* event has been triggered */
-#define KN_QUEUED 0x02 /* event is on queue */
-#define KN_DISABLED 0x04 /* event is disabled */
-#define KN_DETACHED 0x08 /* knote is detached */
-#define KN_MARKER 0x20 /* ignore this knote */
-#define KN_KQUEUE 0x40 /* this knote belongs to a kq */
-#define KN_HASKQLOCK 0x80 /* for _inevent */
-#define KN_SCAN 0x100 /* flux set in kqueue_scan() */
- int kn_influx;
- int kn_sfflags; /* saved filter flags */
- intptr_t kn_sdata; /* saved data field */
- union {
- struct file *p_fp; /* file data pointer */
- struct proc *p_proc; /* proc pointer */
- struct kaiocb *p_aio; /* AIO job pointer */
- struct aioliojob *p_lio; /* LIO job pointer */
- void *p_v; /* generic other pointer */
- } kn_ptr;
- struct filterops *kn_fop;
-
-#define kn_id kn_kevent.ident
-#define kn_filter kn_kevent.filter
-#define kn_flags kn_kevent.flags
-#define kn_fflags kn_kevent.fflags
-#define kn_data kn_kevent.data
-#define kn_fp kn_ptr.p_fp
-};
-struct kevent_copyops {
- void *arg;
- int (*k_copyout)(void *arg, struct kevent *kevp, int count);
- int (*k_copyin)(void *arg, struct kevent *kevp, int count);
-};
-
-struct thread;
-struct proc;
-struct knlist;
-struct mtx;
-struct rwlock;
-
-void knote(struct knlist *list, long hint, int lockflags);
-void knote_fork(struct knlist *list, int pid);
-struct knlist *knlist_alloc(struct mtx *lock);
-void knlist_detach(struct knlist *knl);
-void knlist_add(struct knlist *knl, struct knote *kn, int islocked);
-void knlist_remove(struct knlist *knl, struct knote *kn, int islocked);
-int knlist_empty(struct knlist *knl);
-void knlist_init(struct knlist *knl, void *lock, void (*kl_lock)(void *),
- void (*kl_unlock)(void *), void (*kl_assert_locked)(void *),
- void (*kl_assert_unlocked)(void *));
-void knlist_init_mtx(struct knlist *knl, struct mtx *lock);
-void knlist_init_rw_reader(struct knlist *knl, struct rwlock *lock);
-void knlist_destroy(struct knlist *knl);
-void knlist_cleardel(struct knlist *knl, struct thread *td,
- int islocked, int killkn);
-#define knlist_clear(knl, islocked) \
- knlist_cleardel((knl), NULL, (islocked), 0)
-#define knlist_delete(knl, td, islocked) \
- knlist_cleardel((knl), (td), (islocked), 1)
-void knote_fdclose(struct thread *p, int fd);
-int kqfd_register(int fd, struct kevent *kev, struct thread *p,
- int waitok);
-int kqueue_add_filteropts(int filt, struct filterops *filtops);
-int kqueue_del_filteropts(int filt);
-
-#else /* !_KERNEL */
-
-#include <sys/cdefs.h>
-struct timespec;
-
-__BEGIN_DECLS
-int kqueue(void);
-int kevent(int kq, const struct kevent *changelist, int nchanges,
- struct kevent *eventlist, int nevents,
- const struct timespec *timeout);
-__END_DECLS
-
-#endif /* !_KERNEL */
-
-#endif /* !_SYS_EVENT_H_ */
diff --git a/cpukit/libcsupport/include/sys/poll.h b/cpukit/libcsupport/include/sys/poll.h
deleted file mode 100644
index c955f321c7..0000000000
--- a/cpukit/libcsupport/include/sys/poll.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * Copyright (c) 1997 Peter Wemm <peter@freebsd.org>
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _SYS_POLL_H_
-#define _SYS_POLL_H_
-
-#include <sys/cdefs.h>
-
-/*
- * This file is intended to be compatible with the traditional poll.h.
- */
-
-typedef unsigned int nfds_t;
-
-/*
- * This structure is passed as an array to poll(2).
- */
-struct pollfd {
- int fd; /* which file descriptor to poll */
- short events; /* events we are interested in */
- short revents; /* events found on return */
-};
-
-/*
- * Requestable events. If poll(2) finds any of these set, they are
- * copied to revents on return.
- * XXX Note that FreeBSD doesn't make much distinction between POLLPRI
- * and POLLRDBAND since none of the file types have distinct priority
- * bands - and only some have an urgent "mode".
- * XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV
- * POLLIN includes all of normal, band and urgent data. Most poll handlers
- * on FreeBSD only treat it as "normal" data.
- */
-#define POLLIN 0x0001 /* any readable data available */
-#define POLLPRI 0x0002 /* OOB/Urgent readable data */
-#define POLLOUT 0x0004 /* file descriptor is writeable */
-#define POLLRDNORM 0x0040 /* non-OOB/URG data available */
-#define POLLWRNORM POLLOUT /* no write type differentiation */
-#define POLLRDBAND 0x0080 /* OOB/Urgent readable data */
-#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */
-
-#if __BSD_VISIBLE
-/* General FreeBSD extension (currently only supported for sockets): */
-#define POLLINIGNEOF 0x2000 /* like POLLIN, except ignore EOF */
-#endif
-
-/*
- * These events are set if they occur regardless of whether they were
- * requested.
- */
-#define POLLERR 0x0008 /* some poll error occurred */
-#define POLLHUP 0x0010 /* file descriptor was "hung up" */
-#define POLLNVAL 0x0020 /* requested events "invalid" */
-
-#if __BSD_VISIBLE
-
-#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\
- POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
-
-/*
- * Request that poll() wait forever.
- * XXX in SYSV, this is defined in stropts.h, which is not included
- * by poll.h.
- */
-#define INFTIM (-1)
-
-#endif
-
-#ifndef _KERNEL
-
-__BEGIN_DECLS
-int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);
-__END_DECLS
-
-#endif /* !_KERNEL */
-
-#endif /* !_SYS_POLL_H_ */
diff --git a/cpukit/libcsupport/include/sys/statvfs.h b/cpukit/libcsupport/include/sys/statvfs.h
deleted file mode 100644
index cf80478aae..0000000000
--- a/cpukit/libcsupport/include/sys/statvfs.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @file
- *
- * @brief Interface to the statvfs() Set of API Methods
- *
- * This include file defines the interface to the statvfs() set of
- * API methods. The statvfs as defined by the SUS:
- *
- * - http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html
- */
-
-/*
- * COPYRIGHT (c) 2009 Chris Johns <chrisj@rtems.org>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-/*
- */
-
-#ifndef _SYS_STATVFS_H_
-#define _SYS_STATVFS_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef uint64_t fsblkcnt_t;
-typedef uint32_t fsfilcnt_t;
-
-struct statvfs
-{
- unsigned long f_bsize; /**< File system block size. */
- unsigned long f_frsize; /**< Fundamental file system block size. */
- fsblkcnt_t f_blocks; /**< Total number of blocks on file system in units
- * of f_frsize. */
- fsblkcnt_t f_bfree; /**< Total number of free blocks. */
- fsblkcnt_t f_bavail; /**< Number of free blocks available to
- * non-privileged process. */
- fsfilcnt_t f_files; /**< Total number of file serial numbers. */
- fsfilcnt_t f_ffree; /**< Total number of free file serial numbers. */
- fsfilcnt_t f_favail; /**< Number of file serial numbers available to
- * non-privileged process. */
- unsigned long f_fsid; /**< File system ID. */
- unsigned long f_flag; /**< Bit mask of f_flag values. */
- unsigned long f_namemax; /**< Maximum filename length. */
-};
-
-extern int statvfs(const char *__restrict , struct statvfs *__restrict);
-extern int fstatvfs(int, struct statvfs *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/cpukit/libcsupport/include/sys/utsname.h b/cpukit/libcsupport/include/sys/utsname.h
deleted file mode 100644
index ddeb0e90c2..0000000000
--- a/cpukit/libcsupport/include/sys/utsname.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * @file
- *
- * @brief Interface to the POSIX utsname() Service
- *
- * This include file defines the interface to the POSIX utsname() service.
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef __POSIX_SYS_UTSNAME_h
-#define __POSIX_SYS_UTSNAME_h
-
-/**
- * @defgroup UTSNAME utsname Service
- *
- * @ingroup POSIXAPI
- */
-/**@{*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90
- *
- * NOTE: The lengths of the strings in this structure are
- * just long enough to reliably contain the RTEMS information.
- * For example, the fields are not long enough to support
- * Internet hostnames.
- */
-
-#ifdef _KERNEL
-#define SYS_NMLN 48 /* uname(2) for the FreeBSD 1.1 ABI. */
-#endif
-
-#ifndef SYS_NMLN
-#define SYS_NMLN 48 /* User can override. */
-#endif
-
-struct utsname {
- char sysname[SYS_NMLN]; /* Name of this implementation of the */
- /* operating system */
- char nodename[SYS_NMLN]; /* Name of this node within an implementation */
- /* specified communication network */
- char release[SYS_NMLN]; /* Current release level of this implementation */
- char version[SYS_NMLN]; /* Current version level of this release */
- char machine[SYS_NMLN]; /* Name of the hardware type on which the system */
- /* is running */
-};
-
-/**
- * @brief Get system name.
- *
- * 4.4.1 Get System Name, P1003.1b-1993, p. 90
- */
-int uname(
- struct utsname *name
-);
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */
diff --git a/cpukit/libcsupport/include/vmeintr.h b/cpukit/libcsupport/include/vmeintr.h
deleted file mode 100644
index 74bda9bf08..0000000000
--- a/cpukit/libcsupport/include/vmeintr.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- *
- * @brief VMEbus Interface Library
- *
- * This file is the specification for the VMEbus interface library
- * which should be provided by all BSPs for VMEbus Single Board
- * Computers but currently only a few do so.
- */
-
-/*
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_VMEINTR_H
-#define _RTEMS_VMEINTR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This defines the mask which is used to determine which
- * interrupt levels are affected by a call to this package.
- * The LSB corresponds to VME interrupt 0 and the MSB
- * to VME interrupt 7.
- *
- */
-
-typedef uint8_t VME_interrupt_Mask;
-
-/*
- * VME_interrupt_Disable
- *
- */
-
-void VME_interrupt_Disable (
- VME_interrupt_Mask mask /* IN */
-);
-
-/*
- * VME_interrupt_Disable
- *
- */
-
-void VME_interrupt_Enable (
- VME_interrupt_Mask mask /* IN */
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* end of include file */
diff --git a/cpukit/libcsupport/preinstall.am b/cpukit/libcsupport/preinstall.am
deleted file mode 100644
index 01a128e2ff..0000000000
--- a/cpukit/libcsupport/preinstall.am
+++ /dev/null
@@ -1,101 +0,0 @@
-## Automatically generated by ampolish3 - Do not edit
-
-if AMPOLISH3
-$(srcdir)/preinstall.am: Makefile.am
- $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
-endif
-
-PREINSTALL_DIRS =
-DISTCLEANFILES = $(PREINSTALL_DIRS)
-
-all-am: $(PREINSTALL_FILES)
-
-PREINSTALL_FILES =
-CLEANFILES = $(PREINSTALL_FILES)
-
-$(PROJECT_INCLUDE)/rtems/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/rtems
- @: > $(PROJECT_INCLUDE)/rtems/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/$(dirstamp)
-
-$(PROJECT_INCLUDE)/rtems/iosupp.h: include/iosupp.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/iosupp.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/iosupp.h
-
-$(PROJECT_INCLUDE)/rtems/ringbuf.h: include/ringbuf.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/ringbuf.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/ringbuf.h
-
-$(PROJECT_INCLUDE)/rtems/tod.h: include/rtems/tod.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/tod.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/tod.h
-
-$(PROJECT_INCLUDE)/rtems/spurious.h: include/spurious.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/spurious.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/spurious.h
-
-$(PROJECT_INCLUDE)/rtems/vmeintr.h: include/vmeintr.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/vmeintr.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/vmeintr.h
-
-$(PROJECT_INCLUDE)/rtems/assoc.h: include/rtems/assoc.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/assoc.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/assoc.h
-
-$(PROJECT_INCLUDE)/rtems/deviceio.h: include/rtems/deviceio.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/deviceio.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/deviceio.h
-
-$(PROJECT_INCLUDE)/rtems/error.h: include/rtems/error.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/error.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/error.h
-
-$(PROJECT_INCLUDE)/rtems/libcsupport.h: include/rtems/libcsupport.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/libcsupport.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libcsupport.h
-
-$(PROJECT_INCLUDE)/rtems/libio.h: include/rtems/libio.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/libio.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libio.h
-
-$(PROJECT_INCLUDE)/rtems/libio_.h: include/rtems/libio_.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/libio_.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libio_.h
-
-$(PROJECT_INCLUDE)/rtems/malloc.h: include/rtems/malloc.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/malloc.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/malloc.h
-
-$(PROJECT_INCLUDE)/rtems/termiostypes.h: include/rtems/termiostypes.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/termiostypes.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/termiostypes.h
-
-$(PROJECT_INCLUDE)/rtems/gxx_wrappers.h: include/rtems/gxx_wrappers.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/gxx_wrappers.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/gxx_wrappers.h
-
-$(PROJECT_INCLUDE)/machine/$(dirstamp):
- @$(MKDIR_P) $(PROJECT_INCLUDE)/machine
- @: > $(PROJECT_INCLUDE)/machine/$(dirstamp)
-PREINSTALL_DIRS += $(PROJECT_INCLUDE)/machine/$(dirstamp)
-
-$(PROJECT_INCLUDE)/machine/_kernel_cpuset.h: include/machine/_kernel_cpuset.h $(PROJECT_INCLUDE)/machine/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/machine/_kernel_cpuset.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine/_kernel_cpuset.h
-
-$(PROJECT_INCLUDE)/machine/_kernel_param.h: include/machine/_kernel_param.h $(PROJECT_INCLUDE)/machine/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/machine/_kernel_param.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine/_kernel_param.h
-
-$(PROJECT_INCLUDE)/machine/_kernel_time.h: include/machine/_kernel_time.h $(PROJECT_INCLUDE)/machine/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/machine/_kernel_time.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine/_kernel_time.h
-
-$(PROJECT_INCLUDE)/machine/_kernel_types.h: include/machine/_kernel_types.h $(PROJECT_INCLUDE)/machine/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/machine/_kernel_types.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine/_kernel_types.h
-
-$(PROJECT_INCLUDE)/machine/_timecounter.h: include/machine/_timecounter.h $(PROJECT_INCLUDE)/machine/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/machine/_timecounter.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/machine/_timecounter.h
-