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.
This commit is contained in:
parent
fe5f56639f
commit
6e5b027ba2
@ -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);
|
||||
|
@ -155,6 +155,8 @@ allocdev(void)
|
||||
bzero(si, sizeof *si);
|
||||
si->si_flags |= SI_STASHED;
|
||||
}
|
||||
si->__si_namebuf[0] = '\0';
|
||||
si->si_name = si->__si_namebuf;
|
||||
LIST_INIT(&si->si_children);
|
||||
TAILQ_INIT(&si->si_snapshots);
|
||||
return (si);
|
||||
|
@ -73,7 +73,7 @@ struct cdev {
|
||||
LIST_ENTRY(cdev) si_siblings;
|
||||
dev_t si_parent;
|
||||
u_int si_inode;
|
||||
char si_name[SPECNAMELEN + 1];
|
||||
char *si_name;
|
||||
void *si_drv1, *si_drv2;
|
||||
struct cdevsw *si_devsw;
|
||||
int si_iosize_max; /* maximum I/O size (for physio &al) */
|
||||
@ -96,6 +96,7 @@ struct cdev {
|
||||
int (*__sid_copyonwrite)(struct vnode *, struct buf *);
|
||||
} __si_disk;
|
||||
} __si_u;
|
||||
char __si_namebuf[SPECNAMELEN + 1];
|
||||
};
|
||||
|
||||
#define si_tty __si_u.__si_tty.__sit_tty
|
||||
|
@ -73,7 +73,7 @@ struct cdev {
|
||||
LIST_ENTRY(cdev) si_siblings;
|
||||
dev_t si_parent;
|
||||
u_int si_inode;
|
||||
char si_name[SPECNAMELEN + 1];
|
||||
char *si_name;
|
||||
void *si_drv1, *si_drv2;
|
||||
struct cdevsw *si_devsw;
|
||||
int si_iosize_max; /* maximum I/O size (for physio &al) */
|
||||
@ -96,6 +96,7 @@ struct cdev {
|
||||
int (*__sid_copyonwrite)(struct vnode *, struct buf *);
|
||||
} __si_disk;
|
||||
} __si_u;
|
||||
char __si_namebuf[SPECNAMELEN + 1];
|
||||
};
|
||||
|
||||
#define si_tty __si_u.__si_tty.__sit_tty
|
||||
|
Loading…
Reference in New Issue
Block a user