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
747 return -EINVAL; in efivar_entry_set_safe()
749 ops = __efivars->ops; in efivar_entry_set_safe()
750 if (!ops->query_variable_store) in efivar_entry_set_safe()
751 return -ENOSYS; in efivar_entry_set_safe()
754 * If the EFI variable backend provides a non-blocking in efivar_entry_set_safe()
755 * ->set_variable() operation and we're in a context where we in efivar_entry_set_safe()
756 * cannot block, then we need to use it to avoid live-locks, in efivar_entry_set_safe()
757 * since the implication is that the regular ->set_variable() in efivar_entry_set_safe()
760 * If no ->set_variable_nonblocking() is provided then in efivar_entry_set_safe()
761 * ->set_variable() is assumed to be non-blocking. in efivar_entry_set_safe()
763 if (!block && ops->set_variable_nonblocking) in efivar_entry_set_safe()
764 return efivar_entry_set_nonblocking(name, vendor, attributes, in efivar_entry_set_safe()
769 return -EBUSY; in efivar_entry_set_safe()
772 return -EINTR; in efivar_entry_set_safe()
775 status = check_var_size(attributes, size + ucs2_strsize(name, 1024)); in efivar_entry_set_safe()
778 return -ENOSPC; in efivar_entry_set_safe()
781 status = ops->set_variable(name, &vendor, attributes, size, data); in efivar_entry_set_safe()
790 * efivar_entry_find - search for an entry
791 * @name: the EFI variable name
794 * @remove: should we remove the entry from the list?
796 * Search for an entry on the variable list that has the EFI variable
797 * name @name and vendor guid @guid. If an entry is found on the list
798 * and @remove is true, the entry is removed from the list.
804 * Returns the entry if found on the list, %NULL otherwise.
806 struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, in efivar_entry_find() argument
809 struct efivar_entry *entry, *n; in efivar_entry_find() local
813 list_for_each_entry_safe(entry, n, head, list) { in efivar_entry_find()
814 strsize1 = ucs2_strsize(name, 1024); in efivar_entry_find()
815 strsize2 = ucs2_strsize(entry->var.VariableName, 1024); in efivar_entry_find()
817 !memcmp(name, &(entry->var.VariableName), strsize1) && in efivar_entry_find()
818 !efi_guidcmp(guid, entry->var.VendorGuid)) { in efivar_entry_find()
828 if (entry->scanning) { in efivar_entry_find()
830 * The entry will be deleted in efivar_entry_find()
833 entry->deleting = true; in efivar_entry_find()
835 list_del(&entry->list); in efivar_entry_find()
838 return entry; in efivar_entry_find()
843 * efivar_entry_size - obtain the size of a variable
844 * @entry: entry for this variable
847 int efivar_entry_size(struct efivar_entry *entry, unsigned long *size) in efivar_entry_size() argument
855 return -EINTR; in efivar_entry_size()
858 return -EINVAL; in efivar_entry_size()
860 ops = __efivars->ops; in efivar_entry_size()
861 status = ops->get_variable(entry->var.VariableName, in efivar_entry_size()
862 &entry->var.VendorGuid, NULL, size, NULL); in efivar_entry_size()
873 * __efivar_entry_get - call get_variable()
874 * @entry: read data for this variable
883 int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in __efivar_entry_get() argument
889 return -EINVAL; in __efivar_entry_get()
891 status = __efivars->ops->get_variable(entry->var.VariableName, in __efivar_entry_get()
892 &entry->var.VendorGuid, in __efivar_entry_get()
900 * efivar_entry_get - call get_variable()
901 * @entry: read data for this variable
906 int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in efivar_entry_get() argument
912 return -EINTR; in efivar_entry_get()
916 return -EINVAL; in efivar_entry_get()
919 status = __efivars->ops->get_variable(entry->var.VariableName, in efivar_entry_get()
920 &entry->var.VendorGuid, in efivar_entry_get()
929 * efivar_entry_set_get_size - call set_variable() and get new size (atomic)
930 * @entry: entry containing variable to set and get
938 * Atomically call set_variable() for @entry and if the call is
942 * Returns 0 on success, -EINVAL if the variable data is invalid,
943 * -ENOSPC if the firmware does not have enough available space, or a
948 * (EFI_NOT_FOUND), @entry is removed from the variable list.
950 int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, in efivar_entry_set_get_size() argument
954 efi_char16_t *name = entry->var.VariableName; in efivar_entry_set_get_size() local
955 efi_guid_t *vendor = &entry->var.VendorGuid; in efivar_entry_set_get_size()
961 if (efivar_validate(*vendor, name, data, *size) == false) in efivar_entry_set_get_size()
962 return -EINVAL; in efivar_entry_set_get_size()
970 return -EINTR; in efivar_entry_set_get_size()
973 err = -EINVAL; in efivar_entry_set_get_size()
980 status = check_var_size(attributes, *size + ucs2_strsize(name, 1024)); in efivar_entry_set_get_size()
988 err = -ENOSPC; in efivar_entry_set_get_size()
993 ops = __efivars->ops; in efivar_entry_set_get_size()
995 status = ops->set_variable(name, vendor, attributes, *size, data); in efivar_entry_set_get_size()
1010 status = ops->get_variable(entry->var.VariableName, in efivar_entry_set_get_size()
1011 &entry->var.VendorGuid, in efivar_entry_set_get_size()
1015 efivar_entry_list_del_unlock(entry); in efivar_entry_set_get_size()
1032 * efivar_entry_iter_begin - begin iterating the variable list
1034 * Lock the variable list to prevent entry insertion and removal until
1045 * efivar_entry_iter_end - finish iterating the variable list
1056 * __efivar_entry_iter - iterate over variable list
1059 * @data: function-specific data to pass to callback
1060 * @prev: entry to begin iterating from
1063 * entry on the list. It is safe for @func to remove entries in the
1069 * It is possible to begin iteration from an arbitrary entry within
1071 * the last entry passed to @func. To begin iterating from the
1081 struct efivar_entry *entry, *n; in __efivar_entry_iter() local
1085 list_for_each_entry_safe(entry, n, head, list) { in __efivar_entry_iter()
1086 err = func(entry, data); in __efivar_entry_iter()
1092 *prev = entry; in __efivar_entry_iter()
1109 * efivar_entry_iter - iterate over variable list
1112 * @data: function-specific data to pass to callback
1115 * entry on the list. It is safe for @func to remove entries in the
1119 * - a non-zero return value indicates an error and terminates the loop
1120 * - @func is called from atomic context
1138 * efivars_kobject - get the kobject for the registered efivars
1148 return __efivars->kobject; in efivars_kobject()
1153 * efivars_register - register an efivars
1156 * @kobject: @efivars-specific kobject
1165 return -EINTR; in efivars_register()
1167 efivars->ops = ops; in efivars_register()
1168 efivars->kobject = kobject; in efivars_register()
1181 * efivars_unregister - unregister an efivars
1184 * The caller must have already removed every entry from the list,
1192 return -EINTR; in efivars_unregister()
1196 rv = -EINVAL; in efivars_unregister()
1201 rv = -EINVAL; in efivars_unregister()
1217 return __efivars && __efivars->ops->set_variable; in efivar_supports_writes()