lkml.org 
[lkml]   [2000]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Stackable filesystem fixes for 2.4.0test5 (-pre3)
This patch provides better support for stackable filesystem based on
fist (http://www.cs.columbia.edu/~ezk/research/fist/, patch for
fist 0.0.3 to support Linux 2.4 at ftp.openlinux.org:/pub/people/hch).
All work was done by Erez Zadok, I've only ported it to Linux 2.4.

Please apply, this patch is completly passive and couldn"t impact kernel
stability.

Christoph


diff -uNr --exclude-from=exclude linux.orig/fs/exec.c linux/fs/exec.c
--- linux.orig/fs/exec.c Wed Jul 19 14:39:40 2000
+++ linux/fs/exec.c Wed Jul 19 15:16:52 2000
@@ -117,7 +117,7 @@
if (error)
goto exit;

- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
+ file = dentry_open(nd.dentry, nd.mnt, FMODE_READ, O_RDONLY);
error = PTR_ERR(file);
if (IS_ERR(file))
goto out;
@@ -348,7 +348,7 @@
int err = permission(inode, MAY_EXEC);
file = ERR_PTR(err);
if (!err) {
- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY);
+ file = dentry_open(nd.dentry, nd.mnt, FMODE_READ, O_RDONLY);
if (!IS_ERR(file)) {
err = deny_write_access(file);
if (err) {
diff -uNr --exclude-from=exclude linux.orig/fs/open.c linux/fs/open.c
--- linux.orig/fs/open.c Wed Jul 19 14:39:40 2000
+++ linux/fs/open.c Wed Jul 19 15:16:52 2000
@@ -587,12 +587,12 @@
}

/*
- * Note that while the flag value (low two bits) for sys_open means:
+ * Note that while the flags value (low two bits) for sys_open means:
* 00 - read-only
* 01 - write-only
* 10 - read-write
* 11 - special
- * it is changed into
+ * when it is copied into open_flags, it is changed into
* 00 - no permissions needed
* 01 - read-permission
* 10 - write-permission
@@ -602,23 +602,24 @@
*/
struct file *filp_open(const char * filename, int flags, int mode)
{
- int namei_flags, error;
+ int namei_flags, open_flags, error;
struct nameidata nd;

namei_flags = flags;
- if ((namei_flags+1) & O_ACCMODE)
+ open_flags = ((namei_flags+1) & O_ACCMODE);
+ if (open_flags)
namei_flags++;
if (namei_flags & O_TRUNC)
namei_flags |= 2;

error = open_namei(filename, namei_flags, mode, &nd);
if (!error)
- return dentry_open(nd.dentry, nd.mnt, flags);
+ return dentry_open(nd.dentry, nd.mnt, open_flags, flags);

return ERR_PTR(error);
}

-struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
+struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int mode, int flags)
{
struct file * f;
struct inode *inode;
@@ -629,7 +630,7 @@
if (!f)
goto cleanup_dentry;
f->f_flags = flags;
- f->f_mode = (flags+1) & O_ACCMODE;
+ f->f_mode = mode;
inode = dentry->d_inode;
if (f->f_mode & FMODE_WRITE) {
error = get_write_access(inode);
diff -uNr --exclude-from=exclude linux.orig/include/linux/fs.h linux/include/linux/fs.h
--- linux.orig/include/linux/fs.h Wed Jul 19 14:56:28 2000
+++ linux/include/linux/fs.h Wed Jul 19 15:16:53 2000
@@ -879,7 +879,7 @@
extern int do_truncate(struct dentry *, loff_t start);

extern struct file *filp_open(const char *, int, int);
-extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
+extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, int);
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);

diff -uNr --exclude-from=exclude linux.orig/include/linux/fs.h~ linux/include/linux/fs.h~
--- linux.orig/include/linux/fs.h~ Wed Jul 19 14:33:58 2000
+++ linux/include/linux/fs.h~ Wed Jul 19 14:56:28 2000
@@ -879,7 +879,7 @@
extern int do_truncate(struct dentry *, loff_t start);

extern struct file *filp_open(const char *, int, int);
-extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, int);
+extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
extern int filp_close(struct file *, fl_owner_t id);
extern char * getname(const char *);

diff -uNr --exclude-from=exclude linux.orig/include/linux/mm.h linux/include/linux/mm.h
--- linux.orig/include/linux/mm.h Wed Jul 19 14:56:28 2000
+++ linux/include/linux/mm.h Wed Jul 19 15:16:53 2000
@@ -544,6 +544,21 @@
#define vmlist_modify_lock(mm) vmlist_access_lock(mm)
#define vmlist_modify_unlock(mm) vmlist_access_unlock(mm)

+/*
+ * Common MM functions for inclusion in the VFS
+ * or in other stackable file systems. Some of these
+ * functions were in linux/mm/ C files.
+ *
+ */
+static inline int sync_page(struct page *page)
+{
+ struct address_space *mapping = page->mapping;
+
+ if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
+ return mapping->a_ops->sync_page(page);
+ return 0;
+}
+
#endif /* __KERNEL__ */

#endif
diff -uNr --exclude-from=exclude linux.orig/include/linux/mm.h~ linux/include/linux/mm.h~
--- linux.orig/include/linux/mm.h~ Wed Jul 19 14:33:58 2000
+++ linux/include/linux/mm.h~ Wed Jul 19 14:56:28 2000
@@ -544,21 +544,6 @@
#define vmlist_modify_lock(mm) vmlist_access_lock(mm)
#define vmlist_modify_unlock(mm) vmlist_access_unlock(mm)

-/*
- * Common MM functions for inclusion in the VFS
- * or in other stackable file systems. Some of these
- * functions were in linux/mm/ C files.
- *
- */
-static inline int sync_page(struct page *page)
-{
- struct address_space *mapping = page->mapping;
-
- if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
- return mapping->a_ops->sync_page(page);
- return 0;
-}
-
#endif /* __KERNEL__ */

#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.041 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site