Received: by 10.223.176.5 with SMTP id f5csp4033834wra; Tue, 30 Jan 2018 00:49:11 -0800 (PST) X-Google-Smtp-Source: AH8x226WrUvrQkcCOotSgAvcI8XsYCCRSLoY4FeG/aZaZXfLws0O6l47eH2szwx087Q5ff71+lmt X-Received: by 2002:a17:902:6186:: with SMTP id u6-v6mr24010644plj.390.1517302151403; Tue, 30 Jan 2018 00:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517302151; cv=none; d=google.com; s=arc-20160816; b=B0Wjphd8dIddmFTmCbztABUhk2VGrCo649zAFTG2LIjvgOC9AsXIJLNWKyzzUz11rJ GNV27HfuM1eTu0+aL8n60rRZFKhPfCtadKCj6eJhAVJhoqZKvlg1MZSyXSrBv9SJUKuU 3QRykYnjnHUydbjzlRNJ2MHrr4NH2Qx8/l3/+RmbB7N6GIBo4AjxSEjshJhlzPCdcgds ux9YbeqbW8woiinX953RTEqCvWu+lYG4Ilfdw7KqFCLj6KvN83KaA9KzoqLMiAXfsJRL dmRABTGw4syeQxyqlOH9qZJWFtk2Q7xPUKcMHn+MtNkyj46qyUyyHvlJHUKC7b04QEae XD2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=IlpemdG6fQY1p/i00WrT3yUnaFMvrmkQDHrhb4qjm/E=; b=wUL4aufVp7uX48WUzKOuc19508UrJ2pWvtEtbtI39UpiC4LNEMwk+j6K00GGBUZ4bb nowWWjjK53jeSwbV/cB+OLgpNH2MtHZ86tarIdbhTRdiiZw/K0e1VvmyofKBIiA/Va6u kTeipZPDwnm6ZFvL9JrS1dklIlFbIlD8CrxubpGR3yC1Rnml+yc/tefsgIEaorFjMN4P WzQBXWtVVo3MokdsbU8DerzqZl8OdnMtZE543vcV1cvXljcp5+lywnXk+L+5lp6zbT8v KusAGU1B+kjTvhPYT76iFILZqDgossq1RVaTPH/nsaKahUlVPNWI8Y/O16CpKMylFGoH +hyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vFnJw9py; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t83si1260541pfi.53.2018.01.30.00.48.56; Tue, 30 Jan 2018 00:49:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vFnJw9py; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751687AbeA3Isc (ORCPT + 99 others); Tue, 30 Jan 2018 03:48:32 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43054 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeA3Isb (ORCPT ); Tue, 30 Jan 2018 03:48:31 -0500 Received: by mail-wr0-f194.google.com with SMTP id 39so1490136wrb.10 for ; Tue, 30 Jan 2018 00:48:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=IlpemdG6fQY1p/i00WrT3yUnaFMvrmkQDHrhb4qjm/E=; b=vFnJw9pyVzuLbpgXnjcwvJj0ppbgycfJEq5b9VB0nTfovp5mgV+jhLQD1ZJfk/RdxW xDqgl4md7785GTAt37BmXj1u8UWKrTbGxa2xmAb49k4Dm9+gQidROSEcizgob09+0/c/ hkZ8oLKo75qJi0iU8XvQPDWDgk6RPbSpadtODfzykGL4EAosxV/r2zRgd+zgFEq98ZGl I0g7IqXORTTmYDmQMGfYfLwjSBLpW4JMMWYOsOUOBM2u9jFg6IK6ReH+c+XEdILCqt1w Phy0xYJSUk/OzaEp2rOkixtQmUOBa9w2mo0ZxoJlBaV+CAoiIK+EyptIgrk93HH+4P1T etpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=IlpemdG6fQY1p/i00WrT3yUnaFMvrmkQDHrhb4qjm/E=; b=h/uRX/8n8xzbAUH1QBil0S26ksNF+n6kQVPhkwsn/iFRjEG+PlIEWBKEiK24WqvQTi 1S0leWRfnml2bxz8RZRqQgMqpo7ul6nCMfAJ/5mT7hRiiKhldQOdn+mb77IqyudNPIaP bjlgELjC3nJZavKamAUM3RUtiP4Nx1Bs0kI3JDO+XV/KKiNubwhZMaTgdRvtGfAEEUyR iKlY3Tpco6+UYXCbmh8frxTaUt8yspOKsxWCf+gCIqRURIJjx6+2nHfts8D/f1CBwS7x 3P8df735142Q4+slZIoh0dAXb9tFdZH2z5W7Arv1RGCAq3o3L2g4oWcKL9UWLXaFKCn9 EMIg== X-Gm-Message-State: AKwxytesQmmXxm46lKutwPWw6/UH0+Luf4w7nHMGOJfrior7xivScbw8 MBLKoVXZa6L3FwGO1chkvAM= X-Received: by 10.223.166.176 with SMTP id t45mr952134wrc.221.1517302109757; Tue, 30 Jan 2018 00:48:29 -0800 (PST) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id r42sm7184376wrb.56.2018.01.30.00.48.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 00:48:29 -0800 (PST) Date: Tue, 30 Jan 2018 09:48:27 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Chen Guanqiao Cc: Andy Shevchenko , OGAWA Hirofumi , Linux Kernel Mailing List Subject: Re: [PATCH 3/3] fs: fat: add ioctl method in fat filesystem driver Message-ID: <20180130084827.g6iegq4rsqnji76s@pali> References: <20180117104355.889-1-chen.chenchacha@foxmail.com> <20180117104355.889-4-chen.chenchacha@foxmail.com> <20180129164304.44on6tdlhpzcwarv@pali> <5a7011dd.ca40650a.885bf.f16eSMTPIN_ADDED_BROKEN@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <5a7011dd.ca40650a.885bf.f16eSMTPIN_ADDED_BROKEN@mx.google.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 30 January 2018 14:33:49 Chen Guanqiao wrote: > On Mon, 2018-01-29 at 17:43 +0100, Pali Roh=C3=A1r wrote: > > On Monday 29 January 2018 15:18:42 Andy Shevchenko wrote: > > > +Cc: Pali, who AFAIRC is interested in FAT labeling mess. > >=20 > > Yes, please CC me for FAT labeling discussing in future. > >=20 > > > On Wed, Jan 17, 2018 at 12:43 PM, ChenGuanqiao > > > wrote: > > >=20 > > > Commit message? > > >=20 > > > > Signed-off-by: ChenGuanqiao > > > > =C2=A0#include > > > > =C2=A0#include > > > > =C2=A0#include > > > > +#include > > >=20 > > > It would be better to squeeze it to have order (to some extent) > > > preserved. > > >=20 > > > > +static int fat_check_d_characters(char *label, unsigned long > > > > len) > > > > +{ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0int i; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0for (i =3D 0; i < len; += +i) { > > >=20 > > > Oy vey, unsigned long len vs. int i. > > >=20 > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0switch (label[i]) { > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0case 'a' ... 'z': > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0lab= el[i] =3D __toupper(label[i]); > >=20 > > Why only lower a..z? =C3=A1 or =C3=B3 are also valid (according to some= OEM > > codepage) and are lower case. > >=20 > > Also please look at my testing results. Even old DOS versions are > > able > > to correctly read lower case label. Therefore I do not see any reason > > why to have such "force" code in kernel. > >=20 > > https://www.spinics.net/lists/kernel/msg2645732.html > >=20 > > Here I proposed how should be linux tools unified which manipulates > > with > > fat label. > In character detection, I refer to the FAT standard document "Ecma- > 107". So please stick with implementation which is already used in kernel driver or refer to one of two MS documentations for FAT12/16/32. We do not want to have part of kernel fs driver to be written according one documentation, other parts according to another documentation and remaining parts according to guess or something else. We already have compatibility with MS FAT, so inventing something new does not make sense. Also in past there was found mistakes in MS documentation (like incorrect formulas for counting clusters, etc.), so beware of facts that documentation/specification does not have to be 100% correct. In above email I did investigation for FAT labels and come to the conclusion which seems to make sense. So if you disagree with it, please open discussion what is wrong with proposed solution for unifying handling label on Linux. Instead of inventing fully new way how to handle FAT label in Linux. It really does not make any sense to use fully different way how to handle FAT label which is incompatible with existing Linux and Windows implementations. In namei_msdos.c you can find already used functions. Others should be available in dir.c. > The document limits the volume label to a range of characters > called "d-characters". The "d-characters" only includes uppercase > letter, '-' and numbers. msdos.ko and vfat.ko already handles also other characters. > And I have found the volume label can be written as extended ASCII, > double-byte characters in Windows. such as Chinese characters, Arabic > characters, and others are not all characters that control characters > and punctuation mark in ASCII. This is obviously no correct if we copy > the implementation of windows completely, let the maximum length of > volume label is variable? Label is stored in two locations: boot sector and as entry in root directory structure. For directory entry there are strict rules which msdos.ko/vfat.ko uses and which are verified by years of usage. Maximum length is fixed to 11 bytes due to length of directory entry. Also note that label cannot be stored as LFN entry. --=20 Pali Roh=C3=A1r pali.rohar@gmail.com