Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linux/linux_file.c
Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | |||||
linux_getdents(struct thread *td, struct linux_getdents_args *args) | linux_getdents(struct thread *td, struct linux_getdents_args *args) | ||||
{ | { | ||||
struct dirent *bdp; | struct dirent *bdp; | ||||
caddr_t inp, buf; /* BSD-format */ | caddr_t inp, buf; /* BSD-format */ | ||||
int len, reclen; /* BSD-format */ | int len, reclen; /* BSD-format */ | ||||
caddr_t outp; /* Linux-format */ | caddr_t outp; /* Linux-format */ | ||||
int resid, linuxreclen; /* Linux-format */ | int resid, linuxreclen; /* Linux-format */ | ||||
caddr_t lbuf; /* Linux-format */ | caddr_t lbuf; /* Linux-format */ | ||||
long base; | off_t base; | ||||
struct l_dirent *linux_dirent; | struct l_dirent *linux_dirent; | ||||
int buflen, error; | int buflen, error; | ||||
size_t retval; | size_t retval; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(getdents)) | if (ldebug(getdents)) | ||||
printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count); | printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
linux_getdents64(struct thread *td, struct linux_getdents64_args *args) | linux_getdents64(struct thread *td, struct linux_getdents64_args *args) | ||||
{ | { | ||||
struct dirent *bdp; | struct dirent *bdp; | ||||
caddr_t inp, buf; /* BSD-format */ | caddr_t inp, buf; /* BSD-format */ | ||||
int len, reclen; /* BSD-format */ | int len, reclen; /* BSD-format */ | ||||
caddr_t outp; /* Linux-format */ | caddr_t outp; /* Linux-format */ | ||||
int resid, linuxreclen; /* Linux-format */ | int resid, linuxreclen; /* Linux-format */ | ||||
caddr_t lbuf; /* Linux-format */ | caddr_t lbuf; /* Linux-format */ | ||||
long base; | off_t base; | ||||
struct l_dirent64 *linux_dirent64; | struct l_dirent64 *linux_dirent64; | ||||
int buflen, error; | int buflen, error; | ||||
size_t retval; | size_t retval; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(getdents64)) | if (ldebug(getdents64)) | ||||
uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count); | uprintf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | ||||
int | int | ||||
linux_readdir(struct thread *td, struct linux_readdir_args *args) | linux_readdir(struct thread *td, struct linux_readdir_args *args) | ||||
{ | { | ||||
struct dirent *bdp; | struct dirent *bdp; | ||||
caddr_t buf; /* BSD-format */ | caddr_t buf; /* BSD-format */ | ||||
int linuxreclen; /* Linux-format */ | int linuxreclen; /* Linux-format */ | ||||
caddr_t lbuf; /* Linux-format */ | caddr_t lbuf; /* Linux-format */ | ||||
long base; | off_t base; | ||||
struct l_dirent *linux_dirent; | struct l_dirent *linux_dirent; | ||||
int buflen, error; | int buflen, error; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(readdir)) | if (ldebug(readdir)) | ||||
printf(ARGS(readdir, "%d, *"), args->fd); | printf(ARGS(readdir, "%d, *"), args->fd); | ||||
#endif | #endif | ||||
buflen = LINUX_RECLEN(LINUX_NAME_MAX); | buflen = LINUX_RECLEN(LINUX_NAME_MAX); | ||||
▲ Show 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | #endif | ||||
free(auio, M_IOV); | free(auio, M_IOV); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
linux_mount(struct thread *td, struct linux_mount_args *args) | linux_mount(struct thread *td, struct linux_mount_args *args) | ||||
{ | { | ||||
char fstypename[MFSNAMELEN]; | char fstypename[MFSNAMELEN]; | ||||
char mntonname[MNAMELEN], mntfromname[MNAMELEN]; | char *mntonname, *mntfromname; | ||||
int error; | int error, fsflags; | ||||
int fsflags; | |||||
mntonname = malloc(MNAMELEN, M_TEMP, M_WAITOK); | |||||
mntfromname = malloc(MNAMELEN, M_TEMP, M_WAITOK); | |||||
error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1, | error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1, | ||||
NULL); | NULL); | ||||
if (error) | if (error != 0) | ||||
return (error); | goto out; | ||||
error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL); | error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL); | ||||
if (error) | if (error != 0) | ||||
return (error); | goto out; | ||||
error = copyinstr(args->dir, mntonname, MNAMELEN - 1, NULL); | error = copyinstr(args->dir, mntonname, MNAMELEN - 1, NULL); | ||||
if (error) | if (error != 0) | ||||
return (error); | goto out; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(mount)) | if (ldebug(mount)) | ||||
printf(ARGS(mount, "%s, %s, %s"), | printf(ARGS(mount, "%s, %s, %s"), | ||||
fstypename, mntfromname, mntonname); | fstypename, mntfromname, mntonname); | ||||
#endif | #endif | ||||
if (strcmp(fstypename, "ext2") == 0) { | if (strcmp(fstypename, "ext2") == 0) { | ||||
Show All 21 Lines | if (args->rwflag & LINUX_MS_REMOUNT) | ||||
fsflags |= MNT_UPDATE; | fsflags |= MNT_UPDATE; | ||||
} | } | ||||
error = kernel_vmount(fsflags, | error = kernel_vmount(fsflags, | ||||
"fstype", fstypename, | "fstype", fstypename, | ||||
"fspath", mntonname, | "fspath", mntonname, | ||||
"from", mntfromname, | "from", mntfromname, | ||||
NULL); | NULL); | ||||
out: | |||||
free(mntonname, M_TEMP); | |||||
free(mntfromname, M_TEMP); | |||||
return (error); | return (error); | ||||
} | } | ||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) | ||||
int | int | ||||
linux_oldumount(struct thread *td, struct linux_oldumount_args *args) | linux_oldumount(struct thread *td, struct linux_oldumount_args *args) | ||||
{ | { | ||||
struct linux_umount_args args2; | struct linux_umount_args args2; | ||||
▲ Show 20 Lines • Show All 525 Lines • Show Last 20 Lines |