* Get statistics on all filesystems. */
| 789 | * Get statistics on all filesystems. |
| 790 | */ |
| 791 | int |
| 792 | freebsd11_getfsstat(struct thread *td, struct freebsd11_getfsstat_args *uap) |
| 793 | { |
| 794 | struct freebsd11_statfs osb; |
| 795 | struct statfs *buf, *sp; |
| 796 | size_t count, size; |
| 797 | int error; |
| 798 | |
| 799 | count = uap->bufsize / sizeof(struct ostatfs); |
| 800 | size = count * sizeof(struct statfs); |
| 801 | error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, |
| 802 | uap->mode); |
| 803 | if (error == 0) |
| 804 | td->td_retval[0] = count; |
| 805 | if (size > 0) { |
| 806 | sp = buf; |
| 807 | while (count > 0 && error == 0) { |
| 808 | freebsd11_cvtstatfs(sp, &osb); |
| 809 | error = copyout(&osb, uap->buf, sizeof(osb)); |
| 810 | sp++; |
| 811 | uap->buf++; |
| 812 | count--; |
| 813 | } |
| 814 | free(buf, M_STATFS); |
| 815 | } |
| 816 | return (error); |
| 817 | } |
| 818 | |
| 819 | /* |
| 820 | * Implement fstatfs() for (NFS) file handles. |
nothing calls this directly
no test coverage detected