Merge si_name and __si_namebuf.

The si_name pointer always points to the __si_namebuf member inside the
same object. Remove it and rename __si_namebuf to si_name.
This commit is contained in:
ed 2012-02-10 12:40:50 +00:00
parent 28b4a002d6
commit 2b4f7a9e8a
3 changed files with 9 additions and 10 deletions

View File

@ -133,7 +133,6 @@ devfs_alloc(int flags)
cdev = &cdp->cdp_c;
cdev->si_name = cdev->__si_namebuf;
LIST_INIT(&cdev->si_children);
vfs_timestamp(&ts);
cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;

View File

@ -690,16 +690,16 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
mtx_assert(&devmtx, MA_OWNED);
len = vsnrprintf(dev->__si_namebuf, sizeof(dev->__si_namebuf), 32,
len = vsnrprintf(dev->si_name, sizeof(dev->si_name), 32,
fmt, ap);
if (len > sizeof(dev->__si_namebuf) - 1)
if (len > sizeof(dev->si_name) - 1)
return (ENAMETOOLONG);
/* Strip leading slashes. */
for (from = dev->__si_namebuf; *from == '/'; from++)
for (from = dev->si_name; *from == '/'; from++)
;
for (to = dev->__si_namebuf; *from != '\0'; from++, to++) {
for (to = dev->si_name; *from != '\0'; from++, to++) {
/* Treat multiple sequential slashes as single. */
while (from[0] == '/' && from[1] == '/')
from++;
@ -710,11 +710,11 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
}
*to = '\0';
if (dev->__si_namebuf[0] == '\0')
if (dev->si_name[0] == '\0')
return (EINVAL);
/* Disallow "." and ".." components. */
for (s = dev->__si_namebuf;;) {
for (s = dev->si_name;;) {
for (q = s; *q != '/' && *q != '\0'; q++)
;
if (q - s == 1 && s[0] == '.')
@ -726,7 +726,7 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
s = q + 1;
}
if (devfs_dev_exists(dev->__si_namebuf) != 0)
if (devfs_dev_exists(dev->si_name) != 0)
return (EEXIST);
return (0);

View File

@ -78,7 +78,7 @@ struct cdev {
LIST_HEAD(, cdev) si_children;
LIST_ENTRY(cdev) si_siblings;
struct cdev *si_parent;
char *si_name;
void *si_spare0;
void *si_drv1, *si_drv2;
struct cdevsw *si_devsw;
int si_iosize_max; /* maximum I/O size (for physio &al) */
@ -87,7 +87,7 @@ struct cdev {
union {
struct snapdata *__sid_snapdata;
} __si_u;
char __si_namebuf[SPECNAMELEN + 1];
char si_name[SPECNAMELEN + 1];
};
#define si_snapdata __si_u.__sid_snapdata