Lines Matching +full:entry +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-only
37 * 1. A case-sensitive variable name
38 * 2. A case-insensitive GUID
40 * So we need to perform a case-sensitive match on part 1 and a
41 * case-insensitive match on part 2.
45 const struct qstr *name) in efivarfs_d_compare() argument
47 int guid = len - EFI_VARIABLE_GUID_LEN; in efivarfs_d_compare()
49 if (name->len != len) in efivarfs_d_compare()
52 /* Case-sensitive compare for the variable name */ in efivarfs_d_compare()
53 if (memcmp(str, name->name, guid)) in efivarfs_d_compare()
56 /* Case-insensitive compare for the GUID */ in efivarfs_d_compare()
57 return strncasecmp(name->name + guid, str + guid, EFI_VARIABLE_GUID_LEN); in efivarfs_d_compare()
63 const unsigned char *s = qstr->name; in efivarfs_d_hash()
64 unsigned int len = qstr->len; in efivarfs_d_hash()
67 return -EINVAL; in efivarfs_d_hash()
69 while (len-- > EFI_VARIABLE_GUID_LEN) in efivarfs_d_hash()
72 /* GUID is case-insensitive. */ in efivarfs_d_hash()
73 while (len--) in efivarfs_d_hash()
76 qstr->hash = end_name_hash(hash); in efivarfs_d_hash()
86 static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) in efivarfs_alloc_dentry() argument
92 q.name = name; in efivarfs_alloc_dentry()
93 q.len = strlen(name); in efivarfs_alloc_dentry()
103 return ERR_PTR(-ENOMEM); in efivarfs_alloc_dentry()
110 struct efivar_entry *entry; in efivarfs_callback() local
112 struct dentry *dentry, *root = sb->s_root; in efivarfs_callback()
114 char *name; in efivarfs_callback() local
116 int err = -ENOMEM; in efivarfs_callback()
119 entry = kzalloc(sizeof(*entry), GFP_KERNEL); in efivarfs_callback()
120 if (!entry) in efivarfs_callback()
123 memcpy(entry->var.VariableName, name16, name_size); in efivarfs_callback()
124 memcpy(&(entry->var.VendorGuid), &vendor, sizeof(efi_guid_t)); in efivarfs_callback()
126 len = ucs2_utf8size(entry->var.VariableName); in efivarfs_callback()
128 /* name, plus '-', plus GUID, plus NUL*/ in efivarfs_callback()
129 name = kmalloc(len + 1 + EFI_VARIABLE_GUID_LEN + 1, GFP_KERNEL); in efivarfs_callback()
130 if (!name) in efivarfs_callback()
133 ucs2_as_utf8(name, entry->var.VariableName, len); in efivarfs_callback()
135 if (efivar_variable_is_removable(entry->var.VendorGuid, name, len)) in efivarfs_callback()
138 name[len] = '-'; in efivarfs_callback()
140 efi_guid_to_str(&entry->var.VendorGuid, name + len + 1); in efivarfs_callback()
142 name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; in efivarfs_callback()
145 strreplace(name, '/', '!'); in efivarfs_callback()
152 dentry = efivarfs_alloc_dentry(root, name); in efivarfs_callback()
158 __efivar_entry_get(entry, NULL, &size, NULL); in efivarfs_callback()
159 __efivar_entry_add(entry, &efivarfs_list); in efivarfs_callback()
162 kfree(name); in efivarfs_callback()
165 inode->i_private = entry; in efivarfs_callback()
166 i_size_write(inode, size + sizeof(entry->var.Attributes)); in efivarfs_callback()
175 kfree(name); in efivarfs_callback()
177 kfree(entry); in efivarfs_callback()
181 static int efivarfs_destroy(struct efivar_entry *entry, void *data) in efivarfs_destroy() argument
183 efivar_entry_remove(entry); in efivarfs_destroy()
184 kfree(entry); in efivarfs_destroy()
194 sb->s_maxbytes = MAX_LFS_FILESIZE; in efivarfs_fill_super()
195 sb->s_blocksize = PAGE_SIZE; in efivarfs_fill_super()
196 sb->s_blocksize_bits = PAGE_SHIFT; in efivarfs_fill_super()
197 sb->s_magic = EFIVARFS_MAGIC; in efivarfs_fill_super()
198 sb->s_op = &efivarfs_ops; in efivarfs_fill_super()
199 sb->s_d_op = &efivarfs_d_ops; in efivarfs_fill_super()
200 sb->s_time_gran = 1; in efivarfs_fill_super()
203 sb->s_flags |= SB_RDONLY; in efivarfs_fill_super()
207 return -ENOMEM; in efivarfs_fill_super()
208 inode->i_op = &efivarfs_dir_inode_operations; in efivarfs_fill_super()
211 sb->s_root = root; in efivarfs_fill_super()
213 return -ENOMEM; in efivarfs_fill_super()
235 fc->ops = &efivarfs_context_ops; in efivarfs_init_fs_context()
249 .name = "efivarfs",
257 return -ENODEV; in efivarfs_init()