[Tux3] [PATCH] mknod() support

Pranith Kumar bobby.prani at gmail.com
Wed Dec 10 04:04:21 PST 2008


Hello all,

This patch adds mknod support. Please review.

Thanks,
-- 
Pranith.

diff -r 240369b13361 user/kernel/namei.c
--- a/user/kernel/namei.c	Tue Dec 09 16:52:27 2008 +0530
+++ b/user/kernel/namei.c	Wed Dec 10 17:32:08 2008 +0530
@@ -177,6 +191,30 @@
 	return err;
 }

+static int tux3_mknod(struct inode *dir, struct dentry *dentry, int
mode, dev_t rdev)
+{
+	struct inode *inode;
+	int err;
+
+	if (!new_valid_dev(rdev))
+		return -EINVAL;
+
+	inode = tux_create_inode(dir, mode);	
+	err = PTR_ERR(inode);
+
+	if (!IS_ERR(inode)) {
+		init_special_inode(inode, inode->i_mode, rdev);
+		err = tux_add_dirent(dir, dentry, inode);
+		if (err) {
+			drop_nlink(inode);	
+			iput(inode);
+			return err;
+		}
+		mark_inode_dirty(inode);
+	}
+	return err;
+}
+
 const struct file_operations tux_dir_fops = {
 	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
@@ -191,7 +229,7 @@
 	.symlink	= tux3_symlink,
 	.mkdir		= tux3_mkdir,
 	.rmdir		= tux3_rmdir,
-//	.mknod		= ext3_mknod,
+	.mknod		= tux3_mknod,
 	.rename		= tux3_rename,
 //	.setattr	= ext3_setattr,
 //	.setxattr	= generic_setxattr,

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list