Getting ready for 0.5.1

This commit is contained in:
gord committed 1999-02-22 03:20:36 +00:00
1 parent 6b874486ce
commit 553fec6022
21 files changed
+379 -208

No files matched your search

+8 -5
View File
@@ -521,18 +521,21 @@ strncat(char *s1, char *s2, int n)
int
strcmp(char *s1, char *s2)
substring(char *s1, char *s2)
{
while (*s1 == *s2)
{
/* The strings match, so return 0. */
if (!*(s1++))
return 0;
s2++;
}
/* S1 is shorter than S2. */
if (*s1 == 0)
return -1;
/* S1 is a substring of S2. */
return 1;
}
@@ -577,9 +580,9 @@ bcopy(char *from, char *to, int len)
{
if ((to >= from+len) || (to <= from))
{
while (len > 3)
while (len >= sizeof (unsigned long))
{
len -= 4;
len -= sizeof (unsigned long);
*(((unsigned long *)to)++) = *(((unsigned long *)from)++);
}
while (len-- > 0)
@@ -587,6 +590,8 @@ bcopy(char *from, char *to, int len)
}
else
{
/* We have a region that overlaps, but would be overwritten
if we copied it forward. */
while (len-- > 0)
to[len] = from[len];
}
@@ -607,5 +612,3 @@ bzero(char *start, int len)
return (!errnum);
}
+16 -17
View File
@@ -214,7 +214,7 @@ returnit:
if (run_cmdline && get_cmdline("command> ", commands, cur_heap, 2048))
return 1;
if (strcmp("boot", cur_heap) == 0 || (script && !*cur_heap))
if (substring("boot", cur_heap) == 0 || (script && !*cur_heap))
{
if ((type == 'f') | (type == 'n'))
bsd_boot(type, bootdev);
@@ -245,9 +245,9 @@ returnit:
cmd_len = 0;
while (cur_cmdline[cmd_len++]);
if (strcmp("chainloader", cur_heap) < 1)
if (substring("chainloader", cur_heap) < 1)
{
if (open(cur_cmdline) && (read(BOOTSEC_LOCATION, SECTOR_SIZE)
if (open(cur_cmdline) && (read(BOOTSEC_LOCATION, SECTOR_SIZE)
== SECTOR_SIZE)
&& (*((unsigned short *) (BOOTSEC_LOCATION+BOOTSEC_SIG_OFFSET))
== BOOTSEC_SIGNATURE))
@@ -258,17 +258,17 @@ returnit:
type = 0;
}
}
else if (strcmp("pause", cur_heap) < 1)
else if (substring("pause", cur_heap) < 1)
{
if (getc() == 27)
return 1;
}
else if (strcmp("uppermem", cur_heap) < 1)
else if (substring("uppermem", cur_heap) < 1)
{
if (safe_parse_maxint(&cur_cmdline, (int *)&(mbi.mem_upper)))
mbi.flags &= ~MB_INFO_MEM_MAP;
}
else if (strcmp("root", cur_heap) < 1)
else if (substring("root", cur_heap) < 1)
{
int hdbias = 0;
char *biasptr = skip_to(0, set_device(cur_cmdline));
@@ -295,7 +295,7 @@ returnit:
current_drive = -1;
}
}
else if (strcmp("kernel", cur_heap) < 1)
else if (substring("kernel", cur_heap) < 1)
{
/* make sure it's at the beginning of the boot heap area */
bcopy(cur_heap, heap, cmd_len + (((int)cur_cmdline) - ((int)cur_heap)));
@@ -304,7 +304,7 @@ returnit:
if (type = load_image())
cur_heap = cur_cmdline + cmd_len;
}
else if (strcmp("module", cur_heap) < 1)
else if (substring("module", cur_heap) < 1)
{
if (type == 'm')
{
@@ -329,7 +329,7 @@ returnit:
else
errnum = ERR_NEED_MB_KERNEL;
}
else if (strcmp("initrd", cur_heap) < 1)
else if (substring("initrd", cur_heap) < 1)
{
if (type == 'L' || type == 'l')
{
@@ -338,7 +338,7 @@ returnit:
else
errnum = ERR_NEED_LX_KERNEL;
}
else if (strcmp("install", cur_heap) < 1)
else if (substring("install", cur_heap) < 1)
{
char *stage1_file = cur_cmdline, *dest_dev, *file, *addr, *config_file;
char buffer[SECTOR_SIZE], old_sect[SECTOR_SIZE];
@@ -470,7 +470,7 @@ returnit:
}
}
#ifdef DEBUG
else if (strcmp("testload", cur_heap) < 1)
else if (substring("testload", cur_heap) < 1)
{
type = 0;
if (open(cur_cmdline))
@@ -534,13 +534,13 @@ returnit:
debug_fs = NULL;
}
}
else if (strcmp("read", cur_heap) < 1)
else if (substring("read", cur_heap) < 1)
{
int myaddr;
if (safe_parse_maxint(&cur_cmdline, &myaddr))
printf("Address 0x%x: Value 0x%x", myaddr, *((unsigned *)myaddr));
}
else if (strcmp("fstest", cur_heap) == 0)
else if (substring("fstest", cur_heap) == 0)
{
if (debug_fs)
{
@@ -553,12 +553,12 @@ returnit:
printf(" Filesystem tracing is now on\n");
}
}
else if (strcmp("impsprobe", cur_heap) == 0)
else if (substring("impsprobe", cur_heap) == 0)
{
if (!imps_probe())
printf(" No MPS information found or probe failed\n");
}
else if (strcmp("displaymem", cur_heap) == 0)
else if (substring("displaymem", cur_heap) == 0)
{
if (get_eisamemsize() != -1)
printf(" EISA Memory BIOS Interface is present\n");
@@ -592,11 +592,10 @@ returnit:
}
}
#endif /* DEBUG */
else if (strcmp("makeactive", cur_heap) == 0)
else if (substring("makeactive", cur_heap) == 0)
make_saved_active();
else if (*cur_heap && *cur_heap != ' ')
errnum = ERR_UNRECOGNIZED;
goto restart;
}
+30 -31
View File
@@ -41,36 +41,36 @@ int errnum = 0;
char *err_list[] =
{
0,
"Selected item won\'t fit into memory",
"Selected disk doesn\'t exist",
"Disk read error",
"Disk write error",
"Disk geometry error",
"Attempt to access block outside partition",
"Partition table invalid or corrupt",
"No such partition",
"Bad filename (must be absolute pathname or blocklist)",
"Bad file or directory type",
"File not found",
"Cannot mount selected partition",
"Inconsistent filesystem structure",
"Filesystem compatibility error, can\'t read whole file",
"Error while parsing number",
"Device string unrecognizable",
"Invalid device requested",
"Invalid or unsupported executable format",
"Loading below 1MB is not supported",
"Unsupported Multiboot features requested",
"Unknown boot failure",
"Must load Multiboot kernel before modules",
"Must load Linux kernel before initrd",
"Cannot boot without kernel loaded",
"Unrecognized command",
"Bad or incompatible header on compressed file",
"Bad or corrupt data while decompressing file",
"Bad or corrupt version of stage1/stage2",
0
[ERR_NONE] = 0,
[ERR_BAD_FILENAME] = "Bad filename (must be absolute pathname or blocklist)",
[ERR_BAD_FILETYPE] = "Bad file or directory type",
[ERR_BAD_GZIP_DATA] = "Bad or corrupt data while decompressing file",
[ERR_BAD_GZIP_HEADER] = "Bad or incompatible header on compressed file",
[ERR_BAD_PART_TABLE] = "Partition table invalid or corrupt",
[ERR_BAD_VERSION] = "Bad or corrupt version of stage1/stage2",
[ERR_BELOW_1MB] = "Loading below 1MB is not supported",
[ERR_BOOT_COMMAND] = "Cannot boot without kernel loaded",
[ERR_BOOT_FAILURE] = "Unknown boot failure",
[ERR_BOOT_FEATURES] = "Unsupported Multiboot features requested",
[ERR_DEV_FORMAT] = "Device string unrecognizable",
[ERR_DEV_VALUES] = "Invalid device requested",
[ERR_EXEC_FORMAT] = "Invalid or unsupported executable format",
[ERR_FILELENGTH] = "Filesystem compatibility error, cannot read whole file",
[ERR_FILE_NOT_FOUND] = "File not found",
[ERR_FSYS_CORRUPT] = "Inconsistent filesystem structure",
[ERR_FSYS_MOUNT] = "Cannot mount selected partition",
[ERR_GEOM] = "Disk geometry error",
[ERR_NEED_LX_KERNEL] = "Must load Linux kernel before initrd",
[ERR_NEED_MB_KERNEL] = "Must load Multiboot kernel before modules",
[ERR_NO_DISK] = "Selected disk does not exist",
[ERR_NO_PART] = "No such partition",
[ERR_NUMBER_PARSING] = "Error while parsing number",
[ERR_OUTSIDE_PART] = "Attempt to access block outside partition",
[ERR_READ] = "Disk read error",
[ERR_SYMLINK_LOOP] = "Too many symbolic links",
[ERR_UNRECOGNIZED] = "Unrecognized command",
[ERR_WONT_FIT] = "Selected item cannot fit into memory",
[ERR_WRITE] = "Disk write error",
};
@@ -212,4 +212,3 @@ init_bios_info(void)
cmain();
}
+88 -14
View File
@@ -1,6 +1,7 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* 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
@@ -19,12 +20,7 @@
#include "shared.h"
#ifdef E2DEBUG
#include "pc_slice.h"
#else
#include "filesys.h"
#endif
static int mapblock1, mapblock2;
@@ -180,7 +176,9 @@ struct ext2_dir_entry {
#define log2(n) ffz(~(n))
#define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */
#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */
#define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */
#define PATH_MAX 1024 /* include/linux/limits.h */
#define MAX_LINK_COUNT 5 /* number of symbolic links to follow */
/* made up, these are pointers into FSYS_BUF */
/* read once, always stays there: */
@@ -209,8 +207,10 @@ struct ext2_dir_entry {
(EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
/* linux/stat.h */
#define S_IFMT 00170000
#define S_IFLNK 0120000
#define S_IFREG 0100000
#define S_IFDIR 0040000
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
@@ -358,12 +358,13 @@ ext2fs_read(int addr, int len)
int size = 0;
#ifdef E2DEBUG
static char hexdigit[] = "0123456789abcdef";
unsigned char * i;
for (i = (unsigned char *)INODE;
i < ((unsigned char *)INODE + sizeof(struct ext2_inode));
i++) {
printf("%c", "0123456789abcdef"[*i >> 4]);
printf("%c", "0123456789abcdef"[*i % 16]);
printf("%c", hexdigit[*i >> 4]);
printf("%c", hexdigit[*i % 16]);
if (!((i + 1 - (unsigned char *)INODE) % 16)) { printf("\n"); }
else { printf(" "); }
}
@@ -390,7 +391,7 @@ ext2fs_read(int addr, int len)
devread(map * (EXT2_BLOCK_SIZE(SUPERBLOCK) / DEV_BSIZE),
offset, size, addr);
#ifndef NO_FANCY_STUFF
debug_fs_func = NULL;
#endif /* NO_FANCY_STUFF */
@@ -442,6 +443,7 @@ int
ext2fs_dir(char *dirname)
{
int current_ino = EXT2_ROOT_INO; /* start at the root */
int updir_ino = current_ino; /* the parent of the current directory */
int group_id; /* which group the inode is in */
int group_desc; /* fs pointer to that group */
int desc; /* index within that group */
@@ -450,6 +452,9 @@ ext2fs_dir(char *dirname)
struct ext2_group_desc * gdp;
struct ext2_inode * raw_inode; /* inode info corresponding to current_ino */
char linkbuf[PATH_MAX]; /* buffer for following symbolic links */
int link_count = 0;
char *rest;
char ch; /* temp char holder */
@@ -527,6 +532,74 @@ ext2fs_dir(char *dirname)
printf("first word=%x\n", *((int *)INODE));
#endif /* E2DEBUG */
/* If we've got a symbolic link, then chase it. */
if (S_ISLNK(INODE->i_mode))
{
int len, remaining;
if (++ link_count > MAX_LINK_COUNT)
{
errnum = ERR_SYMLINK_LOOP;
return 0;
}
/* Find out how long our remaining name is. */
len = 0;
while (dirname[len] && !isspace (dirname[len]))
len ++;
/* Get the symlink size. */
filemax = (INODE->i_size);
if (filemax + len > sizeof (linkbuf) - 2)
{
errnum = ERR_FILELENGTH;
return 0;
}
if (len)
{
/* Copy the remaining name to the end of the symlink data.
Note that DIRNAME and LINKBUF may overlap! */
bcopy (dirname, linkbuf + filemax, len);
}
linkbuf[filemax + len] = '\0';
/* Read the symlink data. */
if (INODE->i_blocks)
{
/* Read the necessary blocks, and reset the file pointer. */
len = read ((int) linkbuf, filemax);
filepos = 0;
if (!len)
return 0;
}
else
{
/* Copy the data directly from the inode. */
len = filemax;
bcopy ((char *) INODE->i_block, linkbuf, len);
}
#if E2DEBUG
printf ("symlink=%s\n", linkbuf);
#endif
dirname = linkbuf;
if (*dirname == '/')
{
/* It's an absolute link, so look it up in root. */
current_ino = EXT2_ROOT_INO;
updir_ino = current_ino;
}
else
{
/* Relative, so look it up in our parent directory. */
current_ino = updir_ino;
}
/* Try again using the new name. */
continue;
}
/* if end of filename, INODE points to the file's inode */
if (!*dirname || isspace(*dirname))
{
@@ -541,6 +614,7 @@ ext2fs_dir(char *dirname)
}
/* else we have to traverse a directory */
updir_ino = current_ino;
/* skip over slashes */
while (*dirname == '/')
@@ -573,7 +647,7 @@ ext2fs_dir(char *dirname)
if (print_possibilities < 0) {
putchar('\n');
}
else {
else {
errnum = ERR_FILE_NOT_FOUND;
*rest = ch;
}
@@ -583,7 +657,7 @@ ext2fs_dir(char *dirname)
/* else, find the (logical) block component of our location */
blk = loc >> EXT2_BLOCK_SIZE_BITS(SUPERBLOCK);
/* now we know which logical block of the directory entry we are looking
/* we know which logical block of the directory entry we are looking
for, now we have to translate that to the physical (fs) block on
the disk */
map = ext2fs_block_map(blk);
@@ -605,7 +679,7 @@ ext2fs_dir(char *dirname)
#ifdef E2DEBUG
printf("directory entry ino=%d\n", dp->inode);
if (dp->inode)
if (dp->inode)
printf("entry=%s\n", dp->name);
#endif /* E2DEBUG */
@@ -614,7 +688,7 @@ ext2fs_dir(char *dirname)
int saved_c = dp->name[dp->name_len];
dp->name[dp->name_len] = 0;
str_chk = strcmp(dirname, dp->name);
str_chk = substring(dirname, dp->name);
if (print_possibilities && ch != '/'
&& (!*dirname || str_chk <= 0))
+3 -4
View File
@@ -234,14 +234,15 @@ loop:
}
if (print_possibilities && ch != '/'
&& (!*dirname || strcmp(dirname, filename) <= 0))
&& (!*dirname || substring(dirname, filename) <= 0))
{
if (print_possibilities > 0)
print_possibilities = -print_possibilities;
printf(" %s", filename);
}
}
while (strcmp(dirname, filename) != 0 || (print_possibilities && ch != '/'));
while (substring(dirname, filename) != 0 ||
(print_possibilities && ch != '/'));
*(dirname = rest) = ch;
@@ -252,5 +253,3 @@ loop:
/* go back to main loop at top of function */
goto loop;
}
+7 -9
View File
@@ -28,24 +28,24 @@
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
*
* Carnegie Mellon requests users of this software to return to
*
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*
@@ -244,7 +244,7 @@ loop:
loc += dp->d_reclen;
if (dp->d_ino && print_possibilities && ch != '/'
&& (!*dirname || strcmp(dirname, dp->d_name) <= 0))
&& (!*dirname || substring(dirname, dp->d_name) <= 0))
{
if (print_possibilities > 0)
print_possibilities = -print_possibilities;
@@ -252,7 +252,7 @@ loop:
printf(" %s", dp->d_name);
}
}
while (!dp->d_ino || (strcmp(dirname, dp->d_name) != 0
while (!dp->d_ino || (substring(dirname, dp->d_name) != 0
|| (print_possibilities && ch != '/')) );
/* only get here if we have a matching directory entry */
@@ -263,5 +263,3 @@ loop:
/* go back to main loop at top of function */
goto loop;
}
+35 -31
View File
@@ -316,36 +316,40 @@ int special_attribute;
#endif /* _CHAR_IO_C */
#define ERR_NONE 0
#define ERR_WONT_FIT (ERR_NONE + 1)
#define ERR_NO_DISK (ERR_WONT_FIT + 1)
#define ERR_READ (ERR_NO_DISK + 1)
#define ERR_WRITE (ERR_READ + 1)
#define ERR_GEOM (ERR_WRITE + 1)
#define ERR_OUTSIDE_PART (ERR_GEOM + 1)
#define ERR_BAD_PART_TABLE (ERR_OUTSIDE_PART + 1)
#define ERR_NO_PART (ERR_BAD_PART_TABLE + 1)
#define ERR_BAD_FILENAME (ERR_NO_PART + 1)
#define ERR_BAD_FILETYPE (ERR_BAD_FILENAME + 1)
#define ERR_FILE_NOT_FOUND (ERR_BAD_FILETYPE + 1)
#define ERR_FSYS_MOUNT (ERR_FILE_NOT_FOUND + 1)
#define ERR_FSYS_CORRUPT (ERR_FSYS_MOUNT + 1)
#define ERR_FILELENGTH (ERR_FSYS_CORRUPT + 1)
#define ERR_NUMBER_PARSING (ERR_FILELENGTH + 1)
#define ERR_DEV_FORMAT (ERR_NUMBER_PARSING + 1)
#define ERR_DEV_VALUES (ERR_DEV_FORMAT + 1)
#define ERR_EXEC_FORMAT (ERR_DEV_VALUES + 1)
#define ERR_BELOW_1MB (ERR_EXEC_FORMAT + 1)
#define ERR_BOOT_FEATURES (ERR_BELOW_1MB + 1)
#define ERR_BOOT_FAILURE (ERR_BOOT_FEATURES + 1)
#define ERR_NEED_MB_KERNEL (ERR_BOOT_FAILURE + 1)
#define ERR_NEED_LX_KERNEL (ERR_NEED_MB_KERNEL + 1)
#define ERR_BOOT_COMMAND (ERR_NEED_LX_KERNEL + 1)
#define ERR_UNRECOGNIZED (ERR_BOOT_COMMAND + 1)
#define ERR_BAD_GZIP_HEADER (ERR_UNRECOGNIZED + 1)
#define ERR_BAD_GZIP_DATA (ERR_BAD_GZIP_HEADER + 1)
#define ERR_BAD_VERSION (ERR_BAD_GZIP_DATA + 1)
#define MAX_ERR_NUM (ERR_BAD_VERSION + 1)
enum grub_error_t {
ERR_NONE = 0,
ERR_BAD_FILENAME,
ERR_BAD_FILETYPE,
ERR_BAD_GZIP_DATA,
ERR_BAD_GZIP_HEADER,
ERR_BAD_PART_TABLE,
ERR_BAD_VERSION,
ERR_BELOW_1MB,
ERR_BOOT_COMMAND,
ERR_BOOT_FAILURE,
ERR_BOOT_FEATURES,
ERR_DEV_FORMAT,
ERR_DEV_VALUES,
ERR_EXEC_FORMAT,
ERR_FILELENGTH,
ERR_FILE_NOT_FOUND,
ERR_FSYS_CORRUPT,
ERR_FSYS_MOUNT,
ERR_GEOM,
ERR_NEED_LX_KERNEL,
ERR_NEED_MB_KERNEL,
ERR_NO_DISK,
ERR_NO_PART,
ERR_NUMBER_PARSING,
ERR_OUTSIDE_PART,
ERR_READ,
ERR_SYMLINK_LOOP,
ERR_UNRECOGNIZED,
ERR_WONT_FIT,
ERR_WRITE,
MAX_ERR_NUM
};
/* returns packed BIOS/ASCII code */
#define BIOS_CODE(x) ((x) >> 8)
@@ -371,7 +375,7 @@ int get_cmdline(char *prompt, char *commands, char *cmdline, int maxlen);
int tolower(int c);
int isspace(int c);
int strncat(char *s1, char *s2, int n);
int strcmp(char *s1, char *s2);
int substring(char *s1, char *s2);
char *strstr(char *s1, char *s2);
int bcopy(char *from, char *to, int len);
int bzero(char *start, int len);
+5 -5
View File
@@ -529,7 +529,7 @@ cmain(void)
{
ptr = skip_to(1, cmdline);
if (strcmp("title", cmdline) < 1)
if (substring("title", cmdline) < 1)
{
if (state > 1)
{
@@ -551,13 +551,13 @@ cmain(void)
}
else if (!state)
{
if (strcmp("timeout", cmdline) < 1)
if (substring("timeout", cmdline) < 1)
safe_parse_maxint(&ptr, &timeout);
if (strcmp("fallback", cmdline) < 1)
if (substring("fallback", cmdline) < 1)
safe_parse_maxint(&ptr, &fallback);
if (strcmp("default", cmdline) < 1)
if (substring("default", cmdline) < 1)
safe_parse_maxint(&ptr, &default_entry);
if (strcmp("password", cmdline) < 1)
if (substring("password", cmdline) < 1)
{
char *ptrend = ptr;
password = config_entries;