From 2b4f7a9e8aff3b740995b6d2aff23de6cad7646d Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 10 Feb 2012 12:40:50 +0000 Subject: 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. --- sys/fs/devfs/devfs_devs.c | 1 - sys/kern/kern_conf.c | 14 +++++++------- sys/sys/conf.h | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'sys') diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index a111527..71caa29 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -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; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 85737e8..0ca4fcc 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -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); diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 7dfa82e..0a12124 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -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 -- cgit v1.1