kfusd/kfusd.c
static int fusd_fops_reply(fusd_dev_t *fusd_dev, fusd_msg_t *msg)
{
	fusd_file_t *fusd_file;
	struct fusd_transaction *transaction;

	/* figure out the index of the file we are replying to.  usually
	 * very fast (uses a hint) */
	if ((fusd_file = find_fusd_reply_file(fusd_dev, msg)) == NULL) {
		RDEBUG(2, "fusd_fops_reply: got a reply on /dev/%s with no connection",
		       NAME(fusd_dev));
		goto discard;
	}

	/* make sure this is not an old reply going to an old instance that's gone */
	/* todo: kor fix this */
	/*
	  if (fusd_file->fusd_dev_version != fusd_dev->version ||
	      msg->parm.fops_msg.transid != fusd_file->transid_outstanding) {
	    RDEBUG(2, "fusd_fops_reply: got an old message, discarding");
	    goto discard;
	  }*/

	transaction = fusd_find_transaction(fusd_file, msg->parm.fops_msg.transid);
	if (transaction == NULL) {
		RDEBUG(2, "fusd_fops_reply: No transaction found with transid %ld", msg->parm.fops_msg.transid);
		goto discard;
	}

	RDEBUG(10, "fusd_fops_reply: /dev/%s completed transid %ld (retval %d)",
	       NAME(fusd_dev), msg->parm.fops_msg.transid,
	       (int) msg->parm.fops_msg.retval);

	transaction->msg_in = msg;
	mb();

	WAKE_UP_INTERRUPTIBLE_SYNC(&fusd_file->file_wait);

	return 0;

discard:
	if (msg->subcmd == FUSD_OPEN && msg->parm.fops_msg.retval == 0) {
		fusd_forge_close(msg, fusd_dev);
		return 0;
	} else {
		return -EPIPE;
	}
}
/* Process an incoming reply to a message dispatched by
 * fusd_fops_call.  Called by fusd_write when a driver writes to
 * /dev/fusd. */
Process an incoming reply to a message dispatched by
fusd_fops_call.  Called by fusd_write when a driver writes to
/dev/fusd.
Process an incoming reply to a message dispatched by fusd_fops_call . Called by fusd_write when a driver writes to / dev / fusd .
static int fusd_fops_reply(fusd_dev_t *fusd_dev, fusd_msg_t *msg)
{
	fusd_file_t *fusd_file;
	struct fusd_transaction *transaction;
	if ((fusd_file = find_fusd_reply_file(fusd_dev, msg)) == NULL) {
		RDEBUG(2, "fusd_fops_reply: got a reply on /dev/%s with no connection",
		       NAME(fusd_dev));
		goto discard;
	}
	transaction = fusd_find_transaction(fusd_file, msg->parm.fops_msg.transid);
	if (transaction == NULL) {
		RDEBUG(2, "fusd_fops_reply: No transaction found with transid %ld", msg->parm.fops_msg.transid);
		goto discard;
	}
	RDEBUG(10, "fusd_fops_reply: /dev/%s completed transid %ld (retval %d)",
	       NAME(fusd_dev), msg->parm.fops_msg.transid,
	       (int) msg->parm.fops_msg.retval);
	transaction->msg_in = msg;
	mb();
	WAKE_UP_INTERRUPTIBLE_SYNC(&fusd_file->file_wait);
	return 0;
discard:
	if (msg->subcmd == FUSD_OPEN && msg->parm.fops_msg.retval == 0) {
		fusd_forge_close(msg, fusd_dev);
		return 0;
	} else {
		return -EPIPE;
	}
}
static int fusd_fops_reply ( fusd_dev_t * fusd_dev , fusd_msg_t * msg ) { fusd_file_t * fusd_file ; struct fusd_transaction * transaction ; if ( ( fusd_file = find_fusd_reply_file ( fusd_dev , msg ) ) == NULL ) { RDEBUG ( 2 , " " , NAME ( fusd_dev ) ) ; goto discard ; } transaction = fusd_find_transaction ( fusd_file , msg -> parm . fops_msg . transid ) ; if ( transaction == NULL ) { RDEBUG ( 2 , " " , msg -> parm . fops_msg . transid ) ; goto discard ; } RDEBUG ( 10 , " " , NAME ( fusd_dev ) , msg -> parm . fops_msg . transid , ( int ) msg -> parm . fops_msg . retval ) ; transaction -> msg_in = msg ; mb ( ) ; WAKE_UP_INTERRUPTIBLE_SYNC ( & fusd_file -> file_wait ) ; return 0 ; discard : if ( msg -> subcmd == FUSD_OPEN && msg -> parm . fops_msg . retval == 0 ) { fusd_forge_close ( msg , fusd_dev ) ; return 0 ; } else { return - EPIPE ; } }
Process an incoming reply to a message dispatched by
 fusd_fops_call.
Process an incoming reply to a message dispatched by fusd_fops_call .
/* figure out the index of the file we are replying to.  usually
	 * very fast (uses a hint) */ /* make sure this is not an old reply going to an old instance that's gone */ /* todo: kor fix this */ /*
	  if (fusd_file->fusd_dev_version != fusd_dev->version ||
	      msg->parm.fops_msg.transid != fusd_file->transid_outstanding) {
	    RDEBUG(2, "fusd_fops_reply: got an old message, discarding");
	    goto discard;
	  }*/