Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16653156ybl; Wed, 1 Jan 2020 10:13:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyrFQ1h2Bn9pu3eK9/Fi9rXegIUij0JmEYPZVlQrWsZIlfab7FcOjyQTjxJw8/MyZgRPq01 X-Received: by 2002:a05:6830:12ce:: with SMTP id a14mr50437923otq.366.1577902406162; Wed, 01 Jan 2020 10:13:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577902406; cv=none; d=google.com; s=arc-20160816; b=LdYMA/wgoeMTHyExuYFwupt4G2jHtk29+fDqFNdnxqczhUzu4zVRFRiMfT5a/TtxoX z1VJk+yrkyJz3HC2J2e4QMDesSaHlMpIon7edfZ8fcs0aeU3wj/HZ1pKeuxL6cCSTdJn wgXN65gmXyoNwXgN3peoGvgUVoT4/fAYu8FG050P7fS5TwM6ZLuSPKbL2W2WBdKkctFs zjPZz5iRm2aoSF/taFg4OngzlXW5GNpPqrptHj3zHBpnT/+AVhq016PqBu1/2ubcVygy 7yhIlfMlqI/T1vztC0Xsvnq1pk5rm0SodpZCxSkBojK6UpwPXco38fxDKAUVe+Bqgu/j gd0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=CvlYmcopR6K325Hz2rT7Ss562OnxXdyt/eCpqEEaxUI=; b=v6keumIFqV7A7FAL472+DDodnA2dJIMb7L+qRzo1VNVjJ0SuYvIiUlcNndpaQd75tp NsJeljSP3jKiyRvnXk0cL9seMiCw6zNc/yigiDoE4dYxEHaCvOr/odCTb/j0qWTwCmdm ino2OvhifexnH2sRCpBYoH9nDT10SC0CxAnnySTGfT803vxHp+8SO29t5D4XXGVjch97 9cL7wmzgNqh8ZFIDuRqEvRpEo94wpA28MR+NULLBJSreiHSwkEUlUnNGZJ2HG1YMH2Gc gyKs+Gv8p4hbPr7/+KTpTApA6eAG4ExvNLQr/bkcVgxSq4I9jiX5stnYuFij7sDvORzJ UYrA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si27335137otp.20.2020.01.01.10.13.13; Wed, 01 Jan 2020 10:13:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbgAASLH (ORCPT + 99 others); Wed, 1 Jan 2020 13:11:07 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:46907 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727237AbgAASLH (ORCPT ); Wed, 1 Jan 2020 13:11:07 -0500 Received: from callcc.thunk.org (pool-72-93-95-157.bstnma.fios.verizon.net [72.93.95.157]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 001IAtE2003793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 1 Jan 2020 13:10:55 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id D366E420485; Wed, 1 Jan 2020 13:10:54 -0500 (EST) Date: Wed, 1 Jan 2020 13:10:54 -0500 From: "Theodore Y. Ts'o" To: Eric Sandeen Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , Andreas Dilger , David Sterba , "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL Message-ID: <20200101181054.GB191637@mit.edu> References: <20191228143651.bjb4sjirn2q3xup4@pali> <517472d1-c686-2f18-4e0b-000cda7e88c7@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <517472d1-c686-2f18-4e0b-000cda7e88c7@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 31, 2019 at 04:54:18PM -0600, Eric Sandeen wrote: > > Because I was not able to find any documentation for it, what is format > > of passed buffer... null-term string? fixed-length? and in which > > encoding? utf-8? latin1? utf-16? or filesystem dependent? > > It simply copies the bits from the memory location you pass in, it knows > nothing of encodings. > > For the most part it's up to the filesystem's own utilities to do any > interpretation of the resulting bits on disk, null-terminating maximal-length > label strings, etc. I'm not sure this is going to be the best API design choice. The blkid library interprets the on disk format for each file syustem knowing what is the "native" format for that particular file system. This is mainly an issue only for the non-Linux file systems; for the Linux file system, the party line has historically been that we don't get involved with character encoding, but in practice, what that has evolved into is that userspace has standardized on UTF-8, and that's what we pass into the kernel from userspace by convention. But the problem is that if the goal is to make FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL work without the calling program knowing what file system type a particular pathname happens to be, then it would be easist for the userspace program if it can expect that it can always pass in a null-terminated UTF-8 string, and get back a null-terminated UTF-8. I bet that in practice, that is what most userspace programs are going to be do anyway, since it works that way for all other file system syscalls. So for a file system which is a non-Linux-native file system, if it happens to store the its label using utf-16, or some other Windows-system-silliness, it would work a lot better if it assumed that it was passed in utf-8, and stored in the the Windows file system using whatever crazy encoding Windows wants to use. Otherwise, why bother uplifting the ioctl to one which is file system independent, if the paramters are defined to be file system *dependent*? - Ted