Esempio n. 1
0
File: file.c Progetto: mnv104/capfs
/* capfs_release()
 *
 * Called when the last open file reference for a given file is
 * finished.  We use this as an opportunity to tell the daemon to close
 * the file when it wants to.
 */
int capfs_release(struct inode *inode, struct file *f)
{
	int error = 0;
	struct capfs_inode *pinode;
	/* update the statistics */
	if(capfs_collect_stats) capfs_vfs_stat.release++;   
	PENTRY;

	update_atime(inode);
	if (S_ISDIR(inode->i_mode))
	{
		return dcache_dir_close(inode, f);
	}

	pinode = CAPFS_I(inode);

	PDEBUG(D_FILE, "capfs_release called for %s (%ld) [atime: %lu] [mtime: %lu] [ctime: %lu]\n", 
			pinode->name, (unsigned long) pinode->handle, inode->i_atime.tv_sec,
			inode->i_mtime.tv_sec, inode->i_ctime.tv_sec);

	error = ll_capfs_hint(pinode, HINT_CLOSE, NULL);

	/* 
	 * remove all associated inode pages from the page cache
	 */
	truncate_inode_pages(f->f_dentry->d_inode->i_mapping, 0);
	
	PEXIT;
	return error;
}
Esempio n. 2
0
int sjfs_dir_fops_release(struct inode *dir, struct file *file) {
	printk("sjfs_dir_fops_release -> dcache_dir_close(\n");

        if(dir) {
                printk("--- dir.ino:%lu\n", dir->i_ino);
        } else {
                printk("--- dir.ino:NULL\n");
        }
        if(file && &(file->f_path) != NULL && file->f_path.dentry != NULL && &(file->f_path.dentry->d_name) != NULL && file->f_path.dentry->d_name.name != NULL) {
                printk("--- file.path: \"%s\");\n", file->f_path.dentry->d_name.name);
        } else {
                printk("--- file.path: NULL);\n");
        }

	return dcache_dir_close(dir, file);
}