rem: switch( page_header.page_code ) { case SCSI_MODEPAGE_CONTROL: if( !ata_mode_select_contrpage( device, qrequest, (scsi_modepage_contr *)modepage_buffer ))
add: switch (page_header.page_code) { case SCSI_MODEPAGE_CONTROL: if (!ata_mode_select_control_page(device, qrequest, (scsi_modepage_contr *)modepage_buffer)) return; break;  default: set_sense(device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_PARAM_LIST_FIELD);
context: static void ata_mode_select_10( ide_device_info *device, ide_qrequest *qrequest ){	scsi_ccb *request = qrequest->request;	scsi_cmd_mode_select_10 *cmd = (scsi_cmd_mode_select_10 *)request->cdb;	scsi_mode_param_header_10 param_header;	scsi_modepage_header page_header;	int total_length;	uint modepage_offset;	char modepage_buffer[64];	// !!! enlarge this to support longer mode pages		if( cmd->SP || cmd->PF != 1 ) {		set_sense( device, SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_CDB_FIELD );		return;	}		total_length = min( request->data_len, 		((uint16)cmd->high_param_list_length << 8) | cmd->low_param_list_length);		// first, retrieve page header to get size of different chunks	//param_header = (scsi_mode_param_header_10 *)request->data;	if( !copy_sg_data( request, 0, total_length, 		&param_header, sizeof( param_header ), true ))		goto err;		total_length = min( total_length, 		(((uint16)param_header.high_mode_data_len << 8) | param_header.low_mode_data_len) + 1 );		// this is the start of the first mode page;	// we ignore the block descriptor silently	modepage_offset = 			sizeof( param_header ) + 		(((uint16)param_header.high_block_desc_len << 8) | param_header.low_block_desc_len);			// go through list of pages			while( modepage_offset < total_length ) {		int page_len;				// get header to know how long page is		if( !copy_sg_data( request, modepage_offset, total_length, 			&page_header, sizeof( page_header ), true ))			goto err;		// get size of one page and copy it to buffer		page_len = page_header.page_length + sizeof( scsi_modepage_header );				// the buffer has a maximum size - this is really standard compliant but		// sufficient for our needs		if( page_len > sizeof( modepage_buffer ))			goto err;					if( !copy_sg_data( request, modepage_offset, total_length, 			&modepage_buffer, min( page_len, sizeof( modepage_buffer )), true ))			goto err;		// modify page;		// currently, we only support the control mode page		switch( page_header.page_code ) {		case SCSI_MODEPAGE_CONTROL:			if( !ata_mode_select_contrpage( device, qrequest,				(scsi_modepage_contr *)modepage_buffer ))				return;			break;					default:			set_sense( device, 				SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_INV_PARAM_LIST_FIELD );			return;		}				modepage_offset += page_len;	}		if( modepage_offset != total_length )		goto err;			request->data_resid = request->data_len - total_length;	return;	// if we arrive here, data length was incorrecterr:	set_sense( device, 		SCSIS_KEY_ILLEGAL_REQUEST, SCSIS_ASC_PARAM_LIST_LENGTH_ERR );}