Re: [PATCH v8 8/9] tmpfs: Expose filesystem features via sysfs

From: André Almeida
Date: Thu Oct 31 2024 - 15:12:22 EST


Em 31/10/2024 14:31, André Almeida escreveu:
Hi Nathan,

Em 31/10/2024 02:18, Nathan Chancellor escreveu:
Hi André,


[...]

If there is any patch I can test or further information I can provide, I
am more than happy to do so.


I found the issue, was just the DEVICE_ macro that I wasn't supposed to use inside of tmpfs, this diff solved the error for me, I will send a proper patch in a moment:

-- >8 --

diff --git a/mm/shmem.c b/mm/shmem.c
index 971e6f1184a5..db52c34d5020 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5551,12 +5551,21 @@ EXPORT_SYMBOL_GPL(shmem_read_mapping_page_gfp);

#if defined(CONFIG_SYSFS) && defined(CONFIG_TMPFS)
#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");
+}
+static struct kobj_attribute tmpfs_attr_casefold = {
+ .attr = { .name = "casefold", .mode = 0444 },
+ .show = casefold_show,
+ .store = NULL,
+};
#endif

static struct attribute *tmpfs_attributes[] = {
#if IS_ENABLED(CONFIG_UNICODE)
- &dev_attr_casefold.attr.attr,
+ &tmpfs_attr_casefold.attr,
#endif
NULL
};