diff options
author | phk <phk@FreeBSD.org> | 2005-09-15 10:28:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2005-09-15 10:28:19 +0000 |
commit | 3c4b94c1fe49b5c696e55c582954871f904dbec7 (patch) | |
tree | 7d1f430b792e9c40a76416f1909a70f6f73a5b14 /sys/fs/devfs | |
parent | eafa84f647542c3749340df5617561b979945594 (diff) | |
download | FreeBSD-src-3c4b94c1fe49b5c696e55c582954871f904dbec7.zip FreeBSD-src-3c4b94c1fe49b5c696e55c582954871f904dbec7.tar.gz |
Various minor polishing.
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r-- | sys/fs/devfs/devfs.h | 2 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_devs.c | 11 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 19 |
3 files changed, 10 insertions, 22 deletions
diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index 5013a0b..07912a9 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -192,7 +192,7 @@ void devfs_rules_newmount(struct devfs_mount *dm, struct thread *td); int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); struct cdev **devfs_itod (int inode); struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode); -int devfs_populate (struct devfs_mount *dm); +void devfs_populate (struct devfs_mount *dm); struct devfs_dirent *devfs_newdirent (char *name, int namelen); void devfs_purge (struct devfs_dirent *dd); struct devfs_dirent *devfs_vmkdir (char *name, int namelen, struct devfs_dirent *dotdot); diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 9cec56d..5bb45fb 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -201,7 +201,7 @@ devfs_newdirent(char *name, int namelen) d.d_namlen = namelen; i = sizeof (*de) + GENERIC_DIRSIZ(&d); - MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_WAITOK | M_ZERO); + de = malloc(i, M_DEVFS, M_WAITOK | M_ZERO); de->de_dirent = (struct dirent *)(de + 1); de->de_dirent->d_namlen = namelen; de->de_dirent->d_reclen = GENERIC_DIRSIZ(&d); @@ -254,7 +254,7 @@ devfs_delete(struct devfs_dirent *dd, struct devfs_dirent *de) { if (de->de_symlink) { - FREE(de->de_symlink, M_DEVFS); + free(de->de_symlink, M_DEVFS); de->de_symlink = NULL; } if (de->de_vnode) @@ -263,7 +263,7 @@ devfs_delete(struct devfs_dirent *dd, struct devfs_dirent *de) #ifdef MAC mac_destroy_devfsdirent(de); #endif - FREE(de, M_DEVFS); + free(de, M_DEVFS); } void @@ -281,7 +281,7 @@ devfs_purge(struct devfs_dirent *dd) } -int +void devfs_populate(struct devfs_mount *dm) { int i, j; @@ -291,7 +291,7 @@ devfs_populate(struct devfs_mount *dm) char *q, *s; if (dm->dm_generation == devfs_generation) - return (0); + return; lockmgr(&dm->dm_lock, LK_UPGRADE, 0, curthread); if (devfs_noverflow && dm->dm_overflow == NULL) { i = devfs_noverflow * sizeof (struct devfs_dirent *); @@ -371,7 +371,6 @@ devfs_populate(struct devfs_mount *dm) } } lockmgr(&dm->dm_lock, LK_DOWNGRADE, 0, curthread); - return (0); } /* diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 30c2c21..b9540b1 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -61,7 +61,6 @@ #include <sys/proc.h> #include <sys/stat.h> #include <sys/sx.h> -#include <sys/sysctl.h> #include <sys/time.h> #include <sys/ttycom.h> #include <sys/unistd.h> @@ -746,12 +745,6 @@ devfs_pathconf(struct vop_pathconf_args *ap) { switch (ap->a_name) { - case _PC_NAME_MAX: - *ap->a_retval = NAME_MAX; - return (0); - case _PC_PATH_MAX: - *ap->a_retval = PATH_MAX; - return (0); case _PC_MAC_PRESENT: #ifdef MAC /* @@ -884,12 +877,10 @@ devfs_readdir(struct vop_readdir_args *ap) static int devfs_readlink(struct vop_readlink_args *ap) { - int error; struct devfs_dirent *de; de = ap->a_vp->v_data; - error = uiomove(de->de_symlink, strlen(de->de_symlink), ap->a_uio); - return (error); + return (uiomove(de->de_symlink, strlen(de->de_symlink), ap->a_uio)); } static int @@ -938,7 +929,7 @@ devfs_remove(struct vop_remove_args *ap) #ifdef MAC mac_destroy_devfsdirent(de); #endif - FREE(de, M_DEVFS); + free(de, M_DEVFS); } else { de->de_flags |= DE_WHITEOUT; } @@ -981,8 +972,7 @@ devfs_rioctl(struct vop_ioctl_args *ap) dmp = VFSTODEVFS(ap->a_vp->v_mount); lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curthread); devfs_populate(dmp); - error = devfs_rules_ioctl(dmp, ap->a_command, ap->a_data, - ap->a_td); + error = devfs_rules_ioctl(dmp, ap->a_command, ap->a_data, ap->a_td); lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); return (error); } @@ -1128,7 +1118,7 @@ devfs_symlink(struct vop_symlink_args *ap) de->de_inode = dmp->dm_inode++; de->de_dirent->d_type = DT_LNK; i = strlen(ap->a_target) + 1; - MALLOC(de->de_symlink, char *, i, M_DEVFS, M_WAITOK); + de->de_symlink = malloc(i, M_DEVFS, M_WAITOK); bcopy(ap->a_target, de->de_symlink, i); lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, td); #ifdef MAC @@ -1252,7 +1242,6 @@ static struct vop_vector devfs_specops = { .vop_write = VOP_PANIC, }; - /* * Our calling convention to the device drivers used to be that we passed * vnode.h IO_* flags to read()/write(), but we're moving to fcntl.h O_ |