From b910a22b7d1b6b9acbe96bd5c62b242dc8581b69 Mon Sep 17 00:00:00 2001
From: imura <imura@FreeBSD.org>
Date: Sat, 7 Oct 2000 15:34:21 +0000
Subject: Add new port: ja-msdosfs - mounts japanese FAT.

Be sure to edit ${FILESDIR}/revlist if you modify this
port and sync with the kernel.
---
 japanese/msdosfs/Makefile            |  62 +++++++++++++++++
 japanese/msdosfs/distinfo            |   2 +
 japanese/msdosfs/files/ja-msdosfs.sh |  18 +++++
 japanese/msdosfs/files/revlist       |  20 ++++++
 japanese/msdosfs/patches.4/patch-aa  |  20 ++++++
 japanese/msdosfs/patches.4/patch-ac  |  19 ++++++
 japanese/msdosfs/patches.4/patch-af  |  53 +++++++++++++++
 japanese/msdosfs/patches.4/patch-ag  |  20 ++++++
 japanese/msdosfs/patches.4/patch-ah  |  10 +++
 japanese/msdosfs/patches.4/patch-ba  |   9 +++
 japanese/msdosfs/patches.4/patch-bb  |  78 ++++++++++++++++++++++
 japanese/msdosfs/patches.5/patch-aa  |  20 ++++++
 japanese/msdosfs/patches.5/patch-ab  |  18 +++++
 japanese/msdosfs/patches.5/patch-ac  |  27 ++++++++
 japanese/msdosfs/patches.5/patch-ad  |  10 +++
 japanese/msdosfs/patches.5/patch-ae  |  10 +++
 japanese/msdosfs/patches.5/patch-af  |  60 +++++++++++++++++
 japanese/msdosfs/patches.5/patch-ag  | 125 +++++++++++++++++++++++++++++++++++
 japanese/msdosfs/patches.5/patch-ah  |  19 ++++++
 japanese/msdosfs/patches.5/patch-ba  |   9 +++
 japanese/msdosfs/patches.5/patch-bb  |  78 ++++++++++++++++++++++
 japanese/msdosfs/pkg-comment         |   1 +
 japanese/msdosfs/pkg-descr           |   9 +++
 japanese/msdosfs/pkg-plist           |   6 ++
 24 files changed, 703 insertions(+)
 create mode 100644 japanese/msdosfs/Makefile
 create mode 100644 japanese/msdosfs/distinfo
 create mode 100644 japanese/msdosfs/files/ja-msdosfs.sh
 create mode 100644 japanese/msdosfs/files/revlist
 create mode 100644 japanese/msdosfs/patches.4/patch-aa
 create mode 100644 japanese/msdosfs/patches.4/patch-ac
 create mode 100644 japanese/msdosfs/patches.4/patch-af
 create mode 100644 japanese/msdosfs/patches.4/patch-ag
 create mode 100644 japanese/msdosfs/patches.4/patch-ah
 create mode 100644 japanese/msdosfs/patches.4/patch-ba
 create mode 100644 japanese/msdosfs/patches.4/patch-bb
 create mode 100644 japanese/msdosfs/patches.5/patch-aa
 create mode 100644 japanese/msdosfs/patches.5/patch-ab
 create mode 100644 japanese/msdosfs/patches.5/patch-ac
 create mode 100644 japanese/msdosfs/patches.5/patch-ad
 create mode 100644 japanese/msdosfs/patches.5/patch-ae
 create mode 100644 japanese/msdosfs/patches.5/patch-af
 create mode 100644 japanese/msdosfs/patches.5/patch-ag
 create mode 100644 japanese/msdosfs/patches.5/patch-ah
 create mode 100644 japanese/msdosfs/patches.5/patch-ba
 create mode 100644 japanese/msdosfs/patches.5/patch-bb
 create mode 100644 japanese/msdosfs/pkg-comment
 create mode 100644 japanese/msdosfs/pkg-descr
 create mode 100644 japanese/msdosfs/pkg-plist

(limited to 'japanese/msdosfs')

diff --git a/japanese/msdosfs/Makefile b/japanese/msdosfs/Makefile
new file mode 100644
index 0000000..43ad9c1
--- /dev/null
+++ b/japanese/msdosfs/Makefile
@@ -0,0 +1,62 @@
+# Ports collection makefile for:  mount_jamsdos
+# Date created:		3 July 2000
+# Whom:			Ryuichiro IMURA <imura@af.airnet.ne.jp>
+#
+# $FreeBSD$
+#
+
+PORTNAME=	msdosfs
+PORTVERSION=	20001007
+CATEGORIES=	japanese
+MASTER_SITES=	http://www.linkclub.or.jp/~clover/ \
+		${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR=	imura
+DISTNAME=	${PORTNAME}-ja-20000421
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX} \
+		mount_msdos-20000701.tar.gz
+
+MAINTAINER=	imura@FreeBSD.org
+
+WRKSRC=		${WRKDIR}/${DISTNAME}/msdosfs.ja
+NO_PACKAGE=	"to avoid crashing a machine when try to install incorrect version"
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} >= 410001 && ${OSVERSION} < 500000
+PATCHDIR=	${MASTERDIR}/patches.4
+.elif ${OSVERSION} >= 500012
+PATCHDIR=	${MASTERDIR}/patches.5
+.else
+BROKEN=		"It may not work with your FreeBSD version (but I'm not sure)"
+.endif
+
+post-extract:
+	cd ${WRKDIR}/mount ; co RCS/*,v
+	cd ${WRKDIR}/mount_msdos ; co RCS/*,v
+	${LN} -s ${WRKSRC} ${WRKSRC}/msdosfs
+	${LN} -s ${WRKSRC}/msdosfsmount.h ${WRKDIR}/mount_msdos
+
+pre-build:
+	@if [ ! -d /sys -o ! -d /usr/src/sys ]; then \
+		${ECHO} "****************************************" ; \
+		${ECHO} " You need to extract kernel source tree" ; \
+		${ECHO} " before you build this package..." ; \
+		${ECHO} "****************************************" ; \
+		${FALSE} ; \
+	fi
+
+post-build:
+	cd ${WRKDIR}/mount_msdos && ${MAKE}
+	${SED} -e "s,@@PREFIX@@,${PREFIX}," ${FILESDIR}/ja-msdosfs.sh \
+		> ${WRKDIR}/ja-msdosfs.sh
+
+do-install:
+	${MKDIR} ${PREFIX}/lib/ja-msdosfs
+	${INSTALL_PROGRAM} ${WRKDIR}/mount_msdos/mount_jamsdos ${PREFIX}/sbin
+	${INSTALL_SCRIPT} ${WRKSRC}/msdos_ja.ko ${PREFIX}/lib/ja-msdosfs
+	${INSTALL_SCRIPT} ${WRKDIR}/ja-msdosfs.sh ${PREFIX}/etc/rc.d
+
+post-install:
+	/sbin/kldload ${PREFIX}/lib/ja-msdosfs/msdos_ja.ko
+
+.include <bsd.port.post.mk>
diff --git a/japanese/msdosfs/distinfo b/japanese/msdosfs/distinfo
new file mode 100644
index 0000000..6c6ece8
--- /dev/null
+++ b/japanese/msdosfs/distinfo
@@ -0,0 +1,2 @@
+MD5 (msdosfs-ja-20000421.tar.gz) = d4ceb5a80a6b9bdde7a75cdf05b6e326
+MD5 (mount_msdos-20000701.tar.gz) = c45e945eb4503fe9cfad01589f4ed45b
diff --git a/japanese/msdosfs/files/ja-msdosfs.sh b/japanese/msdosfs/files/ja-msdosfs.sh
new file mode 100644
index 0000000..626ae59
--- /dev/null
+++ b/japanese/msdosfs/files/ja-msdosfs.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# $FreeBSD$
+
+module_dir=@@PREFIX@@/lib/ja-msdosfs
+
+case $1 in
+start)
+    kldload ${module_dir}/msdos_ja.ko
+    echo -n " JA-MSDOSFS"
+    ;;
+stop)
+    kldunload msdos_ja.ko
+    ;;
+*)
+    echo "usage: `basename $0` {start|stop}"
+    exit 1
+    ;;
+esac
diff --git a/japanese/msdosfs/files/revlist b/japanese/msdosfs/files/revlist
new file mode 100644
index 0000000..b671800
--- /dev/null
+++ b/japanese/msdosfs/files/revlist
@@ -0,0 +1,20 @@
+$FreeBSD$
+
+This is a table of revisions about this ja-msdosfs.
+
++-------------------+---------------+-----------+
+ BRANCH			RELENG_4	HEAD
++-------------------+---------------+-----------+
+ bootsect.h		1.7		1.7
+ bpb.h			1.7		1.8
+ denode.h		1.20		1.20
+ direntry.h		1.15		1.15
+ fat.h			1.9		1.9
+ msdosfs_conv.c		1.29		1.29
+ msdosfs_denode.c	1.47.2.1	1.49
+ msdosfs_fat.c		1.23		1.24
+ msdosfs_lookup.c	1.30		1.31
+ msdosfs_vfsops.c	1.60.2.2	1.64
+ msdosfs_vnops.c	1.95.2.1	1.103
+ msdosfsmount.h		1.20.2.1	1.22
++-------------------+---------------+-----------+
diff --git a/japanese/msdosfs/patches.4/patch-aa b/japanese/msdosfs/patches.4/patch-aa
new file mode 100644
index 0000000..9bedceb
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-aa
@@ -0,0 +1,20 @@
+--- /dev/null	Mon Jul  3 02:05:31 2000
++++ Makefile	Mon Jul  3 02:15:22 2000
+@@ -0,0 +1,17 @@
++.PATH:	${.CURDIR}
++KMOD=	msdos_ja
++SRCS=	vnode_if.h \
++	msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c \
++	msdosfs_vfsops.c msdosfs_vnops.c opt_msdosfs.h
++NOMAN=
++CLEANFILES+= opt_msdosfs.h
++
++opt_msdosfs.h:
++	touch opt_msdosfs.h
++	echo "#define MSDOSFS_LC_JAPAN 1" >> opt_msdosfs.h
++
++.if ${MACHINE} == "pc98"
++CFLAGS+= -DPC98
++.endif
++
++.include <bsd.kmod.mk>
diff --git a/japanese/msdosfs/patches.4/patch-ac b/japanese/msdosfs/patches.4/patch-ac
new file mode 100644
index 0000000..93110b5
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-ac
@@ -0,0 +1,19 @@
+--- msdosfs_denode.c.orig	Mon Apr 10 04:32:36 2000
++++ msdosfs_denode.c	Wed Oct  4 00:28:00 2000
+@@ -114,6 +114,16 @@
+ {
+ 	dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);
+ 	simple_lock_init(&dehash_slock);
++	return (0);
++}
++
++int 
++msdosfs_uninit(vfsp)
++	struct vfsconf *vfsp;
++{
++
++	if (dehashtbl)
++		free(dehashtbl, M_MSDOSFSMNT);
+ 	return (0);
+ }
+ 
diff --git a/japanese/msdosfs/patches.4/patch-af b/japanese/msdosfs/patches.4/patch-af
new file mode 100644
index 0000000..63366e2
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-af
@@ -0,0 +1,53 @@
+--- msdosfs_vfsops.c.orig	Mon Apr 10 04:32:37 2000
++++ msdosfs_vfsops.c	Wed Oct  4 00:21:29 2000
+@@ -48,11 +48,6 @@
+  * October 1992
+  */
+ 
+-#include "opt_msdosfs.h"
+-
+-/*
+- * System include files.
+- */
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/conf.h>
+@@ -67,9 +62,6 @@
+ #include <sys/stat.h> 				/* defines ALLPERMS */
+ #include <vm/vm_zone.h>
+ 
+-/*
+- * MSDOSFS include files.
+- */
+ #include <msdosfs/bpb.h>
+ #include <msdosfs/bootsect.h>
+ #include <msdosfs/direntry.h>
+@@ -77,6 +69,8 @@
+ #include <msdosfs/msdosfsmount.h>
+ #include <msdosfs/fat.h>
+ 
++#define MSDOSFS_DFLTBSIZE       4096
++
+ #if 1 /*def PC98*/
+ /*
+  * XXX - The boot signature formatted by NEC PC-98 DOS looks like a
+@@ -635,7 +629,7 @@
+ 	if (FAT12(pmp))
+ 		pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
+ 	else
+-		pmp->pm_fatblocksize = DFLTBSIZE;
++		pmp->pm_fatblocksize = MSDOSFS_DFLTBSIZE;
+ 
+ 	pmp->pm_fatblocksec = pmp->pm_fatblocksize / DEV_BSIZE;
+ 	pmp->pm_bnshift = ffs(DEV_BSIZE) - 1;
+@@ -987,8 +981,8 @@
+ 	msdosfs_checkexp,
+ 	msdosfs_vptofh,
+ 	msdosfs_init,
+-	vfs_stduninit,
++	msdosfs_uninit,
+ 	vfs_stdextattrctl,
+ };
+ 
+-VFS_SET(msdosfs_vfsops, msdos, 0);
++VFS_SET(msdosfs_vfsops, msdos_ja, 0);
diff --git a/japanese/msdosfs/patches.4/patch-ag b/japanese/msdosfs/patches.4/patch-ag
new file mode 100644
index 0000000..b39384f
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-ag
@@ -0,0 +1,20 @@
+--- msdosfs_vnops.c.orig	Mon Apr 10 04:32:37 2000
++++ msdosfs_vnops.c	Wed Oct  4 00:13:39 2000
+@@ -1108,7 +1108,6 @@
+ 	VOP_UNLOCK(fvp, 0, p);
+ 	if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster)
+ 		newparent = 1;
+-	vrele(fdvp);
+ 	if (doingdirectory && newparent) {
+ 		if (error)	/* write access check above */
+ 			goto bad;
+@@ -1176,7 +1175,8 @@
+ 		panic("msdosfs_rename: lost from startdir");
+ 	if (!newparent)
+ 		VOP_UNLOCK(tdvp, 0, p);
+-	(void) relookup(fdvp, &fvp, fcnp);
++	if (relookup(fdvp, &fvp, fcnp) == 0)
++		vrele(fdvp);
+ 	if (fvp == NULL) {
+ 		/*
+ 		 * From name has disappeared.
diff --git a/japanese/msdosfs/patches.4/patch-ah b/japanese/msdosfs/patches.4/patch-ah
new file mode 100644
index 0000000..d714acc
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-ah
@@ -0,0 +1,10 @@
+--- msdosfsmount.h.orig	Mon Apr 10 04:32:37 2000
++++ msdosfsmount.h	Wed Oct  4 00:13:52 2000
+@@ -198,6 +198,7 @@
+ 	(1024 << ((pmp)->pm_BlkPerSec >> 2))
+ 
+ int msdosfs_init __P((struct vfsconf *vfsp));
++int msdosfs_uninit __P((struct vfsconf *vfsp));
+ int msdosfs_mountroot __P((void));
+ 
+ #endif /* _KERNEL */
diff --git a/japanese/msdosfs/patches.4/patch-ba b/japanese/msdosfs/patches.4/patch-ba
new file mode 100644
index 0000000..9fcc8af
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-ba
@@ -0,0 +1,9 @@
+--- ../../mount_msdos/Makefile.orig	Mon Jul  3 02:53:38 2000
++++ ../../mount_msdos/Makefile	Mon Jul  3 02:53:52 2000
+@@ -3,6 +3,6 @@
+ #
+ 
+-PROG=	mount_msdos
++PROG=	mount_jamsdos
+ SRCS=	mount_msdos.c getmntopts.c
+ MAN8=	mount_msdos.8
diff --git a/japanese/msdosfs/patches.4/patch-bb b/japanese/msdosfs/patches.4/patch-bb
new file mode 100644
index 0000000..12cf0e4
--- /dev/null
+++ b/japanese/msdosfs/patches.4/patch-bb
@@ -0,0 +1,78 @@
+--- ../../mount_msdos/mount_msdos.c.orig	Mon Jul  3 22:56:20 2000
++++ ../../mount_msdos/mount_msdos.c	Mon Jul  3 23:02:54 2000
+@@ -39,8 +39,6 @@
+ #include <sys/mount.h>
+ #include <sys/stat.h>
+ 
+-#include <msdosfs/msdosfsmount.h>
+-
+ #include <ctype.h>
+ #include <err.h>
+ #include <grp.h>
+@@ -55,6 +53,7 @@
+ #include <unistd.h>
+ 
+ #include "mntopts.h"
++#include "msdosfsmount.h"
+ 
+ /*
+  * XXX - no way to specify "foo=<bar>"-type options; that's what we'd
+@@ -95,8 +94,9 @@
+ 	mntflags = set_gid = set_uid = set_mask = 0;
+ 	(void)memset(&args, '\0', sizeof(args));
+ 	args.magic = MSDOSFS_ARGSMAGIC;
++	args.flags = MSDOSFSMNT_EUCJAPAN;
+ 
+-	while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) {
++	while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) {
+ 		switch (c) {
+ #ifdef MSDOSFSMNT_GEMDOSFS
+ 		case 'G':
+@@ -124,14 +124,6 @@
+ 			args.mask = a_mask(optarg);
+ 			set_mask = 1;
+ 			break;
+-		case 'L':
+-			load_ultable(&args, optarg);
+-			args.flags |= MSDOSFSMNT_ULTABLE;
+-			break;
+-		case 'W':
+-			load_u2wtable(&args, optarg);
+-			args.flags |= MSDOSFSMNT_U2WTABLE;
+-			break;
+ 		case 'o':
+ 			getmntopts(optarg, mopts, &mntflags, &args.flags);
+ 			break;
+@@ -173,15 +165,15 @@
+ 			args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
+ 	}
+ 
+-	error = getvfsbyname("msdos", &vfc);
+-	if (error && vfsisloadable("msdos")) {
+-		if (vfsload("msdos"))
+-			err(EX_OSERR, "vfsload(msdos)");
++	error = getvfsbyname("msdos_ja", &vfc);
++	if (error && vfsisloadable("msdos_ja")) {
++		if (vfsload("msdos_ja"))
++			err(EX_OSERR, "vfsload(msdos_ja)");
+ 		endvfsent();	/* clear cache */
+-		error = getvfsbyname("msdos", &vfc);
++		error = getvfsbyname("msdos_ja", &vfc);
+ 	}
+ 	if (error)
+-		errx(EX_OSERR, "msdos filesystem is not available");
++		errx(EX_OSERR, "msdos_ja filesystem is not available");
+ 
+ 	if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
+ 		err(EX_OSERR, "%s", dev);
+@@ -251,8 +243,8 @@
+ usage()
+ {
+ 	fprintf(stderr, "%s\n%s\n", 
+-	"usage: mount_msdos [-o options] [-u user] [-g group] [-m mask]",
+-	"                   [-s] [-l] [-9] [-L locale] [-W table] bdev dir");
++	"usage: mount_jmsdos [-o options] [-u user] [-g group] [-m mask]",
++	"                      [-s] [-l] [-9] bdev dir");
+ 	exit(EX_USAGE);
+ }
+ 
diff --git a/japanese/msdosfs/patches.5/patch-aa b/japanese/msdosfs/patches.5/patch-aa
new file mode 100644
index 0000000..9bedceb
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-aa
@@ -0,0 +1,20 @@
+--- /dev/null	Mon Jul  3 02:05:31 2000
++++ Makefile	Mon Jul  3 02:15:22 2000
+@@ -0,0 +1,17 @@
++.PATH:	${.CURDIR}
++KMOD=	msdos_ja
++SRCS=	vnode_if.h \
++	msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c \
++	msdosfs_vfsops.c msdosfs_vnops.c opt_msdosfs.h
++NOMAN=
++CLEANFILES+= opt_msdosfs.h
++
++opt_msdosfs.h:
++	touch opt_msdosfs.h
++	echo "#define MSDOSFS_LC_JAPAN 1" >> opt_msdosfs.h
++
++.if ${MACHINE} == "pc98"
++CFLAGS+= -DPC98
++.endif
++
++.include <bsd.kmod.mk>
diff --git a/japanese/msdosfs/patches.5/patch-ab b/japanese/msdosfs/patches.5/patch-ab
new file mode 100644
index 0000000..e437a9a
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ab
@@ -0,0 +1,18 @@
+--- bpb.h.orig	Sat Aug 28 09:48:07 1999
++++ bpb.h	Wed Oct  4 00:40:56 2000
+@@ -113,8 +113,14 @@
+  * 16-bit and 32-bit quantities on byte boundaries.  If this is not true,
+  * use the macros for the big-endian case.
+  */
++
+ #include <machine/endian.h>
+-#if (BYTE_ORDER == LITTLE_ENDIAN) 			/* && defined(UNALIGNED_ACCESS) */
++
++#ifdef __i386__
++#define	UNLALIGNED_ACCESS
++#endif
++
++#if (BYTE_ORDER == LITTLE_ENDIAN) && defined(UNALIGNED_ACCESS)
+ #define	getushort(x)	*((u_int16_t *)(x))
+ #define	getulong(x)	*((u_int32_t *)(x))
+ #define	putushort(p, v)	(*((u_int16_t *)(p)) = (v))
diff --git a/japanese/msdosfs/patches.5/patch-ac b/japanese/msdosfs/patches.5/patch-ac
new file mode 100644
index 0000000..8bff82e
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ac
@@ -0,0 +1,27 @@
+--- msdosfs_denode.c.orig	Mon Apr 10 04:32:36 2000
++++ msdosfs_denode.c	Wed Oct  4 00:41:56 2000
+@@ -59,6 +59,7 @@
+ #include <sys/mount.h>
+ #include <sys/malloc.h>
+ #include <sys/proc.h>
++#include <sys/bio.h>
+ #include <sys/buf.h>
+ #include <sys/vnode.h>
+ 
+@@ -114,6 +115,16 @@
+ {
+ 	dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);
+ 	simple_lock_init(&dehash_slock);
++	return (0);
++}
++
++int 
++msdosfs_uninit(vfsp)
++	struct vfsconf *vfsp;
++{
++
++	if (dehashtbl)
++		free(dehashtbl, M_MSDOSFSMNT);
+ 	return (0);
+ }
+ 
diff --git a/japanese/msdosfs/patches.5/patch-ad b/japanese/msdosfs/patches.5/patch-ad
new file mode 100644
index 0000000..d9fec52
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ad
@@ -0,0 +1,10 @@
+--- msdosfs_fat.c.orig	Mon Apr 10 04:32:36 2000
++++ msdosfs_fat.c	Wed Oct  4 00:53:48 2000
+@@ -55,6 +55,7 @@
+  */
+ #include <sys/param.h>
+ #include <sys/systm.h>
++#include <sys/bio.h>
+ #include <sys/buf.h>
+ #include <sys/mount.h>		/* to define statfs structure */
+ #include <sys/vnode.h>		/* to define vattr structure */
diff --git a/japanese/msdosfs/patches.5/patch-ae b/japanese/msdosfs/patches.5/patch-ae
new file mode 100644
index 0000000..05df3b6
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ae
@@ -0,0 +1,10 @@
+--- msdosfs_lookup.c.orig	Mon Apr 10 04:39:57 2000
++++ msdosfs_lookup.c	Wed Oct  4 00:43:31 2000
+@@ -56,6 +56,7 @@
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/namei.h>
++#include <sys/bio.h>
+ #include <sys/buf.h>
+ #include <sys/vnode.h>
+ #include <sys/mount.h>
diff --git a/japanese/msdosfs/patches.5/patch-af b/japanese/msdosfs/patches.5/patch-af
new file mode 100644
index 0000000..3224846
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-af
@@ -0,0 +1,60 @@
+--- msdosfs_vfsops.c.orig	Mon Apr 10 04:32:37 2000
++++ msdosfs_vfsops.c	Wed Oct  4 00:45:26 2000
+@@ -48,11 +48,6 @@
+  * October 1992
+  */
+ 
+-#include "opt_msdosfs.h"
+-
+-/*
+- * System include files.
+- */
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/conf.h>
+@@ -61,15 +56,12 @@
+ #include <sys/kernel.h>
+ #include <sys/vnode.h>
+ #include <sys/mount.h>
++#include <sys/bio.h>
+ #include <sys/buf.h>
+ #include <sys/fcntl.h>
+ #include <sys/malloc.h>
+ #include <sys/stat.h> 				/* defines ALLPERMS */
+-#include <vm/vm_zone.h>
+ 
+-/*
+- * MSDOSFS include files.
+- */
+ #include <msdosfs/bpb.h>
+ #include <msdosfs/bootsect.h>
+ #include <msdosfs/direntry.h>
+@@ -77,6 +69,8 @@
+ #include <msdosfs/msdosfsmount.h>
+ #include <msdosfs/fat.h>
+ 
++#define MSDOSFS_DFLTBSIZE       4096
++
+ #if 1 /*def PC98*/
+ /*
+  * XXX - The boot signature formatted by NEC PC-98 DOS looks like a
+@@ -635,7 +629,7 @@
+ 	if (FAT12(pmp))
+ 		pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
+ 	else
+-		pmp->pm_fatblocksize = DFLTBSIZE;
++		pmp->pm_fatblocksize = MSDOSFS_DFLTBSIZE;
+ 
+ 	pmp->pm_fatblocksec = pmp->pm_fatblocksize / DEV_BSIZE;
+ 	pmp->pm_bnshift = ffs(DEV_BSIZE) - 1;
+@@ -987,8 +981,8 @@
+ 	msdosfs_checkexp,
+ 	msdosfs_vptofh,
+ 	msdosfs_init,
+-	vfs_stduninit,
++	msdosfs_uninit,
+ 	vfs_stdextattrctl,
+ };
+ 
+-VFS_SET(msdosfs_vfsops, msdos, 0);
++VFS_SET(msdosfs_vfsops, msdos_ja, 0);
diff --git a/japanese/msdosfs/patches.5/patch-ag b/japanese/msdosfs/patches.5/patch-ag
new file mode 100644
index 0000000..580b2df
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ag
@@ -0,0 +1,125 @@
+--- msdosfs_vnops.c.orig	Mon Apr 10 04:32:37 2000
++++ msdosfs_vnops.c	Wed Oct  4 00:50:29 2000
+@@ -59,6 +59,7 @@
+ #include <sys/resourcevar.h>	/* defines plimit structure in proc struct */
+ #include <sys/kernel.h>
+ #include <sys/stat.h>
++#include <sys/bio.h>
+ #include <sys/buf.h>
+ #include <sys/proc.h>
+ #include <sys/mount.h>
+@@ -70,7 +71,6 @@
+ 
+ #include <vm/vm.h>
+ #include <vm/vm_extern.h>
+-#include <vm/vm_zone.h>
+ #include <vm/vnode_pager.h>
+ 
+ /*
+@@ -260,10 +260,7 @@
+ 	struct vnode *vp = ap->a_vp;
+ 	struct denode *dep = VTODE(ap->a_vp);
+ 	struct msdosfsmount *pmp = dep->de_pmp;
+-	struct ucred *cred = ap->a_cred;
+-	mode_t mask, file_mode, mode = ap->a_mode;
+-	register gid_t *gp;
+-	int i;
++	mode_t file_mode, mode = ap->a_mode;
+ 
+ 	file_mode = (S_IXUSR|S_IXGRP|S_IXOTH) | (S_IRUSR|S_IRGRP|S_IROTH) |
+ 	    ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH));
+@@ -287,43 +284,8 @@
+ 		}
+ 	}
+ 
+-	/* User id 0 always gets access. */
+-	if (cred->cr_uid == 0)
+-		return 0;
+-
+-	mask = 0;
+-
+-	/* Otherwise, check the owner. */
+-	if (cred->cr_uid == pmp->pm_uid) {
+-		if (mode & VEXEC)
+-			mask |= S_IXUSR;
+-		if (mode & VREAD)
+-			mask |= S_IRUSR;
+-		if (mode & VWRITE)
+-			mask |= S_IWUSR;
+-		return (file_mode & mask) == mask ? 0 : EACCES;
+-	}
+-
+-	/* Otherwise, check the groups. */
+-	for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
+-		if (pmp->pm_gid == *gp) {
+-			if (mode & VEXEC)
+-				mask |= S_IXGRP;
+-			if (mode & VREAD)
+-				mask |= S_IRGRP;
+-			if (mode & VWRITE)
+-				mask |= S_IWGRP;
+-			return (file_mode & mask) == mask ? 0 : EACCES;
+-		}
+-
+-	/* Otherwise, check everyone else. */
+-	if (mode & VEXEC)
+-		mask |= S_IXOTH;
+-	if (mode & VREAD)
+-		mask |= S_IROTH;
+-	if (mode & VWRITE)
+-		mask |= S_IWOTH;
+-	return (file_mode & mask) == mask ? 0 : EACCES;
++	return (vaccess(vp->v_type, file_mode, pmp->pm_uid, pmp->pm_gid,
++	    ap->a_mode, ap->a_cred, NULL));
+ }
+ 
+ static int
+@@ -974,11 +936,6 @@
+  *
+  * On exit:
+  *	all denodes should be released
+- *
+- * Notes:
+- * I'm not sure how the memory containing the pathnames pointed at by the
+- * componentname structures is freed, there may be some memory bleeding
+- * for each rename done.
+  */
+ static int
+ msdosfs_rename(ap)
+@@ -1108,7 +1065,6 @@
+ 	VOP_UNLOCK(fvp, 0, p);
+ 	if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster)
+ 		newparent = 1;
+-	vrele(fdvp);
+ 	if (doingdirectory && newparent) {
+ 		if (error)	/* write access check above */
+ 			goto bad;
+@@ -1176,7 +1132,8 @@
+ 		panic("msdosfs_rename: lost from startdir");
+ 	if (!newparent)
+ 		VOP_UNLOCK(tdvp, 0, p);
+-	(void) relookup(fdvp, &fvp, fcnp);
++	if (relookup(fdvp, &fvp, fcnp) == 0)
++		vrele(fdvp);
+ 	if (fvp == NULL) {
+ 		/*
+ 		 * From name has disappeared.
+@@ -1856,15 +1813,15 @@
+ 		error = pcbmap(dep, bp->b_lblkno, &bp->b_blkno, 0, 0);
+ 		if (error) {
+ 			bp->b_error = error;
+-			bp->b_flags |= B_ERROR;
+-			biodone(bp);
++			bp->b_ioflags |= BIO_ERROR;
++			bufdone(bp);
+ 			return (error);
+ 		}
+ 		if ((long)bp->b_blkno == -1)
+ 			vfs_bio_clrbuf(bp);
+ 	}
+ 	if (bp->b_blkno == -1) {
+-		biodone(bp);
++		bufdone(bp);
+ 		return (0);
+ 	}
+ 	/*
diff --git a/japanese/msdosfs/patches.5/patch-ah b/japanese/msdosfs/patches.5/patch-ah
new file mode 100644
index 0000000..85e1f47
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ah
@@ -0,0 +1,19 @@
+--- msdosfsmount.h.orig	Mon Apr 10 04:32:37 2000
++++ msdosfsmount.h	Wed Oct  4 00:51:35 2000
+@@ -84,7 +84,7 @@
+ 	u_long pm_fatblocksize;	/* size of fat blocks in bytes */
+ 	u_long pm_fatblocksec;	/* size of fat blocks in sectors */
+ 	u_long pm_fatsize;	/* size of fat in bytes */
+-	u_long pm_fatmask;	/* mask to use for fat numbers */
++	u_int32_t pm_fatmask;	/* mask to use for fat numbers */
+ 	u_long pm_fsinfo;	/* fsinfo block number */
+ 	u_long pm_nxtfree;	/* next free cluster in fsinfo block */
+ 	u_int pm_fatmult;	/* these 2 values are used in fat */
+@@ -198,6 +198,7 @@
+ 	(1024 << ((pmp)->pm_BlkPerSec >> 2))
+ 
+ int msdosfs_init __P((struct vfsconf *vfsp));
++int msdosfs_uninit __P((struct vfsconf *vfsp));
+ int msdosfs_mountroot __P((void));
+ 
+ #endif /* _KERNEL */
diff --git a/japanese/msdosfs/patches.5/patch-ba b/japanese/msdosfs/patches.5/patch-ba
new file mode 100644
index 0000000..9fcc8af
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-ba
@@ -0,0 +1,9 @@
+--- ../../mount_msdos/Makefile.orig	Mon Jul  3 02:53:38 2000
++++ ../../mount_msdos/Makefile	Mon Jul  3 02:53:52 2000
+@@ -3,6 +3,6 @@
+ #
+ 
+-PROG=	mount_msdos
++PROG=	mount_jamsdos
+ SRCS=	mount_msdos.c getmntopts.c
+ MAN8=	mount_msdos.8
diff --git a/japanese/msdosfs/patches.5/patch-bb b/japanese/msdosfs/patches.5/patch-bb
new file mode 100644
index 0000000..12cf0e4
--- /dev/null
+++ b/japanese/msdosfs/patches.5/patch-bb
@@ -0,0 +1,78 @@
+--- ../../mount_msdos/mount_msdos.c.orig	Mon Jul  3 22:56:20 2000
++++ ../../mount_msdos/mount_msdos.c	Mon Jul  3 23:02:54 2000
+@@ -39,8 +39,6 @@
+ #include <sys/mount.h>
+ #include <sys/stat.h>
+ 
+-#include <msdosfs/msdosfsmount.h>
+-
+ #include <ctype.h>
+ #include <err.h>
+ #include <grp.h>
+@@ -55,6 +53,7 @@
+ #include <unistd.h>
+ 
+ #include "mntopts.h"
++#include "msdosfsmount.h"
+ 
+ /*
+  * XXX - no way to specify "foo=<bar>"-type options; that's what we'd
+@@ -95,8 +94,9 @@
+ 	mntflags = set_gid = set_uid = set_mask = 0;
+ 	(void)memset(&args, '\0', sizeof(args));
+ 	args.magic = MSDOSFS_ARGSMAGIC;
++	args.flags = MSDOSFSMNT_EUCJAPAN;
+ 
+-	while ((c = getopt(argc, argv, "sl9u:g:m:o:L:W:")) != -1) {
++	while ((c = getopt(argc, argv, "sl9u:g:m:o:")) != -1) {
+ 		switch (c) {
+ #ifdef MSDOSFSMNT_GEMDOSFS
+ 		case 'G':
+@@ -124,14 +124,6 @@
+ 			args.mask = a_mask(optarg);
+ 			set_mask = 1;
+ 			break;
+-		case 'L':
+-			load_ultable(&args, optarg);
+-			args.flags |= MSDOSFSMNT_ULTABLE;
+-			break;
+-		case 'W':
+-			load_u2wtable(&args, optarg);
+-			args.flags |= MSDOSFSMNT_U2WTABLE;
+-			break;
+ 		case 'o':
+ 			getmntopts(optarg, mopts, &mntflags, &args.flags);
+ 			break;
+@@ -173,15 +165,15 @@
+ 			args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
+ 	}
+ 
+-	error = getvfsbyname("msdos", &vfc);
+-	if (error && vfsisloadable("msdos")) {
+-		if (vfsload("msdos"))
+-			err(EX_OSERR, "vfsload(msdos)");
++	error = getvfsbyname("msdos_ja", &vfc);
++	if (error && vfsisloadable("msdos_ja")) {
++		if (vfsload("msdos_ja"))
++			err(EX_OSERR, "vfsload(msdos_ja)");
+ 		endvfsent();	/* clear cache */
+-		error = getvfsbyname("msdos", &vfc);
++		error = getvfsbyname("msdos_ja", &vfc);
+ 	}
+ 	if (error)
+-		errx(EX_OSERR, "msdos filesystem is not available");
++		errx(EX_OSERR, "msdos_ja filesystem is not available");
+ 
+ 	if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
+ 		err(EX_OSERR, "%s", dev);
+@@ -251,8 +243,8 @@
+ usage()
+ {
+ 	fprintf(stderr, "%s\n%s\n", 
+-	"usage: mount_msdos [-o options] [-u user] [-g group] [-m mask]",
+-	"                   [-s] [-l] [-9] [-L locale] [-W table] bdev dir");
++	"usage: mount_jmsdos [-o options] [-u user] [-g group] [-m mask]",
++	"                      [-s] [-l] [-9] bdev dir");
+ 	exit(EX_USAGE);
+ }
+ 
diff --git a/japanese/msdosfs/pkg-comment b/japanese/msdosfs/pkg-comment
new file mode 100644
index 0000000..156ffed
--- /dev/null
+++ b/japanese/msdosfs/pkg-comment
@@ -0,0 +1 @@
+Mount a Microsoft FAT Japanese file system
diff --git a/japanese/msdosfs/pkg-descr b/japanese/msdosfs/pkg-descr
new file mode 100644
index 0000000..10b3dcc
--- /dev/null
+++ b/japanese/msdosfs/pkg-descr
@@ -0,0 +1,9 @@
+You can mount a Japanese FAT file system via "mount_jamsdos" command.
+Be sure that "msdos_ja.ko" is already dynamically linked into the
+kernal before you type "mount_jamsdos" (see kldstat(8)).
+
+The author is Toshihiko Arai <toshi@FreeBSD.org>.
+
+WWW: http://www.linkclub.or.jp/~clover/msdosfs.html
+
+- R. Imura <imura@FreeBSD.org>
diff --git a/japanese/msdosfs/pkg-plist b/japanese/msdosfs/pkg-plist
new file mode 100644
index 0000000..bc39d39
--- /dev/null
+++ b/japanese/msdosfs/pkg-plist
@@ -0,0 +1,6 @@
+etc/rc.d/ja-msdosfs.sh
+lib/ja-msdosfs/msdos_ja.ko
+sbin/mount_jamsdos
+@dirrm lib/ja-msdosfs
+@exec /sbin/kldload %D/lib/ja-msdosfs/msdos_ja.ko
+@unexec /sbin/kldunload msdos_ja 2>/dev/null || /usr/bin/true
-- 
cgit v1.1