kernels/linux-2.4.0/fs/dcache.c
/*
 * When switching names, the actual string doesn't strictly have to
 * be preserved in the target - because we're dropping the target
 * anyway. As such, we can just do a simple memcpy() to copy over
 * the new name before we switch.
 *
 * Note that we have to be a lot more careful about getting the hash
 * switched - we have to switch the hash value properly even if it
 * then no longer matches the actual (corrupted) string of the target.
 * The hash value has to match the hash queue that the dentry is on..
 */
When switching names, the actual string doesn't strictly have to
be preserved in the target - because we're dropping the target
anyway. As such, we can just do a simple memcpy() to copy over
the new name before we switch.

Note that we have to be a lot more careful about getting the hash
switched - we have to switch the hash value properly even if it
then no longer matches the actual (corrupted) string of the target.
The hash value has to match the hash queue that the dentry is on
When switching names the actual string doesn ' t strictly have to be preserved in the target - because we ' re dropping the target anyway . As such we can just do a simple memcpy () to copy over the new name before we switch . Note that we have to be a lot more careful about getting the hash switched - we have to switch the hash value properly even if it then no longer matches the actual ( corrupted ) string of the target . The hash value has to match the hash queue that the dentry is on
static inline void switch_names(struct dentry * dentry, struct dentry * target)
{
	const unsigned char *old_name, *new_name;
	check_lock();
	memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN); 
	old_name = target->d_name.name;
	new_name = dentry->d_name.name;
	if (old_name == target->d_iname)
		old_name = dentry->d_iname;
	if (new_name == dentry->d_iname)
		new_name = target->d_iname;
	target->d_name.name = new_name;
	dentry->d_name.name = old_name;
}
static inline void switch_names ( struct dentry * dentry , struct dentry * target ) { const unsigned char * old_name , * new_name ; check_lock ( ) ; memcpy ( dentry -> d_iname , target -> d_iname , DNAME_INLINE_LEN ) ; old_name = target -> d_name . name ; new_name = dentry -> d_name . name ; if ( old_name == target -> d_iname ) old_name = dentry -> d_iname ; if ( new_name == dentry -> d_iname ) new_name = target -> d_iname ; target -> d_name . name = new_name ; dentry -> d_name . name = old_name ; }
When switching names, the actual string doesn't strictly have to
 be preserved in the target - because we're dropping the target
 anyway.
When switching names the actual string doesn ' t strictly have to be preserved in the target - because we ' re dropping the target anyway .