Date: Thu, 09 Oct 2008 17:11:14 +1100 From: Donald Douwsma Subject: VFS changes to support DMAPI Patch-mainline: ? References: bnc#450658 VFS changes to support DMAPI including open_exec(), mprotect() and build infastructure. Acked-by: Jan Kara --- MAINTAINERS | 7 +++++++ fs/Kconfig | 19 +++++++++++++++++++ fs/Makefile | 2 ++ fs/exec.c | 8 ++++++++ include/linux/fs.h | 2 ++ include/linux/mm.h | 3 +++ mm/mprotect.c | 5 +++++ 7 files changed, 46 insertions(+) --- a/fs/exec.c +++ b/fs/exec.c @@ -690,6 +690,14 @@ struct file *open_exec(const char *name) if (IS_ERR(file)) return file; + if (file->f_op && file->f_op->open_exec) { + err = file->f_op->open_exec(nd.path.dentry->d_inode); + if (err) { + fput(file); + goto out; + } + } + err = deny_write_access(file); if (err) { fput(file); --- a/fs/Kconfig +++ b/fs/Kconfig @@ -557,6 +557,25 @@ config INOTIFY_USER If unsure, say Y. +config DMAPI + tristate "DMAPI support" + help + The Data Management API is a system interface used to implement + the interface defined in the X/Open document: + "Systems Management: Data Storage Management (XDSM) API", + dated February 1997. This interface is used by hierarchical + storage management systems. + + If any DMAPI-capable filesystem is built into the kernel, then + DMAPI must also be built into the kernel. + +config DMAPI_DEBUG + bool "DMAPI debugging support" + depends on DMAPI + help + If you don't know whether you need it, then you don't need it: + answer N. + config QUOTA bool "Quota support" help --- a/fs/Makefile +++ b/fs/Makefile @@ -56,6 +56,8 @@ obj-$(CONFIG_QFMT_V2) += quota_v2.o obj-$(CONFIG_QUOTA_TREE) += quota_tree.o obj-$(CONFIG_QUOTACTL) += quota.o +obj-$(CONFIG_DMAPI) += dmapi/ + obj-$(CONFIG_DNOTIFY) += dnotify.o obj-$(CONFIG_PROC_FS) += proc/ --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1271,6 +1271,8 @@ struct file_operations { int (*flock) (struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); +#define HAVE_FOP_OPEN_EXEC + int (*open_exec) (struct inode *); int (*setlease)(struct file *, long, struct file_lock **); }; --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -173,6 +173,9 @@ struct vm_operations_struct { void (*close)(struct vm_area_struct * area); int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); +#define HAVE_VMOP_MPROTECT + int (*mprotect)(struct vm_area_struct * area, unsigned int newflags); + #ifdef __GENKSYMS__ int (*page_mkwrite)(struct vm_area_struct *, struct page *); #else --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4584,6 +4584,13 @@ W: http://oss.sgi.com/projects/xfs T: git git://oss.sgi.com:8090/xfs/xfs-2.6.git S: Supported +DMAPI +P: Silicon Graphics Inc +M: xfs-masters@oss.sgi.com +L: xfs@oss.sgi.com +W: http://oss.sgi.com/projects/xfs +S: Supported + XILINX SYSTEMACE DRIVER P: Grant Likely M: grant.likely@secretlab.ca --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -294,6 +294,11 @@ SYSCALL_DEFINE3(mprotect, unsigned long, if (error) goto out; + if (vma->vm_ops && vma->vm_ops->mprotect) { + error = vma->vm_ops->mprotect(vma, newflags); + if (error < 0) + goto out; + } tmp = vma->vm_end; if (tmp > end) tmp = end;