[patch] combine mount_udf(8) with kiconv(3)
R. Imura
imura at ryu16.org
Mon Nov 3 11:52:15 PST 2003
On Mon, Nov 03, 2003 at 01:42:18AM +0900, R. Imura wrote:
> Hi all,
>
> I now added -C option to mount_udf(8) as well as mount_cd9660(8)
> and mount_ntfs(8) with UDF_ICONV kernel module in order to
> handle multibyte characters.
> Since I'm new to nmount(), please correct me if I'm wrong with
> how to write udf specific options/flags.
> The patch is here:
>
> http://www.ryu16.org/FreeBSD/kiconv/udf_5_current_20031101.diff
I updated the patch because it lacked exception case when
meeting a unicode character which is not in his convertion table.
New one is here:
http://www.ryu16.org/FreeBSD/kiconv/udf_5_current_20031103.diff
The difference between 20031101 version and 20031103 version is following.
diff -u -r1.1.2.5 udf_vnops.c
--- udf_vnops.c 3 Nov 2003 19:38:28 -0000 1.1.2.5
+++ udf_vnops.c 3 Nov 2003 19:29:35 -0000
@@ -450,9 +450,8 @@
/*
* Call the OSTA routines to translate the name from a CS0 dstring to a
* 16-bit Unicode String. Hooks need to be placed in here to translate from
- * Unicode to the encoding that the kernel/user expects. For now, compact
- * the encoding to 8 bits if possible. Return the length of the translated
- * string.
+ * Unicode to the encoding that the kernel/user expects. Return the length
+ * of the translated string.
*/
static int
udf_transname(char *cs0string, char *destname, int len, struct udf_mnt *udfmp)
@@ -481,8 +480,17 @@
}
unibuf = unip;
unileft = (size_t)unilen * 2;
- udf_iconv->conv(udfmp->im_d2l, (const char **)&unibuf, &unileft,
- (char **)&destname, &destleft);
+ while (unileft > 0 && destleft > 0) {
+ udf_iconv->conv(udfmp->im_d2l, (const char **)&unibuf,
+ &unileft, (char **)&destname, &destleft);
+ /* Unconverted character found */
+ if (unileft > 0 && destleft > 0) {
+ *destname++ = '?';
+ destleft--;
+ unibuf += 2;
+ unileft -= 2;
+ }
+ }
uma_zfree(udf_zone_trans, unip);
*destname = '\0';
destlen = MAXNAMLEN - (int)destleft;
- R. Imura
More information about the freebsd-fs
mailing list