Exemplo n.º 1
0
/* 
 * Point (dev) at an allocated device specifier for the device matching the
 * path in (devspec). If it contains an explicit device specification,
 * use that.  If not, use the default device.
 */
int
efi_getdev(void **vdev, const char *devspec, const char **path)
{
	struct efi_devdesc **dev = (struct efi_devdesc **)vdev;
	int		rv;
    
	/*
	 * If it looks like this is just a path and no
	 * device, go with the current device.
	 */
	if ((devspec == NULL) || 
	    (devspec[0] == '/') || 
	    (strchr(devspec, ':') == NULL)) {

		if (((rv = efi_parsedev(dev, getenv("currdev"), NULL)) == 0) &&
		    (path != NULL))
			*path = devspec;
		return(rv);
	}
    
	/*
	 * Try to parse the device name off the beginning of the devspec
	 */
	return(efi_parsedev(dev, devspec, path));
}
Exemplo n.º 2
0
/*
 * Point (dev) at an allocated device specifier for the device matching the
 * path in (devspec). If it contains an explicit device specification,
 * use that.  If not, use the default device.
 */
int
efi_getdev(void **vdev, const char *devspec, const char **path)
{
	struct efi_devdesc **dev = (struct efi_devdesc **)vdev;
	int rv;

	/*
	 * If it looks like this is just a path and no device, then
	 * use the current device instead.
	 */
	if (devspec == NULL || *devspec == '/' || !strchr(devspec, ':')) {
		rv = efi_parsedev(dev, getenv("currdev"), NULL);
		if (rv == 0 && path != NULL)
			*path = devspec;
		return (rv);
	}

	/* Parse the device name off the beginning of the devspec. */
	return (efi_parsedev(dev, devspec, path));
}
Exemplo n.º 3
0
/*
 * Set currdev to suit the value being supplied in (value)
 */
int
efi_setcurrdev(struct env_var *ev, int flags, void *value)
{
	struct efi_devdesc *ncurr;
	int		rv;
    
	if ((rv = efi_parsedev(&ncurr, value, NULL)) != 0)
		return(rv);
	free(ncurr);
	env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
	return(0);
}