Allocate memory for cs_disk & cs_local, add cd9660_iconv module.
authorAlexander Polakov <polachok@gmail.com>
Tue, 7 Jul 2009 15:52:28 +0000 (19:52 +0400)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 23 Jul 2009 10:08:34 +0000 (12:08 +0200)
sys/vfs/isofs/cd9660/cd9660_iconv/Makefile [new file with mode: 0644]
sys/vfs/isofs/cd9660/cd9660_iconv/cd9660_iconv.c [new file with mode: 0644]
sys/vfs/isofs/cd9660/cd9660_mount.h
sys/vfs/isofs/cd9660/cd9660_vfsops.c

diff --git a/sys/vfs/isofs/cd9660/cd9660_iconv/Makefile b/sys/vfs/isofs/cd9660/cd9660_iconv/Makefile
new file mode 100644 (file)
index 0000000..172eefd
--- /dev/null
@@ -0,0 +1,6 @@
+# $FreeBSD: src/sys/modules/msdosfs_iconv/Makefile,v 1.1.30.1 2009/04/15 03:14:26 kensmith Exp $
+
+KMOD=  cd9660_iconv
+SRCS=  cd9660_iconv.c
+
+.include <bsd.kmod.mk>
diff --git a/sys/vfs/isofs/cd9660/cd9660_iconv/cd9660_iconv.c b/sys/vfs/isofs/cd9660/cd9660_iconv/cd9660_iconv.c
new file mode 100644 (file)
index 0000000..d4150df
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * Copyright (c) 2003 Ryuichiro Imura
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/mount.h>
+#include <sys/iconv.h>
+
+VFS_DECLARE_ICONV(cd9660);
index de15568..9134c3f 100644 (file)
@@ -39,7 +39,7 @@
  * $FreeBSD: src/sys/isofs/cd9660/cd9660_mount.h,v 1.3.2.2 2001/03/14 12:03:50 bp Exp $
  * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_mount.h,v 1.3 2004/08/17 18:57:33 dillon Exp $
  */
-
+#include <sys/iconv.h>
 /*
  * Arguments to mount ISO 9660 filesystems.
  */
@@ -48,10 +48,10 @@ struct iso_args {
        struct  export_args export;     /* network export info */
        int     flags;                  /* mounting flags, see below */
        int     ssector;                /* starting sector, 0 for 1st session */
-        char    *cs_disk;               /* disk charset for Joliet cs conversion
- */
-        char    *cs_local;              /* local charset for Joliet cs conversio
-n */
+        char    cs_disk[ICONV_CSNMAXLEN];
              /* disk charset for Joliet cs conversion */
+        char    cs_local[ICONV_CSNMAXLEN];
+              /* local charset for Joliet cs conversion */
 };
 #define        ISOFSMNT_NORRIP 0x00000001      /* disable Rock Ridge Ext.*/
 #define        ISOFSMNT_GENS   0x00000002      /* enable generation numbers */
index 783e574..da829a7 100644 (file)
@@ -284,7 +284,8 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct iso_args *argp)
        struct iso_supplementary_descriptor *sup = NULL;
        struct iso_directory_record *rootp;
        int logical_block_size;
-       char *cs_local, *cs_disk;
+       char cs_local[ICONV_CSNMAXLEN];
+       char cs_disk[ICONV_CSNMAXLEN];
 
        if (!(mp->mnt_flag & MNT_RDONLY))
                return EROFS;
@@ -469,10 +470,11 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct iso_args *argp)
                bp = NULL;
        }
        isomp->im_flags = argp->flags & (ISOFSMNT_NORRIP | ISOFSMNT_GENS |
-                                        ISOFSMNT_EXTATT | ISOFSMNT_NOJOLIET);
+                                        ISOFSMNT_EXTATT | ISOFSMNT_NOJOLIET |
+                                        ISOFSMNT_KICONV);
        if (isomp->im_flags & ISOFSMNT_KICONV && cd9660_iconv) {
-               cs_local = "UTF-8";
-               cs_disk = "UTF-16BE";
+                bcopy(argp->cs_local, cs_local, sizeof(cs_local));
+                bcopy(argp->cs_disk, cs_disk, sizeof(cs_disk));
                 cd9660_iconv->open(cs_local, cs_disk, &isomp->im_d2l);
                 cd9660_iconv->open(cs_disk, cs_local, &isomp->im_l2d);
         } else {