mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
Various minor polishing.
This commit is contained in:
parent
6556102dcb
commit
214c8ff0e4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150151
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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_
|
||||
|
Loading…
Reference in New Issue
Block a user