summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/boot.h5
-rw-r--r--include/command.h6
-rw-r--r--include/common.h29
-rw-r--r--include/crc.h102
-rw-r--r--include/dirent.h20
-rw-r--r--include/elf.h2
-rw-r--r--include/fb.h4
-rw-r--r--include/fcntl.h100
-rw-r--r--include/fs.h56
-rw-r--r--include/globalvar.h1
-rw-r--r--include/libfile.h7
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/rbtree.h4
-rw-r--r--include/linux/stddef.h2
-rw-r--r--include/mtd/utils.h2
-rw-r--r--include/platform_data/eth-davinci-emac.h (renamed from include/net/davinci_emac.h)0
-rw-r--r--include/platform_data/eth-designware.h (renamed from include/net/designware.h)0
-rw-r--r--include/platform_data/eth-dm9000.h (renamed from include/dm9000.h)0
-rw-r--r--include/platform_data/eth-ep93xx.h (renamed from include/net/ep93xx_eth.h)0
-rw-r--r--include/platform_data/eth-fec.h (renamed from include/fec.h)0
-rw-r--r--include/platform_data/eth-smc91111.h (renamed from include/net/smc91111.h)0
-rw-r--r--include/platform_data/eth-smc911x.h (renamed from include/smc911x.h)0
-rw-r--r--include/platform_data/ide.h (renamed from include/platform_ide.h)0
-rw-r--r--include/platform_data/serial-ns16550.h (renamed from include/ns16550.h)0
-rw-r--r--include/shell.h11
-rw-r--r--include/stdio.h57
-rw-r--r--include/string.h1
-rw-r--r--include/sys/ioctl.h6
-rw-r--r--include/sys/mount.h8
-rw-r--r--include/sys/stat.h9
-rw-r--r--include/unistd.h24
-rw-r--r--include/w1_mac_address.h2
-rw-r--r--include/wchar.h3
34 files changed, 153 insertions, 312 deletions
diff --git a/include/boot.h b/include/boot.h
index 0198cc8826..8fcbb7f012 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -21,6 +21,11 @@ struct bootm_data {
enum bootm_verify verify;
bool force;
bool dryrun;
+ /*
+ * appendroot - if true, try to add a suitable root= Kernel option to
+ * mount the rootfs from the same device as the Kernel comes from.
+ */
+ bool appendroot;
unsigned long initrd_address;
unsigned long os_address;
unsigned long os_entry;
diff --git a/include/command.h b/include/command.h
index 3aca1a9f1b..2e7278099b 100644
--- a/include/command.h
+++ b/include/command.h
@@ -25,10 +25,7 @@
#include <linux/list.h>
#include <linux/stringify.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
+#include <linux/stddef.h>
#ifndef __ASSEMBLY__
@@ -71,6 +68,7 @@ extern struct command __barebox_cmd_end;
struct command *find_cmd(const char *cmd);
int execute_command(int argc, char **argv);
void barebox_cmd_usage(struct command *cmdtp);
+int run_command(const char *cmd);
#define COMMAND_SUCCESS 0
#define COMMAND_ERROR 1
diff --git a/include/common.h b/include/common.h
index 38a6dbf933..680a0affb6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -61,7 +61,6 @@ void __noreturn hang (void);
char *size_human_readable(unsigned long long size);
-int run_command(const char *cmd);
int readline (const char *prompt, char *buf, int len);
/* common/memsize.c */
@@ -70,12 +69,6 @@ long get_ram_size (volatile long *, long);
/* $(CPU)/cpu.c */
void __noreturn poweroff(void);
-/* lib_generic/crc32.c */
-uint32_t crc32(uint32_t, const void*, unsigned int);
-uint32_t crc32_no_comp(uint32_t, const void*, unsigned int);
-int file_crc(char *filename, ulong start, ulong size, ulong *crc,
- ulong *total);
-
/* common/console.c */
int ctrlc (void);
@@ -88,16 +81,6 @@ static inline void dump_stack(void)
}
#endif
-#define MEMAREA_SIZE_SPECIFIED 1
-
-struct memarea_info {
- struct device_d *device;
- unsigned long start;
- unsigned long end;
- unsigned long size;
- unsigned long flags;
-};
-
int parse_area_spec(const char *str, loff_t *start, loff_t *size);
/* Just like simple_strtoul(), but this one honors a K/M/G suffix */
@@ -113,17 +96,6 @@ extern int (*barebox_main)(void);
void __noreturn start_barebox(void);
void shutdown_barebox(void);
-int run_shell(void);
-
-#ifdef CONFIG_SHELL_HUSH
-char *shell_expand(char *str);
-#else
-static inline char *shell_expand(char *str)
-{
- return strdup(str);
-}
-#endif
-
#define ALIGN_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1))
#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
@@ -156,7 +128,6 @@ static inline void print_hex_dump(const char *level, const char *prefix_str,
int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
char **sourcefile, char **destfile, int *swab);
-int open_and_lseek(const char *filename, int mode, loff_t pos);
#define RW_BUF_SIZE (unsigned)4096
extern const char version_string[];
diff --git a/include/crc.h b/include/crc.h
index 4290f41c57..847a0a4b64 100644
--- a/include/crc.h
+++ b/include/crc.h
@@ -1,100 +1,14 @@
-/*
- *==========================================================================
- *
- * crc.h
- *
- * Interface for the CRC algorithms.
- *
- *==========================================================================
- *####ECOSGPLCOPYRIGHTBEGIN####
- * -------------------------------------------
- * This file is part of eCos, the Embedded Configurable Operating System.
- * Copyright (C) 2002 Andrew Lunn
- *
- * eCos is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 or (at your option) any later version.
- *
- * eCos is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with eCos; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * As a special exception, if other files instantiate templates or use macros
- * or inline functions from this file, or you compile this file and link it
- * with other works to produce a work based on this file, this file does not
- * by itself cause the resulting work to be covered by the GNU General Public
- * License. However the source code for this file must still be made available
- * in accordance with section (3) of the GNU General Public License.
- *
- * This exception does not invalidate any other reasons why a work based on
- * this file might be covered by the GNU General Public License.
- *
- * Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
- * at http: *sources.redhat.com/ecos/ecos-license/
- * -------------------------------------------
- *####ECOSGPLCOPYRIGHTEND####
- *==========================================================================
- *#####DESCRIPTIONBEGIN####
- *
- * Author(s): Andrew Lunn
- * Contributors: Andrew Lunn
- * Date: 2002-08-06
- * Purpose:
- * Description:
- *
- * This code is part of eCos (tm).
- *
- *####DESCRIPTIONEND####
- *
- *==========================================================================
- */
-
-#ifndef _SERVICES_CRC_CRC_H_
-#define _SERVICES_CRC_CRC_H_
+#ifndef __INCLUDE_CRC_H
+#define __INCLUDE_CRC_H
#include <linux/types.h>
-#ifndef __externC
-# ifdef __cplusplus
-# define __externC extern "C"
-# else
-# define __externC extern
-# endif
-#endif
-
-/* Compute a CRC, using the POSIX 1003 definition */
-extern uint32_t
-cyg_posix_crc32(unsigned char *s, int len);
-
-/* Gary S. Brown's 32 bit CRC */
-
-extern uint32_t
-cyg_crc32(unsigned char *s, int len);
-
-/* Gary S. Brown's 32 bit CRC, but accumulate the result from a */
-/* previous CRC calculation */
-
-extern uint32_t
-cyg_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
-
-/* Ethernet FCS Algorithm */
-
-extern uint32_t
-cyg_ether_crc32(unsigned char *s, int len);
-
-/* Ethernet FCS algorithm, but accumulate the result from a previous */
-/* CRC calculation. */
-
-extern uint32_t
-cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
-
/* 16 bit CRC with polynomial x^16+x^12+x^5+1 */
-
extern uint16_t cyg_crc16(const unsigned char *s, int len);
-#endif /* _SERVICES_CRC_CRC_H_ */
+uint32_t crc32(uint32_t, const void *, unsigned int);
+uint32_t crc32_no_comp(uint32_t, const void *, unsigned int);
+int file_crc(char *filename, unsigned long start, unsigned long size,
+ unsigned long *crc, unsigned long *total);
+
+#endif /* __INCLUDE_CRC_H */
diff --git a/include/dirent.h b/include/dirent.h
new file mode 100644
index 0000000000..5ee4c2063e
--- /dev/null
+++ b/include/dirent.h
@@ -0,0 +1,20 @@
+#ifndef __DIRENT_H
+#define __DIRENT_H
+
+struct dirent {
+ char d_name[256];
+};
+
+typedef struct dir {
+ struct device_d *dev;
+ struct fs_driver_d *fsdrv;
+ struct node_d *node;
+ struct dirent d;
+ void *priv; /* private data for the fs driver */
+} DIR;
+
+DIR *opendir(const char *pathname);
+struct dirent *readdir(DIR *dir);
+int closedir(DIR *dir);
+
+#endif /* __DIRENT_H */
diff --git a/include/elf.h b/include/elf.h
index 6d4addf53b..a749bec34e 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -284,7 +284,7 @@ typedef struct elf64_phdr {
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
-
+
typedef struct {
Elf32_Word sh_name;
Elf32_Word sh_type;
diff --git a/include/fb.h b/include/fb.h
index cf113c4300..b2a9c7152b 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -73,8 +73,8 @@ struct fb_videomode {
struct fb_bitfield {
u32 offset; /* beginning of bitfield */
u32 length; /* length of bitfield */
- u32 msb_right; /* != 0 : Most significant bit is */
- /* right */
+ u32 msb_right; /* != 0 : Most significant bit is */
+ /* right */
};
struct fb_info;
diff --git a/include/fcntl.h b/include/fcntl.h
index 12f370a418..98020bdfb1 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -1,5 +1,5 @@
-#ifndef _ASM_GENERIC_FCNTL_H
-#define _ASM_GENERIC_FCNTL_H
+#ifndef __FCNTL_H
+#define __FCNTL_H
#include <linux/types.h>
@@ -24,97 +24,7 @@
#define O_RWSIZE_4 004000000
#define O_RWSIZE_8 010000000
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get close_on_exec */
-#define F_SETFD 2 /* set/clear close_on_exec */
-#define F_GETFL 3 /* get file->f_flags */
-#define F_SETFL 4 /* set file->f_flags */
-#ifndef F_GETLK
-#define F_GETLK 5
-#define F_SETLK 6
-#define F_SETLKW 7
-#endif
-#ifndef F_SETOWN
-#define F_SETOWN 8 /* for sockets. */
-#define F_GETOWN 9 /* for sockets. */
-#endif
-#ifndef F_SETSIG
-#define F_SETSIG 10 /* for sockets. */
-#define F_GETSIG 11 /* for sockets. */
-#endif
+int open(const char *pathname, int flags, ...);
+int creat(const char *pathname, mode_t mode);
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* for posix fcntl() and lockf() */
-#ifndef F_RDLCK
-#define F_RDLCK 0
-#define F_WRLCK 1
-#define F_UNLCK 2
-#endif
-
-/* for old implementation of bsd flock () */
-#ifndef F_EXLCK
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-#endif
-
-/* for leases */
-#ifndef F_INPROGRESS
-#define F_INPROGRESS 16
-#endif
-
-/* operations for bsd flock(), also used by the kernel implementation */
-#define LOCK_SH 1 /* shared lock */
-#define LOCK_EX 2 /* exclusive lock */
-#define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-#define LOCK_UN 8 /* remove lock */
-
-#define LOCK_MAND 32 /* This is a mandatory flock ... */
-#define LOCK_READ 64 /* which allows concurrent read operations */
-#define LOCK_WRITE 128 /* which allows concurrent write operations */
-#define LOCK_RW 192 /* which allows concurrent read & write ops */
-
-#define F_LINUX_SPECIFIC_BASE 1024
-
-#ifndef HAVE_ARCH_STRUCT_FLOCK
-#ifndef __ARCH_FLOCK_PAD
-#define __ARCH_FLOCK_PAD
-#endif
-
-struct flock {
- short l_type;
- short l_whence;
- off_t l_start;
- off_t l_len;
- pid_t l_pid;
- __ARCH_FLOCK_PAD
-};
-#endif
-
-#ifndef CONFIG_64BIT
-
-#ifndef F_GETLK64
-#define F_GETLK64 12 /* using 'struct flock64' */
-#define F_SETLK64 13
-#define F_SETLKW64 14
-#endif
-
-#ifndef HAVE_ARCH_STRUCT_FLOCK64
-#ifndef __ARCH_FLOCK64_PAD
-#define __ARCH_FLOCK64_PAD
-#endif
-
-struct flock64 {
- short l_type;
- short l_whence;
- loff_t l_start;
- loff_t l_len;
- pid_t l_pid;
- __ARCH_FLOCK64_PAD
-};
-#endif
-#endif /* !CONFIG_64BIT */
-
-#endif /* _ASM_GENERIC_FCNTL_H */
+#endif /* __FCNTL_H */
diff --git a/include/fs.h b/include/fs.h
index 943ba55439..6a592893a9 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -1,6 +1,12 @@
#ifndef __FS_H
#define __FS_H
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <dirent.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
#include <driver.h>
#include <filetype.h>
#include <linux/fs.h>
@@ -11,18 +17,6 @@ struct partition;
struct node_d;
struct stat;
-struct dirent {
- char d_name[256];
-};
-
-typedef struct dir {
- struct device_d *dev;
- struct fs_driver_d *fsdrv;
- struct node_d *node;
- struct dirent d;
- void *priv; /* private data for the fs driver */
-} DIR;
-
typedef struct filep {
struct fs_device_d *fsdev; /* The device this FILE belongs to */
char *path;
@@ -107,43 +101,7 @@ struct fs_device_d {
#define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv)
-/*
- * standard posix file functions
- */
-int open(const char *pathname, int flags, ...);
-int creat(const char *pathname, mode_t mode);
-int unlink(const char *pathname);
-int close(int fd);
int flush(int fd);
-int lstat(const char *filename, struct stat *s);
-int stat(const char *filename, struct stat *s);
-int fstat(int fd, struct stat *s);
-ssize_t read(int fd, void *buf, size_t count);
-ssize_t pread(int fd, void *buf, size_t count, loff_t offset);
-int ioctl(int fd, int request, void *buf);
-ssize_t write(int fd, const void *buf, size_t count);
-ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset);
-
-loff_t lseek(int fildes, loff_t offset, int whence);
-int mkdir (const char *pathname, mode_t mode);
-
-/* Create a directory and its parents */
-int make_directory(const char *pathname);
-int rmdir (const char *pathname);
-
-const char *getcwd(void);
-int chdir(const char *pathname);
-
-DIR *opendir(const char *pathname);
-struct dirent *readdir(DIR *dir);
-int closedir(DIR *dir);
-
-int symlink(const char *pathname, const char *newpath);
-int readlink(const char *path, char *buf, size_t bufsiz);
-
-int mount (const char *device, const char *fsname, const char *path,
- const char *fsoptions);
-int umount(const char *pathname);
int umount_by_cdev(struct cdev *cdev);
/* not-so-standard functions */
@@ -183,8 +141,6 @@ void automount_remove(const char *_path);
int automount_add(const char *path, const char *cmd);
void automount_print(void);
-int unlink_recursive(const char *path, char **failedpath);
-
int fsdev_open_cdev(struct fs_device_d *fsdev);
const char *cdev_get_mount_path(struct cdev *cdev);
const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions);
diff --git a/include/globalvar.h b/include/globalvar.h
index e77209bd79..d0c79c07a8 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -14,6 +14,7 @@ int globalvar_add(const char *name,
int (*set)(struct device_d *dev, struct param_d *p, const char *val),
const char *(*get)(struct device_d *, struct param_d *p),
unsigned long flags);
+void globalvar_remove(const char *name);
char *globalvar_get_match(const char *match, const char *separator);
void globalvar_set_match(const char *match, const char *val);
diff --git a/include/libfile.h b/include/libfile.h
index d5b914a47a..de4f42dbd1 100644
--- a/include/libfile.h
+++ b/include/libfile.h
@@ -19,4 +19,11 @@ int copy_recursive(const char *src, const char *dst);
int compare_file(const char *f1, const char *f2);
+int open_and_lseek(const char *filename, int mode, loff_t pos);
+
+/* Create a directory and its parents */
+int make_directory(const char *pathname);
+
+int unlink_recursive(const char *path, char **failedpath);
+
#endif /* __LIBFILE_H */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index e4d185ccf8..57d5ba9523 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -1,6 +1,6 @@
/*
*
- * Definitions for mount interface. This describes the in the kernel build
+ * Definitions for mount interface. This describes the in the kernel build
* linkedlist with mounted filesystems.
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 38b0670187..d7b10afbc9 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -251,7 +251,7 @@ struct phy_driver {
struct driver_d drv;
};
-#define to_phy_driver(d) container_of(d, struct phy_driver, drv)
+#define to_phy_driver(d) ((d) ? container_of(d, struct phy_driver, drv) : NULL)
#define PHY_ANY_ID "MATCH ANY PHY"
#define PHY_ANY_UID 0xffffffff
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index d85b0adb5c..a5ef1b9a98 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -1,7 +1,7 @@
/*
Red Black Trees
(C) 1999 Andrea Arcangeli <andrea@suse.de>
-
+
* SPDX-License-Identifier: GPL-2.0+
linux/include/linux/rbtree.h
@@ -61,7 +61,7 @@ extern struct rb_node *rb_first_postorder(const struct rb_root *);
extern struct rb_node *rb_next_postorder(const struct rb_node *);
/* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
struct rb_root *root);
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index e36632872d..680d0c7662 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -17,6 +17,8 @@ enum {
#include <linux/types.h>
#endif
+typedef unsigned short wchar_t;
+
#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
diff --git a/include/mtd/utils.h b/include/mtd/utils.h
index fca64abd9d..58f89df90c 100644
--- a/include/mtd/utils.h
+++ b/include/mtd/utils.h
@@ -41,7 +41,7 @@
#define sys_errmsg errmsg
#define warnmsg(fmt, ...) do { \
- fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
+ eprintf("%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \
} while(0)
#endif /* INCLUDE_MTD_UTILS_H */
diff --git a/include/net/davinci_emac.h b/include/platform_data/eth-davinci-emac.h
index caead1fecf..caead1fecf 100644
--- a/include/net/davinci_emac.h
+++ b/include/platform_data/eth-davinci-emac.h
diff --git a/include/net/designware.h b/include/platform_data/eth-designware.h
index 7a7a26abfd..7a7a26abfd 100644
--- a/include/net/designware.h
+++ b/include/platform_data/eth-designware.h
diff --git a/include/dm9000.h b/include/platform_data/eth-dm9000.h
index a9a4635d2a..a9a4635d2a 100644
--- a/include/dm9000.h
+++ b/include/platform_data/eth-dm9000.h
diff --git a/include/net/ep93xx_eth.h b/include/platform_data/eth-ep93xx.h
index 0fb11d0acd..0fb11d0acd 100644
--- a/include/net/ep93xx_eth.h
+++ b/include/platform_data/eth-ep93xx.h
diff --git a/include/fec.h b/include/platform_data/eth-fec.h
index 699761a998..699761a998 100644
--- a/include/fec.h
+++ b/include/platform_data/eth-fec.h
diff --git a/include/net/smc91111.h b/include/platform_data/eth-smc91111.h
index 72193bf972..72193bf972 100644
--- a/include/net/smc91111.h
+++ b/include/platform_data/eth-smc91111.h
diff --git a/include/smc911x.h b/include/platform_data/eth-smc911x.h
index 4a802ee52c..4a802ee52c 100644
--- a/include/smc911x.h
+++ b/include/platform_data/eth-smc911x.h
diff --git a/include/platform_ide.h b/include/platform_data/ide.h
index f71fbfbc01..f71fbfbc01 100644
--- a/include/platform_ide.h
+++ b/include/platform_data/ide.h
diff --git a/include/ns16550.h b/include/platform_data/serial-ns16550.h
index ccf950b077..ccf950b077 100644
--- a/include/ns16550.h
+++ b/include/platform_data/serial-ns16550.h
diff --git a/include/shell.h b/include/shell.h
index b98cac3dc5..65dad0e1d1 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -9,4 +9,15 @@
int shell_get_last_return_code(void);
+int run_shell(void);
+
+#ifdef CONFIG_SHELL_HUSH
+char *shell_expand(char *str);
+#else
+static inline char *shell_expand(char *str)
+{
+ return strdup(str);
+}
+#endif
+
#endif /* __SHELL_H__ */
diff --git a/include/stdio.h b/include/stdio.h
index d0817bd071..7b2a42b817 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -9,28 +9,30 @@
*/
/* serial stuff */
-void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
-
-int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
-int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
-int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
-int vsprintf(char *buf, const char *fmt, va_list args);
-char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
-char *vasprintf(const char *fmt, va_list ap);
-int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
-int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
+void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+
+int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
+int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
+int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
+int vsprintf(char *buf, const char *fmt, va_list args);
+char *basprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+int asprintf(char **strp, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
+char *bvasprintf(const char *fmt, va_list ap);
+int vasprintf(char **strp, const char *fmt, va_list ap);
+int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
+int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
#ifndef CONFIG_CONSOLE_NONE
/* stdin */
-int tstc(void);
+int tstc(void);
/* stdout */
-void console_putc(unsigned int ch, const char c);
-int getc(void);
-int console_puts(unsigned int ch, const char *s);
-void console_flush(void);
+void console_putc(unsigned int ch, const char c);
+int getchar(void);
+int console_puts(unsigned int ch, const char *s);
+void console_flush(void);
-int vprintf(const char *fmt, va_list args);
+int vprintf(const char *fmt, va_list args);
#else
static inline int tstc(void)
{
@@ -42,7 +44,7 @@ static inline int console_puts(unsigned int ch, const char *str)
return 0;
}
-static inline int getc(void)
+static inline int getchar(void)
{
return -EINVAL;
}
@@ -87,23 +89,20 @@ static inline void putchar(char c)
console_putc(CONSOLE_STDOUT, c);
}
-/* stderr */
-#define eputc(c) console_putc(CONSOLE_STDERR, c)
-#define eputs(s) console_puts(CONSOLE_STDERR, s)
-#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
-
/*
* FILE based functions
*/
-#define stdin 0
-#define stdout 1
-#define stderr 2
+/* stderr */
+#define eprintf(fmt,args...) dprintf(STDERR_FILENO, fmt ,##args)
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
#define MAX_FILES 128
-int fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
-int fputs(int file, const char *s);
-int fputc(int file, const char c);
-int fgetc(int file);
+int dprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
+int dputs(int file, const char *s);
+int dputc(int file, const char c);
#endif /* __STDIO_H */
diff --git a/include/string.h b/include/string.h
index a833da131b..0c557d6f15 100644
--- a/include/string.h
+++ b/include/string.h
@@ -4,5 +4,6 @@
#include <linux/string.h>
void *memdup(const void *, size_t);
+int strtobool(const char *str, int *val);
#endif /* __STRING_H */
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
new file mode 100644
index 0000000000..6d6d3f5c00
--- /dev/null
+++ b/include/sys/ioctl.h
@@ -0,0 +1,6 @@
+#ifndef __SYS_IOCTL_H
+#define __SYS_IOCTL_H
+
+int ioctl(int fd, int request, void *buf);
+
+#endif /* __SYS_IOCTL_H */
diff --git a/include/sys/mount.h b/include/sys/mount.h
new file mode 100644
index 0000000000..978f3406e8
--- /dev/null
+++ b/include/sys/mount.h
@@ -0,0 +1,8 @@
+#ifndef __SYS_MOUNT_H
+#define __SYS_MOUNT_H
+
+int mount(const char *device, const char *fsname, const char *path,
+ const char *fsoptions);
+int umount(const char *pathname);
+
+#endif /* __SYS_MOUNT_H */
diff --git a/include/sys/stat.h b/include/sys/stat.h
new file mode 100644
index 0000000000..037e5f136d
--- /dev/null
+++ b/include/sys/stat.h
@@ -0,0 +1,9 @@
+#ifndef __STAT_H
+#define __STAT_H
+
+#include <linux/types.h>
+#include <linux/stat.h>
+
+int mkdir (const char *pathname, mode_t mode);
+
+#endif /* __STAT_H */
diff --git a/include/unistd.h b/include/unistd.h
new file mode 100644
index 0000000000..31f430a5b6
--- /dev/null
+++ b/include/unistd.h
@@ -0,0 +1,24 @@
+#ifndef __UNISTD_H
+#define __UNISTD_H
+
+#include <linux/types.h>
+
+struct stat;
+
+int unlink(const char *pathname);
+int close(int fd);
+int lstat(const char *filename, struct stat *s);
+int stat(const char *filename, struct stat *s);
+int fstat(int fd, struct stat *s);
+ssize_t read(int fd, void *buf, size_t count);
+ssize_t pread(int fd, void *buf, size_t count, loff_t offset);
+ssize_t write(int fd, const void *buf, size_t count);
+ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset);
+loff_t lseek(int fildes, loff_t offset, int whence);
+int rmdir (const char *pathname);
+int symlink(const char *pathname, const char *newpath);
+int readlink(const char *path, char *buf, size_t bufsiz);
+int chdir(const char *pathname);
+const char *getcwd(void);
+
+#endif /* __UNISTD_H */
diff --git a/include/w1_mac_address.h b/include/w1_mac_address.h
index 89dd914095..cd4be765f7 100644
--- a/include/w1_mac_address.h
+++ b/include/w1_mac_address.h
@@ -33,7 +33,7 @@ static inline int w1_local_mac_address_register(int ethid, char * oui, char *w1_
addr[i] = oui[i];
}
- tmp = asprintf("%s.id", w1_dev);
+ tmp = basprintf("%s.id", w1_dev);
if (!tmp)
return -ENOMEM;
diff --git a/include/wchar.h b/include/wchar.h
index 702d8e239a..adb4f373e9 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -2,8 +2,7 @@
#define __WCHAR_H
#include <linux/types.h>
-
-typedef u16 wchar_t;
+#include <linux/stddef.h>
wchar_t *strdup_wchar(const wchar_t *src);