break; case VIOC_AVIATOR: return viocaviator (fd, h, size); case VIOC_ARLADEBUG : return vioc_arladebug (fd, h, size); case VIOC_GCPAGS : error = vioc_gcpags (fd, h, size);
xfs_message_pioctl (int fd, struct xfs_message_pioctl *h, u_int size){    int32_t sizeof_x;    char *t;    int error;    t = h->msg ;    switch(h->opcode) {#ifdef KERBEROS    case VIOCSETTOK: {	struct ClearToken ct;	CREDENTIALS c;	long cell;	/* someone probed us */	if (h->insize == 0) {	    error = EINVAL ;	    break;	}	/* Get ticket_st */	memcpy(&sizeof_x, t, sizeof(sizeof_x)) ;	c.ticket_st.length = sizeof_x ;	arla_warnx (ADEBMSG, "ticket_st has size %d", sizeof_x);	t += sizeof(sizeof_x) ;	memcpy(c.ticket_st.dat, t, sizeof_x) ;	t += sizeof_x ;	/* Get ClearToken */	memcpy(&sizeof_x, t, sizeof(sizeof_x)) ;	t += sizeof(sizeof_x) ;	memcpy(&ct, t, sizeof_x) ;	t += sizeof_x ;	/* Get primary cell ? */	memcpy(&sizeof_x, t, sizeof(sizeof_x)) ;	t += sizeof(sizeof_x) ;	/* Get Cellname */ 	strncpy(c.realm, t, REALM_SZ) ;	c.realm[REALM_SZ-1] = '\0' ;	/* Make this a sane world again */	c.kvno = ct.AuthHandle;	memcpy (c.session, ct.HandShakeKey, sizeof(c.session));	c.issue_date = ct.BeginTimestamp - 1;		cell = cell_name2num(strlwr(c.realm));	/* XXX fix ct.ViceId */	conn_clearcred (cell, h->cred.pag, 2);	fcache_purge_cred(h->cred.pag, cell);	cred_add (h->cred.pag, CRED_KRB4, 2, cell, ct.EndTimestamp,		  &c, sizeof(c));		error = 0 ;	break;    }    case VIOCGETTOK :	return viocgettok (fd, h, size);    case VIOCUNPAG:    case VIOCUNLOG: {	pag_t cred = h->cred.pag ;	cred_remove(cred) ;	fcache_purge_cred(cred, -1);	error = 0;	break ;    }#endif /* KERBEROS */    case VIOCCONNECTMODE:	error = viocconnect(fd, h, size);	break;    case VIOCFLUSH:        error = viocflush(fd, h, size);	break;    case VIOC_FLUSHVOLUME:	error = viocflushvolume(fd, h, size);	break;    case VIOCGETFID:	error = xfs_send_message_wakeup_data(fd, h->header.sequence_num, 0,					     &h->handle, sizeof(VenusFid));	break;    case VIOCGETAL:	error = viocgetacl(fd, h, size);	break;    case VIOCSETAL:	error = viocsetacl(fd, h, size);	break;    case VIOCGETVOLSTAT:	error = viocgetvolstat(fd, h, size);	break;    case VIOCSETVOLSTAT:	error = viocsetvolstat(fd, h, size);	break;    case VIOC_AFS_STAT_MT_PT:	error = vioc_afs_stat_mt_pt(fd, h, size);	break;    case VIOCWHEREIS:	error = viocwhereis(fd, h, size);	break;    case VIOCNOP:	error = EINVAL;	break;    case VIOCGETCELL:	error = viocgetcell(fd, h, size);	break;    case VIOC_VENUSLOG:	if (h->cred.uid != 0) {	    error = EACCES;	    break ;	}	    	conn_status (stderr);	volcache_status (stderr);	cred_status (stderr);	fcache_status (stderr);	rx_PrintStats(stderr);	error = 0 ;	break;    case VIOC_AFS_SYSNAME: {	char str[SYSNAMEMAXLEN+sizeof(int32_t)];	error = 0 ;	if (*((int32_t *)t)) {	    t += sizeof(int32_t);	    arla_warnx (ADEBMSG, "VIOC_AFS_SYSNAME: setting sysname: %s", t);	    memcpy(arlasysname, t, h->insize);	    arlasysname[h->insize] = '\0';	    xfs_send_message_wakeup_data(fd, h->header.sequence_num, error,					 str, 0);	} else {	    t = str;	    sizeof_x = strlen(arlasysname);	    memcpy(t, &sizeof_x, sizeof(sizeof_x));	    t += sizeof(sizeof_x);	    h->outsize = sizeof_x;	    strncpy(t, arlasysname, SYSNAMEMAXLEN);	    xfs_send_message_wakeup_data(fd, h->header.sequence_num, error,					 str, sizeof_x + sizeof(sizeof_x));	}	return 0;    }    case VIOC_FILE_CELL_NAME: {	char *cellname ;	error = 0 ;	cellname = (char *) cell_num2name(h->handle.a);	if (cellname) 	    xfs_send_message_wakeup_data(fd, h->header.sequence_num, error,					 cellname, strlen(cellname)+1);	else 	    xfs_send_message_wakeup_data(fd, h->header.sequence_num, EINVAL,					 NULL, 0);	return 0;    }    case VIOC_GET_WS_CELL: {	char *cellname;	cellname = (char*) cell_getthiscell();	xfs_send_message_wakeup_data(fd, h->header.sequence_num, 0 /*error*/,				     cellname, strlen(cellname));	return 0;    }    case VIOCSETCACHESIZE: {	u_int32_t *s = (u_int32_t *)t;	if (h->cred.uid != 0) {	    error = EPERM;	    break ;	}		if (h->insize >= sizeof(int32_t) * 4) 	    error = fcache_reinit(s[0], s[1], s[2], s[3]);	else	    error = fcache_reinit(*s/2, *s, *s*500, *s*1000);	break;    }    case VIOC_GETRXKCRYPT :	getrxkcrypt(fd, h, size);	return 0;    case VIOC_SETRXKCRYPT :	error = setrxkcrypt(fd, h, size);	break;    case VIOC_FPRIOSTATUS:	error = vioc_fpriostatus(fd, h, size);	break;    default:	arla_warnx (ADEBMSG, "unknown pioctl call %d", h->opcode);	error = EINVAL ;    }    xfs_send_message_wakeup (fd, h->header.sequence_num, error);        return 0;}