[Tux3] [PATCH]tux3_mkdir

Pranith Kumar bobby.prani at gmail.com
Sat Dec 6 07:00:00 PST 2008


Hello,

mkdir and create are totally same, except for the flags passed.

It works, atleast in the cases i tested for. :)

--
Pranith.

--- user/kernel/namei.c.orig	2008-12-06 20:10:20.000000000 +0530
+++ user/kernel/namei.c	2008-12-06 19:24:12.000000000 +0530
@@ -43,6 +43,33 @@ error:
 	return err;
 }

+static int tux3_mkdir(struct inode* dir, struct dentry * dentry, int mode)
+{
+	struct inode *inode;
+	int err;
+
+	struct buffer_head *buffer;
+
+	inode = tux_create_inode(dir, S_IFDIR | mode);
+	if (IS_ERR(inode)) {
+		err = PTR_ERR(inode);
+		goto error;
+	}
+
+	if ((err = tux_create_entry(dir, dentry->d_name.name, dentry->d_name.len,
+	    tux_inode(inode)->inum, S_IFDIR | mode)) < 0)
+		goto error;
+
+	d_instantiate(dentry, inode);
+//	tux_make_empty(inode, dir);
+	return 0;
+
+error:
+	inode_dec_link_count(inode);
+	iput(inode);
+	return err;
+}
+
 const struct file_operations tux_dir_fops = {
 	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
@@ -55,7 +82,7 @@ const struct inode_operations tux_dir_io
 //	.link		= ext3_link,
 //	.unlink		= ext3_unlink,
 //	.symlink	= ext3_symlink,
-//	.mkdir		= ext3_mkdir,
+	.mkdir		= tux3_mkdir,
 //	.rmdir		= ext3_rmdir,
 //	.mknod		= ext3_mknod,
 //	.rename		= ext3_rename,

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



More information about the Tux3 mailing list