Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/cd9660 Make it usable from userland.
details: https://anonhg.NetBSD.org/src/rev/9c88915d61e5
branches: trunk
changeset: 344007:9c88915d61e5
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 09 15:45:37 2016 +0000
description:
Make it usable from userland.
diffstat:
sys/fs/cd9660/cd9660_util.c | 52 ++++++++++++++++++++++++++++++++------------
1 files changed, 38 insertions(+), 14 deletions(-)
diffs (140 lines):
diff -r e05c897223f5 -r 9c88915d61e5 sys/fs/cd9660/cd9660_util.c
--- a/sys/fs/cd9660/cd9660_util.c Wed Mar 09 15:44:49 2016 +0000
+++ b/sys/fs/cd9660/cd9660_util.c Wed Mar 09 15:45:37 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_util.c,v 1.12 2014/11/10 18:46:33 maxv Exp $ */
+/* $NetBSD: cd9660_util.c,v 1.13 2016/03/09 15:45:37 christos Exp $ */
/*-
* Copyright (c) 1994
@@ -37,9 +37,17 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_util.c,v 1.12 2014/11/10 18:46:33 maxv Exp $");
+#ifdef _KERNEL
+__KERNEL_RCSID(0, "$NetBSD: cd9660_util.c,v 1.13 2016/03/09 15:45:37 christos Exp $");
+#else
+/* used by macppc_installboot */
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+#endif
#include <sys/param.h>
+#ifdef _KERNEL
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/resourcevar.h>
@@ -51,14 +59,24 @@
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/dirent.h>
+#else
+#include <assert.h>
+#include <dirent.h>
+#define KASSERT(x) assert(x) /* XXX for <fs/unicode.h> */
+#endif
#include <fs/cd9660/iso.h>
+#ifdef _KERNEL
#include <fs/cd9660/cd9660_extern.h>
+#else
+#include "installboot.h"
+static int isochar(const u_char *, const u_char *, int, uint16_t *);
+#endif
#include <fs/unicode.h>
-static u_int16_t wget(const u_char **, size_t *, int);
-static int wput(u_char *, size_t, u_int16_t, int);
+static uint16_t wget(const u_char **, size_t *, int);
+static int wput(u_char *, size_t, uint16_t, int);
int cd9660_utf8_joliet = 1;
@@ -68,8 +86,9 @@
*/
int
isochar(const u_char *isofn, const u_char *isoend, int joliet_level,
- u_int16_t *c)
+ uint16_t *c)
{
+
*c = isofn[0];
if (joliet_level == 0 || isofn + 1 == isoend) {
/* (00) and (01) are one byte in Joliet, too */
@@ -95,12 +114,17 @@
*/
int
isofncmp(const u_char *fn, size_t fnlen, const u_char *isofn, size_t isolen,
- int joliet_level)
+ int joliet_level)
{
int i, j;
- u_int16_t fc, ic;
+ uint16_t fc, ic;
const u_char *isoend = isofn + isolen;
+#ifdef ISOFNCMPDEBUG
+ printf("fn = %s, fnlen = %zu, isofn = %s, isolen = %zu\n",
+ fn, fnlen, isofn, isolen);
+#endif
+
while (fnlen > 0) {
fc = wget(&fn, &fnlen, joliet_level);
@@ -132,10 +156,10 @@
if (fc >= 'a' && fc <= 'z')
fc -= 'a' - 'A';
- return (int) fc - (int) ic;
+ return (int)fc - (int)ic;
}
} else
- return (int) fc - (int) ic;
+ return (int)fc - (int)ic;
}
}
if (isofn != isoend) {
@@ -162,11 +186,11 @@
*/
void
isofntrans(const u_char *infn, int infnlen, u_char *outfn, u_short *outfnlen,
- int original, int casetrans, int assoc, int joliet_level)
+ int original, int casetrans, int assoc, int joliet_level)
{
int fnidx = 0;
const u_char *infnend = infn + infnlen;
- u_int16_t c;
+ uint16_t c;
int sz;
if (assoc) {
@@ -199,7 +223,7 @@
*outfnlen = fnidx;
}
-static u_int16_t
+static uint16_t
wget(const u_char **str, size_t *sz, int joliet_level)
{
if (joliet_level > 0 && cd9660_utf8_joliet) {
@@ -211,7 +235,7 @@
* this effectively assumes provided file name is using
* ISO-8859-1 subset.
*/
- u_int16_t c = *str[0];
+ uint16_t c = *str[0];
(*str)++;
(*sz)--;
@@ -220,7 +244,7 @@
}
static int
-wput(u_char *s, size_t n, u_int16_t c, int joliet_level)
+wput(u_char *s, size_t n, uint16_t c, int joliet_level)
{
if (joliet_level > 0 && cd9660_utf8_joliet) {
/* Store Joliet file name encoded into UTF-8 */
Home |
Main Index |
Thread Index |
Old Index