ko-msdosfs, VFAT filesystem module supporting CP949 VFAT(unicode), activated.

This port is based on japanese/msdosfs. Thanks Japanese hackers!
This commit is contained in:
CHOI Junho 2001-03-24 03:48:41 +00:00
parent 45a54d9a31
commit deeb9d53f4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=40306
27 changed files with 1034 additions and 0 deletions

View File

@ -52,6 +52,7 @@
SUBDIR += mizifont
SUBDIR += mkisofs
SUBDIR += mozilla-klp
SUBDIR += msdosfs
SUBDIR += mule-freewnn
SUBDIR += munhwafonts-cid
SUBDIR += netscape3

69
korean/msdosfs/Makefile Normal file
View File

@ -0,0 +1,69 @@
# Ports collection makefile for: msdosfs for Korean
# Date created: 24 Mar 2001
# Whom: cjh
#
# $FreeBSD$
#
# based on japanese/msdosfs
#
PORTNAME= msdosfs
PORTVERSION= ${LAST_UPDATED}
CATEGORIES= korean
MASTER_SITES= http://www.kr.freebsd.org/~cjh/freebsd/msdosfs-ko/ \
ftp://ftp.kr.freebsd.org/pub/users/cjh/FreeBSD/ \
${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= asami
DISTNAME= ${PORTNAME}-ko-20000710
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
mount_msdos-20000701.tar.gz
MAINTAINER= cjh@FreeBSD.org
WRKSRC= ${WRKDIR}/${DISTNAME}/msdosfs.ko
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 410001 && ${OSVERSION} < 500000
LAST_UPDATED= 20001027
PATCHDIR= ${MASTERDIR}/patches.4
.elif ${OSVERSION} >= 500016
# runs only after 9th Feb 2001 world
LAST_UPDATED= 20010209
PATCHDIR= ${MASTERDIR}/patches.5
NO_PACKAGE= "to avoid crashing a machine when try to install incorrect version"
.else
LAST_UPDATED= 20001022
BROKEN= "Supports up-to-date -CURRENT only"
.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}/ko-msdosfs.sh \
> ${WRKDIR}/ko-msdosfs.sh
do-install:
${MKDIR} ${PREFIX}/lib/ko-msdosfs
${INSTALL_PROGRAM} ${WRKDIR}/mount_msdos/mount_komsdos ${PREFIX}/sbin
${INSTALL_SCRIPT} ${WRKSRC}/msdos_ko.ko ${PREFIX}/lib/ko-msdosfs
${INSTALL_SCRIPT} ${WRKDIR}/ko-msdosfs.sh ${PREFIX}/etc/rc.d
post-install:
/sbin/kldload ${PREFIX}/lib/ko-msdosfs/msdos_ko.ko
.include <bsd.port.post.mk>

2
korean/msdosfs/distinfo Normal file
View File

@ -0,0 +1,2 @@
MD5 (msdosfs-ko-20000710.tar.gz) = efb0f56cecf985927bab7c2ccde156c2
MD5 (mount_msdos-20000701.tar.gz) = c45e945eb4503fe9cfad01589f4ed45b

View File

@ -0,0 +1,19 @@
#!/bin/sh
# $FreeBSD$
#
module_dir=@@PREFIX@@/lib/ko-msdosfs
case $1 in
start)
kldload ${module_dir}/msdos_ko.ko
echo -n " msdosfs(ko)"
;;
stop)
kldunload msdos_ko.ko
;;
*)
echo "usage: `basename $0` {start|stop}"
exit 1
;;
esac

View File

@ -0,0 +1,20 @@
$FreeBSD$
This is a table of revisions about this ko-msdosfs.
+-------------------+---------------+-----------+
BRANCH RELENG_4 MAIN
+-------------------+---------------+-----------+
bootsect.h 1.7 1.7
bpb.h 1.7.2.1 1.8
denode.h 1.20 1.21
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.51
msdosfs_fat.c 1.23 1.24
msdosfs_lookup.c 1.30 1.32
msdosfs_vfsops.c 1.60.2.2 1.66
msdosfs_vnops.c 1.95.2.1 1.106
msdosfsmount.h 1.20.2.2 1.22
+-------------------+---------------+-----------+

View File

@ -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_ko
+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_KOREA 1" >> opt_msdosfs.h
+
+.if ${MACHINE} == "pc98"
+CFLAGS+= -DPC98
+.endif
+
+.include <bsd.kmod.mk>

View File

@ -0,0 +1,18 @@
--- bpb.h.orig Sat Aug 28 09:48:07 1999
+++ bpb.h Sat Oct 28 02:57:36 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))

View File

@ -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);
}

View File

@ -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_ko, 0);

View File

@ -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.

View File

@ -0,0 +1,19 @@
--- msdosfsmount.h.orig Mon Apr 10 04:32:37 2000
+++ msdosfsmount.h Sat Oct 28 02:57:45 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 */

View File

@ -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_komsdos
SRCS= mount_msdos.c getmntopts.c
MAN8= mount_msdos.8

View File

@ -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_EUCKOREA;
- 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_ko", &vfc);
+ if (error && vfsisloadable("msdos_ko")) {
+ if (vfsload("msdos_ko"))
+ err(EX_OSERR, "vfsload(msdos_ko)");
endvfsent(); /* clear cache */
- error = getvfsbyname("msdos", &vfc);
+ error = getvfsbyname("msdos_ko", &vfc);
}
if (error)
- errx(EX_OSERR, "msdos filesystem is not available");
+ errx(EX_OSERR, "msdos_ko 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);
}

View File

@ -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_ko
+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_KOREA 1" >> opt_msdosfs.h
+
+.if ${MACHINE} == "pc98"
+CFLAGS+= -DPC98
+.endif
+
+.include <bsd.kmod.mk>

View File

@ -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))

View File

@ -0,0 +1,132 @@
--- msdosfs_denode.c.orig Mon Apr 10 04:32:36 2000
+++ msdosfs_denode.c Sun Feb 11 16:59:48 2001
@@ -51,7 +51,4 @@
#include "opt_msdosfs.h"
-/*
- * System include files.
- */
#include <sys/param.h>
#include <sys/systm.h>
@@ -60,13 +57,12 @@
#include <sys/malloc.h>
#include <sys/proc.h>
+#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/vnode.h>
+#include <sys/mutex.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
-/*
- * MSDOSFS include files.
- */
#include <msdosfs/bpb.h>
#include <msdosfs/msdosfsmount.h>
@@ -81,7 +77,5 @@
#define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \
sizeof(struct direntry)) & dehash])
-#ifndef NULL_SIMPLELOCKS
-static struct simplelock dehash_slock;
-#endif
+static struct mtx dehash_mtx;
union _qcvt {
@@ -114,5 +108,16 @@
{
dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);
- simple_lock_init(&dehash_slock);
+ mtx_init(&dehash_mtx, "msdosfs dehash", MTX_DEF);
+ return (0);
+}
+
+int
+msdosfs_uninit(vfsp)
+ struct vfsconf *vfsp;
+{
+
+ if (dehashtbl)
+ free(dehashtbl, M_MSDOSFSMNT);
+ mtx_destroy(&dehash_mtx);
return (0);
}
@@ -129,5 +134,5 @@
loop:
- simple_lock(&dehash_slock);
+ mtx_lock(&dehash_mtx);
for (dep = DEHASH(dev, dirclust, diroff); dep; dep = dep->de_next) {
if (dirclust == dep->de_dirclust
@@ -136,6 +141,6 @@
&& dep->de_refcnt != 0) {
vp = DETOV(dep);
- simple_lock(&vp->v_interlock);
- simple_unlock(&dehash_slock);
+ mtx_lock(&vp->v_interlock);
+ mtx_unlock(&dehash_mtx);
if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p))
goto loop;
@@ -143,5 +148,5 @@
}
}
- simple_unlock(&dehash_slock);
+ mtx_unlock(&dehash_mtx);
return (NULL);
}
@@ -153,5 +158,5 @@
struct denode **depp, *deq;
- simple_lock(&dehash_slock);
+ mtx_lock(&dehash_mtx);
depp = &DEHASH(dep->de_dev, dep->de_dirclust, dep->de_diroffset);
deq = *depp;
@@ -161,5 +166,5 @@
dep->de_prev = depp;
*depp = dep;
- simple_unlock(&dehash_slock);
+ mtx_unlock(&dehash_mtx);
}
@@ -170,5 +175,5 @@
struct denode *deq;
- simple_lock(&dehash_slock);
+ mtx_lock(&dehash_mtx);
deq = dep->de_next;
if (deq)
@@ -179,5 +184,5 @@
dep->de_prev = NULL;
#endif
- simple_unlock(&dehash_slock);
+ mtx_unlock(&dehash_mtx);
}
@@ -260,5 +265,6 @@
}
bzero((caddr_t)ldep, sizeof *ldep);
- lockinit(&ldep->de_lock, PINOD, "denode", 0, 0);
+ lockinit(&nvp->v_lock, PINOD, "denode", 0, 0);
+ nvp->v_vnlock = &nvp->v_lock;
nvp->v_data = ldep;
ldep->de_vnode = nvp;
@@ -276,5 +282,5 @@
* call msdosfs_hashins() with a locked denode.
*/
- if (lockmgr(&ldep->de_lock, LK_EXCLUSIVE, (struct simplelock *)0, p))
+ if (VOP_LOCK(nvp, LK_EXCLUSIVE, p) != 0)
panic("deget: unexpected lock failure");
@@ -658,4 +664,5 @@
dep->de_flag = 0;
#endif
+ lockdestroy(&vp->v_lock);
FREE(dep, M_MSDOSFSNODE);
vp->v_data = NULL;
@@ -716,5 +723,5 @@
#endif
if (dep->de_Name[0] == SLOT_DELETED)
- vrecycle(vp, (struct simplelock *)0, p);
+ vrecycle(vp, NULL, p);
return (error);
}

View File

@ -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 */

View File

@ -0,0 +1,90 @@
--- msdosfs_lookup.c.orig Mon Apr 10 04:39:57 2000
+++ msdosfs_lookup.c Sun Oct 22 23:52:33 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>
@@ -124,6 +125,7 @@
int wincnt = 1;
int chksum = -1;
int olddos = 1;
+ cnp->cn_flags &= ~PDIRUNLOCK;
#ifdef MSDOSFS_DEBUG
printf("msdosfs_lookup(): looking for %s\n", cnp->cn_nameptr);
@@ -379,8 +381,10 @@
* information cannot be used.
*/
cnp->cn_flags |= SAVENAME;
- if (!lockparent)
+ if (!lockparent) {
VOP_UNLOCK(vdp, 0, p);
+ cnp->cn_flags |= PDIRUNLOCK;
+ }
return (EJUSTRETURN);
}
/*
@@ -468,8 +472,10 @@
if (error)
return (error);
*vpp = DETOV(tdp);
- if (!lockparent)
+ if (!lockparent) {
VOP_UNLOCK(vdp, 0, p);
+ cnp->cn_flags |= PDIRUNLOCK;
+ }
return (0);
}
@@ -499,8 +505,10 @@
return (error);
*vpp = DETOV(tdp);
cnp->cn_flags |= SAVENAME;
- if (!lockparent)
+ if (!lockparent) {
VOP_UNLOCK(vdp, 0, p);
+ cnp->cn_flags |= PDIRUNLOCK;
+ }
return (0);
}
@@ -526,15 +534,20 @@
pdp = vdp;
if (flags & ISDOTDOT) {
VOP_UNLOCK(pdp, 0, p);
+ cnp->cn_flags |= PDIRUNLOCK;
error = deget(pmp, cluster, blkoff, &tdp);
if (error) {
vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p);
+ cnp->cn_flags &= ~PDIRUNLOCK;
return (error);
}
- if (lockparent && (flags & ISLASTCN) &&
- (error = vn_lock(pdp, LK_EXCLUSIVE, p))) {
- vput(DETOV(tdp));
- return (error);
+ if (lockparent && (flags & ISLASTCN)) {
+ error = vn_lock(pdp, LK_EXCLUSIVE, p);
+ if (error) {
+ vput(DETOV(tdp));
+ return (error);
+ }
+ cnp->cn_flags &= ~PDIRUNLOCK;
}
*vpp = DETOV(tdp);
} else if (dp->de_StartCluster == scn && isadir) {
@@ -543,8 +556,10 @@
} else {
if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0)
return (error);
- if (!lockparent || !(flags & ISLASTCN))
+ if (!lockparent || !(flags & ISLASTCN)) {
VOP_UNLOCK(pdp, 0, p);
+ cnp->cn_flags |= PDIRUNLOCK;
+ }
*vpp = DETOV(tdp);
}

View File

@ -0,0 +1,132 @@
--- msdosfs_vfsops.c.orig Mon Apr 10 04:32:37 2000
+++ msdosfs_vfsops.c Sun Feb 11 17:01:51 2001
@@ -50,8 +50,4 @@
#include "opt_msdosfs.h"
-
-/*
- * System include files.
- */
#include <sys/param.h>
#include <sys/systm.h>
@@ -62,13 +58,11 @@
#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>
+#include <sys/mutex.h>
-/*
- * MSDOSFS include files.
- */
#include <msdosfs/bpb.h>
#include <msdosfs/bootsect.h>
@@ -78,4 +72,6 @@
#include <msdosfs/fat.h>
+#define MSDOSFS_DFLTBSIZE 4096
+
#if 1 /*def PC98*/
/*
@@ -181,6 +177,5 @@
panic("msdosfs_mountroot: can't setup rootvp");
- mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
- bzero((char *)mp, (u_long)sizeof(struct mount));
+ mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO);
mp->mnt_op = &msdosfs_vfsops;
mp->mnt_flag = 0;
@@ -469,6 +464,5 @@
#endif
- pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK);
- bzero((caddr_t)pmp, sizeof *pmp);
+ pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK | M_ZERO);
pmp->pm_mountp = mp;
@@ -636,5 +630,5 @@
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;
@@ -730,5 +724,5 @@
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
mp->mnt_flag |= MNT_LOCAL;
- devvp->v_specmountpoint = mp;
+ devvp->v_rdev->si_mountpoint = mp;
return 0;
@@ -766,5 +760,5 @@
return error;
pmp = VFSTOMSDOSFS(mp);
- pmp->pm_devvp->v_specmountpoint = NULL;
+ pmp->pm_devvp->v_rdev->si_mountpoint = NULL;
#ifdef MSDOSFS_DEBUG
{
@@ -777,5 +771,5 @@
vp->v_id, vp->v_mount, vp->v_op);
printf("freef %p, freeb %p, mount %p\n",
- vp->v_freelist.tqe_next, vp->v_freelist.tqe_prev,
+ TAILQ_NEXT(vp, v_freelist), vp->v_freelist.tqe_prev,
vp->v_mount);
printf("cleanblkhd %p, dirtyblkhd %p, numoutput %ld, type %d\n",
@@ -870,7 +864,7 @@
* Write back each (modified) denode.
*/
- simple_lock(&mntvnode_slock);
+ mtx_lock(&mntvnode_mtx);
loop:
- for (vp = mp->mnt_vnodelist.lh_first; vp != NULL; vp = nvp) {
+ for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
@@ -880,6 +874,6 @@
goto loop;
- simple_lock(&vp->v_interlock);
- nvp = vp->v_mntvnodes.le_next;
+ mtx_lock(&vp->v_interlock);
+ nvp = LIST_NEXT(vp, v_mntvnodes);
dep = VTODE(vp);
if (vp->v_type == VNON ||
@@ -887,11 +881,11 @@
(DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 &&
(TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) {
- simple_unlock(&vp->v_interlock);
+ mtx_unlock(&vp->v_interlock);
continue;
}
- simple_unlock(&mntvnode_slock);
+ mtx_unlock(&mntvnode_mtx);
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p);
if (error) {
- simple_lock(&mntvnode_slock);
+ mtx_lock(&mntvnode_mtx);
if (error == ENOENT)
goto loop;
@@ -903,7 +897,7 @@
VOP_UNLOCK(vp, 0, p);
vrele(vp);
- simple_lock(&mntvnode_slock);
+ mtx_lock(&mntvnode_mtx);
}
- simple_unlock(&mntvnode_slock);
+ mtx_unlock(&mntvnode_mtx);
/*
@@ -988,7 +982,7 @@
msdosfs_vptofh,
msdosfs_init,
- vfs_stduninit,
+ msdosfs_uninit,
vfs_stdextattrctl,
};
-VFS_SET(msdosfs_vfsops, msdos, 0);
+VFS_SET(msdosfs_vfsops, msdos_ko, 0);

View File

@ -0,0 +1,152 @@
--- msdosfs_vnops.c.orig Mon Apr 10 04:32:37 2000
+++ msdosfs_vnops.c Sun Feb 11 17:00:36 2001
@@ -51,7 +51,4 @@
#include "opt_msdosfs.h"
-/*
- * System include files.
- */
#include <sys/param.h>
#include <sys/systm.h>
@@ -60,4 +57,5 @@
#include <sys/kernel.h>
#include <sys/stat.h>
+#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/proc.h>
@@ -71,10 +69,8 @@
#include <vm/vm.h>
#include <vm/vm_extern.h>
-#include <vm/vm_zone.h>
#include <vm/vnode_pager.h>
-/*
- * MSDOSFS include files.
- */
+#include <machine/mutex.h>
+
#include <msdosfs/bpb.h>
#include <msdosfs/direntry.h>
@@ -240,10 +236,10 @@
struct timespec ts;
- simple_lock(&vp->v_interlock);
+ mtx_lock(&vp->v_interlock);
if (vp->v_usecount > 1) {
getnanotime(&ts);
DETIMES(dep, &ts, &ts, &ts);
}
- simple_unlock(&vp->v_interlock);
+ mtx_unlock(&vp->v_interlock);
return 0;
}
@@ -261,8 +257,5 @@
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) |
@@ -288,41 +281,6 @@
}
- /* 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));
}
@@ -915,7 +873,5 @@
/*
- * DOS filesystems don't know what links are. But since we already called
- * msdosfs_lookup() with create and lockparent, the parent is locked so we
- * have to free it before we return the error.
+ * DOS filesystems don't know what links are.
*/
static int
@@ -975,9 +931,4 @@
* 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
@@ -1109,5 +1060,4 @@
if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster)
newparent = 1;
- vrele(fdvp);
if (doingdirectory && newparent) {
if (error) /* write access check above */
@@ -1177,5 +1127,6 @@
if (!newparent)
VOP_UNLOCK(tdvp, 0, p);
- (void) relookup(fdvp, &fvp, fcnp);
+ if (relookup(fdvp, &fvp, fcnp) == 0)
+ vrele(fdvp);
if (fvp == NULL) {
/*
@@ -1857,6 +1808,6 @@
if (error) {
bp->b_error = error;
- bp->b_flags |= B_ERROR;
- biodone(bp);
+ bp->b_ioflags |= BIO_ERROR;
+ bufdone(bp);
return (error);
}
@@ -1865,5 +1816,5 @@
}
if (bp->b_blkno == -1) {
- biodone(bp);
+ bufdone(bp);
return (0);
}
@@ -1890,5 +1841,5 @@
dep->de_StartCluster, dep->de_dirclust, dep->de_diroffset);
printf(" dev %d, %d", major(dep->de_dev), minor(dep->de_dev));
- lockmgr_printinfo(&dep->de_lock);
+ lockmgr_printinfo(&ap->a_vp->v_lock);
printf("\n");
return (0);

View File

@ -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 */

View File

@ -0,0 +1,10 @@
--- denode.h.orig Wed Dec 29 13:54:52 1999
+++ denode.h Sun Oct 22 23:51:49 2000
@@ -135,7 +135,6 @@
* contained within a vnode.
*/
struct denode {
- struct lock de_lock; /* denode lock >Keep this first< */
struct denode *de_next; /* Hash chain forward */
struct denode **de_prev; /* Hash chain back */
struct vnode *de_vnode; /* addr of vnode we are part of */

View File

@ -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_komsdos
SRCS= mount_msdos.c getmntopts.c
MAN8= mount_msdos.8

View File

@ -0,0 +1,77 @@
--- ../../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_EUCKOREA;
- 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_ko", &vfc);
+ if (error && vfsisloadable("msdos_ko")) {
+ if (vfsload("msdos_ko"))
+ err(EX_OSERR, "vfsload(msdos_ko)");
endvfsent(); /* clear cache */
- error = getvfsbyname("msdos", &vfc);
+ error = getvfsbyname("msdos_ko", &vfc);
}
if (error)
- errx(EX_OSERR, "msdos filesystem is not available");
+ errx(EX_OSERR, "msdos_ko 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);
}

View File

@ -0,0 +1 @@
Mount a Microsoft FAT Korean file system

11
korean/msdosfs/pkg-descr Normal file
View File

@ -0,0 +1,11 @@
You can mount a Korean FAT file system via "mount_komsdos" command.
Be sure that "msdos_ko.ko" is already dynamically linked into the
kernal before you type "mount_komsdos" (see kldstat(8)).
The author is CHOI Junho <cjh@FreeBSD.org>.
Original author of Japanese version is Toshihiko Arai <toshi@FreeBSD.org>.
--
CHOI Junho <cjh@FreeBSD.org>
WWW: http://www.kr.freebsd.org/~cjh/freebsd/msdosfs-ko/

6
korean/msdosfs/pkg-plist Normal file
View File

@ -0,0 +1,6 @@
etc/rc.d/ko-msdosfs.sh
lib/ko-msdosfs/msdos_ko.ko
sbin/mount_komsdos
@dirrm lib/ko-msdosfs
@exec /sbin/kldload %D/lib/ko-msdosfs/msdos_ko.ko
@unexec /sbin/kldunload msdos_ko 2>/dev/null || /usr/bin/true