5 #include "xlat/fsmagic.h"
8 sprintfstype(const unsigned int magic)
13 s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic);
15 sprintf(buf, "\"%s\"", s);
18 sprintf(buf, "%#x", magic);
23 printstatfs(struct tcb *tcp, const long addr)
25 struct statfs statbuf;
27 if (syserror(tcp) || !verbose(tcp)) {
28 tprintf("%#lx", addr);
31 if (umove(tcp, addr, &statbuf) < 0) {
35 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
36 sprintfstype(statbuf.f_type),
37 (unsigned long)statbuf.f_bsize,
38 (unsigned long)statbuf.f_blocks,
39 (unsigned long)statbuf.f_bfree);
40 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
41 (unsigned long)statbuf.f_bavail,
42 (unsigned long)statbuf.f_files,
43 (unsigned long)statbuf.f_ffree,
44 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
45 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
46 #ifdef _STATFS_F_FRSIZE
47 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
49 #ifdef _STATFS_F_FLAGS
50 tprintf(", f_flags=%lu", (unsigned long)statbuf.f_flags);
56 sys_statfs(struct tcb *tcp)
59 printpath(tcp, tcp->u_arg[0]);
62 printstatfs(tcp, tcp->u_arg[1]);
68 sys_fstatfs(struct tcb *tcp)
71 printfd(tcp, tcp->u_arg[0]);
74 printstatfs(tcp, tcp->u_arg[1]);
79 #ifdef HAVE_STRUCT_STATFS64
81 printstatfs64(struct tcb *tcp, long addr)
83 struct statfs64 statbuf;
85 if (syserror(tcp) || !verbose(tcp)) {
86 tprintf("%#lx", addr);
89 if (umove(tcp, addr, &statbuf) < 0) {
93 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
94 sprintfstype(statbuf.f_type),
95 (unsigned long long)statbuf.f_bsize,
96 (unsigned long long)statbuf.f_blocks,
97 (unsigned long long)statbuf.f_bfree);
98 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
99 (unsigned long long)statbuf.f_bavail,
100 (unsigned long long)statbuf.f_files,
101 (unsigned long long)statbuf.f_ffree,
102 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
103 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
104 #ifdef _STATFS_F_FRSIZE
105 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
107 #ifdef _STATFS_F_FLAGS
108 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
113 struct compat_statfs64 {
127 #if defined AARCH64 || defined X86_64 || defined X32 || defined IA64
128 __attribute__ ((packed, aligned(4)))
131 #if defined AARCH64 || defined ARM
132 /* See arch/arm/kernel/sys_oabi-compat.c for details. */
133 # define COMPAT_STATFS64_PADDED_SIZE (sizeof(struct compat_statfs64) + 4)
137 printcompat_statfs64(struct tcb *tcp, const long addr)
139 struct compat_statfs64 statbuf;
141 if (syserror(tcp) || !verbose(tcp)) {
142 tprintf("%#lx", addr);
145 if (umove(tcp, addr, &statbuf) < 0) {
149 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
150 sprintfstype(statbuf.f_type),
151 (unsigned long)statbuf.f_bsize,
152 (unsigned long long)statbuf.f_blocks,
153 (unsigned long long)statbuf.f_bfree);
154 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
155 (unsigned long long)statbuf.f_bavail,
156 (unsigned long long)statbuf.f_files,
157 (unsigned long long)statbuf.f_ffree,
158 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
159 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
160 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
161 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
165 do_statfs64_fstatfs64(struct tcb *tcp)
168 tprintf(", %lu, ", tcp->u_arg[1]);
170 if (tcp->u_arg[1] == sizeof(struct statfs64))
171 printstatfs64(tcp, tcp->u_arg[2]);
172 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64)
173 #ifdef COMPAT_STATFS64_PADDED_SIZE
174 || tcp->u_arg[1] == COMPAT_STATFS64_PADDED_SIZE
177 printcompat_statfs64(tcp, tcp->u_arg[2]);
185 sys_statfs64(struct tcb *tcp)
188 printpath(tcp, tcp->u_arg[0]);
189 return do_statfs64_fstatfs64(tcp);
193 sys_fstatfs64(struct tcb *tcp)
196 printfd(tcp, tcp->u_arg[0]);
197 return do_statfs64_fstatfs64(tcp);
199 #endif /* HAVE_STRUCT_STATFS64 */
203 osf_statfs(struct tcb *tcp)
206 printpath(tcp, tcp->u_arg[0]);
209 printstatfs(tcp, tcp->u_arg[1]);
210 tprintf(", %lu", tcp->u_arg[2]);
216 osf_fstatfs(struct tcb *tcp)
219 tprintf("%lu, ", tcp->u_arg[0]);
221 printstatfs(tcp, tcp->u_arg[1]);
222 tprintf(", %lu", tcp->u_arg[2]);