Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/libi386/devicename.c
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
* For disk-type devices, the syntax is: | * For disk-type devices, the syntax is: | ||||
* | * | ||||
* disk<unit>[s<slice>][<partition>]: | * disk<unit>[s<slice>][<partition>]: | ||||
* | * | ||||
*/ | */ | ||||
static int | static int | ||||
i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path) | i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path) | ||||
{ | { | ||||
struct i386_devdesc *idev; | struct i386_devdesc *idev = NULL; | ||||
struct devsw *dv; | struct devsw *dv; | ||||
int i, unit, err; | int i, unit, err; | ||||
char *cp; | char *cp; | ||||
const char *np; | const char *np; | ||||
/* minimum length check */ | /* minimum length check */ | ||||
if (strlen(devspec) < 2) | if (strlen(devspec) < 2) | ||||
return(EINVAL); | return(EINVAL); | ||||
Show All 12 Lines | return(ENOENT); | ||||
idev = NULL; | idev = NULL; | ||||
err = 0; | err = 0; | ||||
switch(dv->dv_type) { | switch(dv->dv_type) { | ||||
case DEVT_NONE: | case DEVT_NONE: | ||||
break; | break; | ||||
case DEVT_DISK: | case DEVT_DISK: | ||||
idev = malloc(sizeof(struct i386_devdesc)); | err = disk_parsedev((struct devdesc **)&idev, np, path); | ||||
if (idev == NULL) | |||||
return (ENOMEM); | |||||
err = disk_parsedev((struct disk_devdesc *)idev, np, path); | |||||
if (err != 0) | if (err != 0) | ||||
goto fail; | goto fail; | ||||
break; | break; | ||||
case DEVT_ZFS: | case DEVT_ZFS: | ||||
idev = malloc(sizeof (struct zfs_devdesc)); | idev = malloc(sizeof (struct zfs_devdesc)); | ||||
if (idev == NULL) | if (idev == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |