From: Michal Marek <mmarek@suse.cz>
Subject: [PATCH] novfs: Fix build with 3.0

Copy fixes by Jeff Mahoney from the master branch of suse kernel tree (before
novfs was dropped).

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 daemon.c  |   32 ++++++-------
 inode.c   |  145 ++++++++++++++++++++++++--------------------------------------
 proc.c    |    5 --
 profile.c |   18 +++----
 scope.c   |    5 --
 vfs.h     |    4 -
 6 files changed, 88 insertions(+), 121 deletions(-)

--- novfs.orig/inode.c
+++ novfs/inode.c
@@ -14,14 +14,12 @@
  */
 
 #include <linux/module.h>
-#include <linux/autoconf.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/dcache.h>
 #include <linux/mount.h>
 #include <linux/pagemap.h>
 #include <linux/string.h>
-#include <linux/smp_lock.h>
 #include <linux/slab.h>
 #include <linux/unistd.h>
 #include <asm/statfs.h>
@@ -44,7 +42,7 @@ struct inode_data {
 	struct inode *Inode;
 	unsigned long cntDC;
 	struct list_head DirCache;
-	struct semaphore DirCacheLock;
+	struct mutex DirCacheLock;
 	void *FileHandle;
 	int CacheFlag;
 	char Name[1];		/* Needs to be last entry */
@@ -57,16 +55,16 @@ struct inode_data {
 static unsigned long novfs_internal_hash(struct qstr *name);
 static int novfs_d_add(struct dentry *p, struct dentry *d, struct inode *i, int add);
 
-static int novfs_get_sb(struct file_system_type *Fstype, int Flags, const char *Dev_name, void *Data, struct vfsmount *Mnt);
-
 static void novfs_kill_sb(struct super_block *SB);
 
 /*
  * Declared dentry_operations
  */
 int novfs_d_revalidate(struct dentry *, struct nameidata *);
-int novfs_d_hash(struct dentry *, struct qstr *);
-int novfs_d_compare(struct dentry *, struct qstr *, struct qstr *);
+int novfs_d_hash(const struct dentry *, const struct inode *, struct qstr *);
+int novfs_d_compare(const struct dentry *, const struct inode *,
+		    const struct dentry *, const struct inode *,
+		    unsigned int, const char *, const struct qstr *);
 int novfs_d_delete(struct dentry *dentry);
 void novfs_d_release(struct dentry *dentry);
 void novfs_d_iput(struct dentry *dentry, struct inode *inode);
@@ -81,7 +79,7 @@ ssize_t novfs_dir_read(struct file *file
 void addtodentry(struct dentry *Parent, unsigned char *List, int Level);
 int novfs_filldir(void *data, const char *name, int namelen, loff_t off, ino_t ino, unsigned ftype);
 int novfs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir);
-int novfs_dir_fsync(struct file *file, struct dentry *dentry, int datasync);
+int novfs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync);
 
 /*
  * Declared address space operations
@@ -102,12 +100,11 @@ ssize_t novfs_a_direct_IO(int rw, struct
 ssize_t novfs_f_read(struct file *, char *, size_t, loff_t *);
 ssize_t novfs_f_write(struct file *, const char *, size_t, loff_t *);
 int novfs_f_readdir(struct file *, void *, filldir_t);
-int novfs_f_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
 int novfs_f_mmap(struct file *file, struct vm_area_struct *vma);
 int novfs_f_open(struct inode *, struct file *);
 int novfs_f_flush(struct file *, fl_owner_t);
 int novfs_f_release(struct inode *, struct file *);
-int novfs_f_fsync(struct file *, struct dentry *, int datasync);
+int novfs_f_fsync(struct file *, loff_t start, loff_t end, int datasync);
 int novfs_f_lock(struct file *, int, struct file_lock *);
 
 /*
@@ -140,7 +137,7 @@ void update_inode(struct inode *Inode, s
 void novfs_read_inode(struct inode *inode);
 void novfs_write_inode(struct inode *inode);
 int novfs_notify_change(struct dentry *dentry, struct iattr *attr);
-void novfs_clear_inode(struct inode *inode);
+void novfs_evict_inode(struct inode *inode);
 int novfs_show_options(struct seq_file *s, struct vfsmount *m);
 
 int novfs_statfs(struct dentry *de, struct kstatfs *buf);
@@ -152,8 +149,6 @@ ssize_t novfs_control_Read(struct file *
 
 ssize_t novfs_control_write(struct file *file, const char *buf, size_t nbytes, loff_t * ppos);
 
-int novfs_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-
 int __init init_novfs(void);
 void __exit exit_novfs(void);
 
@@ -198,7 +193,6 @@ static struct file_operations novfs_file
 	.read = novfs_f_read,
 	.write = novfs_f_write,
 	.readdir = novfs_f_readdir,
-	.ioctl = novfs_f_ioctl,
 	.mmap = novfs_f_mmap,
 	.open = novfs_f_open,
 	.flush = novfs_f_flush,
@@ -216,7 +210,6 @@ struct backing_dev_info novfs_backing_de
 	.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE,
 	.state = 0,
 	.capabilities = BDI_CAP_NO_WRITEBACK | BDI_CAP_MAP_COPY,
-	.unplug_io_fn = default_unplug_io_fn,
 };
 
 static struct address_space_operations novfs_aops = {
@@ -255,7 +248,7 @@ static struct inode_operations novfs_fil
 
 static struct super_operations novfs_ops = {
 	.statfs = novfs_statfs,
-	.clear_inode = novfs_clear_inode,
+	.evict_inode = novfs_evict_inode,
 	.drop_inode = generic_delete_inode,
 	.show_options = novfs_show_options,
 
@@ -265,7 +258,6 @@ static struct super_operations novfs_ops
 static struct file_operations novfs_Control_operations = {
    .read    = novfs_Control_read,
    .write   = novfs_Control_write,
-   .ioctl   = novfs_Control_ioctl,
 };
 */
 
@@ -274,11 +266,11 @@ static atomic_t novfs_Inode_Number = ATO
 struct dentry *novfs_root = NULL;
 char *novfs_current_mnt = NULL;
 
-DECLARE_MUTEX(InodeList_lock);
+DEFINE_MUTEX(InodeList_lock);
 
 LIST_HEAD(InodeList);
 
-DECLARE_MUTEX(TimeDir_Lock);
+DEFINE_MUTEX(TimeDir_Lock);
 uint64_t lastTime;
 char lastDir[PATH_MAX];
 
@@ -312,7 +304,6 @@ static void PRINT_DENTRY(const char *s,
 	__DbgPrint("   d_op:         0x%p\n", d->d_op);
 	__DbgPrint("   d_sb:         0x%p\n", d->d_sb);
 	__DbgPrint("   d_flags:      0x%x\n", d->d_flags);
-	__DbgPrint("   d_mounted:    0x%x\n", d->d_mounted);
 	__DbgPrint("   d_fsdata:     0x%p\n", d->d_fsdata);
 /*   DbgPrint("   d_cookie:     0x%x\n", d->d_cookie); */
 	__DbgPrint("   d_parent:     0x%p\n", d->d_parent);
@@ -333,7 +324,7 @@ int novfs_remove_from_root(char *RemoveN
 	DbgPrint("%s", RemoveName);
 	name.len = strlen(RemoveName);
 	name.name = RemoveName;
-	novfs_d_hash(novfs_root, &name);
+	novfs_d_hash(novfs_root, novfs_root->d_inode, &name);
 
 	dentry = d_lookup(novfs_root, &name);
 	if (dentry) {
@@ -364,7 +355,7 @@ int novfs_add_to_root(char *AddName)
 	DbgPrint("%s", AddName);
 	name.len = strlen(AddName);
 	name.name = AddName;
-	novfs_d_hash(novfs_root, &name);
+	novfs_d_hash(novfs_root, novfs_root->d_inode, &name);
 
 	dir = novfs_root->d_inode;
 
@@ -398,7 +389,7 @@ int novfs_Add_to_Root2(char *AddName)
 	name.len = strlen(AddName);
 	name.name = AddName;
 
-	novfs_d_hash(novfs_root, &name);
+	novfs_d_hash(novfs_root, novfs_root->d_inode, &name);
 
 	entry = d_lookup(novfs_root, &name);
 	DbgPrint("novfs_d_lookup 0x%p", entry);
@@ -750,7 +741,8 @@ static unsigned long novfs_internal_hash
 	return (hash);
 }
 
-int novfs_d_hash(struct dentry *dentry, struct qstr *name)
+int novfs_d_hash(const struct dentry *dentry, const struct inode *inode,
+		 struct qstr *name)
 {
 	DbgPrint("%.*s", name->len, name->name);
 
@@ -759,18 +751,15 @@ int novfs_d_hash(struct dentry *dentry,
 	return (0);
 }
 
-int novfs_d_strcmp(struct qstr *s1, struct qstr *s2)
+static int novfs_d_strcmp(const char *str1, unsigned int len,
+			  const struct qstr *s2)
 {
 	int retCode = 1;
-	unsigned char *str1, *str2;
-	unsigned int len;
+	const unsigned char *str2 = s2->name;
 
-	DbgPrint("s1=%.*s s2=%.*s", s1->len, s1->name, s2->len, s2->name);
+	DbgPrint("s1=%.*s s2=%.*s", len, str1, s2->len, s2->name);
 
-	if (s1->len && (s1->len == s2->len) && (s1->hash == s2->hash)) {
-		len = s1->len;
-		str1 = (unsigned char *)s1->name;
-		str2 = (unsigned char *)s2->name;
+	if (len && (len == s2->len)) {
 		for (retCode = 0; len--; str1++, str2++) {
 			if (*str1 != *str2) {
 				if (tolower(*str1) != tolower(*str2)) {
@@ -785,11 +774,14 @@ int novfs_d_strcmp(struct qstr *s1, stru
 	return (retCode);
 }
 
-int novfs_d_compare(struct dentry *parent, struct qstr *s1, struct qstr *s2)
+int novfs_d_compare(const struct dentry *parent,
+	            const struct inode *parent_inode,
+		    const struct dentry *dentry, const struct inode *inode,
+		    unsigned int len, const char *s1, const struct qstr *s2)
 {
 	int retCode;
 
-	retCode = novfs_d_strcmp(s1, s2);
+	retCode = novfs_d_strcmp(s1, len, s2);
 
 	DbgPrint("retCode=0x%x", retCode);
 	return (retCode);
@@ -1065,7 +1057,7 @@ int novfs_dir_readdir(struct file *file,
 // Use this hack by default
 #ifndef SKIP_CROSSOVER_HACK
 	// Hack for crossover - begin
-	down(&TimeDir_Lock);
+	mutex_lock(&TimeDir_Lock);
 	if ((file->f_dentry->d_name.len == 7) &&
 	    ((0 == strncmp(file->f_dentry->d_name.name, " !xover", 7)) ||
 	     (0 == strncmp(file->f_dentry->d_name.name, "z!xover", 7)))) {
@@ -1091,7 +1083,7 @@ int novfs_dir_readdir(struct file *file,
 		}
 	}
 
-	up(&TimeDir_Lock);
+	mutex_unlock(&TimeDir_Lock);
 	// Hack for crossover - end
 #endif
 
@@ -1171,10 +1163,11 @@ int novfs_dir_readdir(struct file *file,
 	return 1;
 }
 
-int novfs_dir_fsync(struct file *file, struct dentry *dentry, int datasync)
+int novfs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
-	DbgPrint("Name %.*s", file->f_dentry->d_name.len, file->f_dentry->d_name.name);
-	return (simple_sync_file(file, dentry, datasync));
+	DbgPrint("Name %.*s", file->f_dentry->d_name.len,
+		 file->f_dentry->d_name.name);
+	return generic_file_fsync(file, start, end, datasync);
 }
 
 ssize_t novfs_f_read(struct file * file, char *buf, size_t len, loff_t * off)
@@ -1286,13 +1279,6 @@ int novfs_f_readdir(struct file *file, v
 	return -EISDIR;
 }
 
-int novfs_f_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
-	DbgPrint("file=0x%p cmd=0x%x arg=0x%p", file, cmd, arg);
-
-	return -ENOSYS;
-}
-
 int novfs_f_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	int retCode = -EINVAL;
@@ -1520,7 +1506,7 @@ int novfs_f_release(struct inode *inode,
 	return (retCode);
 }
 
-int novfs_f_fsync(struct file *file, struct dentry *dentry, int datasync)
+int novfs_f_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
 	return 0;
 }
@@ -2668,7 +2654,7 @@ int novfs_i_rename(struct inode *odir, s
 	int retCode = -ENOTEMPTY;
 	char *newpath, *newbuf, *newcon;
 	char *oldpath, *oldbuf, *oldcon;
-	struct qstr newname, oldname;
+	struct qstr oldname;
 	struct novfs_entry_info *info = NULL;
 	int oldlen, newlen;
 	struct novfs_schandle session;
@@ -2714,14 +2700,12 @@ int novfs_i_rename(struct inode *odir, s
 				DbgPrint("2; newcon=0x%p newpath=0x%p", newcon, newpath);
 				DbgPrint("2; oldcon=0x%p oldpath=0x%p", oldcon, oldpath);
 				if (newcon && oldcon && ((int)(newcon - newpath) == (int)(oldcon - oldpath))) {
-					newname.name = newpath;
-					newname.len = (int)(newcon - newpath);
-					newname.hash = 0;
-
 					oldname.name = oldpath;
 					oldname.len = (int)(oldcon - oldpath);
 					oldname.hash = 0;
-					if (!novfs_d_strcmp(&newname, &oldname)) {
+					if (!novfs_d_strcmp(newpath,
+						    newcon - newpath,
+						    &oldname)) {
 
 						if (od->d_inode && od->d_inode->i_private) {
 
@@ -3166,8 +3150,11 @@ int novfs_notify_change(struct dentry *d
 	return (0);
 }
 
-void novfs_clear_inode(struct inode *inode)
+void novfs_evict_inode(struct inode *inode)
 {
+	truncate_inode_pages(&inode->i_data, 0);
+	end_writeback(inode);
+
 	InodeCount--;
 
 	if (inode->i_private) {
@@ -3177,9 +3164,9 @@ void novfs_clear_inode(struct inode *ino
 
 		novfs_free_inode_cache(inode);
 
-		down(&InodeList_lock);
+		mutex_lock(&InodeList_lock);
 		list_del(&id->IList);
-		up(&InodeList_lock);
+		mutex_unlock(&InodeList_lock);
 
 		kfree(inode->i_private);
 		inode->i_private = NULL;
@@ -3312,15 +3299,15 @@ struct inode *novfs_get_inode(struct sup
 			id->cntDC = 1;
 
 			INIT_LIST_HEAD(&id->DirCache);
-			init_MUTEX(&id->DirCacheLock);
+			mutex_init(&id->DirCacheLock);
 
 			id->FileHandle = 0;
 			id->CacheFlag = 0;
 
-			down(&InodeList_lock);
+			mutex_lock(&InodeList_lock);
 
 			list_add_tail(&id->IList, &InodeList);
-			up(&InodeList_lock);
+			mutex_unlock(&InodeList_lock);
 
 			id->Name[0] = '\0';
 
@@ -3451,10 +3438,11 @@ int novfs_fill_super(struct super_block
 	return (0);
 }
 
-static int novfs_get_sb(struct file_system_type *Fstype, int Flags, const char *Dev_name, void *Data, struct vfsmount *Mnt)
+static struct dentry *novfs_mount(struct file_system_type *fs_type, int flags,
+		       const char *dev_name, void *data)
 {
-	DbgPrint("Fstype=0x%x Dev_name=%s", Fstype, Dev_name);
-	return get_sb_nodev(Fstype, Flags, Data, novfs_fill_super, Mnt);
+	DbgPrint("Fstype=0x%x Dev_name=%s", fs_type, dev_name);
+	return mount_nodev(fs_type, flags, data, novfs_fill_super);
 }
 
 static void novfs_kill_sb(struct super_block *super)
@@ -3465,36 +3453,17 @@ static void novfs_kill_sb(struct super_b
 
 ssize_t novfs_Control_read(struct file *file, char *buf, size_t nbytes, loff_t * ppos)
 {
-	ssize_t retval = 0;
-
-	DbgPrint("kernel_locked 0x%x", kernel_locked());
-
-	return retval;
+	return 0;
 }
 
 ssize_t novfs_Control_write(struct file * file, const char *buf, size_t nbytes, loff_t * ppos)
 {
-	ssize_t retval = 0;
-
-	DbgPrint("kernel_locked 0x%x", kernel_locked());
-	if (buf && nbytes) {
-	}
-
-	return (retval);
-}
-
-int novfs_Control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
-	int retval = 0;
-
-	DbgPrint("kernel_locked 0x%x", kernel_locked());
-
-	return (retval);
+	return 0;
 }
 
 static struct file_system_type novfs_fs_type = {
 	.name = "novfs",
-	.get_sb = novfs_get_sb,
+	.mount = novfs_mount,
 	.kill_sb = novfs_kill_sb,
 	.owner = THIS_MODULE,
 };
@@ -3561,7 +3530,7 @@ int novfs_lock_inode_cache(struct inode
 
 	DbgPrint("0x%p", i);
 	if (i && (id = i->i_private) && id->DirCache.next) {
-		down(&id->DirCacheLock);
+		mutex_lock(&id->DirCacheLock);
 		retVal = 1;
 	}
 	DbgPrint("return %d", retVal);
@@ -3573,7 +3542,7 @@ void novfs_unlock_inode_cache(struct ino
 	struct inode_data *id;
 
 	if (i && (id = i->i_private) && id->DirCache.next) {
-		up(&id->DirCacheLock);
+		mutex_unlock(&id->DirCacheLock);
 	}
 }
 
@@ -4071,7 +4040,7 @@ void novfs_dump_inode(void *pf)
 	char ctime_buf[32];
 	unsigned long icnt = 0, dccnt = 0;
 
-	down(&InodeList_lock);
+	mutex_lock(&InodeList_lock);
 	list_for_each(il, &InodeList) {
 		id = list_entry(il, struct inode_data, IList);
 		inode = id->Inode;
@@ -4116,7 +4085,7 @@ void novfs_dump_inode(void *pf)
 			}
 		}
 	}
-	up(&InodeList_lock);
+	mutex_unlock(&InodeList_lock);
 
 	pfunc("Inodes: %d(%d) DirCache: %d(%d)\n", InodeCount, icnt, DCCount, dccnt);
 
--- novfs.orig/daemon.c
+++ novfs/daemon.c
@@ -21,8 +21,8 @@
 #include <linux/timer.h>
 #include <linux/poll.h>
 #include <linux/pagemap.h>
-#include <linux/smp_lock.h>
 #include <linux/semaphore.h>
+#include <linux/sched.h>
 #include <asm/uaccess.h>
 #include <asm/atomic.h>
 #include <linux/time.h>
@@ -109,7 +109,7 @@ static atomic_t Daemon_Open_Count = ATOM
 
 static unsigned long Daemon_Command_Timeout = TIMEOUT_VALUE;
 
-static DECLARE_MUTEX(DriveMapLock);
+static DEFINE_MUTEX(DriveMapLock);
 static LIST_HEAD(DriveMapList);
 
 int novfs_max_iosize = PAGE_SIZE;
@@ -118,7 +118,7 @@ void novfs_daemon_queue_init()
 {
 	INIT_LIST_HEAD(&Daemon_Queue.list);
 	spin_lock_init(&Daemon_Queue.lock);
-	init_MUTEX_LOCKED(&Daemon_Queue.semaphore);
+	sema_init(&Daemon_Queue.semaphore, 0);
 }
 
 void novfs_daemon_queue_exit(void)
@@ -159,7 +159,7 @@ int Queue_Daemon_Command(void *request,
 			que->status = QUEUE_SENDING;
 			que->flags = 0;
 
-			init_MUTEX_LOCKED(&que->semaphore);
+			sema_init(&que->semaphore, 0);
 
 			que->sequence = atomic_inc_return(&Sequence);
 
@@ -902,7 +902,7 @@ int novfs_daemon_destroy_sessionId(struc
 			 * When destroying the session check to see if there are any
 			 * mapped drives.  If there are then remove them.
 			 */
-			down(&DriveMapLock);
+			mutex_lock(&DriveMapLock);
 			list_for_each(list, &DriveMapList) {
 				dm = list_entry(list, struct drive_map, list);
 				if (SC_EQUAL(SessionId, dm->session)) {
@@ -913,7 +913,7 @@ int novfs_daemon_destroy_sessionId(struc
 				}
 
 			}
-			up(&DriveMapLock);
+			mutex_unlock(&DriveMapLock);
 
 		} else {
 			retCode = -EIO;
@@ -1043,7 +1043,7 @@ int novfs_daemon_debug_cmd_send(char *Co
 	return (retCode);
 }
 
-int novfs_daemon_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+long novfs_daemon_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	int retCode = -ENOSYS;
 	struct novfs_schandle session_id;
@@ -1362,7 +1362,7 @@ loff_t novfs_daemon_lib_llseek(struct fi
 
 #define DbgIocCall(str)		__DbgPrint("[VFS XPLAT] Call " str "\n")
 
-int novfs_daemon_lib_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+long novfs_daemon_lib_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	int retCode = -ENOSYS;
 	struct daemon_handle *dh;
@@ -1760,7 +1760,7 @@ static int set_map_drive(struct novfs_xp
 
 	dm = (struct drive_map *)&DriveMapList.next;
 
-	down(&DriveMapLock);
+	mutex_lock(&DriveMapLock);
 
 	list_for_each(list, &DriveMapList) {
 		dm = list_entry(list, struct drive_map, list);
@@ -1786,7 +1786,7 @@ static int set_map_drive(struct novfs_xp
 		}
 	} else
 		kfree(drivemap);
-	up(&DriveMapLock);
+	mutex_unlock(&DriveMapLock);
 	return (retVal);
 }
 
@@ -1819,7 +1819,7 @@ static int unmap_drive(struct novfs_xpla
 
 	dm = NULL;
 
-	down(&DriveMapLock);
+	mutex_lock(&DriveMapLock);
 
 	list_for_each(list, &DriveMapList) {
 		dm = list_entry(list, struct drive_map, list);
@@ -1844,7 +1844,7 @@ static int unmap_drive(struct novfs_xpla
 		kfree(dm);
 	}
 
-	up(&DriveMapLock);
+	mutex_unlock(&DriveMapLock);
 	return (retVal);
 }
 
@@ -1853,7 +1853,7 @@ static void RemoveDriveMaps(void)
 	struct drive_map *dm;
 	struct list_head *list;
 
-	down(&DriveMapLock);
+	mutex_lock(&DriveMapLock);
 	list_for_each(list, &DriveMapList) {
 		dm = list_entry(list, struct drive_map, list);
 
@@ -1865,7 +1865,7 @@ static void RemoveDriveMaps(void)
 		list_del(&dm->list);
 		kfree(dm);
 	}
-	up(&DriveMapLock);
+	mutex_unlock(&DriveMapLock);
 }
 
 /* As picked from do_unlinkat() */
@@ -1878,8 +1878,8 @@ static long local_unlink(const char *pat
 	struct nameidata nd;
 	struct inode *inode = NULL;
 
-	error = path_lookup(pathname, LOOKUP_PARENT, &nd);
-	DbgPrint("path_lookup %s error: %d\n", pathname, error);
+	error = kern_path_parent(pathname, &nd);
+	DbgPrint("kern_path_parent %s error: %d\n", pathname, error);
 	if (error)
 		return error;
 
--- novfs.orig/proc.c
+++ novfs/proc.c
@@ -16,7 +16,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
 
 #include "vfs.h"
 
@@ -77,7 +76,7 @@ int novfs_proc_init(void)
 			novfs_daemon_proc_fops.release = novfs_daemon_close_control;
 			novfs_daemon_proc_fops.read = novfs_daemon_cmd_send;
 			novfs_daemon_proc_fops.write = novfs_daemon_recv_reply;
-			novfs_daemon_proc_fops.ioctl = novfs_daemon_ioctl;
+			novfs_daemon_proc_fops.unlocked_ioctl = novfs_daemon_ioctl;
 
 			Novfs_Control->proc_fops = &novfs_daemon_proc_fops;
 		} else {
@@ -99,7 +98,7 @@ int novfs_proc_init(void)
 			novfs_lib_proc_fops.read = novfs_daemon_lib_read;
 			novfs_lib_proc_fops.write = novfs_daemon_lib_write;
 			novfs_lib_proc_fops.llseek = novfs_daemon_lib_llseek;
-			novfs_lib_proc_fops.ioctl = novfs_daemon_lib_ioctl;
+			novfs_lib_proc_fops.unlocked_ioctl = novfs_daemon_lib_ioctl;
 			Novfs_Library->proc_fops = &novfs_lib_proc_fops;
 		} else {
 			remove_proc_entry("Control", novfs_procfs_dir);
--- novfs.orig/scope.c
+++ novfs/scope.c
@@ -22,7 +22,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/synclink.h>
-#include <linux/smp_lock.h>
 #include <linux/semaphore.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
@@ -601,8 +600,8 @@ char *novfs_scope_dget_path(struct dentr
 void novfs_scope_init(void)
 {
 	INIT_LIST_HEAD(&Scope_List);
-	init_MUTEX(&Scope_Lock);
-	init_MUTEX_LOCKED(&Scope_Thread_Delay);
+	sema_init(&Scope_Lock, 1);
+	sema_init(&Scope_Thread_Delay, 0);
 	kthread_run(Scope_Cleanup_Thread, NULL, "novfs_ST");
 }
 
--- novfs.orig/profile.c
+++ novfs/profile.c
@@ -60,7 +60,7 @@ static struct proc_dir_entry *dbg_file =
 static struct proc_dir_entry *dentry_file = NULL;
 static struct proc_dir_entry *inode_file = NULL;
 
-static DECLARE_MUTEX(LocalPrint_lock);
+static DEFINE_MUTEX(LocalPrint_lock);
 
 static ssize_t User_proc_write_DbgBuffer(struct file *file, const char __user * buf, size_t nbytes, loff_t * ppos)
 {
@@ -439,8 +439,7 @@ static void dump(struct dentry *parent,
 								     d->d_name.len,
 								     d->d_name.name,
 								     d->d_parent,
-								     atomic_read
-								     (&d->d_count), d->d_flags, d->d_subdirs.next, d->d_inode);
+								     d->d_count, d->d_flags, d->d_subdirs.next, d->d_inode);
 							}
 						}
 					}
@@ -466,8 +465,9 @@ static void dump(struct dentry *parent,
 						      "   d_subdirs: 0x%p%s\n"
 						      "   d_inode:   0x%p%s\n",
 						      d, path, d->d_parent,
-						      atomic_read(&d->d_count),
-						      d->d_flags, d->d_subdirs.next, sd, d->d_inode, inode_number);
+						      d->d_count, d->d_flags,
+						      d->d_subdirs.next, sd,
+						      d->d_inode, inode_number);
 					}
 
 					n = l;
@@ -513,7 +513,7 @@ static ssize_t novfs_profile_read_inode(
 	static char save_DbgPrintOn;
 
 	if (offset == 0) {
-		down(&LocalPrint_lock);
+		mutex_lock(&LocalPrint_lock);
 		save_DbgPrintOn = DbgPrintOn;
 		DbgPrintOn = 0;
 
@@ -527,7 +527,7 @@ static ssize_t novfs_profile_read_inode(
 		DbgPrintOn = save_DbgPrintOn;
 		DbgPrintBufferOffset = DbgPrintBufferReadOffset = 0;
 
-		up(&LocalPrint_lock);
+		mutex_unlock(&LocalPrint_lock);
 	}
 
 	return retval;
@@ -541,7 +541,7 @@ static ssize_t novfs_profile_dentry_read
 	static char save_DbgPrintOn;
 
 	if (offset == 0) {
-		down(&LocalPrint_lock);
+		mutex_lock(&LocalPrint_lock);
 		save_DbgPrintOn = DbgPrintOn;
 		DbgPrintOn = 0;
 		DbgPrintBufferOffset = DbgPrintBufferReadOffset = 0;
@@ -554,7 +554,7 @@ static ssize_t novfs_profile_dentry_read
 		DbgPrintBufferOffset = DbgPrintBufferReadOffset = 0;
 		DbgPrintOn = save_DbgPrintOn;
 
-		up(&LocalPrint_lock);
+		mutex_unlock(&LocalPrint_lock);
 	}
 
 	return retval;
--- novfs.orig/vfs.h
+++ novfs/vfs.h
@@ -248,9 +248,9 @@ extern int novfs_daemon_get_userspace(st
 extern int novfs_daemon_debug_cmd_send(char *Command);
 extern ssize_t novfs_daemon_recv_reply(struct file *file, const char *buf, size_t nbytes, loff_t * ppos);
 extern ssize_t novfs_daemon_cmd_send(struct file *file, char *buf, size_t len, loff_t * off);
-extern int novfs_daemon_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern long novfs_daemon_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 extern int novfs_daemon_lib_close(struct inode *inode, struct file *file);
-extern int novfs_daemon_lib_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern long novfs_daemon_lib_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 extern int novfs_daemon_lib_open(struct inode *inode, struct file *file);
 extern ssize_t novfs_daemon_lib_read(struct file *file, char *buf, size_t len, loff_t * off);
 extern ssize_t novfs_daemon_lib_write(struct file *file, const char *buf, size_t len, loff_t * off);
