aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1997-12-04 21:52:47 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1997-12-04 21:52:47 +0000
commit3bb99eb225a264262bd480d725c336f4e0a14042 (patch)
tree5591549f0166958efbf61d95cf0e8bb2a742757e /sys/i386
parent4d9deedb49d6031cdbbc6ba4e5c924f06d71e104 (diff)
downloadsrc-3bb99eb225a264262bd480d725c336f4e0a14042.tar.gz
src-3bb99eb225a264262bd480d725c336f4e0a14042.zip
Finally, implement a mini-parser for RockRidge alternative filenames,
so the filenames can be displayed and selected in full beauty. If RR is present, the match is now case-sensitive, if RR is missing, the match is case-insensitive (as it used to be before).
Notes
Notes: svn path=/head/; revision=31545
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/boot/biosboot/boot.h8
-rw-r--r--sys/i386/boot/biosboot/io.c14
-rw-r--r--sys/i386/boot/cdboot/boot.h5
-rw-r--r--sys/i386/boot/cdboot/cdrom.c68
4 files changed, 62 insertions, 33 deletions
diff --git a/sys/i386/boot/biosboot/boot.h b/sys/i386/boot/biosboot/boot.h
index e0907c2485c3..366dbfc3ce72 100644
--- a/sys/i386/boot/biosboot/boot.h
+++ b/sys/i386/boot/biosboot/boot.h
@@ -24,11 +24,10 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
- * $Id: boot.h,v 1.21 1997/08/31 06:11:26 phk Exp $
+ * $Id: boot.h,v 1.22 1997/09/24 07:44:34 phk Exp $
*/
#include <sys/param.h>
-#include <sys/lock.h>
#include <sys/time.h>
#include <ufs/ffs/fs.h>
@@ -81,10 +80,9 @@ void printf(const char *format, ...);
void putchar(int c);
void delay1ms(void);
int gets(char *buf);
-#ifndef CDBOOT
int strcmp(const char *s1, const char *s2);
-#else /* CDBOOT */
-int strncasecmp(const char *s1, const char *s2, size_t s);
+#ifdef CDBOOT
+int strcasecmp(const char *s1, const char *s2);
#endif /* !CDBOOT */
void bcopy(const void *from, void *to, size_t len);
void twiddle(void);
diff --git a/sys/i386/boot/biosboot/io.c b/sys/i386/boot/biosboot/io.c
index 1e0527c4279a..b9c40588c46b 100644
--- a/sys/i386/boot/biosboot/io.c
+++ b/sys/i386/boot/biosboot/io.c
@@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
- * $Id: io.c,v 1.23 1997/06/09 05:10:55 bde Exp $
+ * $Id: io.c,v 1.24 1997/07/12 10:23:19 joerg Exp $
*/
#include "boot.h"
@@ -258,8 +258,6 @@ gets(char *buf)
return 0;
}
-#ifndef CDBOOT
-
int
strcmp(const char *s1, const char *s2)
{
@@ -271,26 +269,22 @@ strcmp(const char *s1, const char *s2)
return 1;
}
-#else /* CDBOOT */
-
+#ifdef CDBOOT
int
-strncasecmp(const char *s1, const char *s2, size_t s)
+strcasecmp(const char *s1, const char *s2)
{
/*
* We only consider ASCII chars and don't anticipate
* control characters (they are invalid in filenames
* anyway).
*/
- while (s > 0 && (*s1 & 0x5f) == (*s2 & 0x5f)) {
+ while ((*s1 & 0x5f) == (*s2 & 0x5f)) {
if (!*s1++)
return 0;
s2++;
}
- if (s == 0)
- return 0;
return 1;
}
-
#endif /* !CDBOOT */
void
diff --git a/sys/i386/boot/cdboot/boot.h b/sys/i386/boot/cdboot/boot.h
index b71f457072fb..4604c0877937 100644
--- a/sys/i386/boot/cdboot/boot.h
+++ b/sys/i386/boot/cdboot/boot.h
@@ -24,7 +24,7 @@
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:03 rpd
- * $Id$
+ * $Id: boot.h,v 1.1 1997/07/11 05:52:38 joerg Exp $
*/
/*
* Extensions for El Torito CD-ROM booting:
@@ -155,7 +155,8 @@ void printf(const char *format, ...);
void putchar(int c);
void delay1ms(void);
int gets(char *buf);
-int strncasecmp(const char *s1, const char *s2, size_t s);
+int strcasecmp(const char *s1, const char *s2);
+int strcmp(const char *s1, const char *s2);
void bcopy(const void *from, void *to, size_t len);
void twiddle(void);
diff --git a/sys/i386/boot/cdboot/cdrom.c b/sys/i386/boot/cdboot/cdrom.c
index 23d51b74ed12..d9555852e7fc 100644
--- a/sys/i386/boot/cdboot/cdrom.c
+++ b/sys/i386/boot/cdboot/cdrom.c
@@ -27,7 +27,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: cdrom.c,v 1.1 1997/07/11 05:52:39 joerg Exp $
+ * $Id: cdrom.c,v 1.2 1997/12/02 21:13:59 joerg Exp $
*/
@@ -52,6 +52,7 @@ static u_int32_t curblk, startblk, filesize, offset;
static int bread(u_int32_t rba, size_t nblks, void *buf);
static void badread(const char *msg, u_int32_t blkno);
static struct iso_directory_record *find(const char *path, int list_only);
+static char *get_rr_name(struct iso_directory_record *dirp, size_t *len_ret);
static int iread(u_char *buf, size_t len,
void (*copyfun)(const void *src, void *dst, size_t size));
@@ -207,18 +208,56 @@ xread(u_char *buf, size_t len)
return iread(buf, len, pcpy);
}
-/*
- * XXX Todo:
- * Use RR attributes if present
- */
+static char *
+get_rr_name(struct iso_directory_record *dirp, size_t *len_ret)
+{
+ struct rr_header {
+ char type[2];
+ u_char len;
+ u_char version;
+ } *rrp;
+ struct rr_nm_header {
+ struct rr_header rrh;
+ u_char flags;
+ char name[0]; /* XXX -- using gcc extension */
+ } *rrnmp;
+ char *cp;
+
+ cp = dirp->name + (u_char)dirp->name_len[0];
+ /* round up to 16-bit boundary; ugly */
+ cp = (char *)(((int)cp + 1) & ~1);
+ rrp = (struct rr_header *)cp;
+
+ if (rrp->type[0] != 'R' || rrp->type[1] != 'R') {
+ DPRINTF(("no RR, "));
+ return 0;
+ }
+
+ DPRINTF(("RR attribs: "));
+ cp += rrp->len;
+ while (cp - (char *)dirp <= (u_char)dirp->length[0]) {
+ rrp = (struct rr_header *)cp;
+ DPRINTF(("%c%c ", rrp->type[0], rrp->type[1]));
+ if (rrp->type[0] == 'N' && rrp->type[1] == 'M') {
+ rrnmp = (struct rr_nm_header *)rrp;
+ *len_ret = rrp->len - sizeof(struct rr_nm_header);
+ return rrnmp->name;
+ }
+ cp += rrp->len;
+ }
+
+ return 0;
+}
+
static struct iso_directory_record *
find(const char *path, int list_only)
{
struct iso_directory_record *dirp;
- char *ptr;
+ char *ptr, *rrname;
size_t len, entrylen;
char namebuf[256];
int i;
+ int (*comp)(const char *, const char *);
while (*path && *path == '/')
path++;
@@ -261,21 +300,18 @@ find(const char *path, int list_only)
DPRINTF(("directory\n"));
continue;
}
+ rrname = get_rr_name(dirp, &len);
+ comp = rrname? strcmp: strcasecmp;
-#ifdef DEBUG
- bcopy(dirp->name, namebuf, len);
+ bcopy(rrname? rrname: dirp->name, namebuf, len);
namebuf[len] = 0;
DPRINTF(("name `%s'\n", namebuf));
-#else /* !DEBUG */
+
if (list_only) {
- bcopy(dirp->name, namebuf, len);
- namebuf[len] = 0;
+#ifndef DEBUG
printf("%s ", namebuf);
- }
-#endif /* DEBUG */
-
- if (!list_only &&
- strncasecmp(path, dirp->name, len) == 0)
+#endif
+ } else if (comp(path, namebuf) == 0)
return dirp;
}
#ifndef DEBUG