Exemple #1
0
/* cancel asynchronous read */
uint4 mur_fread_cancel(jnl_ctl_list *jctl)
{
	int			status, index, save_err;
	reg_ctl_list		*rctl;
	mur_read_desc_t		*mur_desc;
	mur_buff_desc_t		*seq_buff;

	rctl = jctl->reg_ctl;
	mur_desc = rctl->mur_desc;
	/* At most one buffer can have read_in_progress, not both */
	assert(!(mur_desc->seq_buff[0].read_in_progress && mur_desc->seq_buff[1].read_in_progress));
	for (index = 0, save_err = 0; index < ARRAYSIZE(mur_desc->seq_buff); index++)
	{
		seq_buff = &mur_desc->seq_buff[index];
		if (seq_buff->read_in_progress)
		{
			AIO_CANCEL(seq_buff->rip_channel, NULL, status);
			if (-1 == status)
				save_err = errno;
			else if (AIO_NOTCANCELED == status)	/* the OS cannot cancel the aio once it has actually started */
				jctl->status = mur_fread_wait(seq_buff);	/* wait for it to finish. */
			seq_buff->read_in_progress = FALSE;
		}
	}
	/* Note that although the cancellation errored out for rip_channel, we are storing the status in jctl which need not
	 * actually be the jctl corresponding to rip_channel
	 */
	return (jctl->status = ((0 == save_err) ? SS_NORMAL : save_err));
}
Exemple #2
0
/* cancel asynchronous read */
uint4 mur_fread_cancel(void)
{
	int	status, index, save_err;

	/* At most one buffer can have read_in_progress, not both */
	assert(!(mur_desc.seq_buff[0].read_in_progress && mur_desc.seq_buff[1].read_in_progress));
	for (index = 0, save_err = 0; index < sizeof(mur_desc.seq_buff) / sizeof(mur_desc.seq_buff[0]); index++)
	{
		if (mur_desc.seq_buff[index].read_in_progress)
		{
			AIO_CANCEL(mur_desc.seq_buff[index].rip_channel, NULL, status);
			if (-1 == status)
				save_err = errno;
			else if (AIO_NOTCANCELED == status)	/* the OS cannot cancel the aio once it has actually started */
				mur_jctl->status = mur_fread_wait(&mur_desc.seq_buff[index]);	/* wait for it to finish. */
			mur_desc.seq_buff[index].read_in_progress = FALSE;
		}
	}
	/* Note that although the cancellation errored out for rip_channel, we are storing the status in mur_jctl which need not
	 * actually be the jctl corresponding to rip_channel
	 */
	return (mur_jctl->status = ((0 == save_err) ? SS_NORMAL : save_err));
}