Changeset View
Changeset View
Standalone View
Standalone View
stand/uboot/devicename.c
| Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | #endif | ||||
| return (0); | return (0); | ||||
| fail: | fail: | ||||
| free(idev); | free(idev); | ||||
| return (err); | return (err); | ||||
| } | } | ||||
| char * | |||||
| uboot_fmtdev(void *vdev) | |||||
| { | |||||
| struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev; | |||||
| static char buf[128]; | |||||
| switch(dev->dd.d_dev->dv_type) { | |||||
| case DEVT_NONE: | |||||
| strcpy(buf, "(no device)"); | |||||
| break; | |||||
| case DEVT_DISK: | |||||
| #ifdef LOADER_DISK_SUPPORT | |||||
| return (disk_fmtdev(vdev)); | |||||
| #endif | |||||
| case DEVT_NET: | |||||
| sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit); | |||||
| break; | |||||
| } | |||||
| return(buf); | |||||
| } | |||||
| /* | /* | ||||
| * Set currdev to suit the value being supplied in (value). | * Set currdev to suit the value being supplied in (value). | ||||
| */ | */ | ||||
| int | int | ||||
| uboot_setcurrdev(struct env_var *ev, int flags, const void *value) | uboot_setcurrdev(struct env_var *ev, int flags, const void *value) | ||||
| { | { | ||||
| struct uboot_devdesc *ncurr; | struct uboot_devdesc *ncurr; | ||||
| int rv; | int rv; | ||||
| if ((rv = uboot_parsedev(&ncurr, value, NULL)) != 0) | if ((rv = uboot_parsedev(&ncurr, value, NULL)) != 0) | ||||
| return (rv); | return (rv); | ||||
| free(ncurr); | free(ncurr); | ||||
| return (mount_currdev(ev, flags, value)); | return (mount_currdev(ev, flags, value)); | ||||
| } | } | ||||