- Add load_mods command to boot2 (load_mods /dir/mod*).
- Rename resulting binary to boot_monitor.
- Change default banner when used in MINIX.
See
.Xr pciback 4 .
.El
+.It Ic load_mods Va mods_path_pattern
+Load modules specified by pattern like /some_path/mod*.
.It Ic ls Op Pa path
Print a directory listing of
.Pa path ,
# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
-PROG= boot
+PROG= boot_monitor
.include <../Makefile.boot>
void command_consdev(char *);
void command_modules(char *);
void command_multiboot(char *);
+void command_load_mods(char *);
const struct bootblk_command commands[] = {
{ "help", command_help },
{ "consdev", command_consdev },
{ "modules", command_modules },
{ "load", module_add },
+ { "load_mods", command_load_mods },
{ "multiboot", command_multiboot },
{ "vesa", command_vesa },
{ "splash", splash_add },
printf("%s\n", bootconf.banner[n]);
} else {
#endif /* !SMALL */
+#ifndef __minix
printf("\n"
">> %s, Revision %s (from NetBSD %s)\n"
">> Memory: %d/%d k\n",
bootprog_name, bootprog_rev, bootprog_kernrev,
getbasemem(), getextmem());
+#else
+ printf("\n"
+ "--- Welcome to MINIX 3. This is the boot monitor. ---\n"
+ "Memory: %d/%d k\n",
+ getbasemem(), getextmem());
+#endif
#ifndef SMALL
}
"vesa {modenum|on|off|enabled|disabled|list}\n"
"modules {on|off|enabled|disabled}\n"
"load {path_to_module}\n"
+ "load_mods {path_to_modules}, pattern might be used\n"
"multiboot [xdNx:][filename] [<args>]\n"
"userconf {command}\n"
"rndseed {path_to_rndseed_file}\n"
const char *save = default_filename;
default_filename = "/";
- ls(arg);
+ ls(arg, NULL);
+ default_filename = save;
+}
+
+void
+command_load_mods(char *arg)
+{
+ const char *save = default_filename;
+
+ default_filename = "/";
+ ls(arg, module_add);
default_filename = save;
}
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-cd9660_ls(struct open_file *f, const char *pattern)
+cd9660_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by cd9660\n");
return;
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-dosfs_ls(struct open_file *f, const char *pattern)
+dosfs_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by dosfs\n");
return;
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-ext2fs_ls(struct open_file *f, const char *pattern)
+ext2fs_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
struct file *fp = (struct file *)f->f_fsdata;
size_t block_size = fp->f_fs->e2fs_bsize;
#include <lib/libkern/libkern.h>
void
-ls(const char *path)
+ls(const char *path, void (*funcp)(char* arg))
{
int fd;
struct stat sb;
size_t size;
const char *fname = 0;
- char *p;
+ char *p = NULL;
struct open_file *f;
if ((fd = open(path, 0)) < 0
memcpy(p, path, size);
p[size] = 0;
fd = open(p, 0);
- dealloc(p, size + 1);
} else {
fd = open("", 0);
fname = path;
#endif
if (FS_LS(f->f_ops) != NULL)
- FS_LS(f->f_ops)(f, fname);
+ FS_LS(f->f_ops)(f, fname, funcp, p);
else
printf("no ls support for this file system\n");
out:
+ if (p != NULL)
+ dealloc(p, size + 1);
close(fd);
}
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-minixfs3_ls(struct open_file *f, const char *pattern)
+minixfs3_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
struct file *fp = (struct file *)f->f_fsdata;
struct mfs_sblock *fs = fp->f_fs;
entry_t *p_names = names;
do {
n = p_names;
- printf("%d: %s\n",
- n->e_ino, n->e_name);
+ if (funcp) {
+ /* Call handler for each file instead of
+ * printing. Used by load_mods command.
+ */
+ char namebuf[MAXPATHLEN+1];
+ namebuf[0] = '\0';
+ if (path != pattern) {
+ strcpy(namebuf, path);
+ namebuf[strlen(path)] = '/';
+ namebuf[strlen(path) + 1] = '\0';
+ }
+ strcat(namebuf, n->e_name);
+
+ funcp(namebuf);
+ } else {
+ printf("%d: %s\n",
+ n->e_ino, n->e_name);
+ }
p_names = n->e_next;
} while (p_names);
} else {
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-nfs_ls(struct open_file *f, const char *pattern)
+nfs_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by nfs\n");
return;
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-null_ls(struct open_file *f, const char *pattern)
+null_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by nullfs\n");
return;
#if defined(LIBSA_ENABLE_LS_OP)
#define FS_DEF(fs) \
FS_DEF_BASE(fs);\
- extern __compactcall void __CONCAT(fs,_ls)(struct open_file *, const char *)
+ extern __compactcall void __CONCAT(fs,_ls)(struct open_file *, const char *,\
+ void (*)(char* arg), char*)
#else
#define FS_DEF(fs) FS_DEF_BASE(fs)
#endif
__compactcall off_t (*seek)(struct open_file *, off_t, int);
__compactcall int (*stat)(struct open_file *, struct stat *);
#if defined(LIBSA_ENABLE_LS_OP)
- __compactcall void (*ls)(struct open_file *, const char *);
+ __compactcall void (*ls)(struct open_file *, const char *,
+ void (*)(char* arg), char*);
#endif
};
int stat(const char *, struct stat *);
int fstat(int, struct stat *);
#if defined(LIBSA_ENABLE_LS_OP)
-void ls(const char *);
+void ls(const char *, void (*funcp)(char* arg));
#endif
typedef int cmp_t(const void *, const void *);
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-tftp_ls(struct open_file *f, const char *pattern)
+tftp_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by tftp\n");
return;
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-ufs_ls(struct open_file *f, const char *pattern)
+ufs_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
struct file *fp = (struct file *)f->f_fsdata;
char *buf;
#if defined(LIBSA_ENABLE_LS_OP)
__compactcall void
-ustarfs_ls(struct open_file *f, const char *pattern)
+ustarfs_ls(struct open_file *f, const char *pattern,
+ void (*funcp)(char* arg), char* path)
{
printf("Currently ls command is unsupported by ustarfs\n");
return;