i386_parsedev() needs to support fd devices
MFC after: 2 weeks
This commit is contained in:
parent
920dfe026c
commit
295586e818
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342707
@ -103,23 +103,42 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
||||
}
|
||||
if (dv == NULL)
|
||||
return(ENOENT);
|
||||
idev = malloc(sizeof(struct i386_devdesc));
|
||||
err = 0;
|
||||
|
||||
np = (devspec + strlen(dv->dv_name));
|
||||
idev = NULL;
|
||||
err = 0;
|
||||
|
||||
switch(dv->dv_type) {
|
||||
case DEVT_NONE: /* XXX what to do here? Do we care? */
|
||||
case DEVT_NONE:
|
||||
break;
|
||||
|
||||
case DEVT_DISK:
|
||||
idev = malloc(sizeof(struct i386_devdesc));
|
||||
if (idev == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
err = disk_parsedev((struct disk_devdesc *)idev, np, path);
|
||||
if (err != 0)
|
||||
goto fail;
|
||||
break;
|
||||
|
||||
case DEVT_CD:
|
||||
case DEVT_NET:
|
||||
case DEVT_ZFS:
|
||||
idev = malloc(sizeof (struct zfs_devdesc));
|
||||
if (idev == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
err = zfs_parsedev((struct zfs_devdesc *)idev, np, path);
|
||||
if (err != 0)
|
||||
goto fail;
|
||||
break;
|
||||
|
||||
default:
|
||||
idev = malloc(sizeof (struct devdesc));
|
||||
if (idev == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
unit = 0;
|
||||
cp = (char *)np;
|
||||
|
||||
if (*np && (*np != ':')) {
|
||||
unit = strtol(np, &cp, 0); /* get unit number if present */
|
||||
@ -127,9 +146,8 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
||||
err = EUNIT;
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
cp = (char *)np;
|
||||
}
|
||||
|
||||
if (*cp && (*cp != ':')) {
|
||||
err = EINVAL;
|
||||
goto fail;
|
||||
@ -139,21 +157,13 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
|
||||
if (path != NULL)
|
||||
*path = (*cp == 0) ? cp : cp + 1;
|
||||
break;
|
||||
case DEVT_ZFS:
|
||||
err = zfs_parsedev((struct zfs_devdesc *)idev, np, path);
|
||||
if (err != 0)
|
||||
goto fail;
|
||||
break;
|
||||
default:
|
||||
err = EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
idev->dd.d_dev = dv;
|
||||
if (dev == NULL) {
|
||||
free(idev);
|
||||
} else {
|
||||
if (dev != NULL)
|
||||
*dev = idev;
|
||||
}
|
||||
else
|
||||
free(idev);
|
||||
|
||||
return(0);
|
||||
|
||||
fail:
|
||||
|
Loading…
Reference in New Issue
Block a user