Deleted Added
full compact
linux_file.c (111797) linux_file.c (111798)
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer
9 * notice, this list of conditions and the following disclaimer
10 * in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
10 * in this position and unchanged.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/compat/linux/linux_file.c 111797 2003-03-03 09:14:26Z des $
28 * $FreeBSD: head/sys/compat/linux/linux_file.c 111798 2003-03-03 09:17:12Z des $
29 */
30
31#include "opt_compat.h"
32#include "opt_mac.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/conf.h>

--- 55 unchanged lines hidden (view full) ---

92#ifdef DEBUG
93 if (ldebug(open))
94 printf(ARGS(open, "%s, 0x%x, 0x%x"),
95 path, args->flags, args->mode);
96#endif
97 bsd_flags = 0;
98 if (args->flags & LINUX_O_RDONLY)
99 bsd_flags |= O_RDONLY;
29 */
30
31#include "opt_compat.h"
32#include "opt_mac.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/conf.h>

--- 55 unchanged lines hidden (view full) ---

92#ifdef DEBUG
93 if (ldebug(open))
94 printf(ARGS(open, "%s, 0x%x, 0x%x"),
95 path, args->flags, args->mode);
96#endif
97 bsd_flags = 0;
98 if (args->flags & LINUX_O_RDONLY)
99 bsd_flags |= O_RDONLY;
100 if (args->flags & LINUX_O_WRONLY)
100 if (args->flags & LINUX_O_WRONLY)
101 bsd_flags |= O_WRONLY;
102 if (args->flags & LINUX_O_RDWR)
103 bsd_flags |= O_RDWR;
104 if (args->flags & LINUX_O_NDELAY)
105 bsd_flags |= O_NONBLOCK;
106 if (args->flags & LINUX_O_APPEND)
107 bsd_flags |= O_APPEND;
108 if (args->flags & LINUX_O_SYNC)

--- 131 unchanged lines hidden (view full) ---

240 ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1))
241
242#define LINUX_DIRBLKSIZ 512
243
244static int
245getdents_common(struct thread *td, struct linux_getdents64_args *args,
246 int is64bit)
247{
101 bsd_flags |= O_WRONLY;
102 if (args->flags & LINUX_O_RDWR)
103 bsd_flags |= O_RDWR;
104 if (args->flags & LINUX_O_NDELAY)
105 bsd_flags |= O_NONBLOCK;
106 if (args->flags & LINUX_O_APPEND)
107 bsd_flags |= O_APPEND;
108 if (args->flags & LINUX_O_SYNC)

--- 131 unchanged lines hidden (view full) ---

240 ALIGN((((char *)&(de)->d_name - (char *)de) + (namlen) + 1))
241
242#define LINUX_DIRBLKSIZ 512
243
244static int
245getdents_common(struct thread *td, struct linux_getdents64_args *args,
246 int is64bit)
247{
248 register struct dirent *bdp;
248 struct dirent *bdp;
249 struct vnode *vp;
250 caddr_t inp, buf; /* BSD-format */
251 int len, reclen; /* BSD-format */
252 caddr_t outp; /* Linux-format */
253 int resid, linuxreclen=0; /* Linux-format */
254 struct file *fp;
255 struct uio auio;
256 struct iovec aiov;

--- 473 unchanged lines hidden (view full) ---

730 bsd.offset = uap->offset;
731 return pwrite(td, &bsd);
732}
733
734int
735linux_mount(struct thread *td, struct linux_mount_args *args)
736{
737 struct ufs_args ufs;
249 struct vnode *vp;
250 caddr_t inp, buf; /* BSD-format */
251 int len, reclen; /* BSD-format */
252 caddr_t outp; /* Linux-format */
253 int resid, linuxreclen=0; /* Linux-format */
254 struct file *fp;
255 struct uio auio;
256 struct iovec aiov;

--- 473 unchanged lines hidden (view full) ---

730 bsd.offset = uap->offset;
731 return pwrite(td, &bsd);
732}
733
734int
735linux_mount(struct thread *td, struct linux_mount_args *args)
736{
737 struct ufs_args ufs;
738 char fstypename[MFSNAMELEN];
739 char mntonname[MNAMELEN], mntfromname[MNAMELEN];
738 char fstypename[MFSNAMELEN];
739 char mntonname[MNAMELEN], mntfromname[MNAMELEN];
740 int error;
741 int fsflags;
742 const char *fstype;
743 void *fsdata;
744
740 int error;
741 int fsflags;
742 const char *fstype;
743 void *fsdata;
744
745 error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
745 error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
746 NULL);
747 if (error)
746 NULL);
747 if (error)
748 return (error);
749 error = copyinstr(args->specialfile, mntfromname, MFSNAMELEN - 1, NULL);
748 return (error);
749 error = copyinstr(args->specialfile, mntfromname, MFSNAMELEN - 1, NULL);
750 if (error)
750 if (error)
751 return (error);
752 error = copyinstr(args->dir, mntonname, MFSNAMELEN - 1, NULL);
751 return (error);
752 error = copyinstr(args->dir, mntonname, MFSNAMELEN - 1, NULL);
753 if (error)
753 if (error)
754 return (error);
754 return (error);
755
756#ifdef DEBUG
757 if (ldebug(mount))
758 printf(ARGS(mount, "%s, %s, %s"),
759 fstypename, mntfromname, mntonname);
760#endif
761
762 if (strcmp(fstypename, "ext2") == 0) {

--- 14 unchanged lines hidden (view full) ---

777 fsflags = 0;
778
779 if ((args->rwflag & 0xffff0000) == 0xc0ed0000) {
780 /*
781 * Linux SYNC flag is not included; the closest equivalent
782 * FreeBSD has is !ASYNC, which is our default.
783 */
784 if (args->rwflag & LINUX_MS_RDONLY)
755
756#ifdef DEBUG
757 if (ldebug(mount))
758 printf(ARGS(mount, "%s, %s, %s"),
759 fstypename, mntfromname, mntonname);
760#endif
761
762 if (strcmp(fstypename, "ext2") == 0) {

--- 14 unchanged lines hidden (view full) ---

777 fsflags = 0;
778
779 if ((args->rwflag & 0xffff0000) == 0xc0ed0000) {
780 /*
781 * Linux SYNC flag is not included; the closest equivalent
782 * FreeBSD has is !ASYNC, which is our default.
783 */
784 if (args->rwflag & LINUX_MS_RDONLY)
785 fsflags |= MNT_RDONLY;
785 fsflags |= MNT_RDONLY;
786 if (args->rwflag & LINUX_MS_NOSUID)
786 if (args->rwflag & LINUX_MS_NOSUID)
787 fsflags |= MNT_NOSUID;
787 fsflags |= MNT_NOSUID;
788 if (args->rwflag & LINUX_MS_NODEV)
788 if (args->rwflag & LINUX_MS_NODEV)
789 fsflags |= MNT_NODEV;
789 fsflags |= MNT_NODEV;
790 if (args->rwflag & LINUX_MS_NOEXEC)
790 if (args->rwflag & LINUX_MS_NOEXEC)
791 fsflags |= MNT_NOEXEC;
791 fsflags |= MNT_NOEXEC;
792 if (args->rwflag & LINUX_MS_REMOUNT)
792 if (args->rwflag & LINUX_MS_REMOUNT)
793 fsflags |= MNT_UPDATE;
793 fsflags |= MNT_UPDATE;
794 }
795
796 return (vfs_mount(td, fstype, mntonname, fsflags, fsdata));
797}
798
799int
800linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
801{

--- 334 unchanged lines hidden ---
794 }
795
796 return (vfs_mount(td, fstype, mntonname, fsflags, fsdata));
797}
798
799int
800linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
801{

--- 334 unchanged lines hidden ---