MCPcopy Create free account
hub / github.com/F-Stack/f-stack / freebsd11_getfsstat

Function freebsd11_getfsstat

freebsd/kern/vfs_syscalls.c:791–817  ·  view source on GitHub ↗

* Get statistics on all filesystems. */

Source from the content-addressed store, hash-verified

789 * Get statistics on all filesystems.
790 */
791int
792freebsd11_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.

Callers

nothing calls this directly

Calls 4

kern_getfsstatFunction · 0.85
freebsd11_cvtstatfsFunction · 0.85
freeFunction · 0.70
copyoutFunction · 0.50

Tested by

no test coverage detected