summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-04 10:32:40 +0000
committerphk <phk@FreeBSD.org>2003-02-04 10:32:40 +0000
commit9d6d3f16738b4468cf07e93bd017adae88c16871 (patch)
tree9f5f3c6b75f01b4b8fd3121c797b479bf00e432b /sys/geom/geom_disk.c
parent1abb95308bcc72d0a245f8d4c0f779f3cbe67d90 (diff)
downloadFreeBSD-src-9d6d3f16738b4468cf07e93bd017adae88c16871.zip
FreeBSD-src-9d6d3f16738b4468cf07e93bd017adae88c16871.tar.gz
Pave the road to removing the fixed size limit on device nodes:
Change the si_name of dev_t's to be a char * and put a private buffer for holding the name at then end of the struct. Initialize si_name to point to the private buffer. Put a KASSERT in geom_disk to prevent overrun on the fake dev_t we still have to generate for the disk_drivers.
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index eb134a9..ebb4ebb 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -296,8 +296,10 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, void *
KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy"));
KASSERT(dp->d_name != NULL, ("disk_create need d_name"));
KASSERT(*dp->d_name != 0, ("disk_create need d_name"));
+ KASSERT(strlen(dp->d_name) < SPECNAMELEN - 4, ("disk name too long"));
dev->si_disk = dp;
dev->si_udev = 0x10002; /* XXX: Needed ? */
+ dev->si_name = dev->__si_namebuf;
sprintf(dev->si_name, "%s%d", dp->d_name, unit);
g_call_me(g_disk_create, dev);
return (dev);
OpenPOWER on IntegriCloud