1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Add offset field to the i386_devdesc structure to be compatible with

disk_devdesc structure. Update biosdisk driver to the new disk API.
This commit is contained in:
Andrey V. Elsukov 2012-08-05 14:37:48 +00:00
parent 1c771f9222
commit a86f714d15
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239066
4 changed files with 245 additions and 1072 deletions

View File

@ -39,10 +39,6 @@ CFLAGS+= -DSMBIOS_LITTLE_ENDIAN_UUID
.endif
.endif
.if !defined(LOADER_NO_GPT_SUPPORT)
CFLAGS+= -DLOADER_GPT_SUPPORT
.endif
# Include simple terminal emulation (cons25-compatible)
CFLAGS+= -DTERM_EMU

File diff suppressed because it is too large Load Diff

View File

@ -29,8 +29,8 @@ __FBSDID("$FreeBSD$");
#include <stand.h>
#include <string.h>
#include <sys/disklabel.h>
#include "bootstrap.h"
#include "disk.h"
#include "libi386.h"
#include "../zfs/libzfs.h"
@ -86,7 +86,7 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
{
struct i386_devdesc *idev;
struct devsw *dv;
int i, unit, slice, partition, err;
int i, unit, err;
char *cp;
const char *np;
@ -112,62 +112,9 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path)
break;
case DEVT_DISK:
unit = -1;
slice = -1;
partition = -1;
if (*np && (*np != ':')) {
unit = strtol(np, &cp, 10); /* next comes the unit number */
if (cp == np) {
err = EUNIT;
goto fail;
}
#ifdef LOADER_GPT_SUPPORT
if (*cp == 'p') { /* got a GPT partition */
np = cp + 1;
slice = strtol(np, &cp, 10);
if (cp == np) {
err = ESLICE;
goto fail;
}
if (*cp && (*cp != ':')) {
err = EINVAL;
goto fail;
}
partition = 0xff;
} else {
#endif
if (*cp == 's') { /* got a slice number */
np = cp + 1;
slice = strtol(np, &cp, 10);
if (cp == np) {
err = ESLICE;
goto fail;
}
}
if (*cp && (*cp != ':')) {
partition = *cp - 'a'; /* got a partition number */
if ((partition < 0) || (partition >= MAXPARTITIONS)) {
err = EPART;
goto fail;
}
cp++;
}
#ifdef LOADER_GPT_SUPPORT
}
#endif
} else {
cp = np;
}
if (*cp && (*cp != ':')) {
err = EINVAL;
err = disk_parsedev((struct disk_devdesc *)idev, np, path);
if (err != 0)
goto fail;
}
idev->d_unit = unit;
idev->d_kind.biosdisk.slice = slice;
idev->d_kind.biosdisk.partition = partition;
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
case DEVT_CD:
@ -221,38 +168,20 @@ i386_fmtdev(void *vdev)
{
struct i386_devdesc *dev = (struct i386_devdesc *)vdev;
static char buf[128]; /* XXX device length constant? */
char *cp;
switch(dev->d_type) {
case DEVT_NONE:
strcpy(buf, "(no device)");
break;
case DEVT_CD:
case DEVT_NET:
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
case DEVT_DISK:
cp = buf;
cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_unit);
#ifdef LOADER_GPT_SUPPORT
if (dev->d_kind.biosdisk.partition == 0xff) {
cp += sprintf(cp, "p%d", dev->d_kind.biosdisk.slice);
} else {
#endif
if (dev->d_kind.biosdisk.slice > 0)
cp += sprintf(cp, "s%d", dev->d_kind.biosdisk.slice);
if (dev->d_kind.biosdisk.partition >= 0)
cp += sprintf(cp, "%c", dev->d_kind.biosdisk.partition + 'a');
#ifdef LOADER_GPT_SUPPORT
}
#endif
strcat(cp, ":");
break;
return (disk_fmtdev(vdev));
case DEVT_NET:
sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
case DEVT_ZFS:
return(zfs_fmtdev(vdev));
}

View File

@ -45,6 +45,7 @@ struct i386_devdesc
void *data;
int slice;
int partition;
off_t offset;
} biosdisk;
struct
{