Skip to contentSkip to conversation

efivars: Make efivarfs autoloading on mount request

PATCH In review James Bottomley 2 participants 4 messages Feb 28, 2013 3 messages not in the archive EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efivars: Make efivarfs autoloading on mount request

Currently you can't mount efivarfs unless the efivar module is already inserted. This is contrary to the usual way in linux, where we autoload the necessary filesystem modules when a mount request is received. The reason this doesn't happen for efivarfs is because the module is called efivars not efivarfs. Fix this by adding a module alias for efivarfs.

---

drivers/firmware/efivars.c +1 -0
index f5596db..62386a0 100644
@@ -93,6 +93,7 @@ MODULE_AUTHOR("Matt Domsch <[email protected]>");
 MODULE_DESCRIPTION("sysfs interface to EFI Variables");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(EFIVARS_VERSION);
+MODULE_ALIAS("efivarfs");	/* we export the efivarfs filesystem */
 
 #define DUMP_NAME_LEN 52
 
#2 lore raw
In reply to a message not in the archive

Hi James,

Quoted 5 lines · James Bottomley

Currently you can't mount efivarfs unless the efivar module is already inserted. This is contrary to the usual way in linux, where we autoload the necessary filesystem modules when a mount request is received. The reason this doesn't happen for efivarfs is because the module is called efivars not efivarfs. Fix this by adding a module alias for efivarfs.

I posted a similar patch recently [0], but it does not really solve the problem as /sys/firmware/efi/efivars (which is the standard mountpoint for this fs) does not exist unless the efivars module is loaded. I believe a proper solution is in the works [1], which will split out all the various parts nicely into separate modules.

Cheers,

Tom

[0]: <http://www.mail-archive.com/[email protected]/msg00560.html>
[1]: <http://www.mail-archive.com/[email protected]/msg00657.html>

#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · Tom Gundersen

Hi James,

Quoted 5 lines · James Bottomley

Currently you can't mount efivarfs unless the efivar module is already inserted. This is contrary to the usual way in linux, where we autoload the necessary filesystem modules when a mount request is received. The reason this doesn't happen for efivarfs is because the module is called efivars not efivarfs. Fix this by adding a module alias for efivarfs.

Quoted 5 lines

I posted a similar patch recently [0], but it does not really solve the problem as /sys/firmware/efi/efivars (which is the standard mountpoint for this fs) does not exist unless the efivars module is loaded. I believe a proper solution is in the works [1], which will split out all the various parts nicely into separate modules.

That depends whether you mount there or not. If you want a filesystem in /sys, then you have the same problem as debugfs and cgroupfs, so it can't be done without distro support: specifically a fstab entry, so this patch is as far as the kernel should go.

Even a split won't solve the problem that the directory won't exist until the modules are loaded and the modules are autoloaded by the mount call, so the problem is the same whether the modules are split or monolithic.

We definitely need this patch in 3.8 because that's where the efivarfs filesystem was added, so it should probably have a cc stable which I forgot.

James

#6 lore raw
In reply to a message not in the archive
Quoted 4 lines · James Bottomley

If you want a filesystem
in /sys, then you have the same problem as debugfs and cgroupfs, so it can't be done without distro support: specifically a fstab entry, so this patch is as far as the kernel should go.

Sure, something would have to do the actual mounting for you. In systemd this is done during early boot to /sys/firmware/efi/efivars/ [0], which means that until Matt's rework is in, it will only work when efivars is compiled into the kernel.

Quoted 4 lines

Even a split won't solve the problem that the directory won't exist until the modules are loaded and the modules are autoloaded by the mount call, so the problem is the same whether the modules are split or monolithic.

Sorry, I was unclear. The efi subsystem itself would not be a module, and hence /sys/firmware/efi/efivars would always exist if the system supports it (similarly to, say, /sys/firmware/acpi). The relevant patch is here [1].

Quoted 3 lines

We definitely need this patch in 3.8 because that's where the efivarfs filesystem was added, so it should probably have a cc stable which I forgot.

Yeah, that might make sense for now (though, due to the above, this would not really help any of the distros, so they'd need to compile efivars into the kernel anyway).

Cheers,

Tom

[0]: <http://cgit.freedesktop.org/systemd/systemd/tree/src/core/mount-setup.c#n93>
[1]: <http://www.mail-archive.com/[email protected]/msg00785.html>