From owner-freebsd-fs@FreeBSD.ORG Mon Nov 3 11:52:14 2003 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9F0216A4CE; Mon, 3 Nov 2003 11:52:14 -0800 (PST) Received: from mail.ryu16.org (YahooBB219005044050.bbtec.net [219.5.44.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 46A7943F85; Mon, 3 Nov 2003 11:52:13 -0800 (PST) (envelope-from imura@ryu16.org) Received: from redeye.xt.ryu16.org (localhost [127.0.0.1]) by mail.ryu16.org (8.12.9p1/8.12.9) with ESMTP id hA3JqCwQ064177; Tue, 4 Nov 2003 04:52:12 +0900 (JST) (envelope-from imura@redeye.xt.ryu16.org) Received: (from imura@localhost) by redeye.xt.ryu16.org (8.12.9p1/8.12.9/Submit) id hA3JqBRH064176; Tue, 4 Nov 2003 04:52:11 +0900 (JST) (envelope-from imura) Date: Tue, 4 Nov 2003 04:52:11 +0900 From: "R. Imura" To: fs@freebsd.org, i18n@freebsd.org Message-ID: <20031103195211.GA63701%imura@ryu16.org> References: <20031102164218.GB606%imura@ryu16.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031102164218.GB606%imura@ryu16.org> User-Agent: Mutt/1.4.1i-ja.1 Subject: Re: [patch] combine mount_udf(8) with kiconv(3) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2003 19:52:15 -0000 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