| 273 | } |
| 274 | |
| 275 | static int |
| 276 | kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) |
| 277 | { |
| 278 | int error; |
| 279 | |
| 280 | if (mp == NULL) |
| 281 | return (EBADF); |
| 282 | error = vfs_busy(mp, 0); |
| 283 | vfs_rel(mp); |
| 284 | if (error != 0) |
| 285 | return (error); |
| 286 | #ifdef MAC |
| 287 | error = mac_mount_check_stat(td->td_ucred, mp); |
| 288 | if (error != 0) |
| 289 | goto out; |
| 290 | #endif |
| 291 | error = VFS_STATFS(mp, buf); |
| 292 | if (error != 0) |
| 293 | goto out; |
| 294 | if (priv_check_cred_vfs_generation(td->td_ucred)) { |
| 295 | buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; |
| 296 | prison_enforce_statfs(td->td_ucred, mp, buf); |
| 297 | } |
| 298 | out: |
| 299 | vfs_unbusy(mp); |
| 300 | return (error); |
| 301 | } |
| 302 | |
| 303 | /* |
| 304 | * Get filesystem statistics. |
no test coverage detected