mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org,
	linux-fsdevel@vger.kernel.org,
	Jacob Thebault-Spieker <summatusmentis@gmail.com>
Subject: [PATCH 02/17] VFS: Implement the AFS system call
Date: Tue, 16 Jun 2009 21:38:56 +0100	[thread overview]
Message-ID: <20090616203856.4526.36438.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20090616203845.4526.60013.stgit@warthog.procyon.org.uk>

From: Jacob Thebault-Spieker <summatusmentis@gmail.com>

Implement the AFS system call, supporting just the pioctl() function for now.

Signed-off-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
---

 arch/x86/ia32/ia32entry.S          |    2 +-
 arch/x86/include/asm/unistd_64.h   |    2 +-
 arch/x86/kernel/syscall_table_32.S |    2 +-
 fs/Makefile                        |    5 ++++-
 fs/afs/Kconfig                     |   12 ++++++++++++
 fs/afs/pioctl.c                    |    1 +
 fs/afs_call.c                      |   33 ++++++++++++++++++++++++++++++++
 fs/afs_compat.c                    |   37 ++++++++++++++++++++++++++++++++++++
 include/linux/afscall.h            |   16 ++++++++++++++++
 include/linux/syscalls.h           |    2 ++
 10 files changed, 108 insertions(+), 4 deletions(-)
 create mode 100644 fs/afs_call.c
 create mode 100644 fs/afs_compat.c
 create mode 100644 include/linux/afscall.h


diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 5caa7bd..43abb72 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -632,7 +632,7 @@ ia32_sys_call_table:
 	.quad quiet_ni_syscall	/* bdflush */
 	.quad sys_sysfs		/* 135 */
 	.quad sys_personality
-	.quad quiet_ni_syscall	/* for afs_syscall */
+	.quad compat_sys_afs	/* for afs_syscall */
 	.quad sys_setfsuid16
 	.quad sys_setfsgid16
 	.quad sys_llseek		/* 140 */
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 495d0fb..5b0a806 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -424,7 +424,7 @@ __SYSCALL(__NR_putpmsg, sys_ni_syscall)
 
 /* reserved for AFS */
 #define __NR_afs_syscall			183
-__SYSCALL(__NR_afs_syscall, sys_ni_syscall)
+__SYSCALL(__NR_afs_syscall, sys_afs)
 
 /* reserved for tux */
 #define __NR_tuxcall				184
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index 723f33e..530c5d0 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -136,7 +136,7 @@ ENTRY(sys_call_table)
 	.long sys_bdflush
 	.long sys_sysfs		/* 135 */
 	.long sys_personality
-	.long sys_ni_syscall	/* reserved for afs_syscall */
+	.long sys_afs	/* reserved for afs_syscall */
 	.long sys_setfsuid16
 	.long sys_setfsgid16
 	.long sys_llseek	/* 140 */
diff --git a/fs/Makefile b/fs/Makefile
index d5bf38a..a75d3d9 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -64,7 +64,10 @@ obj-y				+= devpts/
 
 obj-$(CONFIG_PROFILING)		+= dcookies.o
 obj-$(CONFIG_DLM)		+= dlm/
- 
+
+afs-compat-$(CONFIG_COMPAT)	+= afs_compat.o
+obj-$(CONFIG_AFS_CALL)		+= afs_call.o $(afs-compat-y)
+
 # Do not add any filesystems before this line
 obj-$(CONFIG_FSCACHE)		+= fscache/
 obj-$(CONFIG_REISERFS_FS)	+= reiserfs/
diff --git a/fs/afs/Kconfig b/fs/afs/Kconfig
index 2bd2324..6871ca3 100644
--- a/fs/afs/Kconfig
+++ b/fs/afs/Kconfig
@@ -1,8 +1,15 @@
+config AFS_CALL
+	bool "Enable AFS system call"
+	depends on EXPERIMENTAL
+	help
+	  Enable AFS system call functions, AFS_FS depends on this option.
+
 config AFS_FS
 	tristate "Andrew File System support (AFS) (EXPERIMENTAL)"
 	depends on INET && EXPERIMENTAL
 	select AF_RXRPC
 	select PIOCTL
+ 	select AFS_CALL
 	help
 	  If you say Y here, you will get an experimental Andrew File System
 	  driver. It currently only supports unsecured read-only AFS access.
@@ -28,3 +35,8 @@ config AFS_FSCACHE
 	help
 	  Say Y here if you want AFS data to be cached locally on disk through
 	  the generic filesystem cache manager
+
+
+
+
+
diff --git a/fs/afs/pioctl.c b/fs/afs/pioctl.c
index e266f27..5a76017 100644
--- a/fs/afs/pioctl.c
+++ b/fs/afs/pioctl.c
@@ -8,6 +8,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <linux/fs.h>
+#include <linux/afscall.h>
 #include <linux/pioctl.h>
 #include "internal.h"
 
diff --git a/fs/afs_call.c b/fs/afs_call.c
new file mode 100644
index 0000000..5dc28f8
--- /dev/null
+++ b/fs/afs_call.c
@@ -0,0 +1,33 @@
+/* AFS system call multiplexor
+ *
+ * Copyright (C) 2009 David Howells <dhowells@redhat.com>
+ * Copyright (C) 2008 Jacob Thebault-Spieker <summatusmentis@gmail.com>
+ *
+ * Modified by David Howells <dhowells@redhat.com>
+ *
+ * This program is free software; you can redistribute it a/or
+ * modify it uer the terms of the GNU General Public License
+ * as published by the Free Software Fouation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/syscalls.h>
+#include <linux/afscall.h>
+#include <linux/pioctl.h>
+
+/*
+ * The AFS system call entry point
+ */
+SYSCALL_DEFINE5(afs, int, option,
+		unsigned long, arg2, unsigned long, arg3,
+		unsigned long, arg4, unsigned long, arg5)
+{
+	switch (option) {
+	case AFSCALL_PIOCTL:
+		return sys_pioctl((const char __user *) arg2, (int) arg3,
+				  (struct ViceIoctl __user *) arg4, (int) arg5);
+
+	default:
+		printk(KERN_NOTICE "Unknown AFS call %x invoked\n", option);
+		return -ENOSYS;
+	}
+}
diff --git a/fs/afs_compat.c b/fs/afs_compat.c
new file mode 100644
index 0000000..0add585
--- /dev/null
+++ b/fs/afs_compat.c
@@ -0,0 +1,37 @@
+/* AFS syscall multiplexor, compatibility
+ *
+ * Copyright (C) 2009 David Howells <dhowells@redhat.com>
+ * Copyright (C) 2008 Jacob Thebault-Spieker <summatusmentis@gmail.com>
+ *
+ * Modified by David Howells <dhowells@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/syscalls.h>
+#include <linux/afscall.h>
+#include <linux/pioctl.h>
+#include <linux/compat.h>
+
+/*
+ * The AFS system call 32-bit compatibility entry point
+ */
+asmlinkage long compat_sys_afs(int option,
+			       unsigned long arg2, unsigned long arg3,
+			       unsigned long arg4, unsigned long arg5)
+{
+	switch (option) {
+	case AFSCALL_PIOCTL:
+		return compat_sys_pioctl(
+			(const char __user *) compat_ptr(arg2),
+			(int) arg3,
+			(struct compat_ViceIoctl __user *) compat_ptr(arg4),
+			(int) arg5);
+
+	default:
+		printk(KERN_NOTICE "Unknown AFS call %x invoked\n", option);
+		return -ENOSYS;
+	}
+}
diff --git a/include/linux/afscall.h b/include/linux/afscall.h
new file mode 100644
index 0000000..40cbfa5
--- /dev/null
+++ b/include/linux/afscall.h
@@ -0,0 +1,16 @@
+/* AFS system call multiplexor
+ *
+ * Copyright (C) 2008 Jacob Thebault-Spieker <summatusmentis@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LINUX_AFSCALL_H
+#define _LINUX_AFSCALL_H
+
+#define AFSCALL_PIOCTL 0x14
+
+#endif /* _LINUX_AFSCALL_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index ab6f49f..0a8a194 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -764,5 +764,7 @@ asmlinkage long sys_perf_counter_open(
 
 asmlinkage long sys_pioctl(const char __user *filename, int cmd,
 			   struct ViceIoctl __user *args, int nofollow);
+asmlinkage long sys_afs(int option, unsigned long arg2, unsigned long arg3,
+			unsigned long arg4, unsigned long arg5);
 
 #endif


  parent reply	other threads:[~2009-06-16 20:42 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 20:38 [PATCH 00/17] [RFC] AFS: Implement OpenAFS pioctls(version)s David Howells
2009-06-16 20:38 ` [PATCH 01/17] VFS: Implement the pioctl() system call David Howells
2009-06-16 20:54   ` Christoph Hellwig
2009-06-17  0:19   ` David Howells
2009-06-17  9:02     ` Alan Cox
2009-06-16 20:38 ` David Howells [this message]
2009-06-16 20:39 ` [PATCH 03/17] VFS: Implement handling for pathless pioctls David Howells
2009-06-17  7:47   ` Andreas Dilger
2009-06-17 18:26   ` David Howells
2009-06-16 20:39 ` [PATCH 04/17] AFS: Add key request for pioctl David Howells
2009-06-16 20:39 ` [PATCH 05/17] AFS: Handle pathless pioctls aimed at AFS David Howells
2009-06-16 20:39 ` [PATCH 06/17] VFS: Define pioctl command wrappers David Howells
2009-06-16 20:39 ` [PATCH 07/17] AFS: Implement the PGetFid pioctl David Howells
2009-06-16 20:39 ` [PATCH 08/17] AFS: Implement the PGetFileCell pioctl David Howells
2009-06-16 20:39 ` [PATCH 09/17] AFS: Implement the PGetVolStat pioctl David Howells
2009-06-16 20:39 ` [PATCH 10/17] AFS: Implement the PWhereIs pioctl David Howells
2009-06-17  7:51   ` Andreas Dilger
2009-06-17 18:05   ` David Howells
2009-06-16 20:39 ` [PATCH 11/17] AFS: Implement the PFlushCB pioctl David Howells
2009-06-16 20:39 ` [PATCH 12/17] KEYS: Export lookup_user_key() and the key permission request flags David Howells
2009-06-16 20:39 ` [PATCH 13/17] RxRPC: Record extra data in key David Howells
2009-06-16 20:39 ` [PATCH 14/17] RxRPC: Declare the security index constants symbolically David Howells
2009-06-16 20:40 ` [PATCH 15/17] AFS: Implement the PSetTokens pioctl David Howells
2009-06-16 20:40 ` [PATCH 16/17] KEYS: Add a function by which the contents of a keyring can be enumerated David Howells
2009-06-16 20:40 ` [PATCH 17/17] AFS: Implement the PGetTokens pioctl David Howells
2009-06-16 22:59 ` [PATCH 00/17] [RFC] AFS: Implement OpenAFS pioctls(version)s David Howells
2009-06-16 23:11   ` Alan Cox
2009-06-17  0:25   ` David Howells
2009-06-17  7:55     ` Andreas Dilger
2009-06-17 16:09       ` Linus Torvalds
2009-06-17 18:37         ` Al Viro
2009-06-17 18:44           ` Linus Torvalds
2009-06-17 18:52             ` Al Viro
2009-06-17 19:28             ` David Howells
2009-06-18 12:50               ` Olivier Galibert
2009-06-17 17:24       ` David Howells
2009-06-17 17:33         ` Linus Torvalds
2009-06-17 18:03         ` David Howells
2009-06-17 18:24           ` Linus Torvalds
2009-06-17 18:30           ` Theodore Tso
2009-06-17 19:14             ` david
2009-06-17 19:30             ` David Howells
2009-06-17 19:51           ` David Howells
2009-06-17 20:09             ` Linus Torvalds
2009-06-17  9:00     ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090616203856.4526.36438.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=summatusmentis@gmail.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®