Deleted Added
full compact
linux_file.c (132708) linux_file.c (133816)
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

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

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
29#include <sys/cdefs.h>
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

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

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
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_file.c 132708 2004-07-27 21:38:42Z phk $");
30__FBSDID("$FreeBSD: head/sys/compat/linux/linux_file.c 133816 2004-08-16 07:28:16Z tjr $");
31
32#include "opt_compat.h"
33#include "opt_mac.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

49#include <sys/sysproto.h>
50#include <sys/tty.h>
51#include <sys/vnode.h>
52
53#include <ufs/ufs/extattr.h>
54#include <ufs/ufs/quota.h>
55#include <ufs/ufs/ufsmount.h>
56
31
32#include "opt_compat.h"
33#include "opt_mac.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/conf.h>
38#include <sys/dirent.h>

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

49#include <sys/sysproto.h>
50#include <sys/tty.h>
51#include <sys/vnode.h>
52
53#include <ufs/ufs/extattr.h>
54#include <ufs/ufs/quota.h>
55#include <ufs/ufs/ufsmount.h>
56
57#include "opt_compat.h"
58
59#if !COMPAT_LINUX32
57#include <machine/../linux/linux.h>
58#include <machine/../linux/linux_proto.h>
60#include <machine/../linux/linux.h>
61#include <machine/../linux/linux_proto.h>
62#else
63#include <machine/../linux32/linux.h>
64#include <machine/../linux32/linux32_proto.h>
65#endif
59#include <compat/linux/linux_util.h>
60
61#ifndef __alpha__
62int
63linux_creat(struct thread *td, struct linux_creat_args *args)
64{
65 char *path;
66 int error;

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

822 */
823
824struct l_flock {
825 l_short l_type;
826 l_short l_whence;
827 l_off_t l_start;
828 l_off_t l_len;
829 l_pid_t l_pid;
66#include <compat/linux/linux_util.h>
67
68#ifndef __alpha__
69int
70linux_creat(struct thread *td, struct linux_creat_args *args)
71{
72 char *path;
73 int error;

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

829 */
830
831struct l_flock {
832 l_short l_type;
833 l_short l_whence;
834 l_off_t l_start;
835 l_off_t l_len;
836 l_pid_t l_pid;
830};
837}
838#if __amd64__ && COMPAT_LINUX32
839__packed
840#endif
841;
831
832static void
833linux_to_bsd_flock(struct l_flock *linux_flock, struct flock *bsd_flock)
834{
835 switch (linux_flock->l_type) {
836 case LINUX_F_RDLCK:
837 bsd_flock->l_type = F_RDLCK;
838 break;

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

867 break;
868 }
869 linux_flock->l_whence = bsd_flock->l_whence;
870 linux_flock->l_start = (l_off_t)bsd_flock->l_start;
871 linux_flock->l_len = (l_off_t)bsd_flock->l_len;
872 linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid;
873}
874
842
843static void
844linux_to_bsd_flock(struct l_flock *linux_flock, struct flock *bsd_flock)
845{
846 switch (linux_flock->l_type) {
847 case LINUX_F_RDLCK:
848 bsd_flock->l_type = F_RDLCK;
849 break;

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

878 break;
879 }
880 linux_flock->l_whence = bsd_flock->l_whence;
881 linux_flock->l_start = (l_off_t)bsd_flock->l_start;
882 linux_flock->l_len = (l_off_t)bsd_flock->l_len;
883 linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid;
884}
885
875#if defined(__i386__)
886#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32)
876struct l_flock64 {
877 l_short l_type;
878 l_short l_whence;
879 l_loff_t l_start;
880 l_loff_t l_len;
881 l_pid_t l_pid;
887struct l_flock64 {
888 l_short l_type;
889 l_short l_whence;
890 l_loff_t l_start;
891 l_loff_t l_len;
892 l_pid_t l_pid;
882};
893}
894#if __amd64__ && COMPAT_LINUX32
895__packed
896#endif
897;
883
884static void
885linux_to_bsd_flock64(struct l_flock64 *linux_flock, struct flock *bsd_flock)
886{
887 switch (linux_flock->l_type) {
888 case LINUX_F_RDLCK:
889 bsd_flock->l_type = F_RDLCK;
890 break;

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

918 linux_flock->l_type = LINUX_F_UNLCK;
919 break;
920 }
921 linux_flock->l_whence = bsd_flock->l_whence;
922 linux_flock->l_start = (l_loff_t)bsd_flock->l_start;
923 linux_flock->l_len = (l_loff_t)bsd_flock->l_len;
924 linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid;
925}
898
899static void
900linux_to_bsd_flock64(struct l_flock64 *linux_flock, struct flock *bsd_flock)
901{
902 switch (linux_flock->l_type) {
903 case LINUX_F_RDLCK:
904 bsd_flock->l_type = F_RDLCK;
905 break;

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

933 linux_flock->l_type = LINUX_F_UNLCK;
934 break;
935 }
936 linux_flock->l_whence = bsd_flock->l_whence;
937 linux_flock->l_start = (l_loff_t)bsd_flock->l_start;
938 linux_flock->l_len = (l_loff_t)bsd_flock->l_len;
939 linux_flock->l_pid = (l_pid_t)bsd_flock->l_pid;
940}
926#endif /* __i386__ */
941#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
927
928#if defined(__alpha__)
929#define linux_fcntl64_args linux_fcntl_args
930#endif
931
932static int
933fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
934{

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

1046#endif
1047
1048 args64.fd = args->fd;
1049 args64.cmd = args->cmd;
1050 args64.arg = args->arg;
1051 return (fcntl_common(td, &args64));
1052}
1053
942
943#if defined(__alpha__)
944#define linux_fcntl64_args linux_fcntl_args
945#endif
946
947static int
948fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
949{

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

1061#endif
1062
1063 args64.fd = args->fd;
1064 args64.cmd = args->cmd;
1065 args64.arg = args->arg;
1066 return (fcntl_common(td, &args64));
1067}
1068
1054#if defined(__i386__)
1069#if defined(__i386__) || (defined(__amd64__) && COMPAT_LINUX32)
1055int
1056linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
1057{
1058 struct l_flock64 linux_flock;
1059 struct flock bsd_flock;
1060 int error;
1061
1062#ifdef DEBUG

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

1094 return (error);
1095 linux_to_bsd_flock64(&linux_flock, &bsd_flock);
1096 return (kern_fcntl(td, args->fd, F_SETLKW,
1097 (intptr_t)&bsd_flock));
1098 }
1099
1100 return (fcntl_common(td, args));
1101}
1070int
1071linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
1072{
1073 struct l_flock64 linux_flock;
1074 struct flock bsd_flock;
1075 int error;
1076
1077#ifdef DEBUG

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

1109 return (error);
1110 linux_to_bsd_flock64(&linux_flock, &bsd_flock);
1111 return (kern_fcntl(td, args->fd, F_SETLKW,
1112 (intptr_t)&bsd_flock));
1113 }
1114
1115 return (fcntl_common(td, args));
1116}
1102#endif /* __i386__ */
1117#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1103
1104int
1105linux_chown(struct thread *td, struct linux_chown_args *args)
1106{
1107 char *path;
1108 int error;
1109
1110 LCONVPATHEXIST(td, args->path, &path);

--- 26 unchanged lines hidden ---
1118
1119int
1120linux_chown(struct thread *td, struct linux_chown_args *args)
1121{
1122 char *path;
1123 int error;
1124
1125 LCONVPATHEXIST(td, args->path, &path);

--- 26 unchanged lines hidden ---