Lines Matching +full:case +full:- +full:sensitive
1 // SPDX-License-Identifier: GPL-2.0-only
29 case EFIVAR_OPS_RDONLY: in efivarfs_ops_notifier()
30 sfi->sb->s_flags |= SB_RDONLY; in efivarfs_ops_notifier()
32 case EFIVAR_OPS_RDWR: in efivarfs_ops_notifier()
33 sfi->sb->s_flags &= ~SB_RDONLY; in efivarfs_ops_notifier()
49 struct super_block *sb = root->d_sb; in efivarfs_show_options()
50 struct efivarfs_fs_info *sbi = sb->s_fs_info; in efivarfs_show_options()
51 struct efivarfs_mount_opts *opts = &sbi->mount_opts; in efivarfs_show_options()
53 if (!uid_eq(opts->uid, GLOBAL_ROOT_UID)) in efivarfs_show_options()
55 from_kuid_munged(&init_user_ns, opts->uid)); in efivarfs_show_options()
56 if (!gid_eq(opts->gid, GLOBAL_ROOT_GID)) in efivarfs_show_options()
58 from_kgid_munged(&init_user_ns, opts->gid)); in efivarfs_show_options()
68 u64 id = huge_encode_dev(dentry->d_sb->s_dev); in efivarfs_statfs()
87 buf->f_bsize = 1; in efivarfs_statfs()
88 buf->f_namelen = NAME_MAX; in efivarfs_statfs()
89 buf->f_blocks = storage_space; in efivarfs_statfs()
90 buf->f_bfree = remaining_space; in efivarfs_statfs()
91 buf->f_type = dentry->d_sb->s_magic; in efivarfs_statfs()
92 buf->f_fsid = u64_to_fsid(id); in efivarfs_statfs()
100 buf->f_bavail = remaining_space - efivar_reserved_space(); in efivarfs_statfs()
102 buf->f_bavail = 0; in efivarfs_statfs()
118 * 1. A case-sensitive variable name
119 * 2. A case-insensitive GUID
121 * So we need to perform a case-sensitive match on part 1 and a
122 * case-insensitive match on part 2.
128 int guid = len - EFI_VARIABLE_GUID_LEN; in efivarfs_d_compare()
130 if (name->len != len) in efivarfs_d_compare()
133 /* Case-sensitive compare for the variable name */ in efivarfs_d_compare()
134 if (memcmp(str, name->name, guid)) in efivarfs_d_compare()
137 /* Case-insensitive compare for the GUID */ in efivarfs_d_compare()
138 return strncasecmp(name->name + guid, str + guid, EFI_VARIABLE_GUID_LEN); in efivarfs_d_compare()
144 const unsigned char *s = qstr->name; in efivarfs_d_hash()
145 unsigned int len = qstr->len; in efivarfs_d_hash()
148 return -EINVAL; in efivarfs_d_hash()
150 while (len-- > EFI_VARIABLE_GUID_LEN) in efivarfs_d_hash()
153 /* GUID is case-insensitive. */ in efivarfs_d_hash()
154 while (len--) in efivarfs_d_hash()
157 qstr->hash = end_name_hash(hash); in efivarfs_d_hash()
184 return ERR_PTR(-ENOMEM); in efivarfs_alloc_dentry()
194 struct dentry *dentry, *root = sb->s_root; in efivarfs_callback()
198 int err = -ENOMEM; in efivarfs_callback()
208 memcpy(entry->var.VariableName, name16, name_size); in efivarfs_callback()
209 memcpy(&(entry->var.VendorGuid), &vendor, sizeof(efi_guid_t)); in efivarfs_callback()
211 len = ucs2_utf8size(entry->var.VariableName); in efivarfs_callback()
213 /* name, plus '-', plus GUID, plus NUL*/ in efivarfs_callback()
218 ucs2_as_utf8(name, entry->var.VariableName, len); in efivarfs_callback()
220 if (efivar_variable_is_removable(entry->var.VendorGuid, name, len)) in efivarfs_callback()
223 name[len] = '-'; in efivarfs_callback()
225 efi_guid_to_str(&entry->var.VendorGuid, name + len + 1); in efivarfs_callback()
250 inode->i_private = entry; in efivarfs_callback()
251 i_size_write(inode, size + sizeof(entry->var.Attributes)); in efivarfs_callback()
285 struct efivarfs_fs_info *sbi = fc->s_fs_info; in efivarfs_parse_param()
286 struct efivarfs_mount_opts *opts = &sbi->mount_opts; in efivarfs_parse_param()
295 case Opt_uid: in efivarfs_parse_param()
296 opts->uid = result.uid; in efivarfs_parse_param()
298 case Opt_gid: in efivarfs_parse_param()
299 opts->gid = result.gid; in efivarfs_parse_param()
302 return -EINVAL; in efivarfs_parse_param()
310 struct efivarfs_fs_info *sfi = sb->s_fs_info; in efivarfs_fill_super()
315 sb->s_maxbytes = MAX_LFS_FILESIZE; in efivarfs_fill_super()
316 sb->s_blocksize = PAGE_SIZE; in efivarfs_fill_super()
317 sb->s_blocksize_bits = PAGE_SHIFT; in efivarfs_fill_super()
318 sb->s_magic = EFIVARFS_MAGIC; in efivarfs_fill_super()
319 sb->s_op = &efivarfs_ops; in efivarfs_fill_super()
320 sb->s_d_op = &efivarfs_d_ops; in efivarfs_fill_super()
321 sb->s_time_gran = 1; in efivarfs_fill_super()
324 sb->s_flags |= SB_RDONLY; in efivarfs_fill_super()
328 return -ENOMEM; in efivarfs_fill_super()
329 inode->i_op = &efivarfs_dir_inode_operations; in efivarfs_fill_super()
332 sb->s_root = root; in efivarfs_fill_super()
334 return -ENOMEM; in efivarfs_fill_super()
336 sfi->sb = sb; in efivarfs_fill_super()
337 sfi->nb.notifier_call = efivarfs_ops_notifier; in efivarfs_fill_super()
338 err = blocking_notifier_chain_register(&efivar_ops_nh, &sfi->nb); in efivarfs_fill_super()
342 return efivar_init(efivarfs_callback, sb, &sfi->efivarfs_list); in efivarfs_fill_super()
352 if (!efivar_supports_writes() && !(fc->sb_flags & SB_RDONLY)) { in efivarfs_reconfigure()
354 return -EINVAL; in efivarfs_reconfigure()
371 return -EOPNOTSUPP; in efivarfs_init_fs_context()
375 return -ENOMEM; in efivarfs_init_fs_context()
377 INIT_LIST_HEAD(&sfi->efivarfs_list); in efivarfs_init_fs_context()
379 sfi->mount_opts.uid = GLOBAL_ROOT_UID; in efivarfs_init_fs_context()
380 sfi->mount_opts.gid = GLOBAL_ROOT_GID; in efivarfs_init_fs_context()
382 fc->s_fs_info = sfi; in efivarfs_init_fs_context()
383 fc->ops = &efivarfs_context_ops; in efivarfs_init_fs_context()
389 struct efivarfs_fs_info *sfi = sb->s_fs_info; in efivarfs_kill_sb()
391 blocking_notifier_chain_unregister(&efivar_ops_nh, &sfi->nb); in efivarfs_kill_sb()
395 efivar_entry_iter(efivarfs_destroy, &sfi->efivarfs_list, NULL); in efivarfs_kill_sb()