int efivars_sysfs_init(void) { struct kobject *parent_kobj = efivars_kobject(); int error = 0; if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENODEV; /* No efivars has been registered yet */ if (!parent_kobj) return 0; printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, EFIVARS_DATE); efivars_kset = kset_create_and_add("vars", NULL, parent_kobj); if (!efivars_kset) { printk(KERN_ERR "efivars: Subsystem registration failed.\n"); return -ENOMEM; } efivar_init(efivars_sysfs_callback, NULL, false, true, &efivar_sysfs_list); error = create_efivars_bin_attributes(); if (error) { efivars_sysfs_exit(); return error; } INIT_WORK(&efivar_work, efivar_update_sysfs_entries); return 0; }
static __init int efivarfs_init(void) { if (!efi_enabled(EFI_RUNTIME_SERVICES)) return 0; if (!efivars_kobject()) return 0; return register_filesystem(&efivarfs_type); }
static __init int efivars_pstore_init(void) { if (!efi_enabled(EFI_RUNTIME_SERVICES)) return 0; if (!efivars_kobject()) return 0; if (efivars_pstore_disable) return 0; efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); if (!efi_pstore_info.buf) return -ENOMEM; efi_pstore_info.bufsize = 1024; spin_lock_init(&efi_pstore_info.buf_lock); pstore_register(&efi_pstore_info); return 0; }