コード例 #1
0
ファイル: pipe.c プロジェクト: acpanna/coding
int scull_p_release (struct inode *inode, struct file *filp)
{
    Scull_Pipe *dev = filp->private_data;
    int scull_p_fasync (fasync_file fd, struct file *filp, int mode);

# ifdef LINUX_20
    scull_p_fasync(inode, filp, 0);
# else
    /* remove this filp from the asynchronously notified filp's */
    scull_p_fasync(-1, filp, 0);
# endif
    down (&dev->sem);
    if (filp->f_mode & FMODE_READ)
        dev->nreaders--;
    if (filp->f_mode & FMODE_WRITE)
        dev->nwriters--;
    if (dev->nreaders + dev->nwriters == 0) {
        kfree(dev->buffer);
        dev->buffer = NULL; /* the other fields are not checked on open */
    }
    up (&dev->sem);
    MOD_DEC_USE_COUNT;
    return 0;
}
コード例 #2
0
ファイル: sscullp.c プロジェクト: elftech/vmware-code
static int scull_p_release(struct inode *inode, struct file *filp)
{
	struct scull_pipe *dev = filp->private_data;

	/* remove this filp from the asynchronously notified filp's */
	scull_p_fasync(-1, filp, 0);
	down(&dev->sem);
	if (filp->f_mode & FMODE_READ)
		dev->nreaders--;
	if (filp->f_mode & FMODE_WRITE)
		dev->nwriters--;
	if (dev->nreaders + dev->nwriters == 0) {
		kfree(dev->buffer);
		dev->buffer = NULL; /* the other fields are not checked on open */
	}
	up(&dev->sem);
	return 0;
}
コード例 #3
0
ファイル: fops.c プロジェクト: cmaiolino/ScullPipe
/* Nothing special to do, since we don't have any hardware to shutdown for while */
int scull_p_release(struct inode *inode, struct file *filp)
{
	scull_p_fasync(-1, filp, 0);
	return 0;
}