Subject: Re: Adding Multiboot support (or not)
To: None <tech-kern@NetBSD.org>
From: Cliff Wright <cliff@snipe444.org>
List: tech-kern
Date: 01/04/2006 10:59:57
This is a multi-part message in MIME format.
--Multipart=_Wed__4_Jan_2006_10_59_57_-0800_vdjoDuWP+aaS7IE=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
I am a little late to this thread, but saw Hubert's comment about the
needed ls in cd9660. When I made my live CD I added this ability, and
the ability to boot a large kernel in non-emulation mode from a CD.
My changes for non-emulation require a new /boot, so I don't consider
this ready to turn in. However the changes for ls could be used (although
their is 1 hack for printable entries). Attached is the patch to 2.1 code:
--Multipart=_Wed__4_Jan_2006_10_59_57_-0800_vdjoDuWP+aaS7IE=
Content-Type: text/plain;
name="cd9660patch1.txt"
Content-Disposition: attachment;
filename="cd9660patch1.txt"
Content-Transfer-Encoding: 7bit
--- cd9660.c.orig 2003-10-17 23:39:12.000000000 -0700
+++ cd9660.c 2005-08-22 18:54:33.000000000 -0700
@@ -71,7 +71,13 @@
#define PTFIXSZ 8
#define PTSIZE(pp) roundup(PTFIXSZ + isonum_711((pp)->namlen), 2)
+#ifndef EL_NO_EMUL
#define cdb2devb(bno) ((bno) * ISO_DEFAULT_BLOCK_SIZE / DEV_BSIZE)
+#else
+#define cdb2devb(bno) ((bno))
+#endif
+
+static int ls_mode = 0; /* set if open does ls instead */
static int pnmatch __P((const char *, struct ptable_ent *));
static int dirmatch __P((const char *, struct iso_directory_record *));
@@ -90,8 +96,10 @@
continue;
return 0;
}
- if (*path != '/')
+ if (*path != '/') {
+ if (ls_mode && *path == 0) return 1;
return 0;
+ }
return 1;
}
@@ -258,7 +266,31 @@
}
if (dsize == 1)
dsize = isonum_733(dp->size);
- if (dirmatch(path, dp))
+ if (ls_mode) {/* cliff */
+ int namelen;
+ char *entname;
+ char *vers;
+ ino_t ino;
+
+ namelen = isonum_711(dp->name_len);
+ entname = alloc(namelen + 1);
+ entname[namelen] = 0;
+ memcpy(entname, dp->name, namelen);
+ /* strip trailing dots, and version number */
+ vers = strrchr(entname, ';');
+ if(vers) {
+ if(*(vers - 1) == '.') *(vers - 1) = 0;
+ else *(vers) = 0;
+ }
+ if (dp->flags[0] & 2)
+ ino = (isonum_733(dp->extent) +
+ isonum_711(dp->ext_attr_length)) << 11;
+ else
+ ino = (bno << 11) + psize;
+ if(*entname > 32) printf("%d: %s (%s)\n", ino,
+ entname, dp->flags[0] & 2 ? "DIR": "REG");
+ free(entname, namelen + 1);
+ } else if (dirmatch(path, dp))
break;
psize += isonum_711(dp->length);
dp = (struct iso_directory_record *)((caddr_t)dp + isonum_711(dp->length));
@@ -289,6 +321,19 @@
return rc;
}
+void
+cd9660_ls(path)
+ const char *path;
+{
+ int fd;
+
+ /* open routine doubles as ls routine if ls_mode is set */
+ ls_mode = 1;
+ fd = open(path, 0);
+ if (fd >= 0) close(fd);
+ ls_mode = 0;
+}
+
#if !defined(LIBSA_NO_FS_CLOSE)
int
cd9660_close(f)
--Multipart=_Wed__4_Jan_2006_10_59_57_-0800_vdjoDuWP+aaS7IE=
Content-Type: text/plain;
name="cd9660patch2.txt"
Content-Disposition: attachment;
filename="cd9660patch2.txt"
Content-Transfer-Encoding: 7bit
--- cd9660.h.orig 2003-08-20 17:00:52.000000000 -0700
+++ cd9660.h 2005-08-22 14:14:17.000000000 -0700
@@ -32,3 +32,5 @@
*/
FS_DEF(cd9660);
+
+void cd9660_ls(const char *);
--Multipart=_Wed__4_Jan_2006_10_59_57_-0800_vdjoDuWP+aaS7IE=--