rem: int trace = 0;
context: cdrom_session_get_nth_info(int deviceFD, int32 index, off_t deviceSize,                   int32 blockSize, struct session_info *sessionInfo){	status_t error = sessionInfo && index >= 0 ? B_OK : B_BAD_VALUE;	uchar data[2048];	int32 session = index+1;	off_t start_lba = 0;	off_t end_lba = 0; 	TRACE(("%s: get_nth_info(%d, %ld, %lld, %ld, %p)\n", kModuleDebugName,		   deviceFD, index, deviceSize, blockSize, sessionInfo));	// As with identify(), this is just a bogus function that	// treats the whole device as a single session.	if (!error) {		error = read_table_of_contents(deviceFD, index+1, data, 2048,		                               false);	}		if (!error) {		cdrom_table_of_contents_header *header;		cdrom_full_table_of_contents_entry *entries;		int i, count;		int trace = 0;		int first_track = session;		header = (cdrom_table_of_contents_header*)data;		entries = (cdrom_full_table_of_contents_entry*)(data+4);		header->length = B_BENDIAN_TO_HOST_INT16(header->length);				count = (header->length-2) / sizeof(cdrom_full_table_of_contents_entry);				// Check for a valid session index		if (session < header->first || session > header->last)			error = B_ENTRY_NOT_FOUND;				if (!error) {						for (i = 0; i < count; i++) {				switch (entries[i].point) {					case 0xa0:	// PMin holds first track in session						if (entries[i].session == session) 							first_track = entries[i].pminutes;											break;					case 0xa2:						// PMSF holds end of session						if (entries[i].session == session) {							end_lba = msf_to_lba(make_msf_address(entries[i].pminutes,							          entries[i].pseconds, entries[i].pframes));							trace++;						}						            						break;						default:						if (entries[i].session == session && entries[i].point == first_track) {							start_lba = msf_to_lba(make_msf_address(entries[i].pminutes,							          entries[i].pseconds, entries[i].pframes));							trace++;						}						break;				}			}									if (trace == 2) {				TRACE(("%s: found session #%ld info\n", kModuleDebugName, session));				sessionInfo->offset = start_lba * blockSize;				sessionInfo->size = (end_lba - start_lba) * blockSize;				sessionInfo->logical_block_size = blockSize;				sessionInfo->index = index;				sessionInfo->flags = B_DATA_SESSION;	// possibly B_AUDIO_SESSION for audio tracks?//			dump_full_table_of_contents(data);			} else {				dprintf("%s: bad trace: %d\n", kModuleDebugName, trace);				error = B_ENTRY_NOT_FOUND;			}		}	}		if (error)			dprintf("%s: get_nth error 0x%lx\n", kModuleDebugName, error);			return error;}