• Home
  • Raw
  • Download

Lines Matching +full:entry +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0+
30 * 2) ->ops calls
47 while (offset <= len - sizeof(*node) && in validate_device_path()
48 node->length >= sizeof(*node) && in validate_device_path()
49 node->length <= len - offset) { in validate_device_path()
50 offset += node->length; in validate_device_path()
52 if ((node->type == EFI_DEV_END_PATH || in validate_device_path()
53 node->type == EFI_DEV_END_PATH2) && in validate_device_path()
54 node->sub_type == EFI_DEV_END_ENTIRE) in validate_device_path()
61 * If we're here then either node->length pointed past the end in validate_device_path()
72 /* An array of 16-bit integers */ in validate_boot_order()
99 /* A valid entry must be at least 8 bytes */ in validate_load_option()
109 desclength = ucs2_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; in validate_load_option()
111 /* Each boot entry must have a descriptor */ in validate_load_option()
134 /* A single 16-bit integer */ in validate_uint16()
160 char *name; member
173 * Note that it's sorted by {vendor,name}, but globbed names must come after
174 * any other name with the same prefix.
199 * @var_name: an array of @len non-NUL characters.
200 * @match_name: a NUL-terminated pattern string, optionally ending in "*". A
203 * @match: on output, the number of non-wildcard characters in @match_name
225 * We've reached a non-wildcard char in @match_name. in variable_matches()
252 for (i = 0; variable_validate[i].name[0] != '\0'; i++) { in efivar_validate()
253 const char *name = variable_validate[i].name; in efivar_validate() local
259 if (variable_matches(utf8_name, utf8_size+1, name, &match)) { in efivar_validate()
283 for (i = 0; variable_validate[i].name[0] != '\0'; i++) { in efivar_variable_is_removable()
288 variable_validate[i].name, &match)) { in efivar_variable_is_removable()
309 fops = __efivars->ops; in check_var_size()
311 if (!fops->query_variable_store) in check_var_size()
314 return fops->query_variable_store(attributes, size, false); in check_var_size()
325 fops = __efivars->ops; in check_var_size_nonblocking()
327 if (!fops->query_variable_store) in check_var_size_nonblocking()
330 return fops->query_variable_store(attributes, size, true); in check_var_size_nonblocking()
336 struct efivar_entry *entry, *n; in variable_is_present() local
341 list_for_each_entry_safe(entry, n, head, list) { in variable_is_present()
342 strsize2 = ucs2_strsize(entry->var.VariableName, 1024); in variable_is_present()
344 !memcmp(variable_name, &(entry->var.VariableName), in variable_is_present()
346 !efi_guidcmp(entry->var.VendorGuid, in variable_is_present()
367 * The variable name is, by definition, a NULL-terminated in var_name_strnsize()
372 c = variable_name[(len / sizeof(c)) - 1]; in var_name_strnsize()
397 printk(KERN_WARNING "efivars: duplicate variable: %s-%pUl\n", in dup_variable_bug()
403 * efivar_init - build the initial list of EFI variables
405 * @data: function-specific data to pass to @func
425 return -EFAULT; in efivar_init()
427 ops = __efivars->ops; in efivar_init()
432 return -ENOMEM; in efivar_init()
436 err = -EINTR; in efivar_init()
442 * the variable name and variable data is 1024 bytes. in efivar_init()
448 status = ops->get_next_variable(&variable_name_size, in efivar_init()
461 * same variable name on multiple calls to in efivar_init()
464 * we'll ever see a different variable name, in efivar_init()
482 err = -EINTR; in efivar_init()
489 err = -EOPNOTSUPP; in efivar_init()
512 * efivar_entry_add - add entry to variable list
513 * @entry: entry to add to list
518 int efivar_entry_add(struct efivar_entry *entry, struct list_head *head) in efivar_entry_add() argument
521 return -EINTR; in efivar_entry_add()
522 list_add(&entry->list, head); in efivar_entry_add()
530 * efivar_entry_remove - remove entry from variable list
531 * @entry: entry to remove from list
535 int efivar_entry_remove(struct efivar_entry *entry) in efivar_entry_remove() argument
538 return -EINTR; in efivar_entry_remove()
539 list_del(&entry->list); in efivar_entry_remove()
547 * efivar_entry_list_del_unlock - remove entry from variable list
548 * @entry: entry to remove
550 * Remove @entry from the variable list and release the list lock.
552 * NOTE: slightly weird locking semantics here - we expect to be
557 static void efivar_entry_list_del_unlock(struct efivar_entry *entry) in efivar_entry_list_del_unlock() argument
559 list_del(&entry->list); in efivar_entry_list_del_unlock()
564 * __efivar_entry_delete - delete an EFI variable
565 * @entry: entry containing EFI variable to delete
567 * Delete the variable from the firmware but leave @entry on the
571 * not remove @entry from the variable list. Also, it is safe to be
578 int __efivar_entry_delete(struct efivar_entry *entry) in __efivar_entry_delete() argument
583 return -EINVAL; in __efivar_entry_delete()
585 status = __efivars->ops->set_variable(entry->var.VariableName, in __efivar_entry_delete()
586 &entry->var.VendorGuid, in __efivar_entry_delete()
594 * efivar_entry_delete - delete variable and remove entry from list
595 * @entry: entry containing variable to delete
597 * Delete the variable from the firmware and remove @entry from the
598 * variable list. It is the caller's responsibility to free @entry
601 * Returns 0 on success, -EINTR if we can't grab the semaphore,
604 int efivar_entry_delete(struct efivar_entry *entry) in efivar_entry_delete() argument
610 return -EINTR; in efivar_entry_delete()
614 return -EINVAL; in efivar_entry_delete()
616 ops = __efivars->ops; in efivar_entry_delete()
617 status = ops->set_variable(entry->var.VariableName, in efivar_entry_delete()
618 &entry->var.VendorGuid, in efivar_entry_delete()
625 efivar_entry_list_del_unlock(entry); in efivar_entry_delete()
631 * efivar_entry_set - call set_variable()
632 * @entry: entry containing the EFI variable to write
645 * the entry is already on the list.
647 * Returns 0 on success, -EINTR if we can't grab the semaphore,
648 * -EEXIST if a lookup is performed and the entry already exists on
651 int efivar_entry_set(struct efivar_entry *entry, u32 attributes, in efivar_entry_set() argument
656 efi_char16_t *name = entry->var.VariableName; in efivar_entry_set() local
657 efi_guid_t vendor = entry->var.VendorGuid; in efivar_entry_set()
660 return -EINTR; in efivar_entry_set()
664 return -EINVAL; in efivar_entry_set()
666 ops = __efivars->ops; in efivar_entry_set()
667 if (head && efivar_entry_find(name, vendor, head, false)) { in efivar_entry_set()
669 return -EEXIST; in efivar_entry_set()
672 status = check_var_size(attributes, size + ucs2_strsize(name, 1024)); in efivar_entry_set()
674 status = ops->set_variable(name, &vendor, in efivar_entry_set()
685 * efivar_entry_set_nonblocking - call set_variable_nonblocking()
691 * efivars_lock. Instead, it returns -EBUSY.
694 efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor, in efivar_entry_set_nonblocking() argument
701 return -EBUSY; in efivar_entry_set_nonblocking()
705 return -EINVAL; in efivar_entry_set_nonblocking()
709 size + ucs2_strsize(name, 1024)); in efivar_entry_set_nonblocking()
712 return -ENOSPC; in efivar_entry_set_nonblocking()
715 ops = __efivars->ops; in efivar_entry_set_nonblocking()
716 status = ops->set_variable_nonblocking(name, &vendor, attributes, in efivar_entry_set_nonblocking()
724 * efivar_entry_set_safe - call set_variable() if enough space in firmware
725 * @name: buffer containing the variable name
736 * Returns 0 on success, -ENOSPC if the firmware does not have enough
740 int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, in efivar_entry_set_safe() argument
748 return -EINVAL; in efivar_entry_set_safe()
750 ops = __efivars->ops; in efivar_entry_set_safe()
751 if (!ops->query_variable_store) in efivar_entry_set_safe()
752 return -ENOSYS; in efivar_entry_set_safe()
755 * If the EFI variable backend provides a non-blocking in efivar_entry_set_safe()
756 * ->set_variable() operation and we're in a context where we in efivar_entry_set_safe()
757 * cannot block, then we need to use it to avoid live-locks, in efivar_entry_set_safe()
758 * since the implication is that the regular ->set_variable() in efivar_entry_set_safe()
761 * If no ->set_variable_nonblocking() is provided then in efivar_entry_set_safe()
762 * ->set_variable() is assumed to be non-blocking. in efivar_entry_set_safe()
764 if (!block && ops->set_variable_nonblocking) in efivar_entry_set_safe()
765 return efivar_entry_set_nonblocking(name, vendor, attributes, in efivar_entry_set_safe()
768 varsize = size + ucs2_strsize(name, 1024); in efivar_entry_set_safe()
771 return -EBUSY; in efivar_entry_set_safe()
775 return -EINTR; in efivar_entry_set_safe()
781 return -ENOSPC; in efivar_entry_set_safe()
784 status = ops->set_variable(name, &vendor, attributes, size, data); in efivar_entry_set_safe()
793 * efivar_entry_find - search for an entry
794 * @name: the EFI variable name
797 * @remove: should we remove the entry from the list?
799 * Search for an entry on the variable list that has the EFI variable
800 * name @name and vendor guid @guid. If an entry is found on the list
801 * and @remove is true, the entry is removed from the list.
807 * Returns the entry if found on the list, %NULL otherwise.
809 struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, in efivar_entry_find() argument
812 struct efivar_entry *entry, *n; in efivar_entry_find() local
816 list_for_each_entry_safe(entry, n, head, list) { in efivar_entry_find()
817 strsize1 = ucs2_strsize(name, 1024); in efivar_entry_find()
818 strsize2 = ucs2_strsize(entry->var.VariableName, 1024); in efivar_entry_find()
820 !memcmp(name, &(entry->var.VariableName), strsize1) && in efivar_entry_find()
821 !efi_guidcmp(guid, entry->var.VendorGuid)) { in efivar_entry_find()
831 if (entry->scanning) { in efivar_entry_find()
833 * The entry will be deleted in efivar_entry_find()
836 entry->deleting = true; in efivar_entry_find()
838 list_del(&entry->list); in efivar_entry_find()
841 return entry; in efivar_entry_find()
846 * efivar_entry_size - obtain the size of a variable
847 * @entry: entry for this variable
850 int efivar_entry_size(struct efivar_entry *entry, unsigned long *size) in efivar_entry_size() argument
858 return -EINTR; in efivar_entry_size()
861 return -EINVAL; in efivar_entry_size()
863 ops = __efivars->ops; in efivar_entry_size()
864 status = ops->get_variable(entry->var.VariableName, in efivar_entry_size()
865 &entry->var.VendorGuid, NULL, size, NULL); in efivar_entry_size()
876 * __efivar_entry_get - call get_variable()
877 * @entry: read data for this variable
886 int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in __efivar_entry_get() argument
892 return -EINVAL; in __efivar_entry_get()
894 status = __efivars->ops->get_variable(entry->var.VariableName, in __efivar_entry_get()
895 &entry->var.VendorGuid, in __efivar_entry_get()
903 * efivar_entry_get - call get_variable()
904 * @entry: read data for this variable
909 int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in efivar_entry_get() argument
915 return -EINTR; in efivar_entry_get()
919 return -EINVAL; in efivar_entry_get()
922 status = __efivars->ops->get_variable(entry->var.VariableName, in efivar_entry_get()
923 &entry->var.VendorGuid, in efivar_entry_get()
932 * efivar_entry_set_get_size - call set_variable() and get new size (atomic)
933 * @entry: entry containing variable to set and get
941 * Atomically call set_variable() for @entry and if the call is
945 * Returns 0 on success, -EINVAL if the variable data is invalid,
946 * -ENOSPC if the firmware does not have enough available space, or a
951 * (EFI_NOT_FOUND), @entry is removed from the variable list.
953 int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, in efivar_entry_set_get_size() argument
957 efi_char16_t *name = entry->var.VariableName; in efivar_entry_set_get_size() local
958 efi_guid_t *vendor = &entry->var.VendorGuid; in efivar_entry_set_get_size()
964 if (efivar_validate(*vendor, name, data, *size) == false) in efivar_entry_set_get_size()
965 return -EINVAL; in efivar_entry_set_get_size()
973 return -EINTR; in efivar_entry_set_get_size()
976 err = -EINVAL; in efivar_entry_set_get_size()
983 status = check_var_size(attributes, *size + ucs2_strsize(name, 1024)); in efivar_entry_set_get_size()
991 err = -ENOSPC; in efivar_entry_set_get_size()
996 ops = __efivars->ops; in efivar_entry_set_get_size()
998 status = ops->set_variable(name, vendor, attributes, *size, data); in efivar_entry_set_get_size()
1013 status = ops->get_variable(entry->var.VariableName, in efivar_entry_set_get_size()
1014 &entry->var.VendorGuid, in efivar_entry_set_get_size()
1018 efivar_entry_list_del_unlock(entry); in efivar_entry_set_get_size()
1035 * efivar_entry_iter_begin - begin iterating the variable list
1037 * Lock the variable list to prevent entry insertion and removal until
1048 * efivar_entry_iter_end - finish iterating the variable list
1059 * __efivar_entry_iter - iterate over variable list
1062 * @data: function-specific data to pass to callback
1063 * @prev: entry to begin iterating from
1066 * entry on the list. It is safe for @func to remove entries in the
1072 * It is possible to begin iteration from an arbitrary entry within
1074 * the last entry passed to @func. To begin iterating from the
1084 struct efivar_entry *entry, *n; in __efivar_entry_iter() local
1088 list_for_each_entry_safe(entry, n, head, list) { in __efivar_entry_iter()
1089 err = func(entry, data); in __efivar_entry_iter()
1095 *prev = entry; in __efivar_entry_iter()
1112 * efivar_entry_iter - iterate over variable list
1115 * @data: function-specific data to pass to callback
1118 * entry on the list. It is safe for @func to remove entries in the
1122 * - a non-zero return value indicates an error and terminates the loop
1123 * - @func is called from atomic context
1141 * efivars_kobject - get the kobject for the registered efivars
1151 return __efivars->kobject; in efivars_kobject()
1156 * efivars_register - register an efivars
1159 * @kobject: @efivars-specific kobject
1168 return -EINTR; in efivars_register()
1170 efivars->ops = ops; in efivars_register()
1171 efivars->kobject = kobject; in efivars_register()
1184 * efivars_unregister - unregister an efivars
1187 * The caller must have already removed every entry from the list,
1195 return -EINTR; in efivars_unregister()
1199 rv = -EINVAL; in efivars_unregister()
1204 rv = -EINVAL; in efivars_unregister()
1220 return __efivars && __efivars->ops->set_variable; in efivar_supports_writes()