[Tux3] [PATCH] rename and rmdir

Daniel Phillips phillips at phunq.net
Sun Dec 7 15:49:31 PST 2008


On Sunday 07 December 2008 10:51, Michael Pattrick wrote:
> ...Attached is another patch with less code duplication.

Hi Pattrick,

It is much easier to see what is going on now!

First, trivial things.  The convention for source style in Tux3 is
"lindent":

   cat kernel/namei.c | /src/2.6.26.5.tux3/scripts/Lindent >namei.c.lindented

Then cut just your function back into the file.  Specifically:

   - Spaces before and after binary operators like " = " and keywords
     like "else".

   - No space between a function name and parameter list

Real issues.  This should only be done if the destination is a
directory:

+		err = -ENOTEMPTY;
+		if (!tux_dir_is_empty (new_inode))
+			goto out;

The inc_link_counts and dec_link_counts have to balance for both old
and new inode (which may be the same - the rename may be either to an
existing name or a new name).  Ext2 adds the new entry before it
deletes the old one, in case there is an error in the add.  Your
code will leave the inode with no link in that case, probably not a
good idea.

To tell the truth, I do not know what the link incs and decs in the
Ext2 rename are supposed to do,  Maybe somebody can clear this up?

Regards,

Daniel

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



More information about the Tux3 mailing list