On Thu, Mar 07, 2024 at 03:06:49PM +0800, Baokun Li wrote:It's dawning on me, thank you so much for explaining! ღ( ´・ᴗ・` )
You don't need to register it at all.The helper function here is to avoid extern erofs_anon_fs_type(), because+int erofs_anon_register_fs(void)What for? The only thing it gives you is an ability to look it up by
+{
+ return register_filesystem(&erofs_anon_fs_type);
+}
name. Which is completely pointless, IMO,
we define it in fscache.c, but also use it in super.c. Moreover, we don't
need
to register it when CONFIG_EROFS_FS_ONDEMAND is not enabled, so we
The one and only effect of register_filesystem() is making file_system_type
instance visible to get_fs_type() (and making it show up in /proc/filesystems).
That's it. If you want to have it looked up by name (e.g. for userland
mounts), you need to register. If not, you do not need to do that.
Note that kern_mount() take a pointer to struct file_system_type,
not its (string) name. So all you get from registration is an extra line
in /proc/filesystems. What's the point?