diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-03-20 12:08:57 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-03-20 12:08:57 -0800 |
commit | 006ba7d78486c827ab58372bf1d3a6ea017935a8 (patch) | |
tree | ffbf74a61928af2aa74817262e5cef8e2e378c80 | |
parent | 3f2659fb1a67141814021885facf0023732ce05e (diff) | |
parent | 872fbe1173f92effa8b988169799c194b2128852 (diff) | |
download | klibc-006ba7d78486c827ab58372bf1d3a6ea017935a8.tar.gz |
Merge with git+ssh://master.kernel.org/pub/scm/libs/klibc/klibc.gitklibc-1.2.6
-rw-r--r-- | klibc/README | 16 | ||||
-rw-r--r-- | klibc/mmap.c | 30 | ||||
-rw-r--r-- | usr/kinit/fstype/fstype.c | 34 | ||||
-rw-r--r-- | usr/kinit/ipconfig/main.c | 16 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 51 insertions, 47 deletions
diff --git a/klibc/README b/klibc/README index a3aaa7b0aecb8..7160cd1f86d0c 100644 --- a/klibc/README +++ b/klibc/README @@ -36,35 +36,33 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to alpha: Working arm-thumb: Untested - arm26: Not yet ported arm: Working + arm26: Not yet ported cris: Working h8300: Not yet ported i386: Working ia64: Working m32r: Untested m68k: Not yet ported - mips64: Not yet ported mips: Working + mips64: Not yet ported parisc: Working - ppc64: Working + parisc64: Not yet ported ppc: Working + ppc64: Working s390: Working static, shared untested s390x: Working sh: Untested - sparc64: Untested + sh64: Not yet ported sparc: Working + sparc64: Untested v850: Not yet ported x86-64: Working + xtensa: Not yet ported Shared library support requires recent binutils on many architectures. - "Need sysstub.ph" means the architectural changes first implemented - in klibc-0.117 has not yet been implemented; klibc-0.116 did, - however, work. "Not yet ported" means no porting work has been - done on this architecture. - Note that even the "working" ones likely have bugs. Please report them if you run into them. diff --git a/klibc/mmap.c b/klibc/mmap.c index da11c705933ae..d90c2656bbd73 100644 --- a/klibc/mmap.c +++ b/klibc/mmap.c @@ -10,19 +10,23 @@ #include <bitsize.h> /* - * MMAP2_SHIFT is definitely *NOT* equal to getpageshift() for - * at least some architectures... - */ -#if defined(__i386__) || defined( __sparc__) || defined(__arm__) -# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ -#endif - -/* * Set in SYSCALLS whether or not we should use an unadorned mmap() system * call (typical on 64-bit architectures). */ #if (_BITSIZE == 32 && defined(__NR_mmap2)) || (_BITSIZE == 64 && !defined(__NR_mmap)) +/* + * Some architectures use a fixed value for MMAP2_SHIFT, other use the + * current page size. This, of course, isn't documented or even + * #define'd anywhere. + */ +#if defined(__cris__) || defined(__m68k__) +/* Use the current page size */ +#else +# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ +#endif + + /* This architecture uses mmap2(). The Linux mmap2() system call takes a page offset as the offset argument. We need to make sure we have the proper conversion in place. */ @@ -33,12 +37,12 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset { #ifdef MMAP2_SHIFT const int mmap2_shift = MMAP2_SHIFT; - const unsigned long mmap2_mask = (1UL << mmap2_shift) - 1; #else - extern unsigned int __page_size, __page_shift; + extern unsigned int __page_shift; const int mmap2_shift = __page_shift; - const unsigned long mmap2_mask = (unsigned long)__page_size - 1; #endif + extern unsigned int __page_size; + const unsigned int mmap2_mask = __page_size - 1; if ( offset & mmap2_mask ) { errno = EINVAL; @@ -49,7 +53,3 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset } #endif - - - - diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c index a897e588cec04..370d6ca2cc139 100644 --- a/usr/kinit/fstype/fstype.c +++ b/usr/kinit/fstype/fstype.c @@ -52,16 +52,20 @@ /* Swap needs the definition of block size */ #include "swap_fs.h" -static int gzip_image(const unsigned char *buf, unsigned long long *bytes) +static int gzip_image(const void *buf, unsigned long long *bytes) { - if (buf[0] == 037 && (buf[1] == 0213 || buf[1] == 0236)) { - *bytes = 0; /* Can only be determined by processing the whole file */ + const unsigned char *p = buf; + + if (p[0] == 037 && (p[1] == 0213 || p[1] == 0236)) { + /* The length of a gzip stream can only be determined + by processing the whole stream */ + *bytes = 0ULL; return 1; } return 0; } -static int cramfs_image(const unsigned char *buf, unsigned long long *bytes) +static int cramfs_image(const void *buf, unsigned long long *bytes) { const struct cramfs_super *sb = (const struct cramfs_super *)buf; @@ -76,7 +80,7 @@ static int cramfs_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int romfs_image(const unsigned char *buf, unsigned long long *bytes) +static int romfs_image(const void *buf, unsigned long long *bytes) { const struct romfs_super_block *sb = (const struct romfs_super_block *)buf; @@ -88,7 +92,7 @@ static int romfs_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int minix_image(const unsigned char *buf, unsigned long long *bytes) +static int minix_image(const void *buf, unsigned long long *bytes) { const struct minix_super_block *sb = (const struct minix_super_block *)buf; @@ -102,7 +106,7 @@ static int minix_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int ext3_image(const unsigned char *buf, unsigned long long *bytes) +static int ext3_image(const void *buf, unsigned long long *bytes) { const struct ext3_super_block *sb = (const struct ext3_super_block *)buf; @@ -116,7 +120,7 @@ static int ext3_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int ext2_image(const unsigned char *buf, unsigned long long *bytes) +static int ext2_image(const void *buf, unsigned long long *bytes) { const struct ext2_super_block *sb = (const struct ext2_super_block *)buf; @@ -129,7 +133,7 @@ static int ext2_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int reiserfs_image(const unsigned char *buf, unsigned long long *bytes) +static int reiserfs_image(const void *buf, unsigned long long *bytes) { const struct reiserfs_super_block *sb = (const struct reiserfs_super_block *)buf; @@ -147,7 +151,7 @@ static int reiserfs_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int xfs_image(const unsigned char *buf, unsigned long long *bytes) +static int xfs_image(const void *buf, unsigned long long *bytes) { const struct xfs_sb *sb = (const struct xfs_sb *)buf; @@ -160,7 +164,7 @@ static int xfs_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int jfs_image(const unsigned char *buf, unsigned long long *bytes) +static int jfs_image(const void *buf, unsigned long long *bytes) { const struct jfs_superblock *sb = (const struct jfs_superblock *)buf; @@ -172,7 +176,7 @@ static int jfs_image(const unsigned char *buf, unsigned long long *bytes) return 0; } -static int luks_image(const unsigned char *buf, unsigned long long *blocks) +static int luks_image(const void *buf, unsigned long long *blocks) { const struct luks_partition_header *lph = (const struct luks_partition_header *)buf; @@ -185,7 +189,7 @@ static int luks_image(const unsigned char *buf, unsigned long long *blocks) return 0; } -static int swap_image(const unsigned char *buf, unsigned long long *blocks) +static int swap_image(const void *buf, unsigned long long *blocks) { const struct swap_super_block *ssb = (const struct swap_super_block *)buf; @@ -201,7 +205,7 @@ static int swap_image(const unsigned char *buf, unsigned long long *blocks) struct imagetype { off_t block; const char name[12]; - int (*identify)(const unsigned char *, unsigned long long *); + int (*identify)(const void *, unsigned long long *); }; static struct imagetype images[] = { @@ -223,7 +227,7 @@ static struct imagetype images[] = { int identify_fs(int fd, const char **fstype, unsigned long long *bytes, off_t offset) { - unsigned char buf[BLOCK_SIZE]; + uint64_t buf[BLOCK_SIZE>>3]; /* 64-bit worst case alignment */ off_t cur_block = (off_t)-1; struct imagetype *ip; int ret; diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index dcb28f292deaf..80350f787f976 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -317,28 +317,30 @@ static int loop(void) while (1) { int timeout = 60; int pending = 0; + int done = 0; int timeout_ms; int x; for (s = slist; s; s = s->next) { + DEBUG(("%s: state = %d\n", s->dev->name, s->state)); + if (s->state == DEVST_COMPLETE) { - if ( bringup_first ) - break; - else - continue; + done++; + continue; } - DEBUG(("Pending: %s: state = %d\n", s->dev->name, s->state)); pending++; - if (s->expire - now.tv_sec <= 0) + if (s->expire - now.tv_sec <= 0) { + DEBUG(("timeout\n")); process_timeout_event(s, now.tv_sec); + } if (timeout > s->expire - now.tv_sec) timeout = s->expire - now.tv_sec; } - if (pending == 0) + if (pending == 0 || (bringup_first && done)) break; timeout_ms = timeout * 1000; @@ -1 +1 @@ -1.2.4 +1.2.6 |