From patchwork Sat May 5 12:40:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Jezak X-Patchwork-Id: 157039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 34FA3B6FEF for ; Sat, 5 May 2012 22:40:09 +1000 (EST) Received: from qmta01.westchester.pa.mail.comcast.net (qmta01.westchester.pa.mail.comcast.net [76.96.62.16]) by ozlabs.org (Postfix) with ESMTP id 11090B6FD1 for ; Sat, 5 May 2012 22:40:04 +1000 (EST) Received: from omta17.westchester.pa.mail.comcast.net ([76.96.62.89]) by qmta01.westchester.pa.mail.comcast.net with comcast id 6Bg41j0021vXlb851CftjP; Sat, 05 May 2012 12:39:53 +0000 Received: from [192.168.1.100] ([67.172.56.136]) by omta17.westchester.pa.mail.comcast.net with comcast id 6Cg21j01C2wLdeB3dCg2Uq; Sat, 05 May 2012 12:40:03 +0000 Message-ID: <4FA51FA2.1070604@gentoo.org> Date: Sat, 05 May 2012 08:40:02 -0400 From: Joseph Jezak User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120330 Thunderbird/10.0.3 MIME-Version: 1.0 To: yaboot-devel@lists.ozlabs.org Subject: Re: yaboot doesn't build against new e2fsprogs-1.42 References: <24121266.364901323193562713.JavaMail.defaultUser@defaultHost> <20120111193846.4ba5f2f7.acrux_it@libero.it> <4FA0CE6A.7010106@gentoo.org> In-Reply-To: <4FA0CE6A.7010106@gentoo.org> X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Here's a fixed version of the patch which works with e2fsprogs-1.42.x -Joe diff --git a/lib/malloc.c b/lib/malloc.c index 0121112..e6b29c4 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -64,6 +64,15 @@ void *malloc (unsigned int size) return caddr; } +/* Calloc wrapper for malloc */ +void *memset(void *s, int c, size_t n); +void *calloc(size_t nmemb, size_t size) { + void *caddr; + caddr = malloc(nmemb * size); + memset(caddr, 0, nmemb * size); + return caddr; +} + /* Do not fall back to the malloc above as posix_memalign is needed by * external libraries not yaboot */ int posix_memalign(void **memptr, size_t alignment, size_t size) diff --git a/lib/nonstd.c b/lib/nonstd.c index 5aeb0cb..b536180 100644 --- a/lib/nonstd.c +++ b/lib/nonstd.c @@ -65,3 +65,147 @@ char *getenv(const char *name) { return NULL; } + +// I tried to use prom functions for these... +int open(const char *pathname, int flags) { + return (int) prom_open((char *)pathname); +} + +int open64(const char *pathname, int flags) { + return (int) prom_open((char *)pathname); +} + +int __open64_2 (__const char *__path, int __oflag) { + return (int) prom_open((char *)__path); +} + +int read(int fd, void *buf, size_t count) { + return prom_read((void *)fd, buf, count); +} + +int close(int fd) { + prom_close((void *)fd); + return 0; +} + +void exit(int status) { + prom_exit(); + return; +} + +int __printf_chk(int flag, const char *format, ...) { + va_list ap; + va_start (ap, format); + prom_vfprintf (prom_stdout, format, ap); + va_end (ap); + + return 0; +} + +int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) { + va_list ap; + va_start(ap, format); + // No sprintf? :( + va_end(ap); + return 0; + +} + +int __fprintf_chk(FILE *stream, int flag, const char *format, ...) { + va_list ap; + va_start (ap, format); + prom_vfprintf (prom_stdout, format, ap); + va_end (ap); + + return 0; +} + +void *memcpy(void *dest, const void *src, size_t n); +void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) { + return memcpy(dest, src, n); +} + +// But these are all dummy functions +int __xstat64 (int __ver, const char *__filename, void *__stat_buf) { + return 0; +} + +int stat64(const char *path, void *stat_buf) { + return 0; +} + +int fstat64(int fildes, void *stat_buf) { + return 0; +} + +int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) { + return 0; +} + +signed int random(void) { + return 0; +} + +void srandom(unsigned int seed) { + return; +} + +int rand(void) { + return 0; +} + +void srand(unsigned int seed) { + return; +} + +unsigned int sleep(unsigned int seconds) { + return 0; +} + +int gettimeofday(void *tv, void *tz) { + return 0; +} + +long sysconf(int name) { + return 0; +} + +int getpagesize(void) { + return 0; +} + +int gethostname(char *name, size_t len) { + return 0; +} + +int getpid(void) { + return 0; +} + +int getuid(void) { + return 0; +} + +void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) { + return; +} + +int * __errno_location(void) { + return 0; +} + +int lseek(int fd, int offset, int whence) { + return prom_lseek ((void *)fd, whence + offset); +} + +int lseek64(int fd, int offset, int whence) { + return prom_lseek ((void *)fd, whence + offset); +} + +size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) { + return 0; +} + + +int stderr = 0; +int perror = 0;