| 6078 | } |
| 6079 | |
| 6080 | static int |
| 6081 | sysctl_vfs_ctl(SYSCTL_HANDLER_ARGS) |
| 6082 | { |
| 6083 | struct vfsidctl vc; |
| 6084 | int error; |
| 6085 | struct mount *mp; |
| 6086 | |
| 6087 | error = SYSCTL_IN(req, &vc, sizeof(vc)); |
| 6088 | if (error) |
| 6089 | return (error); |
| 6090 | if (vc.vc_vers != VFS_CTL_VERS1) |
| 6091 | return (EINVAL); |
| 6092 | mp = vfs_getvfs(&vc.vc_fsid); |
| 6093 | if (mp == NULL) |
| 6094 | return (ENOENT); |
| 6095 | /* ensure that a specific sysctl goes to the right filesystem. */ |
| 6096 | if (strcmp(vc.vc_fstypename, "*") != 0 && |
| 6097 | strcmp(vc.vc_fstypename, mp->mnt_vfc->vfc_name) != 0) { |
| 6098 | vfs_rel(mp); |
| 6099 | return (EINVAL); |
| 6100 | } |
| 6101 | VCTLTOREQ(&vc, req); |
| 6102 | error = VFS_SYSCTL(mp, vc.vc_op, req); |
| 6103 | vfs_rel(mp); |
| 6104 | return (error); |
| 6105 | } |
| 6106 | |
| 6107 | SYSCTL_PROC(_vfs, OID_AUTO, ctl, CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | CTLFLAG_WR, |
| 6108 | NULL, 0, sysctl_vfs_ctl, "", |
nothing calls this directly
no test coverage detected