[Tux3] [PATCH]tux3_mkdir

Daniel Phillips phillips at phunq.net
Sat Dec 6 11:57:13 PST 2008

On Saturday 06 December 2008 07:00, Pranith Kumar wrote:
> Hello,
> mkdir and create are totally same, except for the flags passed.
> It works, atleast in the cases i tested for. :)

They should be similar, however the fact that they are nearly identical
is due to:

  * Hirofumi's somewhat nicer factoring of the code than Ext2, with a
    separate setup_inode function that takes care of setting up the
    operations fields, which are different for directories.

  * Links count we haven't implemented them yet, but directories will
    need two of them.

If tux3_mkdir and tux3_create are very similar then they should be the
same function to avoid cut and paste duplication of code, so you would
have a tux3_mkdir and a tux3_mkreg that both call tux3_create, adding
the IFDIR or IFREG flag as a parameter.  Then you would handle the
extra link count in the wrapper.  But it is best to get it working first
as a cut and paste just as you have done, to be able to compare the

> --
> 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)

As a  "lindent" convention, * when used as a reference operator has a
space before and not after, so: inode *dir.

> +//	tux_make_empty(inode, dir);

Let's resolve the question of whether we really need this (interesting

Congratulations on your first Tux3 hack!


Tux3 mailing list
Tux3 at tux3.org

More information about the Tux3 mailing list