From patchwork Fri Nov 1 01:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13858582 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D9FA3F9CC; Fri, 1 Nov 2024 01:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425096; cv=none; b=cB4rDBf3vaBybmGHIfsGPIIZxxjU2BAzoqRJRpMISdm7MxmPRVyDvH2SGInoQFqYmTRL/Ai6GVlQ01folShBUxPPSZrIHJiaSkJ5WKvMRAvUqqWJEWirGD/AkORCtFa/1T9sIk9jDTkzExSfBfGrA8C/bQ2r6Ve7wOHEDjEdGuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425096; c=relaxed/simple; bh=emJCuip6O+uYAJz+KzUytVj8TFsHxkL2bexsE8nkMbU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=idjz+dWJJLYVnWAiXNoUSo1LdRwBSR1b4nYBF1S8kQ+3YNv/ba8q3XivyVkjyDvr2zrZvyoTk2la4YXRjklBo7imMpI/ZR5f6Qj9ij6qU3xymMdU6HKvAR4K2o6TJfgqedb4xS/s+BFSAFiA+a91ap4a4a9JoQDvGZA8IVerZJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=F29RFp4N; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="F29RFp4N" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8swRcMqa/BS2pXAGjnNhVyXxuHalIiMIO71jJmsFBEs=; b=F29RFp4N0vPj0s1J5QEIiOahhJ XtmstjmkH5wGBzWkqKIEA2OND/3xKxCb9IEFo6qCWlDuQUR5ousxHS8g3uJENfHud0qXvl4NTrPCN dviD8nbyefB44gJh9xemI7cUIggGvtLvhYX89M6abblhgPv8kDkh4tN9Haq95WNrpI8zaTZWKj6ly SuhaBPbLcCtIVKQG7cgniiwSRd+pSEpfxhAWMKAzuEMOUBvk0ZXR9HEhnLn6jEL6eDElGjGeLFRKI f7liZadXemfK5Ip7WLRt8d4nYTXsQ3hkFzmReoEDsMG/+k+wlw3DF5/yoqIOwXTnl9gQLak28w572 LDDltqDg==; Received: from [189.78.222.89] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t6gbq-000G0m-O1; Fri, 01 Nov 2024 02:37:55 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara , krisman@kernel.org, Stephen Rothwell , Nathan Chancellor Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, Theodore Ts'o , =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 1/3] libfs: Fix kernel-doc warning in generic_ci_validate_strict_name Date: Thu, 31 Oct 2024 22:37:39 -0300 Message-ID: <20241101013741.295792-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101013741.295792-1-andrealmeid@igalia.com> References: <20241101013741.295792-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fix the indentation of the return values from generic_ci_validate_strict_name() to properly render the comment and to address a `make htmldocs` warning: Documentation/filesystems/api-summary:14: include/linux/fs.h:3504: WARNING: Bullet list ends without a blank line; unexpected unindent. Fixes: 0e152beb5aa1 ("libfs: Create the helper function generic_ci_validate_strict_name()") Reported-by: Stephen Rothwell Closes: https://lore.kernel.org/lkml/20241030162435.05425f60@canb.auug.org.au/ Signed-off-by: André Almeida --- include/linux/fs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 3b279f60e48f..b562a161e2ee 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3499,12 +3499,12 @@ int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, * @name: name of the new file * * Return: - * * True if the filename is suitable for this directory. It can be - * true if a given name is not suitable for a strict encoding - * directory, but the directory being used isn't strict + * * True: if the filename is suitable for this directory. It can be + * true if a given name is not suitable for a strict encoding + * directory, but the directory being used isn't strict * * False if the filename isn't suitable for this directory. This only - * happens when a directory is casefolded and the filesystem is strict - * about its encoding. + * happens when a directory is casefolded and the filesystem is strict + * about its encoding. */ static inline bool generic_ci_validate_strict_name(struct inode *dir, struct qstr *name) { From patchwork Fri Nov 1 01:37:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13858584 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACA4955C29; Fri, 1 Nov 2024 01:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425098; cv=none; b=OeVlPeIXeXS3RDk8exN3wXqL4veZE4zfGW79S7OA0QOMXVX0gxLxH0+4rA10vzyx3GTXnlFvXn0BIDRHdIAi+ewry+UlFEXQOTJTkuvp3l9HT7PWZT/cTfg668iQrcseE6c3vSh/CIkrtUJVv7CFIT2gAwb1JpZjiQx9+/NInO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425098; c=relaxed/simple; bh=TtAJ5PGUajaVYZfEUS9/1RvOM+3qd2uGeqpG6FL8DR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UtxxPkyTbfA9MW7NRkG6NMr+XiUrZbl+bqmdnhB3mm0FF80OiXAkm3Ty2k+tUpSe1D5FOxbvjDPoW737YIaWCQVxujYZHlmCyZ5hig+LmnoQZNLdEzzFp3FNBYn2ykzw8St6nLMvaKJNXl2qnyOS9cWXt/Jqu/z9y4/ICM9S8ZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=rSsUgbSb; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="rSsUgbSb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=QXcbpwTTq6N974MuejeNHJ9xQ2vu2gRxnquK0VwfKiM=; b=rSsUgbSbSkaGXZl2Nm0F3ZzIbh AsSs1pLZiilNWolJ0Ng/HkCRkTwnkQLW9ZdhOtdOBVFNuPI8HjhXpwBWRgrI5/SaVZat03DoIaYV4 uQrEZDBZ0N7tKgeKg3dtxC8JLbPmjfg2Fv5wL6LaCfy0TvL/Z6JszwJE7xsdjdsz9MQNEnlet/5iD cCuzVvwTvT6Vue9CJF/41cIz5pwqd7+GjifCk09VKnfRQOAorR8yfP8d+cHSnQmgBPutzEkAfJcrS IWQIM7j6PEHXGBBBtRCZ1oC7wpbHOqiNnawjK6epVIU1MKto1arXU5WH4jxQijvopmHnkJTscuu/l sFLOwJYw==; Received: from [189.78.222.89] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t6gbu-000G0m-VI; Fri, 01 Nov 2024 02:37:59 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara , krisman@kernel.org, Stephen Rothwell , Nathan Chancellor Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, Theodore Ts'o , =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 2/3] tmpfs: Fix type for sysfs' casefold attribute Date: Thu, 31 Oct 2024 22:37:40 -0300 Message-ID: <20241101013741.295792-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101013741.295792-1-andrealmeid@igalia.com> References: <20241101013741.295792-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DEVICE_STRING_ATTR_RO should be only used by device drivers since it relies on `struct device` to use device_show_string() function. Using this with non device code led to a kCFI violation: > cat /sys/fs/tmpfs/features/casefold [ 70.558496] CFI failure at kobj_attr_show+0x2c/0x4c (target: device_show_string+0x0/0x38; expected type: 0xc527b809) Like the other filesystems, fix this by manually declaring the attribute using kobj_attribute() and writing a proper show() function. Also, leave macros for anyone that need to expand tmpfs sysfs' with more attributes (as seen in fs/btrfs/sysfs.c). Fixes: 5132f08bd332 ("tmpfs: Expose filesystem features via sysfs") Reported-by: Nathan Chancellor Closes: https://lore.kernel.org/lkml/20241031051822.GA2947788@thelio-3990X/ Signed-off-by: André Almeida Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor --- mm/shmem.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index b86f526a1cb1..6038e1d11987 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -5548,13 +5548,38 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, EXPORT_SYMBOL_GPL(shmem_read_mapping_page_gfp); #if defined(CONFIG_SYSFS) && defined(CONFIG_TMPFS) + +#define __INIT_KOBJ_ATTR(_name, _mode, _show, _store) \ +{ \ + .attr = { .name = __stringify(_name), .mode = _mode }, \ + .show = _show, \ + .store = _store, \ +} + +#define TMPFS_ATTR_W(_name, _store) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0200, NULL, _store) + +#define TMPFS_ATTR_RW(_name, _show, _store) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0644, _show, _store) + +#define TMPFS_ATTR_RO(_name, _show) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0444, _show, NULL) + #if IS_ENABLED(CONFIG_UNICODE) -static DEVICE_STRING_ATTR_RO(casefold, 0444, "supported"); +static ssize_t casefold_show(struct kobject *kobj, struct kobj_attribute *a, + char *buf) +{ + return sysfs_emit(buf, "supported\n"); +} +TMPFS_ATTR_RO(casefold, casefold_show); #endif static struct attribute *tmpfs_attributes[] = { #if IS_ENABLED(CONFIG_UNICODE) - &dev_attr_casefold.attr.attr, + &tmpfs_attr_casefold.attr, #endif NULL }; From patchwork Fri Nov 1 01:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13858585 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1340A4204E; Fri, 1 Nov 2024 01:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425100; cv=none; b=Aan6R6uqJDDwlU459qnA4FFRAzRVdasagG9pNGcvutssdfKFq9lY1uCbcCmIkFvi9eDBkM5R4eeuEA0j/RmeKoomUVf65KNAJeJxceAoHFxmGo44q8/6uL2bWe0SENd9fYXLadew+zejaUyceX8AYkO970GgFoOiMqSLfTT/HBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730425100; c=relaxed/simple; bh=RypRFdAwIT/de9xunHRWaJyZWX8vXNj6+mr2YNmmVs4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GBxXlLIzA6eFlPSzzuEB3LIqUQX2l3MzkRU5XmBRX7w6hqzwFavQb9QSlLzudjqaaUQsg/Uir+a2l6yQz0XzwsZ7NLq14egoKnwFxVLZRxikLXWHHkct1po5Qw60NU3GxBy9nG2XswZwtUxTXEykNRWz5Q8Qyz0Jt17kcX5YYg8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=P7renoAq; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="P7renoAq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=k/VHsL4n8pERS64P5NHMSQf1JEBAuX2jkWl5gqjSdQw=; b=P7renoAq/Nj0A3/1vK6ktV09ha 0YPhZg8HwiIH7CYXUUh3/A5MNQ8peqcpFMAQzX/AeCLfbjuEzmFgJVHu/96iSWH7NzooTvRg94Tgo gIA4OKIxxushW8a3C2javH97VxijDClm2UDI+7+h6tooabgWxwmMY4L95Iu7KPgb4n6zy+grPFKAJ jrobxJOCpsjclHQsYboorxe67fkiNuMVAibvI85AqDGo0dsG/jwhSKuCiPzDa4Ao/GdKNM1hV4iMx iYd5PCsCI5aajLgFHt5PEIYKOPQwMOGxLWeDQ8udu/X3kUaZQdrd/6wtKNvk/FvYXi7WddYan2D4x 2jm6T2oA==; Received: from [189.78.222.89] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t6gbz-000G0m-6J; Fri, 01 Nov 2024 02:38:03 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara , krisman@kernel.org, Stephen Rothwell , Nathan Chancellor Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, Theodore Ts'o , =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 3/3] tmpfs: Initialize sysfs during tmpfs init Date: Thu, 31 Oct 2024 22:37:41 -0300 Message-ID: <20241101013741.295792-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241101013741.295792-1-andrealmeid@igalia.com> References: <20241101013741.295792-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of using fs_initcall(), initialize sysfs with the rest of the filesystem. This is the right way to do it because otherwise any error during tmpfs_sysfs_init() would get silently ignored. It's also useful if tmpfs' sysfs ever need to display runtime information. Signed-off-by: André Almeida --- mm/shmem.c | 130 ++++++++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 6038e1d11987..8ff2f619f531 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -5126,6 +5126,66 @@ static struct file_system_type shmem_fs_type = { .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP | FS_MGTIME, }; +#if defined(CONFIG_SYSFS) && defined(CONFIG_TMPFS) + +#define __INIT_KOBJ_ATTR(_name, _mode, _show, _store) \ +{ \ + .attr = { .name = __stringify(_name), .mode = _mode }, \ + .show = _show, \ + .store = _store, \ +} + +#define TMPFS_ATTR_W(_name, _store) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0200, NULL, _store) + +#define TMPFS_ATTR_RW(_name, _show, _store) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0644, _show, _store) + +#define TMPFS_ATTR_RO(_name, _show) \ + static struct kobj_attribute tmpfs_attr_##_name = \ + __INIT_KOBJ_ATTR(_name, 0444, _show, NULL) + +#if IS_ENABLED(CONFIG_UNICODE) +static ssize_t casefold_show(struct kobject *kobj, struct kobj_attribute *a, + char *buf) +{ + return sysfs_emit(buf, "supported\n"); +} +TMPFS_ATTR_RO(casefold, casefold_show); +#endif + +static struct attribute *tmpfs_attributes[] = { +#if IS_ENABLED(CONFIG_UNICODE) + &tmpfs_attr_casefold.attr, +#endif + NULL +}; + +static const struct attribute_group tmpfs_attribute_group = { + .attrs = tmpfs_attributes, + .name = "features" +}; + +static struct kobject *tmpfs_kobj; + +static int __init tmpfs_sysfs_init(void) +{ + int ret; + + tmpfs_kobj = kobject_create_and_add("tmpfs", fs_kobj); + if (!tmpfs_kobj) + return -ENOMEM; + + ret = sysfs_create_group(tmpfs_kobj, &tmpfs_attribute_group); + if (ret) + kobject_put(tmpfs_kobj); + + return ret; +} +#endif /* CONFIG_SYSFS && CONFIG_TMPFS */ + void __init shmem_init(void) { int error; @@ -5149,6 +5209,14 @@ void __init shmem_init(void) goto out1; } +#ifdef CONFIG_SYSFS + error = tmpfs_sysfs_init(); + if (error) { + pr_err("Could not init tmpfs sysfs\n"); + goto out1; + } +#endif + #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (has_transparent_hugepage() && shmem_huge > SHMEM_HUGE_DENY) SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge; @@ -5546,65 +5614,3 @@ struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, return page; } EXPORT_SYMBOL_GPL(shmem_read_mapping_page_gfp); - -#if defined(CONFIG_SYSFS) && defined(CONFIG_TMPFS) - -#define __INIT_KOBJ_ATTR(_name, _mode, _show, _store) \ -{ \ - .attr = { .name = __stringify(_name), .mode = _mode }, \ - .show = _show, \ - .store = _store, \ -} - -#define TMPFS_ATTR_W(_name, _store) \ - static struct kobj_attribute tmpfs_attr_##_name = \ - __INIT_KOBJ_ATTR(_name, 0200, NULL, _store) - -#define TMPFS_ATTR_RW(_name, _show, _store) \ - static struct kobj_attribute tmpfs_attr_##_name = \ - __INIT_KOBJ_ATTR(_name, 0644, _show, _store) - -#define TMPFS_ATTR_RO(_name, _show) \ - static struct kobj_attribute tmpfs_attr_##_name = \ - __INIT_KOBJ_ATTR(_name, 0444, _show, NULL) - -#if IS_ENABLED(CONFIG_UNICODE) -static ssize_t casefold_show(struct kobject *kobj, struct kobj_attribute *a, - char *buf) -{ - return sysfs_emit(buf, "supported\n"); -} -TMPFS_ATTR_RO(casefold, casefold_show); -#endif - -static struct attribute *tmpfs_attributes[] = { -#if IS_ENABLED(CONFIG_UNICODE) - &tmpfs_attr_casefold.attr, -#endif - NULL -}; - -static const struct attribute_group tmpfs_attribute_group = { - .attrs = tmpfs_attributes, - .name = "features" -}; - -static struct kobject *tmpfs_kobj; - -static int __init tmpfs_sysfs_init(void) -{ - int ret; - - tmpfs_kobj = kobject_create_and_add("tmpfs", fs_kobj); - if (!tmpfs_kobj) - return -ENOMEM; - - ret = sysfs_create_group(tmpfs_kobj, &tmpfs_attribute_group); - if (ret) - kobject_put(tmpfs_kobj); - - return ret; -} - -fs_initcall(tmpfs_sysfs_init); -#endif /* CONFIG_SYSFS && CONFIG_TMPFS */