RTEMS 7.0-rc1
Loading...
Searching...
No Matches
kernel-rtems.h
1/*
2 * Copyright (C) 2013 embedded brains GmbH & Co. KG
3 * Copyright (C) 2016 Chris Johns <chrisj@rtems.org>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef __LINUX_RTEMS_IMPL_H__
28#define __LINUX_RTEMS_IMPL_H__
29
30#include <rtems.h>
31#include <rtems/bspIo.h>
32
33static inline char *do_kmemdup(const char *s, size_t n)
34{
35 char *dup = malloc(n + 1);
36
37 if (dup != 0) {
38 dup[n] = '\0';
39 dup = memcpy(dup, s, n);
40 }
41
42 return dup;
43}
44
45/*
46 * Provide a private printk to avoid all the formatting warnings in the JFFS2 code.
47 */
48static inline int jffs2_printk(const char* fmt, ...)
49{
50 va_list ap;
51 int r;
52 va_start(ap, fmt);
53 r = vprintk(fmt, ap);
54 va_end(ap);
55 return r;
56}
57
58#undef printk
59#define printk jffs2_printk
60
61#endif /* __LINUX_RTEMS_IMPL_H__ */
This header file provides the kernel character input/output support API.
int vprintk(const char *fmt, va_list ap)
Outputs the characters defined by the format string and the variable argument list to the kernel char...
Definition: vprintk.c:43
This header file defines the RTEMS Classic API.