diff options
author | bencollins <tailor@grayson> | 2001-06-16 06:35:24 -0400 |
---|---|---|
committer | Ben Collins <bcollins@ubuntu.com> | 2006-06-01 13:18:04 -0400 |
commit | f7e2c8fe49f3de49f7a254ef459831ce7c70e400 (patch) | |
tree | ec017b78f91e710bb9deab7f031e2db1943ac48f | |
parent | 5ce9d6812cea376e94dfe790dd7433c97ee39011 (diff) | |
download | silo-f7e2c8fe49f3de49f7a254ef459831ce7c70e400.tar.gz |
[silo @ 39]
* common/printf.c: Cleanups, and document correct allowed formats.
Also output format if unrecognized.
* common/stringops2.c: Remove unused code that was only needed for
libext2fs.a.
* common/tree.c: Remove unused code.
* first/cd.S: Minor formatting changes to match fd.S.
* include/promlib.h: Remove non-existent declerations.
* include/silo.h: Likewise.
* include/stringops.h: Likewise.
* include/ext2fs/bitops.h: Updated from current e2fsprogs.
* include/ext2fs/ext2_err.h: Likewise.
* include/ext2fs/ext2fs.h: Likewise.
* include/ext2fs/ext2_io.h: Used to be io.h, from update.
* second/file.c: Remove extraneous includes.
* second/fs/ext2.c: Add realloc() and time() stubs.
* include/et/error_table.h: Removed.
* include/et/internal.h: Removed.
* include/et/mit-sipb-copyright.h: Removed.
* include/ext2fs/ext2_err.et: Removed.
* include/ext2fs/io.h: Removed.
* include/non-linux/iso_fs.h: Removed.
* include/non-linux/romfs_fs.h: Removed.#
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | common/printf.c | 14 | ||||
-rw-r--r-- | common/stringops2.c | 19 | ||||
-rw-r--r-- | common/tree.c | 130 | ||||
-rw-r--r-- | first/cd.S | 42 | ||||
-rw-r--r-- | include/et/error_table.h | 35 | ||||
-rw-r--r-- | include/et/internal.h | 22 | ||||
-rw-r--r-- | include/et/mit-sipb-copyright.h | 19 | ||||
-rw-r--r-- | include/ext2fs/bitops.h | 58 | ||||
-rw-r--r-- | include/ext2fs/ext2_err.et | 216 | ||||
-rw-r--r-- | include/ext2fs/ext2_err.h | 125 | ||||
-rw-r--r-- | include/ext2fs/ext2_io.h (renamed from include/ext2fs/io.h) | 13 | ||||
-rw-r--r-- | include/ext2fs/ext2fs.h | 314 | ||||
-rw-r--r-- | include/non-linux/iso_fs.h | 197 | ||||
-rw-r--r-- | include/non-linux/romfs_fs.h | 62 | ||||
-rw-r--r-- | include/promlib.h | 5 | ||||
-rw-r--r-- | include/silo.h | 1 | ||||
-rw-r--r-- | include/stringops.h | 2 | ||||
-rw-r--r-- | second/Makefile | 9 | ||||
-rw-r--r-- | second/file.c | 1 | ||||
-rw-r--r-- | second/file.h | 2 | ||||
-rw-r--r-- | second/fs/ext2.c | 25 | ||||
-rw-r--r-- | second/fs/romfs.c | 3 | ||||
-rw-r--r-- | second/fs/ufs.c | 3 | ||||
-rw-r--r-- | silo/Makefile | 1 | ||||
-rw-r--r-- | silo/silo.c | 2 |
26 files changed, 480 insertions, 872 deletions
@@ -1,3 +1,35 @@ +Sat Jun 16 02:15:35 EDT 2001 Ben Collins <bcollins@debian.org> + + * common/printf.c: Cleanups, and document correct allowed formats. + Also output format if unrecognized. + + * common/stringops2.c: Remove unused code that was only needed for + libext2fs.a. + + * common/tree.c: Remove unused code. + + * first/cd.S: Minor formatting changes to match fd.S. + + * include/promlib.h: Remove non-existent declerations. + * include/silo.h: Likewise. + * include/stringops.h: Likewise. + + * include/ext2fs/bitops.h: Updated from current e2fsprogs. + * include/ext2fs/ext2_err.h: Likewise. + * include/ext2fs/ext2fs.h: Likewise. + * include/ext2fs/ext2_io.h: Used to be io.h, from update. + + * second/file.c: Remove extraneous includes. + * second/fs/ext2.c: Add realloc() and time() stubs. + + * include/et/error_table.h: Removed. + * include/et/internal.h: Removed. + * include/et/mit-sipb-copyright.h: Removed. + * include/ext2fs/ext2_err.et: Removed. + * include/ext2fs/io.h: Removed. + * include/non-linux/iso_fs.h: Removed. + * include/non-linux/romfs_fs.h: Removed. + Fri Jun 15 23:45:53 EDT 2001 Ben Collins <bcollins@debian.org> * The "Fix the FSF Address Update". Replace the COPYING file with the diff --git a/common/printf.c b/common/printf.c index ae9c090..04cd2b6 100644 --- a/common/printf.c +++ b/common/printf.c @@ -1,7 +1,9 @@ /* Dumb printing routines Copyright (C) 1996 Pete A. Zaitcev - Copyright (C) 1997 Jakub Jelinek + 1997 Jakub Jelinek + 2001 Ben Collins + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,7 +63,7 @@ void putchar (char c) */ static void printn (long n, int b) { - char prbuf[24]; + static char prbuf[24]; register char *cp; if (b == 10 && n < 0) { @@ -97,20 +99,22 @@ void vprintf (char *fmt, va_list adx) } else if (c == 'c') { putchar (va_arg (adx, unsigned)); } else if (c == 's') { - s = va_arg (adx, char *); - if (s == NULL) + if ((s = va_arg (adx, char *)) == NULL) s = (char *)"(null)"; while ((c = *s++)) putchar (c); } else if (c == 'l' || c == 'O') { printn ((long) va_arg (adx, long), c == 'l' ? 10 : 8); + } else { + /* This is basically what libc's printf does */ + putchar('%'); putchar(c); } } } /* * Scaled down version of C Library printf. - * Only %c %s %u %d (==%u) %o %x %l %O are recognized. + * Only %c %s %d (==%u) %o %x %X %l %O are recognized. */ void prom_printf (char *fmt,...) diff --git a/common/stringops2.c b/common/stringops2.c index 0698520..761450c 100644 --- a/common/stringops2.c +++ b/common/stringops2.c @@ -131,22 +131,3 @@ char * strstr(const char * s1,const char * s2) } return 0; } - -/* These two are not exactly stringops... */ - -/* This one is needed for libext2fs.a. It's only a stub */ -unsigned long time(void) -{ - return 0; /* I think this is never actually used */ -} - -void *realloc(void *p, int size) -{ - return 0; /* We do not support this */ -} - -int sprintf (char *buf, char *fmt,...) -{ - strcpy (buf, fmt); - return 0; -} diff --git a/common/tree.c b/common/tree.c index 6026fe9..c4483fd 100644 --- a/common/tree.c +++ b/common/tree.c @@ -1,4 +1,4 @@ -/* $Id: tree.c,v 1.1 2001/05/25 14:41:26 bencollins Exp $ +/* $Id: tree.c,v 1.2 2001/06/16 06:35:24 bencollins Exp $ * tree.c: Basic device tree traversal/scanning for the Linux * prom library. * @@ -9,8 +9,6 @@ #include <silo.h> #include <stringops.h> -static char promlib_buf[128]; - /* Return the child of node 'node' or zero if no this node has no * direct descendent. */ @@ -118,16 +116,6 @@ int prom_getintdefault(int node, char *property, int deflt) return retval; } -/* Acquire a boolean property, 1=TRUE 0=FALSE. */ -int prom_getbool(int node, char *prop) -{ - int retval; - - retval = prom_getproplen(node, prop); - if(retval == -1) return 0; - return 1; -} - /* Acquire a property whose value is a string, returns a null * string on error. The char pointer is the user supplied string * buffer. @@ -142,18 +130,6 @@ void prom_getstring(int node, char *prop, char *user_buf, int ubuf_size) return; } - -/* Does the device at node 'node' have name 'name'? - * YES = 1 NO = 0 - */ -int prom_nodematch(int node, char *name) -{ - static char namebuf[128]; - prom_getproperty(node, "name", namebuf, sizeof(namebuf)); - if(strcmp(namebuf, name) == 0) return 1; - return 0; -} - /* Search siblings at 'node_start' for a node with name * 'nodename'. Return node if successful, zero if not. */ @@ -161,6 +137,7 @@ int prom_searchsiblings(int node_start, char *nodename) { int thisnode, error; + static char promlib_buf[128]; for(thisnode = node_start; thisnode; thisnode=prom_getsibling(thisnode)) { @@ -174,109 +151,6 @@ int prom_searchsiblings(int node_start, char *nodename) return 0; } -/* Gets name in the form prom v2+ uses it (name@x,yyyyy or name (if no reg)) */ -int prom_getname (int node, char *buffer, int len) -{ - int i; - struct linux_prom_registers reg[PROMREG_MAX]; - - i = prom_getproperty (node, "name", buffer, len); - if (i <= 0) return -1; - buffer [i] = 0; - len -= i; - i = prom_getproperty (node, "reg", (char *)reg, sizeof (reg)); - if (i <= 0) return 0; - if (len < 11) return -1; - buffer = strchr (buffer, 0); - sprintf (buffer, "@%x,%x", reg[0].which_io, (unsigned)reg[0].phys_addr); - return 0; -} - -/* Return the first property type for node 'node'. - */ -char * prom_firstprop(int node, char *buffer) -{ - char *ret; - - *buffer = 0; - if (node == -1) return buffer; - if (prom_vers != PROM_P1275) { - ret = prom_nodeops->no_nextprop(node, (char *) 0x0); - strcpy (buffer, ret); - } else { - p1275_cmd ("nextprop", 3, node, (char *)0, buffer); - } - return buffer; -} - -/* Return the property type string after property type 'oprop' - * at node 'node' . Returns NULL string if no more - * property types for this node. - */ -char * prom_nextprop(int node, char *oprop, char *buffer) -{ - char *ret; - char buf[32]; - - if (node == -1) { - *buffer = 0; - return buffer; - } - if (oprop == buffer) { - strcpy (buf, oprop); - oprop = buf; - } - *buffer = 0; - if(node == -1) return buffer; - if (prom_vers != PROM_P1275) { - ret = prom_nodeops->no_nextprop(node, oprop); - strcpy (buffer, ret); - } else { - p1275_cmd ("nextprop", 3, node, oprop, buffer); - } - return buffer; -} - -int prom_node_has_property(int node, char *prop) -{ - char buf [32]; - - *buf = 0; - do { - prom_nextprop(node, buf, buf); - if(!strcmp(buf, prop)) - return 1; - } while (*buf); - return 0; -} - -/* Set property 'pname' at node 'node' to value 'value' which has a length - * of 'size' bytes. Return the number of bytes the prom accepted. - */ -int prom_setprop(int node, char *pname, char *value, int size) -{ - int ret; - - if((pname == 0) || (value == 0)) return 0; - if (prom_vers != PROM_P1275) - ret = prom_nodeops->no_setprop(node, pname, value, size); - else - ret = p1275_cmd ("setprop", 4, node, pname, value, size); - return ret; -} - -int prom_inst2pkg(int inst) -{ - int node; - - if (prom_vers != PROM_P1275) - node = (*romvec->pv_v2devops.v2_inst2pkg)(inst); - else - node = p1275_cmd ("instance-to-package", 1, inst); - if (node == -1) return 0; - return node; -} - int prom_finddevice(char *path) { int node; @@ -37,7 +37,8 @@ bootmain: ba,a,pt %xcc, 1f extent: .word 0 size: .word 0 -1: sethi %hi(0x10000), dest +1: + sethi %hi(0x10000), dest mov %o4, promvec add buffer, %lo(chosen), %o1 @@ -53,12 +54,14 @@ size: .word 0 add buffer, %lo(bootpath), %o0 add dest, 256, %o0 mov ':', %o4 -2: ldub [%o0], %o3 +2: + ldub [%o0], %o3 brz,pn %o3, 3f cmp %o3, %o4 bne,a,pt %icc, 2b inc %o0 -3: stb %o4, [%o0] +3: + stb %o4, [%o0] mov 'a', %o4 stb %o4, [%o0 + 1] stb %g0, [%o0 + 2] @@ -109,8 +112,10 @@ putchar: mov 1, %o3 ba,pt %xcc, prom31 add buffer, %lo(write), %o0 -9: add buffer, %lo(exit), %o0 -10: call prom11 +9: + add buffer, %lo(exit), %o0 +10: + call prom11 getprop: stx %o0, [dest + 32] add dest, 256, %o0 @@ -121,18 +126,21 @@ getprop: add buffer, %lo(getprops), %o0 mov 4, %o2 stx %o2, [dest + 8] -2: ba,pt %xcc, 1f +2: + ba,pt %xcc, 1f prom11: mov 1, %o2 stx %o2, [dest + 8] -1: stx %o0, [dest] +1: + stx %o0, [dest] stx %o2, [dest + 16] stx %o1, [dest + 24] jmpl promvec + %g0, %g0 mov dest, %o0 rwprom31: mov fd, %o1 -prom31: mov 3, %o4 +prom31: + mov 3, %o4 stx %o4, [dest + 8] stx %o2, [dest + 32] ba,pt %xcc, 2b @@ -197,11 +205,13 @@ sparc_v8: sth %o2, [buffer + 0x408] ! put there the rest ')\0' as well... b 4f ld [promvec+36], %o1 ! pv_v0devops.v0_devopen -1: ld [promvec+172], %o1 +1: + ld [promvec+172], %o1 ld [%o0], %o0 add buffer, 0x400, %o2 mov ':', %o4 -2: ldub [%o0], %o3 +2: + ldub [%o0], %o3 tst %o3 be 3f cmp %o3, %o4 @@ -211,11 +221,13 @@ sparc_v8: add %o2, 1, %o2 b 2b add %o0, 1, %o0 -3: stb %o4, [%o2] +3: + stb %o4, [%o2] mov 'a', %o4 stb %o4, [%o2 + 1] stb %g0, [%o2 + 2] -4: call %o1 +4: + call %o1 add buffer, 0x400, %o0 mov %o0, fd @@ -235,7 +247,8 @@ sparc_v8: mov %l1, %o1 cmp %o0, %l1 b,a 0f -6: ld [promvec+188], %o4 ! pv_v2devops.v2_dev_seek +6: + ld [promvec+188], %o4 ! pv_v2devops.v2_dev_seek mov %g0, %o1 sll %l3, 11, %o2 call %o4 @@ -248,7 +261,8 @@ sparc_v8: call %o4 mov fd, %o0 cmp %o0, %l1 -0: bne 9f +0: + bne 9f nop call putchar_v8 diff --git a/include/et/error_table.h b/include/et/error_table.h deleted file mode 100644 index 31971f0..0000000 --- a/include/et/error_table.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 1988 by the Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#ifndef _ET_H -/* Are we using ANSI C? */ -#ifndef __STDC__ -#define const -#endif - -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; -struct et_list { - struct et_list *next; - const struct error_table *table; -}; -extern struct et_list * _et_list; - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -#ifdef __STDC__ -extern const char *error_table_name(int num); -#else -extern const char *error_table_name(); -#endif - -#define _ET_H -#endif diff --git a/include/et/internal.h b/include/et/internal.h deleted file mode 100644 index 112c016..0000000 --- a/include/et/internal.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * internal include file for com_err package - */ -#include "mit-sipb-copyright.h" -#ifndef __STDC__ -#undef const -#define const -#endif - -#include <errno.h> - -#ifdef NEED_SYS_ERRLIST -extern char const * const sys_errlist[]; -extern const int sys_nerr; -#endif - -/* AIX and Ultrix have standard conforming header files. */ -#if !defined(ultrix) && !defined(_AIX) -#ifdef __STDC__ -void perror (const char *); -#endif -#endif diff --git a/include/et/mit-sipb-copyright.h b/include/et/mit-sipb-copyright.h deleted file mode 100644 index 2f7eb29..0000000 --- a/include/et/mit-sipb-copyright.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1988 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff --git a/include/ext2fs/bitops.h b/include/ext2fs/bitops.h index a20d395..7e049d1 100644 --- a/include/ext2fs/bitops.h +++ b/include/ext2fs/bitops.h @@ -35,13 +35,13 @@ extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, int code, unsigned long arg); -extern void ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern void ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, +extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); +extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern void ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode); -extern void ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, +extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode); +extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode); extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode); @@ -75,6 +75,7 @@ extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); +extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map); /* * The inline routines themselves... @@ -84,8 +85,9 @@ extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, * inline.c */ #ifdef NO_INLINE_FUNCS -#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || \ - defined(__mc68000__) || defined(__sparc__)) +#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \ + defined(__i586__) || defined(__mc68000__) || \ + defined(__sparc__))) /* This prevents bitops.c from trying to include the C */ /* function version of these functions */ #define _EXT2_HAVE_ASM_BITOPS_ @@ -96,10 +98,15 @@ extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, #ifdef INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else +#ifdef __GNUC__ #define _INLINE_ extern __inline__ +#else /* For Watcom C */ +#define _INLINE_ extern inline +#endif #endif -#if (defined(__i386__) || defined(__i486__) || defined(__i586__)) +#if ((defined __GNUC__) && (defined(__i386__) || defined(__i486__) || \ + defined(__i586__))) #define _EXT2_HAVE_ASM_BITOPS_ @@ -322,31 +329,31 @@ _INLINE_ __u32 ext2fs_swab32(__u32 val) #endif /* !_EXT2_HAVE_ASM_SWAB */ -_INLINE_ void ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, +_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, __u32 bitno); -_INLINE_ void ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, +_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); _INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); -_INLINE_ void ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, +_INLINE_ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, __u32 bitno) { if ((bitno < bitmap->start) || (bitno > bitmap->end)) { ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno); - return; + return 0; } - ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap); + return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap); } -_INLINE_ void ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, +_INLINE_ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno) { if ((bitno < bitmap->start) || (bitno > bitmap->end)) { ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno); - return; + return 0; } - ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap); + return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap); } _INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, @@ -359,16 +366,19 @@ _INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap); } -_INLINE_ void ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, +_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) + bitmap, + block); } -_INLINE_ void ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, +_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block) { - ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + block); } _INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, @@ -378,16 +388,18 @@ _INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, block); } -_INLINE_ void ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, +_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode) { - ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); } -_INLINE_ void ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, +_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode) { - ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); } _INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, diff --git a/include/ext2fs/ext2_err.et b/include/ext2fs/ext2_err.et deleted file mode 100644 index 59d5435..0000000 --- a/include/ext2fs/ext2_err.et +++ /dev/null @@ -1,216 +0,0 @@ -ec EXT2_ET_BASE, - "EXT2FS Library version 1.10" - -ec EXT2_ET_MAGIC_EXT2FS_FILSYS, - "Wrong magic number for ext2_filsys structure" - -ec EXT2_ET_MAGIC_BADBLOCKS_LIST, - "Wrong magic number for badblocks_list structure" - -ec EXT2_ET_MAGIC_BADBLOCKS_ITERATE, - "Wrong magic number for badblocks_iterate structure" - -ec EXT2_ET_MAGIC_INODE_SCAN, - "Wrong magic number for inode_scan structure" - -ec EXT2_ET_MAGIC_IO_CHANNEL, - "Wrong magic number for io_channel structure" - -ec EXT2_ET_MAGIC_UNIX_IO_CHANNEL, - "Wrong magic number for unix io_channel structure" - -ec EXT2_ET_MAGIC_IO_MANAGER, - "Wrong magic number for io_manager structure" - -ec EXT2_ET_MAGIC_BLOCK_BITMAP, - "Wrong magic number for block_bitmap structure" - -ec EXT2_ET_MAGIC_INODE_BITMAP, - "Wrong magic number for inode_bitmap structure" - -ec EXT2_ET_MAGIC_GENERIC_BITMAP, - "Wrong magic number for generic_bitmap structure" - -ec EXT2_ET_MAGIC_TEST_IO_CHANNEL, - "Wrong magic number for test io_channel structure" - -ec EXT2_ET_MAGIC_DBLIST, - "Wrong magic number for directory block list structure" - -ec EXT2_ET_MAGIC_ICOUNT, - "Wrong magic number for icount structure" - -ec EXT2_ET_MAGIC_RESERVED_5, - "Wrong magic number --- RESERVED_5" - -ec EXT2_ET_MAGIC_RESERVED_6, - "Wrong magic number --- RESERVED_6" - -ec EXT2_ET_MAGIC_RESERVED_7, - "Wrong magic number --- RESERVED_7" - -ec EXT2_ET_MAGIC_RESERVED_8, - "Wrong magic number --- RESERVED_8" - -ec EXT2_ET_MAGIC_RESERVED_9, - "Wrong magic number --- RESERVED_9" - -ec EXT2_ET_BAD_MAGIC, - "Bad magic number in super-block" - -ec EXT2_ET_REV_TOO_HIGH, - "Filesystem revision too high" - -ec EXT2_ET_SB_LSEEK, - "Can't seek to superblock" - -ec EXT2_ET_SB_READ, - "Can't read superblock" - -ec EXT2_ET_SB_WRITE, - "Can't write superblock" - -ec EXT2_ET_RO_FILSYS, - "Attempt to write to filesystem opened read-only" - -ec EXT2_ET_GDESC_READ, - "Can't read group descriptors" - -ec EXT2_ET_GDESC_WRITE, - "Can't write group descriptors" - -ec EXT2_ET_GDESC_BAD_BLOCK_MAP, - "Corrupt group descriptor: bad block for block bitmap" - -ec EXT2_ET_GDESC_BAD_INODE_MAP, - "Corrupt group descriptor: bad block for inode bitmap" - -ec EXT2_ET_GDESC_BAD_INODE_TABLE, - "Corrupt group descriptor: bad block for inode table" - -ec EXT2_ET_INODE_BITMAP_WRITE, - "Can't write an inode bitmap" - -ec EXT2_ET_INODE_BITMAP_READ, - "Can't read an inode bitmap" - -ec EXT2_ET_BLOCK_BITMAP_WRITE, - "Can't write an block bitmap" - -ec EXT2_ET_BLOCK_BITMAP_READ, - "Can't read an block bitmap" - -ec EXT2_ET_INODE_TABLE_WRITE, - "Can't write an inode table" - -ec EXT2_ET_INODE_TABLE_READ, - "Can't read an inode table" - -ec EXT2_ET_NEXT_INODE_READ, - "Can't read next inode" - -ec EXT2_ET_UNEXPECTED_BLOCK_SIZE, - "Filesystem has unexpected block size" - -ec EXT2_ET_DIR_CORRUPTED, - "EXT2 directory corrupted" - -ec EXT2_ET_SHORT_READ, - "Attempt to read block from filesystem resulted in short read" - -ec EXT2_ET_SHORT_WRITE, - "Attempt to write block from filesystem resulted in short write" - -ec EXT2_ET_DIR_NO_SPACE, - "No free space in the directory" - -ec EXT2_ET_NO_INODE_BITMAP, - "Inode bitmap not loaded" - -ec EXT2_ET_NO_BLOCK_BITMAP, - "BLOCK bitmap not loaded" - -ec EXT2_ET_BAD_INODE_NUM, - "Illegal inode number" - -ec EXT2_ET_BAD_BLOCK_NUM, - "Illegal block number" - -ec EXT2_ET_EXPAND_DIR_ERR, - "Internal error in ext2fs_expand_dir" - -ec EXT2_ET_TOOSMALL, - "Not enough space to build proposed filesystem" - -ec EXT2_ET_BAD_BLOCK_MARK, - "Illegal block number passed to ext2fs_mark_block_bitmap" - -ec EXT2_ET_BAD_BLOCK_UNMARK, - "Illegal block number passed to ext2fs_unmark_block_bitmap" - -ec EXT2_ET_BAD_BLOCK_TEST, - "Illegal block number passed to ext2fs_test_block_bitmap" - -ec EXT2_ET_BAD_INODE_MARK, - "Illegal inode number passed to ext2fs_mark_inode_bitmap" - -ec EXT2_ET_BAD_INODE_UNMARK, - "Illegal inode number passed to ext2fs_unmark_inode_bitmap" - -ec EXT2_ET_BAD_INODE_TEST, - "Illegal inode number passed to ext2fs_test_inode_bitmap" - -ec EXT2_ET_FUDGE_BLOCK_BITMAP_END, - "Attempt to fudge end of block bitmap past the real end" - -ec EXT2_ET_FUDGE_INODE_BITMAP_END, - "Attempt to fudge end of inode bitmap past the real end" - -ec EXT2_ET_BAD_IND_BLOCK, - "Illegal indirect block found" - -ec EXT2_ET_BAD_DIND_BLOCK, - "Illegal doubly indirect block found" - -ec EXT2_ET_BAD_TIND_BLOCK, - "Illegal triply indirect block found" - -ec EXT2_ET_NEQ_BLOCK_BITMAP, - "Block bitmaps are not the same" - -ec EXT2_ET_NEQ_INODE_BITMAP, - "Inode bitmaps are not the same" - -ec EXT2_ET_BAD_DEVICE_NAME, - "Illegal or malformed device name" - -ec EXT2_ET_MISSING_INODE_TABLE, - "A block group is missing an inode table" - -ec EXT2_ET_CORRUPT_SUPERBLOCK, - "The ext2 superblock is corrupt" - -ec EXT2_ET_BAD_GENERIC_MARK, - "Illegal generic bit number passed to ext2fs_mark_generic_bitmap" - -ec EXT2_ET_BAD_GENERIC_UNMARK, - "Illegal generic bit number passed to ext2fs_unmark_generic_bitmap" - -ec EXT2_ET_BAD_GENERIC_TEST, - "Illegal generic bit number passed to ext2fs_test_generic_bitmap" - -ec EXT2_ET_SYMLINK_LOOP, - "Too many symbolic links encountered." - -ec EXT2_ET_CALLBACK_NOTHANDLED, - "The callback function will not handle this case" - -ec EXT2_ET_BAD_BLOCK_IN_INODE_TABLE, - "The inode is from a bad block in the inode table" - -ec EXT2_ET_UNSUPP_FEATURE, - "Filesystem has unsupported feature(s)" - -ec EXT2_ET_RO_UNSUPP_FEATURE, - "Filesystem has unsupported read-only feature(s)" - diff --git a/include/ext2fs/ext2_err.h b/include/ext2fs/ext2_err.h index 3f4d9a3..e986a5c 100644 --- a/include/ext2fs/ext2_err.h +++ b/include/ext2fs/ext2_err.h @@ -2,12 +2,6 @@ * ext2_err.h: * This file is automatically generated; please do not edit it. */ -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif #define EXT2_ET_BASE (2133571328L) #define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L) @@ -23,65 +17,76 @@ #define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L) #define EXT2_ET_MAGIC_DBLIST (2133571340L) #define EXT2_ET_MAGIC_ICOUNT (2133571341L) -#define EXT2_ET_MAGIC_RESERVED_5 (2133571342L) -#define EXT2_ET_MAGIC_RESERVED_6 (2133571343L) +#define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L) +#define EXT2_ET_MAGIC_EXT2_FILE (2133571343L) #define EXT2_ET_MAGIC_RESERVED_7 (2133571344L) #define EXT2_ET_MAGIC_RESERVED_8 (2133571345L) #define EXT2_ET_MAGIC_RESERVED_9 (2133571346L) #define EXT2_ET_BAD_MAGIC (2133571347L) #define EXT2_ET_REV_TOO_HIGH (2133571348L) -#define EXT2_ET_SB_LSEEK (2133571349L) -#define EXT2_ET_SB_READ (2133571350L) -#define EXT2_ET_SB_WRITE (2133571351L) -#define EXT2_ET_RO_FILSYS (2133571352L) -#define EXT2_ET_GDESC_READ (2133571353L) -#define EXT2_ET_GDESC_WRITE (2133571354L) -#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571355L) -#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571356L) -#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571357L) -#define EXT2_ET_INODE_BITMAP_WRITE (2133571358L) -#define EXT2_ET_INODE_BITMAP_READ (2133571359L) -#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571360L) -#define EXT2_ET_BLOCK_BITMAP_READ (2133571361L) -#define EXT2_ET_INODE_TABLE_WRITE (2133571362L) -#define EXT2_ET_INODE_TABLE_READ (2133571363L) -#define EXT2_ET_NEXT_INODE_READ (2133571364L) -#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571365L) -#define EXT2_ET_DIR_CORRUPTED (2133571366L) -#define EXT2_ET_SHORT_READ (2133571367L) -#define EXT2_ET_SHORT_WRITE (2133571368L) -#define EXT2_ET_DIR_NO_SPACE (2133571369L) -#define EXT2_ET_NO_INODE_BITMAP (2133571370L) -#define EXT2_ET_NO_BLOCK_BITMAP (2133571371L) -#define EXT2_ET_BAD_INODE_NUM (2133571372L) -#define EXT2_ET_BAD_BLOCK_NUM (2133571373L) -#define EXT2_ET_EXPAND_DIR_ERR (2133571374L) -#define EXT2_ET_TOOSMALL (2133571375L) -#define EXT2_ET_BAD_BLOCK_MARK (2133571376L) -#define EXT2_ET_BAD_BLOCK_UNMARK (2133571377L) -#define EXT2_ET_BAD_BLOCK_TEST (2133571378L) -#define EXT2_ET_BAD_INODE_MARK (2133571379L) -#define EXT2_ET_BAD_INODE_UNMARK (2133571380L) -#define EXT2_ET_BAD_INODE_TEST (2133571381L) -#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571382L) -#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571383L) -#define EXT2_ET_BAD_IND_BLOCK (2133571384L) -#define EXT2_ET_BAD_DIND_BLOCK (2133571385L) -#define EXT2_ET_BAD_TIND_BLOCK (2133571386L) -#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571387L) -#define EXT2_ET_NEQ_INODE_BITMAP (2133571388L) -#define EXT2_ET_BAD_DEVICE_NAME (2133571389L) -#define EXT2_ET_MISSING_INODE_TABLE (2133571390L) -#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571391L) -#define EXT2_ET_BAD_GENERIC_MARK (2133571392L) -#define EXT2_ET_BAD_GENERIC_UNMARK (2133571393L) -#define EXT2_ET_BAD_GENERIC_TEST (2133571394L) -#define EXT2_ET_SYMLINK_LOOP (2133571395L) -#define EXT2_ET_CALLBACK_NOTHANDLED (2133571396L) -#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571397L) -#define EXT2_ET_UNSUPP_FEATURE (2133571398L) -#define EXT2_ET_RO_UNSUPP_FEATURE (2133571399L) -extern void initialize_ext2_error_table (NOARGS); +#define EXT2_ET_RO_FILSYS (2133571349L) +#define EXT2_ET_GDESC_READ (2133571350L) +#define EXT2_ET_GDESC_WRITE (2133571351L) +#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L) +#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L) +#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L) +#define EXT2_ET_INODE_BITMAP_WRITE (2133571355L) +#define EXT2_ET_INODE_BITMAP_READ (2133571356L) +#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L) +#define EXT2_ET_BLOCK_BITMAP_READ (2133571358L) +#define EXT2_ET_INODE_TABLE_WRITE (2133571359L) +#define EXT2_ET_INODE_TABLE_READ (2133571360L) +#define EXT2_ET_NEXT_INODE_READ (2133571361L) +#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L) +#define EXT2_ET_DIR_CORRUPTED (2133571363L) +#define EXT2_ET_SHORT_READ (2133571364L) +#define EXT2_ET_SHORT_WRITE (2133571365L) +#define EXT2_ET_DIR_NO_SPACE (2133571366L) +#define EXT2_ET_NO_INODE_BITMAP (2133571367L) +#define EXT2_ET_NO_BLOCK_BITMAP (2133571368L) +#define EXT2_ET_BAD_INODE_NUM (2133571369L) +#define EXT2_ET_BAD_BLOCK_NUM (2133571370L) +#define EXT2_ET_EXPAND_DIR_ERR (2133571371L) +#define EXT2_ET_TOOSMALL (2133571372L) +#define EXT2_ET_BAD_BLOCK_MARK (2133571373L) +#define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L) +#define EXT2_ET_BAD_BLOCK_TEST (2133571375L) +#define EXT2_ET_BAD_INODE_MARK (2133571376L) +#define EXT2_ET_BAD_INODE_UNMARK (2133571377L) +#define EXT2_ET_BAD_INODE_TEST (2133571378L) +#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L) +#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L) +#define EXT2_ET_BAD_IND_BLOCK (2133571381L) +#define EXT2_ET_BAD_DIND_BLOCK (2133571382L) +#define EXT2_ET_BAD_TIND_BLOCK (2133571383L) +#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L) +#define EXT2_ET_NEQ_INODE_BITMAP (2133571385L) +#define EXT2_ET_BAD_DEVICE_NAME (2133571386L) +#define EXT2_ET_MISSING_INODE_TABLE (2133571387L) +#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L) +#define EXT2_ET_BAD_GENERIC_MARK (2133571389L) +#define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L) +#define EXT2_ET_BAD_GENERIC_TEST (2133571391L) +#define EXT2_ET_SYMLINK_LOOP (2133571392L) +#define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L) +#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L) +#define EXT2_ET_UNSUPP_FEATURE (2133571395L) +#define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L) +#define EXT2_ET_LLSEEK_FAILED (2133571397L) +#define EXT2_ET_NO_MEMORY (2133571398L) +#define EXT2_ET_INVALID_ARGUMENT (2133571399L) +#define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L) +#define EXT2_ET_INODE_ALLOC_FAIL (2133571401L) +#define EXT2_ET_NO_DIRECTORY (2133571402L) +#define EXT2_ET_TOO_MANY_REFS (2133571403L) +#define EXT2_ET_FILE_NOT_FOUND (2133571404L) +#define EXT2_ET_FILE_RO (2133571405L) +#define EXT2_ET_DB_NOT_FOUND (2133571406L) +#define EXT2_ET_DIR_EXISTS (2133571407L) +#define EXT2_ET_UNIMPLEMENTED (2133571408L) +#define EXT2_ET_CANCEL_REQUESTED (2133571409L) +#define EXT2_ET_FILE_TOO_BIG (2133571410L) +extern void initialize_ext2_error_table(void); #define ERROR_TABLE_BASE_ext2 (2133571328L) /* for compatibility with older versions... */ diff --git a/include/ext2fs/io.h b/include/ext2fs/ext2_io.h index fcd1a01..9568866 100644 --- a/include/ext2fs/io.h +++ b/include/ext2fs/ext2_io.h @@ -9,6 +9,9 @@ * %End-Header% */ +#ifndef _EXT2FS_EXT2_IO_H +#define _EXT2FS_EXT2_IO_H + /* * ext2_loff_t is defined here since unix_io.c needs it. */ @@ -19,13 +22,13 @@ typedef long ext2_loff_t; #endif /* llseek.c */ -ext2_loff_t ext2fs_llseek (unsigned int, ext2_loff_t, unsigned int); +ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); typedef struct struct_io_manager *io_manager; typedef struct struct_io_channel *io_channel; struct struct_io_channel { - int magic; + errcode_t magic; io_manager manager; char *name; int block_size; @@ -46,10 +49,11 @@ struct struct_io_channel { int refcount; int reserved[15]; void *private_data; + void *app_data; }; struct struct_io_manager { - int magic; + errcode_t magic; const char *name; errcode_t (*open)(const char *name, int flags, io_channel *channel); errcode_t (*close)(io_channel channel); @@ -85,3 +89,6 @@ extern void (*test_io_cb_write_blk) (unsigned long block, int count, errcode_t err); extern void (*test_io_cb_set_blksize) (int blksize, errcode_t err); + +#endif /* _EXT2FS_EXT2_IO_H */ + diff --git a/include/ext2fs/ext2fs.h b/include/ext2fs/ext2fs.h index 0e20c97..0c052f6 100644 --- a/include/ext2fs/ext2fs.h +++ b/include/ext2fs/ext2fs.h @@ -8,14 +8,18 @@ * License. * %End-Header% */ - + #ifndef _EXT2FS_EXT2FS_H #define _EXT2FS_EXT2FS_H +#ifdef __cplusplus +extern "C" { +#endif + /* * Non-GNU C compilers won't necessarily understand inline */ -#ifndef __GNUC__ +#if (!defined(__GNUC__) && !defined(__WATCOMC__)) #define NO_INLINE_FUNCS #endif @@ -35,20 +39,58 @@ */ #define EXT2_LIB_CURRENT_REV 0 +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> -#include <linux/types.h> +#endif -typedef __u32 blk_t; -typedef unsigned int dgrp_t; +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif +#if EXT2_FLAT_INCLUDES +#include "e2_types.h" +#else +#include <asm/types.h> +#if !defined(__GNUC__) || defined(__STRICT_ANSI__) /* asm/types.h already defines __s64 and __u64 otherwise */ +#if SIZEOF_LONG == 8 +typedef __signed__ long __s64; +typedef unsigned long __u64; +#elif SIZEOF_LONG_LONG == 8 || \ + defined(__GNUC__) && (((~0UL) == 0xffffffff) || defined(__i386__)) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif /* SIZEOF_LONG == 8 */ +#endif +#endif /* EXT2_FLAT_INCLUDES */ + +typedef __u32 blk_t; +typedef __u32 dgrp_t; +typedef __u32 ext2_off_t; +typedef __s64 e2_blkcnt_t; + +#if EXT2_FLAT_INCLUDES +#include "com_err.h" +#include "ext2_io.h" +#include "ext2_err.h" +#else #include "et/com_err.h" -#include "ext2fs/io.h" +#include "ext2fs/ext2_io.h" #include "ext2fs/ext2_err.h" +#endif + +/* + * Portability help for Microsoft Visual C++ + */ +#ifdef _MSC_VER +#define EXT2_QSORT_TYPE int __cdecl +#else +#define EXT2_QSORT_TYPE int +#endif typedef struct struct_ext2_filsys *ext2_filsys; struct ext2fs_struct_generic_bitmap { - int magic; + errcode_t magic; ext2_filsys fs; __u32 start, end; __u32 real_end; @@ -100,6 +142,24 @@ typedef struct ext2_struct_dblist *ext2_dblist; #define DBLIST_ABORT 1 /* + * ext2_fileio definitions + */ + +#define EXT2_FILE_WRITE 0x0001 +#define EXT2_FILE_CREATE 0x0002 + +#define EXT2_FILE_MASK 0x00FF + +#define EXT2_FILE_BUF_DIRTY 0x4000 +#define EXT2_FILE_BUF_VALID 0x2000 + +typedef struct ext2_file *ext2_file_t; + +#define EXT2_SEEK_SET 0 +#define EXT2_SEEK_CUR 1 +#define EXT2_SEEK_END 2 + +/* * Flags for the ext2_filsys structure */ @@ -122,14 +182,14 @@ typedef struct ext2_struct_dblist *ext2_dblist; #define EXT2_NEW_INODE_FL 0x80000000 struct struct_ext2_filsys { - int magic; + errcode_t magic; io_channel io; int flags; char * device_name; struct ext2_super_block * super; int blocksize; int fragsize; - unsigned long group_desc_count; + dgrp_t group_desc_count; unsigned long desc_blocks; struct ext2_group_desc * group_desc; int inode_blocks_per_group; @@ -153,7 +213,7 @@ struct struct_ext2_filsys { /* * Reserved for the use of the calling application. */ - void * private; + void * priv_data; /* * Inode cache @@ -161,8 +221,12 @@ struct struct_ext2_filsys { struct ext2_inode_cache *icache; }; +#if EXT2_FLAT_INCLUDES +#include "e2_bitops.h" +#else #include "ext2fs/bitops.h" - +#endif + /* * Return flags for the block iterator functions */ @@ -187,12 +251,17 @@ struct struct_ext2_filsys { * * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be * called for data blocks only. + * + * BLOCK_FLAG_NO_LARGE is for internal use only. It informs + * ext2fs_block_iterate2 that large files won't be accepted. */ #define BLOCK_FLAG_APPEND 1 #define BLOCK_FLAG_HOLE 1 #define BLOCK_FLAG_DEPTH_TRAVERSE 2 #define BLOCK_FLAG_DATA_ONLY 4 +#define BLOCK_FLAG_NO_LARGE 0x1000 + /* * Magic "block count" return values for the block iterator function. */ @@ -201,6 +270,14 @@ struct struct_ext2_filsys { #define BLOCK_COUNT_TIND (-3) #define BLOCK_COUNT_TRANSLATOR (-4) +#if 0 +/* + * Flags for ext2fs_move_blocks + */ +#define EXT2_BMOVE_GET_DBLIST 0x0001 +#define EXT2_BMOVE_DEBUG 0x0002 +#endif + /* * Return flags for the directory iterator functions */ @@ -287,6 +364,11 @@ typedef struct ext2_struct_inode_scan *ext2_inode_scan; typedef struct ext2_icount *ext2_icount_t; /* + * Flags for ext2fs_bmap + */ +#define BMAP_ALLOC 1 + +/* * For checking structure magic numbers... */ @@ -347,21 +429,90 @@ struct ext2fs_sb { __u8 s_uuid[16]; /* 128-bit uuid for volume */ char s_volume_name[16]; /* volume name */ char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_reserved[206]; /* Padding to the end of the block */ + __u32 s_algorithm_usage_bitmap; /* For compression */ + /* + * Performance hints. Directory preallocation should only + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. + */ + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ + __u16 s_padding1; + /* + * Journaling support. + */ + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ + __u32 s_journal_inum; /* inode number of journal file */ + __u32 s_journal_dev; /* device number of journal file */ + __u32 s_last_orphan; /* start of list of inodes to delete */ + + __u32 s_reserved[197]; /* Padding to the end of the block */ }; +#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) 0xffffffff) +#define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR) + /* * Feature set definitions (that might not be in ext2_fs.h - * (was EXT2_COMPAT_SPARSE_SUPER) */ + +#ifndef EXT2_FEATURE_COMPAT_DIR_PREALLOC +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 +#endif + +#ifndef EXT2_FEATURE_COMPAT_IMAGIC_INODES /* for AFS, etc. */ +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 +#define EXT2_IMAGIC_FL 0x00002000 +#endif + +#ifndef EXT3_FEATURE_COMPAT_HAS_JOURNAL +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 +#endif + #ifndef EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 #endif -#define EXT2_LIB_FEATURE_COMPAT_SUPP 0 -#define EXT2_LIB_FEATURE_INCOMPAT_SUPP 0 -#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER +#ifndef EXT2_FEATURE_RO_COMPAT_LARGE_FILE +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 +#define i_size_high i_dir_acl +#endif + +#ifndef EXT2_FEATURE_RO_COMPAT_BTREE_DIR +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#endif + +#ifndef EXT2_FEATURE_INCOMPAT_COMPRESSION +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 +#endif + +#ifndef EXT2_FEATURE_INCOMPAT_FILETYPE +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 +#endif + +#ifndef EXT3_FEATURE_INCOMPAT_RECOVER +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ +#endif +#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\ + EXT2_FEATURE_COMPAT_IMAGIC_INODES|\ + EXT3_FEATURE_COMPAT_HAS_JOURNAL) +/* This #ifdef is temporary until compression is fully supported */ +#ifdef ENABLE_COMPRESSION +#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL +/* If the below warning bugs you, then have + `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your + environment at configure time. */ +#warning "Compression support is experimental" +#endif +#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ + EXT2_FEATURE_INCOMPAT_COMPRESSION|\ + EXT3_FEATURE_INCOMPAT_RECOVER) +#else +#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ + EXT3_FEATURE_INCOMPAT_RECOVER) +#endif +#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE) /* * function prototypes */ @@ -375,9 +526,13 @@ extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, int num, ext2fs_block_bitmap map, blk_t *ret); +extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, + char *block_buf, blk_t *ret); -/* allocate_tables.c */ -errcode_t ext2fs_allocate_tables(ext2_filsys fs); +/* alloc_tables.c */ +extern errcode_t ext2fs_allocate_tables(ext2_filsys fs); +extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, + ext2fs_block_bitmap bmap); /* badblocks.c */ extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, @@ -394,6 +549,8 @@ extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter); extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, ext2_badblocks_list *dest); +extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1, + ext2_badblocks_list bb2); /* bb_compat */ extern errcode_t badblocks_list_create(badblocks_list *ret, int size); @@ -442,20 +599,34 @@ extern errcode_t ext2fs_block_iterate(ext2_filsys fs, int (*func)(ext2_filsys fs, blk_t *blocknr, int blockcnt, - void *private), - void *private); - + void *priv_data), + void *priv_data); errcode_t ext2fs_block_iterate2(ext2_filsys fs, ino_t ino, int flags, char *block_buf, int (*func)(ext2_filsys fs, blk_t *blocknr, - int blockcnt, + e2_blkcnt_t blockcnt, blk_t ref_blk, int ref_offset, - void *private), - void *private); + void *priv_data), + void *priv_data); + +/* bmap.c */ +extern errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino, + struct ext2_inode *inode, + char *block_buf, int bmap_flags, + blk_t block, blk_t *phys_blk); + + +#if 0 +/* bmove.c */ +extern errcode_t ext2fs_move_blocks(ext2_filsys fs, + ext2fs_block_bitmap reserve, + ext2fs_block_bitmap alloc_map, + int flags); +#endif /* check_desc.c */ extern errcode_t ext2fs_check_desc(ext2_filsys fs); @@ -479,12 +650,13 @@ extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk, int blockcnt); extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info, - void *private), - void *private); + void *priv_data), + void *priv_data); extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk, int blockcnt); extern errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest); +extern int ext2fs_dblist_count(ext2_dblist dblist); /* dblist_dir.c */ extern errcode_t @@ -497,8 +669,8 @@ extern errcode_t int offset, int blocksize, char *buf, - void *private), - void *private); + void *priv_data), + void *priv_data); /* dirblock.c */ extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, @@ -515,13 +687,8 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, int offset, int blocksize, char *buf, - void *private), - void *private); - /* private to library */ -extern int ext2fs_process_dir_block(ext2_filsys fs, - blk_t *blocknr, - int blockcnt, - void *private); + void *priv_data), + void *priv_data); /* dupfs.c */ extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); @@ -529,6 +696,20 @@ extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); /* expanddir.c */ extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ino_t dir); +/* fileio.c */ +extern errcode_t ext2fs_file_open(ext2_filsys fs, ino_t ino, + int flags, ext2_file_t *ret); +extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file); +extern errcode_t ext2fs_file_close(ext2_file_t file); +extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf, + unsigned int wanted, unsigned int *got); +extern errcode_t ext2fs_file_write(ext2_file_t file, void *buf, + unsigned int nbytes, unsigned int *written); +extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, + int whence, ext2_off_t *ret_pos); +extern ext2_off_t ext2fs_file_get_size(ext2_file_t file); +extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size); + /* freefs.c */ extern void ext2fs_free(ext2_filsys fs); extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap); @@ -559,7 +740,7 @@ extern void ext2fs_set_inode_callback errcode_t (*done_group)(ext2_filsys fs, ext2_inode_scan scan, dgrp_t group, - void * private), + void * priv_data), void *done_group_data); extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, int clear_flags); @@ -631,6 +812,13 @@ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list); /* read_bb_file.c */ +extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, + ext2_badblocks_list *bb_list, + void *private, + void (*invalid)(ext2_filsys fs, + blk_t blk, + char *badstr, + void *private)); extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, ext2_badblocks_list *bb_list, void (*invalid)(ext2_filsys fs, @@ -662,6 +850,12 @@ extern int ext2fs_get_library_version(const char **ver_string, const char **date_string); /* inline functions */ +extern errcode_t ext2fs_get_mem(unsigned long size, void **ptr); +extern errcode_t ext2fs_free_mem(void **ptr); +#if 0 +extern errcode_t ext2fs_resize_mem(unsigned long old_size, + unsigned long size, void **ptr); +#endif extern void ext2fs_mark_super_dirty(ext2_filsys fs); extern void ext2fs_mark_changed(ext2_filsys fs); extern int ext2fs_test_changed(ext2_filsys fs); @@ -685,8 +879,52 @@ extern int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino); #ifdef INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else +#ifdef __GNUC__ #define _INLINE_ extern __inline__ +#else /* For Watcom C */ +#define _INLINE_ extern inline #endif +#endif + +#ifndef EXT2_CUSTOM_MEMORY_ROUTINES +/* + * Allocate memory + */ +_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void **ptr) +{ + *ptr = malloc(size); + if (!*ptr) + return EXT2_ET_NO_MEMORY; + return 0; +} + +/* + * Free memory + */ +_INLINE_ errcode_t ext2fs_free_mem(void **ptr) +{ + free(*ptr); + *ptr = 0; + return 0; +} + +#if 0 +/* + * Resize memory + */ +_INLINE_ errcode_t ext2fs_resize_mem(unsigned long old_size, + unsigned long size, void **ptr) +{ + void *p; + + p = realloc(*ptr, size); + if (!p) + return EXT2_ET_NO_MEMORY; + *ptr = p; + return 0; +} +#endif +#endif /* Custom memory routines */ /* * Mark a filesystem superblock as dirty @@ -787,4 +1025,8 @@ _INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino) #undef _INLINE_ #endif +#ifdef __cplusplus +} +#endif + #endif /* _EXT2FS_EXT2FS_H */ diff --git a/include/non-linux/iso_fs.h b/include/non-linux/iso_fs.h deleted file mode 100644 index e356d5a..0000000 --- a/include/non-linux/iso_fs.h +++ /dev/null @@ -1,197 +0,0 @@ - -#ifndef _ISOFS_FS_H -#define _ISOFS_FS_H - -#include <non-linux/types.h> -/* - * The isofs filesystem constants/structures - */ - -/* This part borrowed from the bsd386 isofs */ -#define ISODCL(from, to) (to - from + 1) - -struct iso_volume_descriptor { - char type[ISODCL(1,1)]; /* 711 */ - char id[ISODCL(2,6)]; - char version[ISODCL(7,7)]; - char data[ISODCL(8,2048)]; -}; - -/* volume descriptor types */ -#define ISO_VD_PRIMARY 1 -#define ISO_VD_END 255 - -#define ISO_STANDARD_ID "CD001" - -struct iso_primary_descriptor { - char type [ISODCL ( 1, 1)]; /* 711 */ - char id [ISODCL ( 2, 6)]; - char version [ISODCL ( 7, 7)]; /* 711 */ - char unused1 [ISODCL ( 8, 8)]; - char system_id [ISODCL ( 9, 40)]; /* achars */ - char volume_id [ISODCL ( 41, 72)]; /* dchars */ - char unused2 [ISODCL ( 73, 80)]; - char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ - char unused3 [ISODCL ( 89, 120)]; - char volume_set_size [ISODCL (121, 124)]; /* 723 */ - char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ - char logical_block_size [ISODCL (129, 132)]; /* 723 */ - char path_table_size [ISODCL (133, 140)]; /* 733 */ - char type_l_path_table [ISODCL (141, 144)]; /* 731 */ - char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ - char type_m_path_table [ISODCL (149, 152)]; /* 732 */ - char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ - char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ - char volume_set_id [ISODCL (191, 318)]; /* dchars */ - char publisher_id [ISODCL (319, 446)]; /* achars */ - char preparer_id [ISODCL (447, 574)]; /* achars */ - char application_id [ISODCL (575, 702)]; /* achars */ - char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ - char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ - char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ - char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ - char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ - char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ - char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ - char file_structure_version [ISODCL (882, 882)]; /* 711 */ - char unused4 [ISODCL (883, 883)]; - char application_data [ISODCL (884, 1395)]; - char unused5 [ISODCL (1396, 2048)]; -}; - - -#define HS_STANDARD_ID "CDROM" - -struct hs_volume_descriptor { - char foo [ISODCL ( 1, 8)]; /* 733 */ - char type [ISODCL ( 9, 9)]; /* 711 */ - char id [ISODCL ( 10, 14)]; - char version [ISODCL ( 15, 15)]; /* 711 */ - char data[ISODCL(16,2048)]; -}; - - -struct hs_primary_descriptor { - char foo [ISODCL ( 1, 8)]; /* 733 */ - char type [ISODCL ( 9, 9)]; /* 711 */ - char id [ISODCL ( 10, 14)]; - char version [ISODCL ( 15, 15)]; /* 711 */ - char unused1 [ISODCL ( 16, 16)]; /* 711 */ - char system_id [ISODCL ( 17, 48)]; /* achars */ - char volume_id [ISODCL ( 49, 80)]; /* dchars */ - char unused2 [ISODCL ( 81, 88)]; /* 733 */ - char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ - char unused3 [ISODCL ( 97, 128)]; /* 733 */ - char volume_set_size [ISODCL (129, 132)]; /* 723 */ - char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ - char logical_block_size [ISODCL (137, 140)]; /* 723 */ - char path_table_size [ISODCL (141, 148)]; /* 733 */ - char type_l_path_table [ISODCL (149, 152)]; /* 731 */ - char unused4 [ISODCL (153, 180)]; /* 733 */ - char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ -}; - -/* We use this to help us look up the parent inode numbers. */ - -struct iso_path_table{ - unsigned char name_len[2]; /* 721 */ - char extent[4]; /* 731 */ - char parent[2]; /* 721 */ - char name[0]; -}; - -/* high sierra is identical to iso, except that the date is only 6 bytes, and - there is an extra reserved byte after the flags */ - -struct iso_directory_record { - char length [ISODCL (1, 1)]; /* 711 */ - char ext_attr_length [ISODCL (2, 2)]; /* 711 */ - char extent [ISODCL (3, 10)]; /* 733 */ - char size [ISODCL (11, 18)]; /* 733 */ - char date [ISODCL (19, 25)]; /* 7 by 711 */ - char flags [ISODCL (26, 26)]; - char file_unit_size [ISODCL (27, 27)]; /* 711 */ - char interleave [ISODCL (28, 28)]; /* 711 */ - char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ - unsigned char name_len [ISODCL (33, 33)]; /* 711 */ - char name [0]; -}; - -#define ISOFS_BLOCK_BITS 11 -#define ISOFS_BLOCK_SIZE 2048 - -#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) -#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) -#define ISOFS_ZONE_BITS(INODE) ((INODE)->i_sb->u.isofs_sb.s_log_zone_size) - -#define ISOFS_SUPER_MAGIC 0x9660 -#define ISOFS_FILE_UNKNOWN 0 -#define ISOFS_FILE_TEXT 1 -#define ISOFS_FILE_BINARY 2 -#define ISOFS_FILE_TEXT_M 3 - -#ifdef __KERNEL__ -extern int isonum_711(char *); -extern int isonum_712(char *); -extern int isonum_721(char *); -extern int isonum_722(char *); -extern int isonum_723(char *); -extern int isonum_731(char *); -extern int isonum_732(char *); -extern int isonum_733(char *); -extern int iso_date(char *, int); - -extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *); -extern int get_rock_ridge_filename(struct iso_directory_record *, char ** name, int * len, struct inode *); - -extern char * get_rock_ridge_symlink(struct inode *); -extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inode *); - -/* The stuff that follows may be totally unneeded. I have not checked to see - which prototypes we are still using. */ - -extern int isofs_open(struct inode * inode, struct file * filp); -extern void isofs_release(struct inode * inode, struct file * filp); -extern int isofs_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); -extern unsigned long isofs_count_free_inodes(struct super_block *sb); -extern int isofs_new_block(int dev); -extern int isofs_free_block(int dev, int block); -extern int isofs_bmap(struct inode *,int); - -extern void isofs_put_super(struct super_block *); -extern struct super_block *isofs_read_super(struct super_block *,void *,int); -extern int init_iso9660_fs(void); -extern void isofs_read_inode(struct inode *); -extern void isofs_put_inode(struct inode *); -extern void isofs_statfs(struct super_block *, struct statfs *, int); - -extern int isofs_lseek(struct inode *, struct file *, off_t, int); -extern int isofs_read(struct inode *, struct file *, char *, int); -extern int isofs_lookup_grandparent(struct inode *, int); - -extern struct inode_operations isofs_file_inode_operations; -extern struct inode_operations isofs_dir_inode_operations; -extern struct inode_operations isofs_symlink_inode_operations; -extern struct inode_operations isofs_chrdev_inode_operations; -extern struct inode_operations isofs_blkdev_inode_operations; -extern struct inode_operations isofs_fifo_inode_operations; - -/* The following macros are used to check for memory leaks. */ -#ifdef LEAK_CHECK -#define free_s leak_check_free_s -#define malloc leak_check_malloc -#define bread leak_check_bread -#define brelse leak_check_brelse -extern void * leak_check_malloc(unsigned int size); -extern void leak_check_free_s(void * obj, int size); -extern struct buffer_head * leak_check_bread(int dev, int block, int size); -extern void leak_check_brelse(struct buffer_head * bh); -#endif /* LEAK_CHECK */ - -#endif /* __KERNEL__ */ - -#endif - - - diff --git a/include/non-linux/romfs_fs.h b/include/non-linux/romfs_fs.h deleted file mode 100644 index 844e22f..0000000 --- a/include/non-linux/romfs_fs.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __LINUX_ROMFS_FS_H -#define __LINUX_ROMFS_FS_H - -/* The basic structures of the romfs filesystem */ - -#define ROMBSIZE BLOCK_SIZE -#define ROMBSBITS BLOCK_SIZE_BITS -#define ROMBMASK (ROMBSIZE-1) -#define ROMFS_MAGIC 0x7275 - -#define ROMFS_MAXFN 128 - -#define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff)) -#define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff)) -#define __mk4(a,b,c,d) htonl(__mkl(__mkw(a,b),__mkw(c,d))) -#define ROMSB_WORD0 __mk4('-','r','o','m') -#define ROMSB_WORD1 __mk4('1','f','s','-') - -/* On-disk "super block" */ - -struct romfs_super_block { - __u32 word0; - __u32 word1; - __u32 size; - __u32 checksum; - char name[0]; /* volume name */ -}; - -/* On disk inode */ - -struct romfs_inode { - __u32 next; /* low 4 bits see ROMFH_ */ - __u32 spec; - __u32 size; - __u32 checksum; - char name[0]; -}; - -#define ROMFH_TYPE 7 -#define ROMFH_HRD 0 -#define ROMFH_DIR 1 -#define ROMFH_REG 2 -#define ROMFH_SYM 3 -#define ROMFH_BLK 4 -#define ROMFH_CHR 5 -#define ROMFH_SCK 6 -#define ROMFH_FIF 7 -#define ROMFH_EXEC 8 - -/* Alignment */ - -#define ROMFH_SIZE 16 -#define ROMFH_PAD (ROMFH_SIZE-1) -#define ROMFH_MASK (~ROMFH_PAD) - -#ifdef __KERNEL__ - -/* Not much now */ -extern int init_romfs_fs(void); - -#endif /* __KERNEL__ */ -#endif diff --git a/include/promlib.h b/include/promlib.h index 765bd93..2671fbc 100644 --- a/include/promlib.h +++ b/include/promlib.h @@ -22,16 +22,11 @@ int prom_getproplen (int, char *); int prom_getproperty (int, char *, char *, int); int prom_getint (int, char *); int prom_getintdefault (int, char *, int); -int prom_getbool (int, char *); int prom_finddevice (char *); void prom_getstring (int, char *, char *, int); void prom_chain (unsigned long, int, unsigned long, char *, int); void prom_reboot (char *command); -int prom_nodematch (int, char *); int prom_searchsiblings (int, char *); -char *prom_firstprop (int, char *); -char *prom_nextprop (int, char *, char *); -int prom_node_has_property (int, char *); int prom_setprop (int, char *, char *, int); void prom_adjust_regs (struct linux_prom_registers *, int, struct linux_prom_ranges *, int); diff --git a/include/silo.h b/include/silo.h index 916636d..2e4ccfd 100644 --- a/include/silo.h +++ b/include/silo.h @@ -134,7 +134,6 @@ void sun4c_unmapio (unsigned long); /* libc */ char *strdup (const char *); char *strstr (const char *, const char *); -int sprintf (char *buf, char *fmt,...); int strcmp (const char *, const char *); char *strcat (char *, const char *); #undef tolower diff --git a/include/stringops.h b/include/stringops.h index e1bb77c..3df17a8 100644 --- a/include/stringops.h +++ b/include/stringops.h @@ -31,8 +31,6 @@ char *strdup(const char *); int strcasecmp(const char *, const char *); int strncasecmp(const char *, const char *, size_t); char *strstr(const char *, const char *); -void *realloc(void *, int); int memcmp(const void *, const void *, size_t); -int sprintf (char *, char *, ...); #endif /* __STRINGOPS_H */ diff --git a/second/Makefile b/second/Makefile index d81bd00..3bb7cbc 100644 --- a/second/Makefile +++ b/second/Makefile @@ -48,7 +48,6 @@ OBJSNET = $(OBJS1) $(OBJS2N) $(OBJS3) bmark.o $(OBJS4N) $(OBJS5) FS_OBJS = fs/iom.o fs/ext2.o fs/isofs.o fs/romfs.o fs/ufs.o # Should really switch to autoconf... -LIBINC=$(shell if [ ! -f /lib/ld-linux.so.2 -o ! -f /usr/lib/libext2fs.so ]; then echo -L../include; fi) all: second.b silotftp.b fs/libfs.a: $(FS_OBJS) @@ -56,13 +55,13 @@ fs/libfs.a: $(FS_OBJS) $(AR) rc $@ $(FS_OBJS) second: $(OBJS) mark.o - $(LD) $(LDFLAGS_SMALL) -Bstatic -o second $(OBJS) $(LIBINC) -lext2fs mark.o - $(LD) $(LDFLAGS_LARGE) -Bstatic -o second2 $(OBJS) $(LIBINC) -lext2fs mark.o + $(LD) $(LDFLAGS_SMALL) -Bstatic -o second $(OBJS) -lext2fs mark.o + $(LD) $(LDFLAGS_LARGE) -Bstatic -o second2 $(OBJS) -lext2fs mark.o $(NM) second | grep -v '*ABS*' | sort > second.map silotftp: $(OBJSNET) mark.o - $(LD) $(LDFLAGS_SMALL) -Bstatic -o silotftp $(OBJSNET) $(LIBINC) -lext2fs mark.o - $(LD) $(LDFLAGS_LARGE) -Bstatic -o silotftp2 $(OBJSNET) $(LIBINC) -lext2fs mark.o + $(LD) $(LDFLAGS_SMALL) -Bstatic -o silotftp $(OBJSNET) -lext2fs mark.o + $(LD) $(LDFLAGS_LARGE) -Bstatic -o silotftp2 $(OBJSNET) -lext2fs mark.o $(NM) silotftp | grep -v '*ABS*' | sort > silotftp.map second.l: second diff --git a/second/file.c b/second/file.c index c9cc479..840d4e3 100644 --- a/second/file.c +++ b/second/file.c @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sys/types.h> #include <silo.h> #include <file.h> #include <stringops.h> diff --git a/second/file.h b/second/file.h index b009c12..c40b2e5 100644 --- a/second/file.h +++ b/second/file.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -typedef int FILE; #include <linux/ext2_fs.h> +typedef int FILE; #include <ext2fs/ext2fs.h> extern unsigned int bs; /* Block Size */ diff --git a/second/fs/ext2.c b/second/fs/ext2.c index e5c33f5..7199b0c 100644 --- a/second/fs/ext2.c +++ b/second/fs/ext2.c @@ -24,17 +24,6 @@ #include <file.h> #include <stringops.h> -#define ec ,},{ - -static struct { - int errnum; - char *desc; -} ext2errors[] = { -{ 0, "OK" -#include <ext2fs/ext2_err.et> -} -}; - static ino_t inode = 0; struct fs_ops ext2_fs_ops; @@ -45,13 +34,14 @@ void com_err (const char *a, long i, const char *fmt,...) static void ext2fs_error (int errcode) { +#if 0 int i; - for (i = 0; i < sizeof (ext2errors) / sizeof (ext2errors[0]); i++) if (ext2errors[i].errnum == errcode) { printf ("%s", ext2errors [i].desc); return; } +#endif printf ("Unknown ext2 error"); } @@ -162,3 +152,14 @@ struct fs_ops ext2_fs_ops = { namei_follow: namei_follow_ext2, have_inode: 0, }; + +/* These are silly stubs to satisfy libext2fs symbols */ +unsigned long time(void) +{ + return 0; +} + +void *realloc(void *p, int size) +{ + return NULL; +} diff --git a/second/fs/romfs.c b/second/fs/romfs.c index 871f71e..10d44e6 100644 --- a/second/fs/romfs.c +++ b/second/fs/romfs.c @@ -229,7 +229,7 @@ static int dir_namei(romfs_filsys fs, const char *pathname, int *namelen, ino_t inode; if ((c = *pathname) == '/') { - base = (ino_t)fs->private; + base = root; pathname++; } @@ -276,7 +276,6 @@ static int namei_follow_romfs (const char *filename) { int ret; - fs->private = (void *)root; link_count = 0; ret = open_namei (fs, filename, &inode, root); diff --git a/second/fs/ufs.c b/second/fs/ufs.c index f826979..ba1a2cf 100644 --- a/second/fs/ufs.c +++ b/second/fs/ufs.c @@ -278,7 +278,7 @@ static int dir_namei(ufs_filsys fs, const char *pathname, int *namelen, ino_t inode; if ((c = *pathname) == '/') { - base = (ino_t)fs->private; + base = root; pathname++; } if (ufs_read_inode (fs, base, &ub)) return -1; @@ -320,7 +320,6 @@ static int open_namei(ufs_filsys fs, const char *pathname, static int ufs_namei (ufs_filsys fs, ino_t root, ino_t cwd, const char *filename, ino_t *inode) { - fs->private = (void *)root; link_count = 0; return open_namei (fs, filename, inode, cwd); } diff --git a/silo/Makefile b/silo/Makefile index 9050d0c..ef3a754 100644 --- a/silo/Makefile +++ b/silo/Makefile @@ -8,7 +8,6 @@ ifeq ($(OPSYS),Solaris) endif all: $(PROGRAMS) - @echo $(MESSAGE) HEADERS=../first/first.h ../first/ultra.h ../first/fd.h SILO_OBJS=confcheck.o prom.o silo.o diff --git a/silo/silo.c b/silo/silo.c index 023d234..2fafba0 100644 --- a/silo/silo.c +++ b/silo/silo.c @@ -28,7 +28,7 @@ #define DFL_SECONDARY "/boot/second.b" #ifdef __sun__ -#include "../second/ufs.c" +#include "../second/fs/ufs.c" #endif #include <errno.h> |