diff options
author | mav <mav@FreeBSD.org> | 2011-04-26 17:01:49 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2011-04-26 17:01:49 +0000 |
commit | 519a30551e314539bf947c982c6407ccfa2a1fc7 (patch) | |
tree | c2addcf01914b57db809b818c842c9fb3345fe25 /sys/geom/geom_dev.c | |
parent | e19591c5077914564e9818802d634404fc9e3808 (diff) | |
download | FreeBSD-src-519a30551e314539bf947c982c6407ccfa2a1fc7.zip FreeBSD-src-519a30551e314539bf947c982c6407ccfa2a1fc7.tar.gz |
- Add shim to simplify migration to the CAM-based ATA. For each new adaX
device in /dev/ create symbolic link with adY name, trying to mimic old ATA
numbering. Imitation is not complete, but should be enough in most cases to
mount file systems without touching /etc/fstab.
- To know what behavior to mimic, restore ATA_STATIC_ID option in cases
where it was present before.
- Add some more details to UPDATING.
Diffstat (limited to 'sys/geom/geom_dev.c')
-rw-r--r-- | sys/geom/geom_dev.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 6ae4201..909cb91 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -113,8 +113,9 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) { struct g_geom *gp; struct g_consumer *cp; - int error; - struct cdev *dev; + int error, len; + struct cdev *dev, *adev; + char buf[64], *val; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -136,12 +137,35 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) g_destroy_geom(gp); return (NULL); } + + /* Search for device alias name and create it if found. */ + adev = NULL; + for (len = MIN(strlen(gp->name), sizeof(buf) - 15); len > 0; len--) { + snprintf(buf, sizeof(buf), "kern.devalias.%s", gp->name); + buf[14 + len] = 0; + val = getenv(buf); + if (val != NULL) { + snprintf(buf, sizeof(buf), "%s%s", + val, gp->name + len); + freeenv(val); + adev = make_dev_alias(dev, buf); + break; + } + } + if (pp->flags & G_PF_CANDELETE) dev->si_flags |= SI_CANDELETE; dev->si_iosize_max = MAXPHYS; gp->softc = dev; dev->si_drv1 = gp; dev->si_drv2 = cp; + if (adev != NULL) { + if (pp->flags & G_PF_CANDELETE) + adev->si_flags |= SI_CANDELETE; + adev->si_iosize_max = MAXPHYS; + adev->si_drv1 = gp; + adev->si_drv2 = cp; + } return (gp); } |