Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17879643ybl; Thu, 2 Jan 2020 13:59:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwiwFWVeE4/a8jFqRitYQTUcXscJ/cnIrMF2OfvxXIpNPJQlICh/m0sSDogsFk4oMmYO7Qv X-Received: by 2002:a9d:7cd9:: with SMTP id r25mr88271763otn.326.1578002351098; Thu, 02 Jan 2020 13:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578002351; cv=none; d=google.com; s=arc-20160816; b=C5d0IghM1mUACSscp+meQT+jnAYRv+jTAma9hS3FDY+pD9e8aHbCpKSu3RxUo6wg8G aiXR81atq1kzP+/5kWMhVI2y08JD1fEJBYFcaAJzwdV1FszhGLxnMdLii86w5naMWIXf +OwB2Td4KQLRxAPhaVn18pv9rtsphdLri1WosUVM+aR8YqR/lI5qSMV0hdRHMX2G6UfZ qgEo9Xw1zJRvdKwZ2VjPpURe3qgzLvszmgm/Vfacu4bpOe2Nm7PnW3Gq0FU3ypkNStJg /xkgpeNhMhrQu4iNg4X0bJXaFry7SBwGYgaUmckliE5Iph9CFFKe/XYFjHOgYAvsoMzv CnKg== 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; bh=c9CiFIyiVXzLlpT9+lnQQn3z7fPJn3E86zFXm4+hGo8=; b=jarC045Y0xDWv6E/tGMe6uIAtWhZIJ3Bewd7RG8VAFwRiVKP02O5M2iB9R9/tFnwLM lmGndQ72osjSbsNbYSFVO3HR9kYR5qpMjAqApFR5wCsAHZu1Ca01h6HsjFs/39ef7Np8 EBep1pQRLDFepeIxBy0XV529mi3ACJ4Ryw+aP49frZcGujQvme+dH0IiDOWkSRwmLlIL /M7Jfv/ZwmB5s9iP1oq6uYUH23HTvhBo2FrI4E879xvTdI5cq36c8lIn7epKfyWWwP8E 0BtFZYUDOVl5bRnSIVzqwzzBvKGk6p6eFE6FVDynxYMh66l0Qz0wi+mP44VkZiiuxVIB TLtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b="l27tJV/1"; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si28727732otp.126.2020.01.02.13.58.59; Thu, 02 Jan 2020 13:59: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=@oracle.com header.s=corp-2019-08-05 header.b="l27tJV/1"; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725890AbgABV6M (ORCPT + 99 others); Thu, 2 Jan 2020 16:58:12 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:34258 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbgABV6I (ORCPT ); Thu, 2 Jan 2020 16:58:08 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 002LsRxn088500; Thu, 2 Jan 2020 21:57:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2019-08-05; bh=c9CiFIyiVXzLlpT9+lnQQn3z7fPJn3E86zFXm4+hGo8=; b=l27tJV/1FLn856+Rp/OjZkzDW2jl7hotIb6XEilTNAo7KS7Rl39jaLx7IT3t5WgPzclf ZDGYMC/EgYCPjcwv1xhButdkXpUrfNMjVCX+99Kmg0aMg7pviO73tTWHYWxLqZFL16kV qxRYuaEwynUH+0BjB5fty3tIp/E4Ge6H2nsdSJWv28D5YVtPPtwIio8wHWudjFJyC8xz X+2Xl3m92k3NSGsQncZqrFDMttmje6oOGXnpjtj+bt4OXUwp+mEIm7aJW+Vkn9uj3EHB EWRA8bAlyfC4yIaFEPKoFSI6tFW/5spkqoPiUMqgIViXzZ/EhCZ31U1al+HsD89MLpqM Hw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2x5ypqsku0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jan 2020 21:57:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 002LmiPw101439; Thu, 2 Jan 2020 21:57:56 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2x9jm6n3tw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jan 2020 21:57:56 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 002LvtAF000910; Thu, 2 Jan 2020 21:57:55 GMT Received: from localhost (/10.145.178.64) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 02 Jan 2020 13:57:55 -0800 Date: Thu, 2 Jan 2020 13:57:54 -0800 From: "Darrick J. Wong" To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: "Theodore Y. Ts'o" , Eric Sandeen , Andreas Dilger , David Sterba , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL Message-ID: <20200102215754.GA1508646@magnolia> References: <20191228143651.bjb4sjirn2q3xup4@pali> <517472d1-c686-2f18-4e0b-000cda7e88c7@redhat.com> <20200101181054.GB191637@mit.edu> <20200101183920.imncit5sllj46c22@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200101183920.imncit5sllj46c22@pali> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9488 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001020176 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9488 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001020177 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 01, 2020 at 07:39:20PM +0100, Pali Roh?r wrote: > On Wednesday 01 January 2020 13:10:54 Theodore Y. Ts'o wrote: > > 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. "Null terminated sequence of bytes*" is more or less what xfsprogs do, and it looks like btrfs does that as well. (* with the idiotic exception that if the label is exactly 256 bytes long then the array is not required to have a null terminator, because btrfs encoded that quirk of their ondisk format into the API. ) So for VFAT, I think you can use the same code that does the name encoding transformations for iocharset= to handle labels, right? > > 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*? > > Exactly. In another email I wrote that for those non-Linux-native > filesystem could be used encoding specified in iocharset= mount > parameter. I think it is better as usage of one fixing encoding (e.g. > UTF-8) if other filesystem strings are propagated to userspace in other > encoding (as specified by iocharset=). I'm confused by this statement... but I think we're saying the same thing? --D > > -- > Pali Roh?r > pali.rohar@gmail.com