forked from pool/openafs
882dc0c539
- Update to 1.8.0 - Fix AArch64 build by updating spec and backporting patches: * add_support_fo_arm64_linux26.patch * dont_require_AFS_SYSCALL.patch * add_AFS_STRINGIZE_macro.patch * avoid_double_param_in_arm64_kernel.patch OBS-URL: https://build.opensuse.org/request/show/604055 OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=15
224 lines
6.8 KiB
Diff
224 lines
6.8 KiB
Diff
From ed513bb516acdb28fc6bbf01714ef2e1df422a8a Mon Sep 17 00:00:00 2001
|
|
From: Andrew Deason <adeason@sinenomine.net>
|
|
Date: Wed, 11 Mar 2015 12:55:42 -0500
|
|
Subject: [PATCH] Do not require AFS_SYSCALL
|
|
|
|
Various parts of the code make use of AFS_SYSCALL in order to
|
|
communicate with the libafs kernel module. Even though most modern
|
|
platforms do not use an actual syscall anymore (instead using an
|
|
ioctl-based method or similar to emulate the traditional AFS syscall),
|
|
some code paths rely on AFS_SYSCALL as a fallback, or just use
|
|
AFS_SYSCALL because they were never updated to use the newer methods.
|
|
|
|
Even platforms that do not use the traditional AFS syscall still
|
|
define the AFS_SYSCALL number, in case someone still uses it for
|
|
something. However, some platforms do not have an AFS syscall number;
|
|
there is no "slot" allocated to us, so we cannot safely issue any
|
|
syscall.
|
|
|
|
For those platforms, we must not reference AFS_SYSCALL at all, or we
|
|
will fail to build. So, get rid of these references to AFS_SYSCALL if
|
|
it is not defined. In some places, we can just avoid the relevant code
|
|
making the syscall. In a few other places, we just pretend like the
|
|
libafs kernel module was not loaded and yield an ENOSYS error, to make
|
|
the code simpler.
|
|
|
|
Change-Id: I38e033caf7149c2b1b567f9877221ca8551db2ea
|
|
Reviewed-on: https://gerrit.openafs.org/11937
|
|
Tested-by: BuildBot <buildbot@rampaginggeek.com>
|
|
Reviewed-by: Ian Wienand <iwienand@redhat.com>
|
|
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
|
|
---
|
|
src/afsd/afsd_kernel.c | 10 ++++++++--
|
|
src/afsd/vsys.c | 4 ++++
|
|
src/rx/rx_user.c | 4 +++-
|
|
src/sys/pioctl.c | 7 ++++++-
|
|
src/sys/setpag.c | 8 +++++++-
|
|
src/venus/fstrace.c | 18 ++++++++++++++++--
|
|
src/viced/viced.c | 13 ++++++++++++-
|
|
src/volser/volmain.c | 7 +++++++
|
|
8 files changed, 63 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/afsd/afsd_kernel.c b/src/afsd/afsd_kernel.c
|
|
index b15df7476c..093ba5cc0c 100644
|
|
--- a/src/afsd/afsd_kernel.c
|
|
+++ b/src/afsd/afsd_kernel.c
|
|
@@ -274,12 +274,18 @@ afsd_call_syscall(struct afsd_syscall_args *args)
|
|
error = os_syscall(args);
|
|
|
|
if (afsd_debug) {
|
|
+ const char *syscall_str;
|
|
+#if defined(AFS_SYSCALL)
|
|
+ syscall_str = AFS_STRINGIZE(AFS_SYSCALL);
|
|
+#else
|
|
+ syscall_str = "[AFS_SYSCALL]";
|
|
+#endif
|
|
if (error == -1) {
|
|
char *s = strerror(errno);
|
|
- printf("SScall(%d, %d, %d)=%d (%d, %s)\n", AFS_SYSCALL, AFSCALL_CALL,
|
|
+ printf("SScall(%s, %d, %d)=%d (%d, %s)\n", syscall_str, AFSCALL_CALL,
|
|
(int)args->params[0], error, errno, s);
|
|
} else {
|
|
- printf("SScall(%d, %d, %d)=%d\n", AFS_SYSCALL, AFSCALL_CALL,
|
|
+ printf("SScall(%s, %d, %d)=%d\n", syscall_str, AFSCALL_CALL,
|
|
(int)args->params[0], error);
|
|
}
|
|
}
|
|
diff --git a/src/afsd/vsys.c b/src/afsd/vsys.c
|
|
index 44f4281626..6b5d3b9bc8 100644
|
|
--- a/src/afsd/vsys.c
|
|
+++ b/src/afsd/vsys.c
|
|
@@ -57,9 +57,13 @@ main(int argc, char **argv)
|
|
numberFlag = 1;
|
|
}
|
|
}
|
|
+#ifdef AFS_SYSCALL
|
|
code =
|
|
syscall(AFS_SYSCALL, parms[0], parms[1], parms[2], parms[3], parms[4],
|
|
parms[5]);
|
|
+#else
|
|
+ code = -1;
|
|
+#endif
|
|
printf("code %d\n", code);
|
|
return 0;
|
|
}
|
|
diff --git a/src/rx/rx_user.c b/src/rx/rx_user.c
|
|
index f135fac0ea..4793494041 100644
|
|
--- a/src/rx/rx_user.c
|
|
+++ b/src/rx/rx_user.c
|
|
@@ -448,8 +448,10 @@ rxi_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|
|
|
|
#if defined(AFS_SGI_ENV)
|
|
rcode = afs_syscall(AFS_SYSCALL, 28, a3, a4, a5);
|
|
-#else
|
|
+#elif defined(AFS_SYSCALL)
|
|
rcode = syscall(AFS_SYSCALL, 28 /* AFSCALL_CALL */ , a3, a4, a5);
|
|
+#else
|
|
+ rcode = -1;
|
|
#endif /* AFS_SGI_ENV */
|
|
|
|
signal(SIGSYS, old);
|
|
diff --git a/src/sys/pioctl.c b/src/sys/pioctl.c
|
|
index 031def2282..f2f9138dee 100644
|
|
--- a/src/sys/pioctl.c
|
|
+++ b/src/sys/pioctl.c
|
|
@@ -51,9 +51,14 @@ lpioctl(char *path, int cmd, void *cmarg, int follow)
|
|
rval = proc_afs_syscall(AFSCALL_PIOCTL, (long)path, cmd, (long)cmarg,
|
|
follow, &errcode);
|
|
|
|
- if(rval)
|
|
+ if(rval) {
|
|
+# ifdef AFS_SYSCALL
|
|
errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg,
|
|
follow);
|
|
+# else
|
|
+ errcode = -1;
|
|
+# endif
|
|
+ }
|
|
|
|
return (errcode);
|
|
}
|
|
diff --git a/src/sys/setpag.c b/src/sys/setpag.c
|
|
index 3c90279ee7..48570bf78a 100644
|
|
--- a/src/sys/setpag.c
|
|
+++ b/src/sys/setpag.c
|
|
@@ -55,8 +55,14 @@ lsetpag(void)
|
|
|
|
rval = proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode);
|
|
|
|
- if(rval)
|
|
+ if(rval) {
|
|
+# ifdef AFS_SYSCALL
|
|
errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
|
|
+# else
|
|
+ errcode = -1;
|
|
+# endif
|
|
+ }
|
|
+
|
|
#elif defined(AFS_DARWIN80_ENV)
|
|
int rval;
|
|
|
|
diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c
|
|
index 12a594972f..04e7407a1a 100644
|
|
--- a/src/venus/fstrace.c
|
|
+++ b/src/venus/fstrace.c
|
|
@@ -1120,12 +1120,22 @@ afs_syscall(long call, long parm0, long parm1, long parm2, long parm3,
|
|
/* Linux can only handle 5 arguments in the actual syscall. */
|
|
if (call == AFSCALL_ICL) {
|
|
rval = proc_afs_syscall(call, parm0, parm1, parm2, (long)eparm, &code);
|
|
- if (rval)
|
|
+ if (rval) {
|
|
+#ifdef AFS_SYSCALL
|
|
code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm);
|
|
+#else
|
|
+ code = -1;
|
|
+#endif
|
|
+ }
|
|
} else {
|
|
rval = proc_afs_syscall(call, parm0, parm1, parm2, parm3, &code);
|
|
- if (rval)
|
|
+ if (rval) {
|
|
+#ifdef AFS_SYSCALL
|
|
code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3);
|
|
+#else
|
|
+ code = -1;
|
|
+#endif
|
|
+ }
|
|
}
|
|
#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
|
|
/* on sparc this function returns none value, so do it myself */
|
|
@@ -1137,7 +1147,11 @@ afs_syscall(long call, long parm0, long parm1, long parm2, long parm3,
|
|
if (!code) code = rval;
|
|
#else
|
|
#if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV)
|
|
+# if defined(AFS_SYSCALL)
|
|
code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3, parm4);
|
|
+# else
|
|
+ code = -1;
|
|
+# endif
|
|
#else
|
|
#if defined(AFS_SGI_ENV)
|
|
code = syscall(AFS_ICL, call, parm0, parm1, parm2, parm3, parm4); /* XXX */
|
|
diff --git a/src/viced/viced.c b/src/viced/viced.c
|
|
index a8b6e337ce..11f21e0e7e 100644
|
|
--- a/src/viced/viced.c
|
|
+++ b/src/viced/viced.c
|
|
@@ -312,7 +312,18 @@ fs_IsLocalRealmMatch(void *rock, char *name, char *inst, char *cell)
|
|
return islocal;
|
|
}
|
|
|
|
-#if !defined(AFS_NT40_ENV) && !defined(AFS_DARWIN160_ENV)
|
|
+#if defined(AFS_NT40_ENV)
|
|
+/* no viced_syscall */
|
|
+#elif defined(AFS_DARWIN160_ENV)
|
|
+/* no viced_syscall */
|
|
+#elif !defined(AFS_SYSCALL)
|
|
+int
|
|
+viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|
|
+{
|
|
+ errno = ENOSYS;
|
|
+ return -1;
|
|
+}
|
|
+#else
|
|
int
|
|
viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|
|
{
|
|
diff --git a/src/volser/volmain.c b/src/volser/volmain.c
|
|
index 430510f4fe..f454dd10dd 100644
|
|
--- a/src/volser/volmain.c
|
|
+++ b/src/volser/volmain.c
|
|
@@ -173,6 +173,13 @@ volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|
|
}
|
|
return err;
|
|
}
|
|
+#elif !defined(AFS_SYSCALL)
|
|
+int
|
|
+volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|
|
+{
|
|
+ errno = ENOSYS;
|
|
+ return -1;
|
|
+}
|
|
#else
|
|
int
|
|
volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
|