Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/efi/libefi/efizfs.c
/*- | /*- | ||||
* Copyright (c) 2008-2010 Rui Paulo | * Copyright (c) 2008-2010 Rui Paulo | ||||
manu: Most of this code isn't your as it comes from loader/main.c, please add the original license. | |||||
Done Inline ActionsTrue. That was an file auto-creation mistake... eric_metricspace.net: True. That was an file auto-creation mistake... | |||||
* Copyright (c) 2006 Marcel Moolenaar | * Copyright (c) 2006 Marcel Moolenaar | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* | * | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | insert_zfs(EFI_HANDLE handle, uint64_t guid) | ||||
STAILQ_INSERT_TAIL(&zfsinfo, zi, zi_link); | STAILQ_INSERT_TAIL(&zfsinfo, zi, zi_link); | ||||
} | } | ||||
void | void | ||||
efi_zfs_probe(void) | efi_zfs_probe(void) | ||||
{ | { | ||||
pdinfo_list_t *hdi; | pdinfo_list_t *hdi; | ||||
pdinfo_t *hd, *pd = NULL; | pdinfo_t *hd, *pd = NULL; | ||||
EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; | |||||
EFI_LOADED_IMAGE *img; | |||||
char devname[SPECNAMELEN + 1]; | char devname[SPECNAMELEN + 1]; | ||||
uint64_t guid; | uint64_t guid; | ||||
BS->HandleProtocol(IH, &imgid, (VOID**)&img); | |||||
hdi = efiblk_get_pdinfo_list(&efipart_hddev); | hdi = efiblk_get_pdinfo_list(&efipart_hddev); | ||||
STAILQ_INIT(&zfsinfo); | STAILQ_INIT(&zfsinfo); | ||||
/* | /* | ||||
* Find the handle for the boot device. The boot1 did find the | * Find the handle for the boot device. The boot1 did find the | ||||
* device with loader binary, now we need to search for the | * device with loader binary, now we need to search for the | ||||
* same device and if it is part of the zfs pool, we record the | * same device and if it is part of the zfs pool, we record the | ||||
* pool GUID for currdev setup. | * pool GUID for currdev setup. | ||||
*/ | */ | ||||
STAILQ_FOREACH(hd, hdi, pd_link) { | STAILQ_FOREACH(hd, hdi, pd_link) { | ||||
STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { | STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { | ||||
snprintf(devname, sizeof(devname), "%s%dp%d:", | snprintf(devname, sizeof(devname), "%s%dp%d:", | ||||
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); | efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); | ||||
if (zfs_probe_dev(devname, &guid) == 0) { | if (zfs_probe_dev(devname, &guid) == 0) { | ||||
insert_zfs(pd->pd_handle, guid); | insert_zfs(pd->pd_handle, guid); | ||||
if (pd->pd_handle == img->DeviceHandle) | if (efi_zfs_is_preferred(pd->pd_handle)) | ||||
pool_guid = guid; | pool_guid = guid; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
uint64_t | uint64_t | ||||
Show All 9 Lines |
Most of this code isn't your as it comes from loader/main.c, please add the original license.