Пример #1
0
int
linux_statfs(struct thread *td, struct linux_statfs_args *args)
{
	struct l_statfs linux_statfs;
	struct statfs bsd_statfs;
	char *path;
	int error, dev_shm;

	LCONVPATHEXIST(td, args->path, &path);

#ifdef DEBUG
	if (ldebug(statfs))
		printf(ARGS(statfs, "%s, *"), path);
#endif
	dev_shm = 0;
	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
	if (strncmp(path, "/dev/shm", sizeof("/dev/shm") - 1) == 0)
		dev_shm = (path[8] == '\0'
		    || (path[8] == '/' && path[9] == '\0'));
	LFREEPATH(path);
	if (error)
		return (error);
	bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
	if (dev_shm)
		linux_statfs.f_type = LINUX_SHMFS_MAGIC;
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
}
int
linux_statfs(struct thread *td, struct linux_statfs_args *args)
{
	struct l_statfs linux_statfs;
	struct statfs bsd_statfs;
	char *path;
	int error;

	LCONVPATHEXIST(td, args->path, &path);

#ifdef DEBUG
	if (ldebug(statfs))
		printf(ARGS(statfs, "%s, *"), path);
#endif
	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
	LFREEPATH(path);
	if (error)
		return (error);
	bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
}