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()
508 * efivar_entry_add - add entry to variable list
509 * @entry: entry to add to list
514 int efivar_entry_add(struct efivar_entry *entry, struct list_head *head) in efivar_entry_add() argument
517 return -EINTR; in efivar_entry_add()
518 list_add(&entry->list, head); in efivar_entry_add()
526 * efivar_entry_remove - remove entry from variable list
527 * @entry: entry to remove from list
531 int efivar_entry_remove(struct efivar_entry *entry) in efivar_entry_remove() argument
534 return -EINTR; in efivar_entry_remove()
535 list_del(&entry->list); in efivar_entry_remove()
543 * efivar_entry_list_del_unlock - remove entry from variable list
544 * @entry: entry to remove
546 * Remove @entry from the variable list and release the list lock.
548 * NOTE: slightly weird locking semantics here - we expect to be
553 static void efivar_entry_list_del_unlock(struct efivar_entry *entry) in efivar_entry_list_del_unlock() argument
555 list_del(&entry->list); in efivar_entry_list_del_unlock()
560 * __efivar_entry_delete - delete an EFI variable
561 * @entry: entry containing EFI variable to delete
563 * Delete the variable from the firmware but leave @entry on the
567 * not remove @entry from the variable list. Also, it is safe to be
574 int __efivar_entry_delete(struct efivar_entry *entry) in __efivar_entry_delete() argument
579 return -EINVAL; in __efivar_entry_delete()
581 status = __efivars->ops->set_variable(entry->var.VariableName, in __efivar_entry_delete()
582 &entry->var.VendorGuid, in __efivar_entry_delete()
590 * efivar_entry_delete - delete variable and remove entry from list
591 * @entry: entry containing variable to delete
593 * Delete the variable from the firmware and remove @entry from the
594 * variable list. It is the caller's responsibility to free @entry
597 * Returns 0 on success, -EINTR if we can't grab the semaphore,
600 int efivar_entry_delete(struct efivar_entry *entry) in efivar_entry_delete() argument
606 return -EINTR; in efivar_entry_delete()
610 return -EINVAL; in efivar_entry_delete()
612 ops = __efivars->ops; in efivar_entry_delete()
613 status = ops->set_variable(entry->var.VariableName, in efivar_entry_delete()
614 &entry->var.VendorGuid, in efivar_entry_delete()
621 efivar_entry_list_del_unlock(entry); in efivar_entry_delete()
627 * efivar_entry_set - call set_variable()
628 * @entry: entry containing the EFI variable to write
641 * the entry is already on the list.
643 * Returns 0 on success, -EINTR if we can't grab the semaphore,
644 * -EEXIST if a lookup is performed and the entry already exists on
647 int efivar_entry_set(struct efivar_entry *entry, u32 attributes, in efivar_entry_set() argument
652 efi_char16_t *name = entry->var.VariableName; in efivar_entry_set() local
653 efi_guid_t vendor = entry->var.VendorGuid; in efivar_entry_set()
656 return -EINTR; in efivar_entry_set()
660 return -EINVAL; in efivar_entry_set()
662 ops = __efivars->ops; in efivar_entry_set()
663 if (head && efivar_entry_find(name, vendor, head, false)) { in efivar_entry_set()
665 return -EEXIST; in efivar_entry_set()
668 status = check_var_size(attributes, size + ucs2_strsize(name, 1024)); in efivar_entry_set()
670 status = ops->set_variable(name, &vendor, in efivar_entry_set()
681 * efivar_entry_set_nonblocking - call set_variable_nonblocking()
687 * efivars_lock. Instead, it returns -EBUSY.
690 efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor, in efivar_entry_set_nonblocking() argument
697 return -EBUSY; in efivar_entry_set_nonblocking()
701 return -EINVAL; in efivar_entry_set_nonblocking()
705 size + ucs2_strsize(name, 1024)); in efivar_entry_set_nonblocking()
708 return -ENOSPC; in efivar_entry_set_nonblocking()
711 ops = __efivars->ops; in efivar_entry_set_nonblocking()
712 status = ops->set_variable_nonblocking(name, &vendor, attributes, in efivar_entry_set_nonblocking()
720 * efivar_entry_set_safe - call set_variable() if enough space in firmware
721 * @name: buffer containing the variable name
732 * Returns 0 on success, -ENOSPC if the firmware does not have enough
736 int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, in efivar_entry_set_safe() argument
743 return -EINVAL; in efivar_entry_set_safe()
745 ops = __efivars->ops; in efivar_entry_set_safe()
746 if (!ops->query_variable_store) in efivar_entry_set_safe()
747 return -ENOSYS; in efivar_entry_set_safe()
750 * If the EFI variable backend provides a non-blocking in efivar_entry_set_safe()
751 * ->set_variable() operation and we're in a context where we in efivar_entry_set_safe()
752 * cannot block, then we need to use it to avoid live-locks, in efivar_entry_set_safe()
753 * since the implication is that the regular ->set_variable() in efivar_entry_set_safe()
756 * If no ->set_variable_nonblocking() is provided then in efivar_entry_set_safe()
757 * ->set_variable() is assumed to be non-blocking. in efivar_entry_set_safe()
759 if (!block && ops->set_variable_nonblocking) in efivar_entry_set_safe()
760 return efivar_entry_set_nonblocking(name, vendor, attributes, in efivar_entry_set_safe()
765 return -EBUSY; in efivar_entry_set_safe()
768 return -EINTR; in efivar_entry_set_safe()
771 status = check_var_size(attributes, size + ucs2_strsize(name, 1024)); in efivar_entry_set_safe()
774 return -ENOSPC; in efivar_entry_set_safe()
777 status = ops->set_variable(name, &vendor, attributes, size, data); in efivar_entry_set_safe()
786 * efivar_entry_find - search for an entry
787 * @name: the EFI variable name
790 * @remove: should we remove the entry from the list?
792 * Search for an entry on the variable list that has the EFI variable
793 * name @name and vendor guid @guid. If an entry is found on the list
794 * and @remove is true, the entry is removed from the list.
800 * Returns the entry if found on the list, %NULL otherwise.
802 struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, in efivar_entry_find() argument
805 struct efivar_entry *entry, *n; in efivar_entry_find() local
809 list_for_each_entry_safe(entry, n, head, list) { in efivar_entry_find()
810 strsize1 = ucs2_strsize(name, 1024); in efivar_entry_find()
811 strsize2 = ucs2_strsize(entry->var.VariableName, 1024); in efivar_entry_find()
813 !memcmp(name, &(entry->var.VariableName), strsize1) && in efivar_entry_find()
814 !efi_guidcmp(guid, entry->var.VendorGuid)) { in efivar_entry_find()
824 if (entry->scanning) { in efivar_entry_find()
826 * The entry will be deleted in efivar_entry_find()
829 entry->deleting = true; in efivar_entry_find()
831 list_del(&entry->list); in efivar_entry_find()
834 return entry; in efivar_entry_find()
839 * efivar_entry_size - obtain the size of a variable
840 * @entry: entry for this variable
843 int efivar_entry_size(struct efivar_entry *entry, unsigned long *size) in efivar_entry_size() argument
851 return -EINTR; in efivar_entry_size()
854 return -EINVAL; in efivar_entry_size()
856 ops = __efivars->ops; in efivar_entry_size()
857 status = ops->get_variable(entry->var.VariableName, in efivar_entry_size()
858 &entry->var.VendorGuid, NULL, size, NULL); in efivar_entry_size()
869 * __efivar_entry_get - call get_variable()
870 * @entry: read data for this variable
879 int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in __efivar_entry_get() argument
885 return -EINVAL; in __efivar_entry_get()
887 status = __efivars->ops->get_variable(entry->var.VariableName, in __efivar_entry_get()
888 &entry->var.VendorGuid, in __efivar_entry_get()
896 * efivar_entry_get - call get_variable()
897 * @entry: read data for this variable
902 int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, in efivar_entry_get() argument
908 return -EINTR; in efivar_entry_get()
912 return -EINVAL; in efivar_entry_get()
915 status = __efivars->ops->get_variable(entry->var.VariableName, in efivar_entry_get()
916 &entry->var.VendorGuid, in efivar_entry_get()
925 * efivar_entry_set_get_size - call set_variable() and get new size (atomic)
926 * @entry: entry containing variable to set and get
934 * Atomically call set_variable() for @entry and if the call is
938 * Returns 0 on success, -EINVAL if the variable data is invalid,
939 * -ENOSPC if the firmware does not have enough available space, or a
944 * (EFI_NOT_FOUND), @entry is removed from the variable list.
946 int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, in efivar_entry_set_get_size() argument
950 efi_char16_t *name = entry->var.VariableName; in efivar_entry_set_get_size() local
951 efi_guid_t *vendor = &entry->var.VendorGuid; in efivar_entry_set_get_size()
957 if (efivar_validate(*vendor, name, data, *size) == false) in efivar_entry_set_get_size()
958 return -EINVAL; in efivar_entry_set_get_size()
966 return -EINTR; in efivar_entry_set_get_size()
969 err = -EINVAL; in efivar_entry_set_get_size()
976 status = check_var_size(attributes, *size + ucs2_strsize(name, 1024)); in efivar_entry_set_get_size()
984 err = -ENOSPC; in efivar_entry_set_get_size()
989 ops = __efivars->ops; in efivar_entry_set_get_size()
991 status = ops->set_variable(name, vendor, attributes, *size, data); in efivar_entry_set_get_size()
1006 status = ops->get_variable(entry->var.VariableName, in efivar_entry_set_get_size()
1007 &entry->var.VendorGuid, in efivar_entry_set_get_size()
1011 efivar_entry_list_del_unlock(entry); in efivar_entry_set_get_size()
1028 * efivar_entry_iter_begin - begin iterating the variable list
1030 * Lock the variable list to prevent entry insertion and removal until
1041 * efivar_entry_iter_end - finish iterating the variable list
1052 * __efivar_entry_iter - iterate over variable list
1055 * @data: function-specific data to pass to callback
1056 * @prev: entry to begin iterating from
1059 * entry on the list. It is safe for @func to remove entries in the
1065 * It is possible to begin iteration from an arbitrary entry within
1067 * the last entry passed to @func. To begin iterating from the
1077 struct efivar_entry *entry, *n; in __efivar_entry_iter() local
1081 list_for_each_entry_safe(entry, n, head, list) { in __efivar_entry_iter()
1082 err = func(entry, data); in __efivar_entry_iter()
1088 *prev = entry; in __efivar_entry_iter()
1105 * efivar_entry_iter - iterate over variable list
1108 * @data: function-specific data to pass to callback
1111 * entry on the list. It is safe for @func to remove entries in the
1115 * - a non-zero return value indicates an error and terminates the loop
1116 * - @func is called from atomic context
1134 * efivars_kobject - get the kobject for the registered efivars
1144 return __efivars->kobject; in efivars_kobject()
1149 * efivars_register - register an efivars
1152 * @kobject: @efivars-specific kobject
1161 return -EINTR; in efivars_register()
1163 efivars->ops = ops; in efivars_register()
1164 efivars->kobject = kobject; in efivars_register()
1177 * efivars_unregister - unregister an efivars
1180 * The caller must have already removed every entry from the list,
1188 return -EINTR; in efivars_unregister()
1192 rv = -EINVAL; in efivars_unregister()
1197 rv = -EINVAL; in efivars_unregister()
1213 return __efivars && __efivars->ops->set_variable; in efivar_supports_writes()