Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp12392017ybl; Sat, 28 Dec 2019 11:16:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyR+tCSXQerNEVRlfrVT1tNK8AMJ/vcBP4ba6hQJSk5Em1Z4r2V5x9KeCgL1vfz5+qlRHgw X-Received: by 2002:a05:6830:1e46:: with SMTP id e6mr58260014otj.245.1577560576880; Sat, 28 Dec 2019 11:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577560576; cv=none; d=google.com; s=arc-20160816; b=rW35HM6xYRp/CqfgLSV2RxbiG57F3MOAn8CjzMA2O1rCfh2+VgGO3/taDqNGJVo/md YJCtEXytdBz1axeP4CK4NivljmrvtjiKIxqq6I30tKBIf3EL6WfTS6nfuJ6drelsmElk aRlZ/vJGNu9kDlbONv/GaItJyZebjOgAADgeEdb6AoXaG55vQyUMFbhHJ8DRqG3qiCS4 n/n/A+adJ7PQULop1vIPWa5JbpIwe+I1o0IZxjIqndbdQST9cvBqZ+lhUCda3EYsOTav 5iEOCBQ9f64awNb70fQpBUiGVBVtcZXBaj2Y+RaXIqoSpT1ZaDHnRVyRhs4UTz4XYIn6 AtDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=SvOoylQ6teeU3N0UBqZLiYR+yruKjrC1zR60QXBr0Jk=; b=nmKYajv6u1aLHYDh+hCKL9mxyQTYbL+Idhhe8rxtTA6S/Q6UvNKzgvuyNaq9sIKU2z gwVxck7cBUBltDPIRd3K9AnexYPiSnp2X04gaSXpNrTcdFDilLBjvipWrl39VFrnMrjJ 9PfyPn4QGDiQ71aj+IaRtM8i22pp0eA98PjY6C6ZypFB9oNK5MwqcQWx3TAPuP68r9dc hPbZZBWtwrqDGFfnaXTJ+D2Nb+jawepMgi8pyIeIRcYv4Pv9PULHEtIG3Wn6enf70Gx4 7Vzn+kDDuEmRsx1cEbkYI+OfXsF51wTp+StU66vKFMeux5XLKdvp85JL5Jj+I3vQ3WiT j8Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=pLnScRws; 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 e63si18144097ote.166.2019.12.28.11.16.02; Sat, 28 Dec 2019 11:16:16 -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=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=pLnScRws; 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 S1726502AbfL1TPD (ORCPT + 99 others); Sat, 28 Dec 2019 14:15:03 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41085 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbfL1TPC (ORCPT ); Sat, 28 Dec 2019 14:15:02 -0500 Received: by mail-pl1-f196.google.com with SMTP id bd4so13060632plb.8 for ; Sat, 28 Dec 2019 11:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=SvOoylQ6teeU3N0UBqZLiYR+yruKjrC1zR60QXBr0Jk=; b=pLnScRwstsbDt2cv0ddGWf6yaMNWpKrknH6skWGkChcgaiTmUitKYRrHuYguS/eA+Z T8tCsB+r0yhbgkoXjYXZkwVycx4r2xs8EjnfHMAeuGGAxwI/GzURx92gmQThy9mZDNod nkcE1RS6FYftHoddStnJeRDBfn+3VO2SAXPdmWYVaYmoXfhfzRC5YJrP49ppNzSu7MYQ 4hdnFEq54tjU9EEdCvESphmKaNqI+meaJkk4kJKpJW7FkmU4ywy46xCYGSDzVmg4pOhQ XVwY2ir5C9ojJJooGkNQSdV70Spvj8OLeZQVBCUppJWYpRIjD2foe+QVzF2Oj6aDpyi+ d/Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=SvOoylQ6teeU3N0UBqZLiYR+yruKjrC1zR60QXBr0Jk=; b=rFel0Bf8p1zL4wr86Ptgw8wLM68AqN/3fRgJQ5S/u49iKuyxu1b+XwQ9QLA+meVwSz jb4t1DjzX6+hvPIhE5jT9l4DEaw8gpFg6JGIG9CirD23E5X0ta3zKIa0RDiPbTWyVCLz /7hMvHb665J1wOp/igLdR5RZ8uH57+K7PdPgtc4pCr5SCcGKveEA+VQedFP7J230++nH Vlko4QpA2Vt7hthg30dOFAZy2Ol3H9ZEQPwizaV3T6hwR3grjmsEN3uBokqZ+6bfIsfp yGt7sRDGEHdiU9KjoF4M9O4/Jaw1KW1is0NiPeJMwuOkhTNFZUXJvsD3ZrWPdjcrWpWi JU4w== X-Gm-Message-State: APjAAAWUMgYbEulcEc7tbnibT/Qo9WjGSfVZZ0HPQVA/eLg8hAneuwji rgnANovwzRn1qxjIPGvRAlO5Ow== X-Received: by 2002:a17:90a:e2ce:: with SMTP id fr14mr33639409pjb.99.1577560502221; Sat, 28 Dec 2019 11:15:02 -0800 (PST) Received: from cabot-wlan.adilger.int (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id 199sm47262164pfv.81.2019.12.28.11.15.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Dec 2019 11:15:01 -0800 (PST) From: Andreas Dilger Message-Id: <6C6421AB-84B1-4E9D-9E8F-492A704D2A16@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_39BFD451-41EB-47AD-A778-E1593D3723C6"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL Date: Sat, 28 Dec 2019 12:14:57 -0700 In-Reply-To: <20191228143651.bjb4sjirn2q3xup4@pali> Cc: Eric Sandeen , David Sterba , "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: =?utf-8?Q?Pali_Roh=C3=A1r?= References: <20191228143651.bjb4sjirn2q3xup4@pali> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_39BFD451-41EB-47AD-A778-E1593D3723C6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 28, 2019, at 7:36 AM, Pali Roh=C3=A1r = wrote: >=20 > Hello! >=20 > I see that you have introduced in commit 62750d0 two new IOCTLs for > filesyetems: FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL. >=20 > I would like to ask, are these two new ioctls mean to be generic way = for > userspace to get or set fs label independently of which filesystem is > used? Or are they only for btrfs? >=20 > 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 seems that SETFSLABEL is supported by BtrFS and XFS, and GETFSLABEL also by GFS2. We were just discussing recently about adding it to ext4, so if you wanted to submit a patch for that it would be welcome. It looks like the label is a NUL-terminated string, up to the length allowed by the various filesystems. That said, it seems like a bit of a bug that the kernel will return -EFAULT if a string shorter than the maximum size is supplied (256 chars for btrfs). The copy_{to,from}_user() function will (I think) return the number of bytes remaining to be copied, so IMHO it would make sense that this is compared to the string length of the label, and not return -EFAULT if the buffer is large enough to hold the actual label. Otherwise, the caller has to magically know the maximum label size that is returned from any filesystem and/or allocate specific buffer sizes for different filesystem types, which makes it not very useful as a generic interface. Cheers, Andreas --Apple-Mail=_39BFD451-41EB-47AD-A778-E1593D3723C6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl4HqbEACgkQcqXauRfM H+Dm2g//SpKpi80w8UEmoN7QCS2u0vUtIkSIkPEnwm2aky+cIYNFUBYhvr3PTH0b 1dljQ/WDLghsalOBQSYAChYQejuWDqzW8WBF4OmILDB6hK4LGMZorSg8HDyqP5Kv XSGBfKo9J1Kz5PViQIihfM9ioTF8iJPzK7kS2tW8/EKNFcJtbgt7s6S1jQOniwbh L4SYhyWx1Tt+oFv+kazqzjD/JwI1aBeh9CJrdkV5i4G0HgwVW7C1sjgWNRk20bIx NJVhH7AbXzYCkssipSGXY/uKAfbXtsbARtgyOOLmAL2IHBqiwxT9dCR9ev/1NGxn FrWxiagxgKdPS8FQ5VnJNS8IYqxSHibMbVjQyLEXbEfHSarQcZ8GMkj4vRaGxeS0 K75+1dEClvrd8oAUY/UhHEs6aGYjF8OFvimu6UCoWRU9ogoKtdFfJ8G1tASOLCAd vuAw2S2xv6ZSgIcZayq4pxCNlUYtq4jPYZ26/Ddz5QqRbaArWOvV7iXYI02uV9pw SctIBAvO3nZ45OmHi2MDTGFS6w+IB14XcY9c60oTgM9spmxe1aWvjYRZOUxh1pAN g2CKpasJpobdSxhpuQ5lIwxc//kz6GG6wVzUYBI9n4X/Cus7PKutJCdLbim0tvIK DPaG8oZwuqpa650DAiJZzZGwUjOOmjRSg4YKrjVjEjmJctbQ0Rg= =Qzkb -----END PGP SIGNATURE----- --Apple-Mail=_39BFD451-41EB-47AD-A778-E1593D3723C6--