sprintf(path, "/sys/class/stgt_device/device%d:%llu/path", tid, lun);
sprintf(path, "/sys/class/stgt_device/device%d:%" PRIu64 "/path", tid, lun);
static int sync_cache(int tid, uint64_t lun, uint8_t *scb, uint8_t *data,		      int *len){	int fd, err;	char path[PATH_MAX], buf[PATH_MAX];	sprintf(path, "/sys/class/stgt_device/device%d:%llu/path", tid, lun);	fd = open(path, O_RDONLY);	if (fd < 0) {		perror("scsi sync_cache could not get LU's path");		err = EINVAL;		goto einval;	}	err = read(fd, buf, sizeof(buf));	close(fd);	if (err < 0) {		perror("scsi sync_cache could not read LUN path");		err = EIO;		goto eio;	}	/*	 * yuck! wtf should I be using	 */	memset(path, 0, PATH_MAX);	sscanf(buf, "%s\n", path);	fd = open(path, O_RDWR);	if (fd < 0) {		perror("scsi sync_cache could not open device");		err = EIO;		goto eio;	}	err = fsync(fd);	close(fd);	switch (err) {	case EROFS:	case EINVAL:	case EBADF:einval:		/* is this the right sense code? */		*len = sense_data_build(data, 0x70, ILLEGAL_REQUEST, 0, 0);		return SAM_STAT_CHECK_CONDITION;	case EIO:eio:		/* what should I put for the asc/ascq? */		*len = sense_data_build(data, 0x70, ILLEGAL_REQUEST, 0, 0);		return SAM_STAT_CHECK_CONDITION;	default:		*len = 0;		return SAM_STAT_GOOD;	}}