Listing 5. Calling the fs_remove_file() Function

static void fs_remove_file (struct dentry *dentry)
{
   struct dentry *parent = dentry->d_parent;

   if (!parent || !parent->d_inode)
        return;

   down(&parent->d_inode->i_sem);
   if (pcihpfs_positive(dentry)) {
       if (dentry->d_inode) {
            if (S_ISDIR(dentry->d_inode->i_mode))
                  vfs_rmdir(parent->d_inode,dentry);
            else
                  vfs_unlink(parent->d_inode,dentry);
       }

       dput(dentry);
   }
   up(&parent->d_inode->i_sem);
}