ret = DARLA_Open(&log_data, ARLACACHEDIR"/discon_log", O_WRONLY | O_CREAT | O_BINARY); if (ret < 0) { arla_warn (ADEBERROR, errno, "DARLA_Open"); } else { Log_is_open = 1; }
viocconnect(int fd, struct xfs_message_pioctl *h, u_int size){    char *p = h->msg;    int32_t tmp;    int32_t ret;    int error = 0;    if (h->insize != sizeof(int32_t) ||	h->outsize != sizeof(int32_t)) {	ret = -EINVAL;    } else {    	memcpy(&tmp, h->msg, sizeof(tmp));	p += sizeof(tmp);	ret = tmp;	switch(tmp) {	case CONNMODE_PROBE:	    switch(connected_mode) {	    case CONNECTED: ret = CONNMODE_CONN; break;	    case FETCH_ONLY: ret = CONNMODE_FETCH; break;	    case DISCONNECTED: ret = CONNMODE_DISCONN; break;	    default:		error = EINVAL;		ret = 0;		break;	    }	    break;	case CONNMODE_CONN:	    connected_mode = CONNECTED ;	    break;	case CONNMODE_FETCH:	    connected_mode = FETCH_ONLY ;	    break;	case CONNMODE_DISCONN:	    connected_mode = DISCONNECTED;	    break;	default:	    error = EINVAL;	    break;	}    }    xfs_send_message_wakeup_data (fd, h->header.sequence_num, error,				  &ret, sizeof(ret));    return 0;}