15 #include <sys/types.h>
45 if (fstat64(fd, &buf) < 0)
47 }
else if (lstat64(path, &buf) < 0) {
50 stat64_to_hostfs(&buf, p);
64 if (
access(path, mode) != 0)
79 else panic(
"Impossible mode in open_file");
83 fd = open64(path, mode);
100 unsigned long long *ino_out,
int *len_out,
101 unsigned int *type_out)
110 *len_out =
strlen(ent->d_name);
111 *ino_out = ent->d_ino;
112 *type_out = ent->d_type;
121 n =
pread64(fd, buf, len, *offset);
132 n =
pwrite64(fd, buf, len, *offset);
143 ret = lseek64(fd, offset, whence);
164 return dup2(oldfd, fd);
169 close(*((
int *) stream));
178 int gw,
int gx,
int or,
int ow,
int ox)
206 if (fchmod(fd, attrs->
ia_mode) != 0)
208 }
else if (chmod(file, attrs->
ia_mode) != 0) {
214 if (fchown(fd, attrs->
ia_uid, -1))
216 }
else if (chown(file, attrs->
ia_uid, -1)) {
222 if (fchown(fd, -1, attrs->
ia_gid))
224 }
else if (chown(file, -1, attrs->
ia_gid)) {
230 if (ftruncate(fd, attrs->
ia_size))
232 }
else if (truncate(file, attrs->
ia_size)) {
248 times[0].
tv_sec = st.atime.tv_sec;
249 times[0].
tv_usec = st.atime.tv_nsec / 1000;
250 times[1].
tv_sec = st.mtime.tv_sec;
251 times[1].
tv_usec = st.mtime.tv_nsec / 1000;
263 if (futimes(fd, times) != 0)
265 }
else if (utimes(file, times) != 0) {
285 err = symlink(to, from);
305 err = mkdir(file, mode);
325 err = mknod(file, mode,
os_makedev(major, minor));
335 err =
link(to, from);
345 n = readlink(file, buf, size);
357 err = rename(from, to);
363 int do_statfs(
char *root,
long *bsize_out,
long long *blocks_out,
364 long long *bfree_out,
long long *bavail_out,
365 long long *files_out,
long long *ffree_out,
366 void *fsid_out,
int fsid_size,
long *namelen_out)
382 sizeof(buf.
f_fsid) > fsid_size ? fsid_size :