kernels/linux-2.4.0/mm/shmem.c
/*
 * This works for both directories and regular files.
 * (non-directories will always have empty subdirs)
 */
This works for both directories and regular files.
(non-directories will always have empty subdirs)
This works for both directories and regular files . ( non - directories will always have empty subdirs )
static int shmem_unlink(struct inode * dir, struct dentry *dentry)
{
	int retval = -ENOTEMPTY;
	if (shmem_empty(dentry)) {
		struct inode *inode = dentry->d_inode;
		inode->i_nlink--;
		dput(dentry);	
		retval = 0;
	}
	return retval;
}
static int shmem_unlink ( struct inode * dir , struct dentry * dentry ) { int retval = - ENOTEMPTY ; if ( shmem_empty ( dentry ) ) { struct inode * inode = dentry -> d_inode ; inode -> i_nlink -- ; dput ( dentry ) ; retval = 0 ; } return retval ; }
This works for both directories and regular files.
This works for both directories and regular files .
/* Undo the count from "create" - this does all the work */