diff options
author | scottl <scottl@FreeBSD.org> | 2003-11-05 06:56:08 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2003-11-05 06:56:08 +0000 |
commit | aa058296bcb3ac9e303628d7414f4634cdba452e (patch) | |
tree | 0b543d04f8a1e099f6c425d001765859a22ff579 /sys/fs/udf/udf_vfsops.c | |
parent | c7d964d2cef031c840960d17686a8247a9528514 (diff) | |
download | FreeBSD-src-aa058296bcb3ac9e303628d7414f4634cdba452e.zip FreeBSD-src-aa058296bcb3ac9e303628d7414f4634cdba452e.tar.gz |
Add hooks for translating directories entries using the iconv methods.
Submitted by: imura@ryu16.org
Diffstat (limited to 'sys/fs/udf/udf_vfsops.c')
-rw-r--r-- | sys/fs/udf/udf_vfsops.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index c8f7e49..0c093d6 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -79,6 +79,7 @@ #include <sys/conf.h> #include <sys/dirent.h> #include <sys/fcntl.h> +#include <sys/iconv.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/mount.h> @@ -90,12 +91,15 @@ #include <vm/uma.h> #include <fs/udf/ecma167-udf.h> -#include <fs/udf/udf.h> #include <fs/udf/osta.h> +#include <fs/udf/udf.h> +#include <fs/udf/udf_mount.h> MALLOC_DEFINE(M_UDFMOUNT, "UDF mount", "UDF mount structure"); MALLOC_DEFINE(M_UDFFENTRY, "UDF fentry", "UDF file entry structure"); +struct iconv_functions *udf_iconv = NULL; + /* Zones */ uma_zone_t udf_zone_trans = NULL; uma_zone_t udf_zone_node = NULL; @@ -125,6 +129,8 @@ static struct vfsops udf_vfsops = { }; VFS_SET(udf_vfsops, udf, VFCF_READONLY); +MODULE_VERSION(udf, 1); + static int udf_mountfs(struct vnode *, struct mount *, struct thread *); static int @@ -183,9 +189,9 @@ udf_mount(struct mount *mp, struct nameidata *ndp, struct thread *td) struct udf_mnt *imp = 0; struct export_args *export; struct vfsoptlist *opts; - char *fspec; + char *fspec, *cs_disk, *cs_local; size_t size; - int error, len; + int error, len, *udf_flags; opts = mp->mnt_optnew; @@ -246,6 +252,28 @@ udf_mount(struct mount *mp, struct nameidata *ndp, struct thread *td) } imp = VFSTOUDFFS(mp); + + udf_flags = NULL; + error = vfs_getopt(opts, "flags", (void **)&udf_flags, &len); + if (error || len != sizeof(int)) + return (EINVAL); + imp->im_flags = *udf_flags; + + if (imp->im_flags & UDFMNT_KICONV && udf_iconv) { + cs_disk = NULL; + error = vfs_getopt(opts, "cs_disk", (void **)&cs_disk, &len); + if (!error && cs_disk[len - 1] != '\0') + return (EINVAL); + cs_local = NULL; + error = vfs_getopt(opts, "cs_local", (void **)&cs_local, &len); + if (!error && cs_local[len - 1] != '\0') + return (EINVAL); + udf_iconv->open(cs_local, cs_disk, &imp->im_d2l); +#if 0 + udf_iconv->open(cs_disk, cs_local, &imp->im_l2d); +#endif + } + copystr(fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); udf_statfs(mp, &mp->mnt_stat, td); @@ -326,6 +354,10 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) { udfmp->im_mountp = mp; udfmp->im_dev = devvp->v_rdev; udfmp->im_devvp = devvp; + udfmp->im_d2l = NULL; +#if 0 + udfmp->im_l2d = NULL; +#endif bsize = 2048; /* XXX Should probe the media for it's size */ @@ -471,6 +503,15 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td) if ((error = vflush(mp, 0, flags))) return (error); + if (udfmp->im_flags & UDFMNT_KICONV && udf_iconv) { + if (udfmp->im_d2l) + udf_iconv->close(udfmp->im_d2l); +#if 0 + if (udfmp->im_l2d) + udf_iconv->close(udfmp->im_l2d); +#endif + } + udfmp->im_devvp->v_rdev->si_mountpoint = NULL; error = VOP_CLOSE(udfmp->im_devvp, FREAD, NOCRED, td); vrele(udfmp->im_devvp); |