===================================================================
@@ -104,12 +104,12 @@
}
}
-const struct dentry_operations v9fs_cached_dentry_operations = {
+COMPAT_dentry_operations v9fs_cached_dentry_operations = {
.d_delete = v9fs_cached_dentry_delete,
.d_release = v9fs_dentry_release,
};
-const struct dentry_operations v9fs_dentry_operations = {
+COMPAT_dentry_operations v9fs_dentry_operations = {
.d_delete = v9fs_dentry_delete,
.d_release = v9fs_dentry_release,
};
===================================================================
@@ -55,7 +55,7 @@
Opt_err
};
-static const match_table_t tokens = {
+static COMPAT_match_table_t tokens = {
{Opt_debug, "debug=%x"},
{Opt_dfltuid, "dfltuid=%u"},
{Opt_dfltgid, "dfltgid=%u"},
@@ -132,10 +132,10 @@
v9ses->afid = option;
break;
case Opt_uname:
- match_strlcpy(v9ses->uname, &args[0], PATH_MAX);
+ COMPAT_match_strlcpy(v9ses->uname, &args[0], PATH_MAX);
break;
case Opt_remotename:
- match_strlcpy(v9ses->aname, &args[0], PATH_MAX);
+ COMPAT_match_strlcpy(v9ses->aname, &args[0], PATH_MAX);
break;
case Opt_nodevmap:
v9ses->nodev = 1;
===================================================================
@@ -41,8 +41,8 @@
extern const struct address_space_operations v9fs_addr_operations;
extern const struct file_operations v9fs_file_operations;
extern const struct file_operations v9fs_dir_operations;
-extern const struct dentry_operations v9fs_dentry_operations;
-extern const struct dentry_operations v9fs_cached_dentry_operations;
+extern COMPAT_dentry_operations v9fs_dentry_operations;
+extern COMPAT_dentry_operations v9fs_cached_dentry_operations;
struct inode *v9fs_get_inode(struct super_block *sb, int mode);
ino_t v9fs_qid2ino(struct p9_qid *qid);
===================================================================
@@ -76,7 +76,7 @@
char *statbuf;
int n, i = 0;
- P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
+ P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->COMPAT_f_dentry->d_name.name);
fid = filp->private_data;
buflen = fid->clnt->msize - P9_IOHDRSZ;
===================================================================
@@ -41,10 +41,10 @@
#include "v9fs_vfs.h"
#include "fid.h"
-static const struct inode_operations v9fs_dir_inode_operations;
-static const struct inode_operations v9fs_dir_inode_operations_ext;
-static const struct inode_operations v9fs_file_inode_operations;
-static const struct inode_operations v9fs_symlink_inode_operations;
+static COMPAT_inode_operations v9fs_dir_inode_operations;
+static COMPAT_inode_operations v9fs_dir_inode_operations_ext;
+static COMPAT_inode_operations v9fs_file_inode_operations;
+static COMPAT_inode_operations v9fs_symlink_inode_operations;
/**
* unixmode2p9mode - convert unix mode bits to plan 9
@@ -1162,7 +1162,7 @@
return retval;
}
-static const struct inode_operations v9fs_dir_inode_operations_ext = {
+static COMPAT_inode_operations v9fs_dir_inode_operations_ext = {
.create = v9fs_vfs_create,
.lookup = v9fs_vfs_lookup,
.symlink = v9fs_vfs_symlink,
@@ -1177,7 +1177,7 @@
.setattr = v9fs_vfs_setattr,
};
-static const struct inode_operations v9fs_dir_inode_operations = {
+static COMPAT_inode_operations v9fs_dir_inode_operations = {
.create = v9fs_vfs_create,
.lookup = v9fs_vfs_lookup,
.unlink = v9fs_vfs_unlink,
@@ -1189,12 +1189,12 @@
.setattr = v9fs_vfs_setattr,
};
-static const struct inode_operations v9fs_file_inode_operations = {
+static COMPAT_inode_operations v9fs_file_inode_operations = {
.getattr = v9fs_vfs_getattr,
.setattr = v9fs_vfs_setattr,
};
-static const struct inode_operations v9fs_symlink_inode_operations = {
+static COMPAT_inode_operations v9fs_symlink_inode_operations = {
.readlink = v9fs_vfs_readlink,
.follow_link = v9fs_vfs_follow_link,
.put_link = v9fs_vfs_put_link,
===================================================================
@@ -45,7 +45,7 @@
#include "fid.h"
static void v9fs_clear_inode(struct inode *);
-static const struct super_operations v9fs_super_ops;
+static COMPAT_super_operations v9fs_super_ops;
/**
* v9fs_clear_inode - release an inode
@@ -225,15 +225,15 @@
}
static void
-v9fs_umount_begin(struct super_block *sb)
+v9fs_umount_begin(COMPAT_umount_begin_args)
{
struct v9fs_session_info *v9ses;
- v9ses = sb->s_fs_info;
+ v9ses = COMPAT_umount_begin_sfi;
v9fs_session_cancel(v9ses);
}
-static const struct super_operations v9fs_super_ops = {
+static COMPAT_super_operations v9fs_super_ops = {
.statfs = simple_statfs,
.clear_inode = v9fs_clear_inode,
.show_options = v9fs_show_options,
===================================================================
@@ -62,7 +62,7 @@
omode = v9fs_uflags2omode(file->f_flags, v9fs_extended(v9ses));
fid = file->private_data;
if (!fid) {
- fid = v9fs_fid_clone(file->f_path.dentry);
+ fid = v9fs_fid_clone(file->COMPAT_f_dentry);
if (IS_ERR(fid))
return PTR_ERR(fid);
@@ -103,7 +103,7 @@
static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
{
int res = 0;
- struct inode *inode = filp->f_path.dentry->d_inode;
+ struct inode *inode = filp->COMPAT_f_dentry->d_inode;
P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
@@ -208,7 +208,7 @@
int n, rsize, total = 0;
struct p9_fid *fid;
struct p9_client *clnt;
- struct inode *inode = filp->f_path.dentry->d_inode;
+ struct inode *inode = filp->COMPAT_f_dentry->d_inode;
int origin = *offset;
P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
===================================================================
@@ -49,7 +49,7 @@
Opt_err,
};
-static const match_table_t tokens = {
+static COMPAT_match_table_t tokens = {
{Opt_msize, "msize=%u"},
{Opt_legacy, "noextend"},
{Opt_trans, "trans=%s"},
===================================================================
@@ -84,7 +84,7 @@
Opt_port, Opt_rfdno, Opt_wfdno, Opt_err,
};
-static const match_table_t tokens = {
+static COMPAT_match_table_t tokens = {
{Opt_port, "port=%u"},
{Opt_rfdno, "rfdno=%u"},
{Opt_wfdno, "wfdno=%u"},
@@ -285,12 +285,12 @@
*
*/
-static void p9_read_work(struct work_struct *work)
+static void p9_read_work(COMPAT_work_struct *work)
{
int n, err;
struct p9_conn *m;
- m = container_of(work, struct p9_conn, rq);
+ m = COMPAT_work_container(work, struct p9_conn, rq);
if (m->err < 0)
return;
@@ -433,13 +433,13 @@
*
*/
-static void p9_write_work(struct work_struct *work)
+static void p9_write_work(COMPAT_work_struct *work)
{
int n, err;
struct p9_conn *m;
struct p9_req_t *req;
- m = container_of(work, struct p9_conn, wq);
+ m = COMPAT_work_container(work, struct p9_conn, wq);
if (m->err < 0) {
clear_bit(Wworksched, &m->wsched);
@@ -581,8 +581,8 @@
INIT_LIST_HEAD(&m->req_list);
INIT_LIST_HEAD(&m->unsent_req_list);
- INIT_WORK(&m->rq, p9_read_work);
- INIT_WORK(&m->wq, p9_write_work);
+ COMPAT_INIT_WORK(&m->rq, p9_read_work, m);
+ COMPAT_INIT_WORK(&m->wq, p9_write_work, m);
INIT_LIST_HEAD(&m->poll_pending_link);
init_poll_funcptr(&m->pt, p9_pollwait);
@@ -791,7 +791,7 @@
int fd, ret;
csocket->sk->sk_allocation = GFP_NOIO;
- fd = sock_map_fd(csocket, 0);
+ fd = COMPAT_sock_map_fd(csocket, 0);
if (fd < 0) {
P9_EPRINTK(KERN_ERR, "p9_socket_open: failed to map fd\n");
return fd;
@@ -821,8 +821,8 @@
m->mux_list.prev, m->mux_list.next);
p9_mux_poll_stop(m);
- cancel_work_sync(&m->rq);
- cancel_work_sync(&m->wq);
+ COMPAT_cancel_work_sync(&m->rq);
+ COMPAT_cancel_work_sync(&m->wq);
p9_conn_cancel(m, -ECONNRESET);
===================================================================
@@ -49,11 +49,21 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
-#define COMPAT_request_irq
-#define COMPAT_INIT_WORK
-#define COMPAT_f_dentry
+#define COMPAT_INIT_WORK(a,b,c) INIT_WORK(a,b,c)
+#define COMPAT_f_dentry f_dentry
+#define COMPAT_sock_map_fd(a,b) sock_map_fd(a)
+#define COMPAT_match_strlcpy(a,b,c) match_strcpy(a,b)
+#define COMPAT_match_table_t match_table_t
+#define COMPAT_cancel_work_sync(a) cancel_delayed_work(a)
+#define COMPAT_super_operations struct super_operations
+#define COMPAT_inode_operations struct inode_operations
+#define COMPAT_dentry_operations struct dentry_operations
+#define COMPAT_umount_begin_args struct vfsmount *vfsmnt, int flags
+#define COMPAT_umount_begin_sfi vfsmnt->mnt_sb->s_fs_info
+#define COMPAT_work_struct void
+#define COMPAT_work_container(a,b,c) (a)
-typedef unsigned int bool;
+//typedef unsigned int bool;
#define true (1)
#define false (0)
@@ -63,24 +73,57 @@
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
-static inline void * __must_check krealloc(const void *data, size_t size,
- gfp_t gfp)
-{
- void *ret;
+#define USHORT_MAX ((u16)(~0U))
- ret = kmalloc(size, gfp);
- if (ret == NULL)
- return ret;
- memcpy(ret, data, min(size, ksize(data)));
- kfree((void *)data);
+#endif
+#endif
+#endif
- return ret;
-}
-
#endif
#endif
#endif
+#ifndef COMPAT_f_dentry
+#define COMPAT_f_dentry f_path.dentry
#endif
+#ifndef COMPAT_INIT_WORK
+#define COMPAT_INIT_WORK(a,b,c) INIT_WORK(a,b)
#endif
+#ifndef COMPAT_sock_map_fd
+#define COMPAT_sock_map_fd(a,b) sock_map_fd(a,b)
#endif
+#ifndef COMPAT_match_strlcpy
+#define COMPAT_match_strlcpy(a,b,c) match_strlcpy(a,b,c)
+#endif
+#ifndef COMPAT_match_table_t
+#define COMPAT_match_table_t const match_table_t
+#endif
+#ifndef COMPAT_cancel_work_sync
+#define COMPAT_cancel_work_sync(a) cancel_work_sync(a)
+#endif
+#ifndef COMPAT_super_operations
+#define COMPAT_super_operations const struct super_operations
+#endif
+#ifndef COMPAT_inode_operations
+#define COMPAT_inode_operations const struct inode_operations
+#endif
+#ifndef COMPAT_dentry_operations
+#define COMPAT_dentry_operations const struct dentry_operations
+#endif
+#ifndef COMPAT_match_table_t
+#define COMPAT_match_table_t const match_table_t
+#endif
+#ifndef COMPAT_umount_begin_args
+#define COMPAT_umount_begin_args struct super_block *sb
+#endif
+#ifndef COMPAT_umount_begin_sfi
+#define COMPAT_umount_begin_sfi sb->s_fs_info
+#endif
+#ifndef COMPAT_work_struct
+#define COMPAT_work_struct struct work_struct
+#endif
+#ifndef COMPAT_work_container
+#define COMPAT_work_container(obj,type,memb) \
+ ((type *)(((char *)obj) - offset_of(type, memb)))
+#endif
+