Subject: CVS commit: [netbsd-4] src
To: None <source-changes@NetBSD.org>
From: Liam J. Foy <liamjfoy@netbsd.org>
List: source-changes
Date: 07/24/2007 10:14:48
Module Name:	src
Committed By:	liamjfoy
Date:		Tue Jul 24 10:14:48 UTC 2007

Modified Files:
	src/regress/sys/fs/tmpfs [netbsd-4]: h_tools.c t_rename
	src/sys/fs/tmpfs [netbsd-4]: tmpfs_vnops.c

Log Message:
Pull up following revision(s) (requested by jmmv in ticket #786):
	sys/fs/tmpfs/tmpfs_vnops.c: revision 1.39
	regress/sys/fs/tmpfs/h_tools.c: revision 1.8
	regress/sys/fs/tmpfs/t_rename: revision 1.6
	regress/sys/fs/tmpfs/t_rename: revision 1.7
Add test cases to ensure that:
1) Renaming a directory to an empty directory works by replacing
the target directory.
2) Renaming a directory to a non-empty directory fails.
This is all by calling rename(2) directly, not mv(1).

tmpfs currently fails those tests, raising an assertion if
DIAGNOSTIC is
enabled.  A fix will hopefully follow soon.
Found by pooka@.

Add some more tests to ensure that renaming a file to a directory
and a directory to a file fails with the appropriate error codes.
tmpfs still fails these tests, but the fix is almost ready to go in.

Multiple fixes for tmpfs' rename operation:
- Raise an error if renaming a file to a directory.
- Raise an error if renaming a directory to a file.
- Raise an error if renaming a directory to a non-empty directory.
- Properly allow renaming a directory to an empty directory.

The system could previously crash if the kernel had DIAGNOSTIC
enabled, as this triggered a bogus assertion.
Problem found by Geoff Wing.


To generate a diff of this commit:
cvs rdiff -r1.7 -r1.7.2.1 src/regress/sys/fs/tmpfs/h_tools.c
cvs rdiff -r1.5 -r1.5.2.1 src/regress/sys/fs/tmpfs/t_rename
cvs rdiff -r1.32.2.2 -r1.32.2.3 src/sys/fs/tmpfs/tmpfs_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.