summaryrefslogtreecommitdiffstats
path: root/sbin/mount_cd9660
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2003-09-26 20:26:25 +0000
committerfjoe <fjoe@FreeBSD.org>2003-09-26 20:26:25 +0000
commit571ef024e3f3a472116a55a8489d77eb4f5f933e (patch)
tree5e4dbdee80eebe5477ad9c5637bb6b0ee47993d5 /sbin/mount_cd9660
parent0c8bfb6d004a87cd501c13516a69b3ef59ed6c7c (diff)
downloadFreeBSD-src-571ef024e3f3a472116a55a8489d77eb4f5f933e.zip
FreeBSD-src-571ef024e3f3a472116a55a8489d77eb4f5f933e.tar.gz
- Support for multibyte charsets in LIBICONV.
- CD9660_ICONV, NTFS_ICONV and MSDOSFS_ICONV kernel options (with corresponding modules). - kiconv(3) for loadable charset conversion tables support. Submitted by: Ryuichiro Imura <imura@ryu16.org>
Diffstat (limited to 'sbin/mount_cd9660')
-rw-r--r--sbin/mount_cd9660/Makefile6
-rw-r--r--sbin/mount_cd9660/mount_cd9660.89
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c42
3 files changed, 55 insertions, 2 deletions
diff --git a/sbin/mount_cd9660/Makefile b/sbin/mount_cd9660/Makefile
index 779b03d..0841157 100644
--- a/sbin/mount_cd9660/Makefile
+++ b/sbin/mount_cd9660/Makefile
@@ -4,11 +4,17 @@
PROG= mount_cd9660
SRCS= mount_cd9660.c getmntopts.c
MAN= mount_cd9660.8
+DPADD= ${LIBKICONV}
+LDADD= -lkiconv
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT}
WARNS= 0
+# Needs to be dynamically linked for optional dlopen() access to
+# userland libiconv
+NOSHARED?= NO
+
.PATH: ${MOUNT}
.include <bsd.prog.mk>
diff --git a/sbin/mount_cd9660/mount_cd9660.8 b/sbin/mount_cd9660/mount_cd9660.8
index fa74784..db266cc 100644
--- a/sbin/mount_cd9660/mount_cd9660.8
+++ b/sbin/mount_cd9660/mount_cd9660.8
@@ -47,6 +47,7 @@
.Op Fl begjrv
.Op Fl o Ar options
.Op Fl s Ar startsector
+.Op Fl C Ar charset
.Ar special | node
.Sh DESCRIPTION
The
@@ -123,6 +124,10 @@ It is possible to mount an arbitrary session of a multi-session CD by specifying
the correct
.Ar startsector
here.
+.It Fl C Ar charset
+Specify local
+.Ar charset
+to convert Unicode file names when using Joliet extensions.
.It Fl v
Be verbose about the starting sector decisions made.
.El
@@ -150,3 +155,7 @@ The
.Nm
utility first appeared in
.Bx 4.4 .
+.Pp
+The unicode conversion routine was added by
+.An Ryuichiro Imura Aq imura@ryu16.org
+at 2003.
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index e9ff591..74e4f21 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -57,6 +57,8 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/../isofs/cd9660/cd9660_mount.h>
+#include <sys/module.h>
+#include <sys/iconv.h>
#include <arpa/inet.h>
@@ -82,6 +84,7 @@ struct mntopt mopts[] = {
};
int get_ssector(const char *dev);
+int set_charset(struct iso_args *, const char *);
void usage(void);
int
@@ -95,7 +98,9 @@ main(int argc, char **argv)
mntflags = opts = verbose = 0;
memset(&args, 0, sizeof args);
args.ssector = -1;
- while ((ch = getopt(argc, argv, "begjo:rs:v")) != -1)
+ args.cs_disk = NULL;
+ args.cs_local = NULL;
+ while ((ch = getopt(argc, argv, "begjo:rs:vC:")) != -1)
switch (ch) {
case 'b':
opts |= ISOFSMNT_BROKENJOLIET;
@@ -121,6 +126,11 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 'C':
+ if (set_charset(&args, optarg) == -1)
+ err(EX_OSERR, "cd9660_iconv");
+ opts |= ISOFSMNT_KICONV;
+ break;
case '?':
default:
usage();
@@ -180,7 +190,7 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: mount_cd9660 [-egrv] [-o options] [-s startsector] special node\n");
+ "usage: mount_cd9660 [-egrv] [-o options] [-s startsector] [-C charset ] special node\n");
exit(EX_USAGE);
}
@@ -225,3 +235,31 @@ get_ssector(const char *dev)
return ntohl(toc_buffer[i].addr.lba);
}
+
+int
+set_charset(struct iso_args *args, const char *localcs)
+{
+ int error;
+
+ if (modfind("cd9660_iconv") < 0)
+ if (kldload("cd9660_iconv") < 0 || modfind("cd9660_iconv") < 0) {
+ warnx( "cannot find or load \"cd9660_iconv\" kernel module");
+ return (-1);
+ }
+
+ if ((args->cs_disk = malloc(ICONV_CSNMAXLEN)) == NULL)
+ return (-1);
+ if ((args->cs_local = malloc(ICONV_CSNMAXLEN)) == NULL)
+ return (-1);
+ strncpy(args->cs_disk, ENCODING_UNICODE, ICONV_CSNMAXLEN);
+ strncpy(args->cs_local, kiconv_quirkcs(localcs, KICONV_VENDOR_MICSFT),
+ ICONV_CSNMAXLEN);
+ error = kiconv_add_xlat16_cspair(args->cs_local, args->cs_disk, 0);
+ if (error)
+ return (-1);
+ error = kiconv_add_xlat16_cspair(args->cs_disk, args->cs_local, 0);
+ if (error)
+ return (-1);
+
+ return (0);
+}
OpenPOWER on IntegriCloud