int ParseCaffHeaderConfig ( FILE * infile , char * infilename , char * fourcc , WavpackContext * wpc , WavpackConfig * config ) {
 uint32_t chan_chunk = 0 , channel_layout = 0 , bcount ;
 unsigned char * channel_identities = NULL ;
 unsigned char * channel_reorder = NULL ;
 int64_t total_samples = 0 , infilesize ;
 CAFFileHeader caf_file_header ;
 CAFChunkHeader caf_chunk_header ;
 CAFAudioFormat caf_audio_format ;
 int i ;
 infilesize = DoGetFileSize ( infile ) ;
 memcpy ( & caf_file_header , fourcc , 4 ) ;
 if ( ( ! DoReadFile ( infile , ( ( char * ) & caf_file_header ) + 4 , sizeof ( CAFFileHeader ) - 4 , & bcount ) || bcount != sizeof ( CAFFileHeader ) - 4 ) ) {
 error_line ( "%s is not a valid .CAF file!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & caf_file_header , sizeof ( CAFFileHeader ) ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 WavpackBigEndianToNative ( & caf_file_header , CAFFileHeaderFormat ) ;
 if ( caf_file_header . mFileVersion != 1 ) {
 error_line ( "%s: can't handle version %d .CAF files!" , infilename , caf_file_header . mFileVersion ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 while ( 1 ) {
 if ( ! DoReadFile ( infile , & caf_chunk_header , sizeof ( CAFChunkHeader ) , & bcount ) || bcount != sizeof ( CAFChunkHeader ) ) {
 error_line ( "%s is not a valid .CAF file!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & caf_chunk_header , sizeof ( CAFChunkHeader ) ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 WavpackBigEndianToNative ( & caf_chunk_header , CAFChunkHeaderFormat ) ;
 if ( ! strncmp ( caf_chunk_header . mChunkType , "desc" , 4 ) ) {
 int supported = TRUE ;
 if ( caf_chunk_header . mChunkSize != sizeof ( CAFAudioFormat ) || ! DoReadFile ( infile , & caf_audio_format , ( uint32_t ) caf_chunk_header . mChunkSize , & bcount ) || bcount != caf_chunk_header . mChunkSize ) {
 error_line ( "%s is not a valid .CAF file!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & caf_audio_format , ( uint32_t ) caf_chunk_header . mChunkSize ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 WavpackBigEndianToNative ( & caf_audio_format , CAFAudioFormatFormat ) ;
 if ( debug_logging_mode ) {
 char formatstr [ 5 ] ;
 memcpy ( formatstr , caf_audio_format . mFormatID , 4 ) ;
 formatstr [ 4 ] = 0 ;
 error_line ( "format = %s, flags = %x, sampling rate = %g" , formatstr , caf_audio_format . mFormatFlags , caf_audio_format . mSampleRate ) ;
 error_line ( "packet = %d bytes and %d frames" , caf_audio_format . mBytesPerPacket , caf_audio_format . mFramesPerPacket ) ;
 error_line ( "channels per frame = %d, bits per channel = %d" , caf_audio_format . mChannelsPerFrame , caf_audio_format . mBitsPerChannel ) ;
 }
 if ( strncmp ( caf_audio_format . mFormatID , "lpcm" , 4 ) || ( caf_audio_format . mFormatFlags & ~ 3 ) ) supported = FALSE ;
 else if ( caf_audio_format . mSampleRate < 1.0 || caf_audio_format . mSampleRate > 16777215.0 || caf_audio_format . mSampleRate != floor ( caf_audio_format . mSampleRate ) ) supported = FALSE ;
 else if ( ! caf_audio_format . mChannelsPerFrame || caf_audio_format . mChannelsPerFrame > 256 ) supported = FALSE ;
 else if ( caf_audio_format . mBitsPerChannel < 1 || caf_audio_format . mBitsPerChannel > 32 || ( ( caf_audio_format . mFormatFlags & CAF_FORMAT_FLOAT ) && caf_audio_format . mBitsPerChannel != 32 ) ) supported = FALSE ;
 else if ( caf_audio_format . mFramesPerPacket != 1 || caf_audio_format . mBytesPerPacket / caf_audio_format . mChannelsPerFrame < ( caf_audio_format . mBitsPerChannel + 7 ) / 8 || caf_audio_format . mBytesPerPacket / caf_audio_format . mChannelsPerFrame > 4 || caf_audio_format . mBytesPerPacket % caf_audio_format . mChannelsPerFrame ) supported = FALSE ;
 if ( ! supported ) {
 error_line ( "%s is an unsupported .CAF format!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 config -> bytes_per_sample = caf_audio_format . mBytesPerPacket / caf_audio_format . mChannelsPerFrame ;
 config -> float_norm_exp = ( caf_audio_format . mFormatFlags & CAF_FORMAT_FLOAT ) ? 127 : 0 ;
 config -> bits_per_sample = caf_audio_format . mBitsPerChannel ;
 config -> num_channels = caf_audio_format . mChannelsPerFrame ;
 config -> sample_rate = ( int ) caf_audio_format . mSampleRate ;
 if ( ! ( caf_audio_format . mFormatFlags & CAF_FORMAT_LITTLE_ENDIAN ) && config -> bytes_per_sample > 1 ) config -> qmode |= QMODE_BIG_ENDIAN ;
 if ( config -> bytes_per_sample == 1 ) config -> qmode |= QMODE_SIGNED_BYTES ;
 if ( debug_logging_mode ) {
 if ( config -> float_norm_exp == 127 ) error_line ( "data format: 32-bit %s-endian floating point" , ( config -> qmode & QMODE_BIG_ENDIAN ) ? "big" : "little" ) ;
 else error_line ( "data format: %d-bit %s-endian integers stored in %d byte(s)" , config -> bits_per_sample , ( config -> qmode & QMODE_BIG_ENDIAN ) ? "big" : "little" , config -> bytes_per_sample ) ;
 }
 }
 else if ( ! strncmp ( caf_chunk_header . mChunkType , "chan" , 4 ) ) {
 CAFChannelLayout * caf_channel_layout = malloc ( ( size_t ) caf_chunk_header . mChunkSize ) ;
 if ( caf_chunk_header . mChunkSize < sizeof ( CAFChannelLayout ) || ! DoReadFile ( infile , caf_channel_layout , ( uint32_t ) caf_chunk_header . mChunkSize , & bcount ) || bcount != caf_chunk_header . mChunkSize ) {
 error_line ( "%s is not a valid .CAF file!" , infilename ) ;
 free ( caf_channel_layout ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , caf_channel_layout , ( uint32_t ) caf_chunk_header . mChunkSize ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 free ( caf_channel_layout ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 WavpackBigEndianToNative ( caf_channel_layout , CAFChannelLayoutFormat ) ;
 chan_chunk = 1 ;
 if ( config -> channel_mask || ( config -> qmode & QMODE_CHANS_UNASSIGNED ) ) {
 error_line ( "this CAF file already has channel order information!" ) ;
 free ( caf_channel_layout ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 switch ( caf_channel_layout -> mChannelLayoutTag ) {
 case kCAFChannelLayoutTag_UseChannelDescriptions : {
 CAFChannelDescription * descriptions = ( CAFChannelDescription * ) ( caf_channel_layout + 1 ) ;
 int num_descriptions = caf_channel_layout -> mNumberChannelDescriptions ;
 int label , cindex = 0 , idents = 0 ;
 if ( caf_chunk_header . mChunkSize != sizeof ( CAFChannelLayout ) + sizeof ( CAFChannelDescription ) * num_descriptions || num_descriptions != config -> num_channels ) {
 error_line ( "channel descriptions in 'chan' chunk are the wrong size!" ) ;
 free ( caf_channel_layout ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( num_descriptions >= 256 ) {
 error_line ( "%d channel descriptions is more than we can handle...ignoring!" ) ;
 break ;
 }
 channel_reorder = malloc ( num_descriptions ) ;
 memset ( channel_reorder , - 1 , num_descriptions ) ;
 channel_identities = malloc ( num_descriptions + 1 ) ;
 for ( i = 0 ;
 i < num_descriptions ;
 ++ i ) {
 WavpackBigEndianToNative ( descriptions + i , CAFChannelDescriptionFormat ) ;
 if ( debug_logging_mode ) error_line ( "chan %d --> %d" , i + 1 , descriptions [ i ] . mChannelLabel ) ;
 }
 for ( label = 1 ;
 label <= 18 ;
 ++ label ) for ( i = 0 ;
 i < num_descriptions ;
 ++ i ) if ( descriptions [ i ] . mChannelLabel == label ) {
 config -> channel_mask |= 1 << ( label - 1 ) ;
 channel_reorder [ i ] = cindex ++ ;
 break ;
 }
 for ( i = 0 ;
 i < num_descriptions ;
 ++ i ) if ( channel_reorder [ i ] == ( unsigned char ) - 1 ) {
 uint32_t clabel = descriptions [ i ] . mChannelLabel ;
 if ( clabel == 0 || clabel == 0xffffffff || clabel == 100 ) channel_identities [ idents ++ ] = 0xff ;
 else if ( ( clabel >= 33 && clabel <= 44 ) || ( clabel >= 200 && clabel <= 207 ) || ( clabel >= 301 && clabel <= 305 ) ) channel_identities [ idents ++ ] = clabel >= 301 ? clabel - 80 : clabel ;
 else {
 error_line ( "warning: unknown channel descriptions label: %d" , clabel ) ;
 channel_identities [ idents ++ ] = 0xff ;
 }
 channel_reorder [ i ] = cindex ++ ;
 }
 for ( i = 0 ;
 i < num_descriptions ;
 ++ i ) if ( channel_reorder [ i ] != i ) break ;
 if ( i == num_descriptions ) {
 free ( channel_reorder ) ;
 channel_reorder = NULL ;
 }
 else {
 config -> qmode |= QMODE_REORDERED_CHANS ;
 channel_layout = num_descriptions ;
 }
 if ( ! idents ) {
 free ( channel_identities ) ;
 channel_identities = NULL ;
 }
 else channel_identities [ idents ] = 0 ;
 if ( debug_logging_mode ) {
 error_line ( "layout_tag = 0x%08x, so generated bitmap of 0x%08x from %d descriptions, %d non-MS" , caf_channel_layout -> mChannelLayoutTag , config -> channel_mask , caf_channel_layout -> mNumberChannelDescriptions , idents ) ;
 if ( channel_reorder && num_descriptions <= 8 ) {
 char reorder_string [ ] = "12345678" ;
 for ( i = 0 ;
 i < num_descriptions ;
 ++ i ) reorder_string [ i ] = channel_reorder [ i ] + '1' ;
 reorder_string [ i ] = 0 ;
 error_line ( "reordering string = \"%s\"\n" , reorder_string ) ;
 }
 }
 }
 break ;
 case kCAFChannelLayoutTag_UseChannelBitmap : config -> channel_mask = caf_channel_layout -> mChannelBitmap ;
 if ( debug_logging_mode ) error_line ( "layout_tag = 0x%08x, so using supplied bitmap of 0x%08x" , caf_channel_layout -> mChannelLayoutTag , caf_channel_layout -> mChannelBitmap ) ;
 break ;
 default : for ( i = 0 ;
 i < NUM_LAYOUTS ;
 ++ i ) if ( caf_channel_layout -> mChannelLayoutTag == layouts [ i ] . mChannelLayoutTag ) {
 config -> channel_mask = layouts [ i ] . mChannelBitmap ;
 channel_layout = layouts [ i ] . mChannelLayoutTag ;
 if ( layouts [ i ] . mChannelReorder ) {
 channel_reorder = ( unsigned char * ) strdup ( layouts [ i ] . mChannelReorder ) ;
 config -> qmode |= QMODE_REORDERED_CHANS ;
 }
 if ( layouts [ i ] . mChannelIdentities ) channel_identities = ( unsigned char * ) strdup ( layouts [ i ] . mChannelIdentities ) ;
 if ( debug_logging_mode ) error_line ( "layout_tag 0x%08x found in table, bitmap = 0x%08x, reorder = %s, identities = %s" , channel_layout , config -> channel_mask , channel_reorder ? "yes" : "no" , channel_identities ? "yes" : "no" ) ;
 break ;
 }
 if ( i == NUM_LAYOUTS && debug_logging_mode ) error_line ( "layout_tag 0x%08x not found in table...all channels unassigned" , caf_channel_layout -> mChannelLayoutTag ) ;
 break ;
 }
 free ( caf_channel_layout ) ;
 }
 else if ( ! strncmp ( caf_chunk_header . mChunkType , "data" , 4 ) ) {
 uint32_t mEditCount ;
 if ( ! DoReadFile ( infile , & mEditCount , sizeof ( mEditCount ) , & bcount ) || bcount != sizeof ( mEditCount ) ) {
 error_line ( "%s is not a valid .CAF file!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & mEditCount , sizeof ( mEditCount ) ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( ( config -> qmode & QMODE_IGNORE_LENGTH ) || caf_chunk_header . mChunkSize == - 1 ) {
 config -> qmode |= QMODE_IGNORE_LENGTH ;
 if ( infilesize && DoGetFilePosition ( infile ) != - 1 ) total_samples = ( infilesize - DoGetFilePosition ( infile ) ) / caf_audio_format . mBytesPerPacket ;
 else total_samples = - 1 ;
 }
 else {
 if ( infilesize && infilesize - caf_chunk_header . mChunkSize > 16777216 ) {
 error_line ( ".CAF file %s has over 16 MB of extra CAFF data, probably is corrupt!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( ( caf_chunk_header . mChunkSize - 4 ) % caf_audio_format . mBytesPerPacket ) {
 error_line ( ".CAF file %s has an invalid data chunk size, probably is corrupt!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 total_samples = ( caf_chunk_header . mChunkSize - 4 ) / caf_audio_format . mBytesPerPacket ;
 if ( ! total_samples ) {
 error_line ( "this .CAF file has no audio samples, probably is corrupt!" ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( total_samples > MAX_WAVPACK_SAMPLES ) {
 error_line ( "%s has too many samples for WavPack!" , infilename ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 }
 break ;
 }
 else {
 int bytes_to_copy = ( uint32_t ) caf_chunk_header . mChunkSize ;
 char * buff = malloc ( bytes_to_copy ) ;
 if ( debug_logging_mode ) error_line ( "extra unknown chunk \"%c%c%c%c\" of %d bytes" , caf_chunk_header . mChunkType [ 0 ] , caf_chunk_header . mChunkType [ 1 ] , caf_chunk_header . mChunkType [ 2 ] , caf_chunk_header . mChunkType [ 3 ] , caf_chunk_header . mChunkSize ) ;
 if ( ! DoReadFile ( infile , buff , bytes_to_copy , & bcount ) || bcount != bytes_to_copy || ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , buff , bytes_to_copy ) ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 free ( buff ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 free ( buff ) ;
 }
 }
 if ( ! chan_chunk && ! config -> channel_mask && config -> num_channels <= 2 && ! ( config -> qmode & QMODE_CHANS_UNASSIGNED ) ) config -> channel_mask = 0x5 - config -> num_channels ;
 if ( ! WavpackSetConfiguration64 ( wpc , config , total_samples , channel_identities ) ) {
 error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( channel_identities ) free ( channel_identities ) ;
 if ( channel_layout || channel_reorder ) {
 if ( ! WavpackSetChannelLayout ( wpc , channel_layout , channel_reorder ) ) {
 error_line ( "problem with setting channel layout (should not happen)" ) ;
 return WAVPACK_SOFT_ERROR ;
 }
 if ( channel_reorder ) free ( channel_reorder ) ;
 }
 return WAVPACK_NO_ERROR ;
 }


enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
{
	/*
	 * Update run-time statistics of the 'current'.
	 */
	update_curr(cfs_rq);

	if (wakeup) {
		place_entity(cfs_rq, se, 0);
		enqueue_sleeper(cfs_rq, se);
	}

	update_stats_enqueue(cfs_rq, se);
	check_spread(cfs_rq, se);
	if (se != cfs_rq->curr)
		__enqueue_entity(cfs_rq, se);
	account_entity_enqueue(cfs_rq, se);
}


static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op){ MpegEncContext * const s = &h->s; const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8; int my= h->mv_cache[list][ scan8[n] ][1] + src_y_offset*8; const int luma_xy= (mx&3) + ((my&3)<<2); uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->mb_linesize; uint8_t * src_cb, * src_cr; int extra_width= h->emu_edge_width; int extra_height= h->emu_edge_height; int emu=0; const int full_mx= mx>>2; const int full_my= my>>2; const int pic_width = 16*s->mb_width; const int pic_height = 16*s->mb_height >> MB_FIELD; if(!pic->data[0]) //FIXME this is unacceptable, some sensible error concealment must be done for missing reference frames return; if(mx&7) extra_width -= 3; if(my&7) extra_height -= 3; if( full_mx < 0-extra_width || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize; emu=1; } qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps? if(!square){ qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize); } if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; if(MB_FIELD){ // chroma offset when predicting from a field of opposite parity my += 2 * ((s->mb_y & 1) - (pic->reference - 1)); emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); } src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize; src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7); if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7); }


static inline struct cfs_rq *cfs_rq_of(struct sched_entity *se)
{
	return se->cfs_rq;
}


load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
		  unsigned long max_load_move,
		  struct sched_domain *sd, enum cpu_idle_type idle,
		  int *all_pinned, int *this_best_prio)
{
	struct cfs_rq *busy_cfs_rq;
	long rem_load_move = max_load_move;
	struct rq_iterator cfs_rq_iterator;

	cfs_rq_iterator.start = load_balance_start_fair;
	cfs_rq_iterator.next = load_balance_next_fair;

	for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
#ifdef CONFIG_FAIR_GROUP_SCHED
		struct cfs_rq *this_cfs_rq;
		long imbalance;
		unsigned long maxload;

		this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu);

		imbalance = busy_cfs_rq->load.weight - this_cfs_rq->load.weight;
		/* Don't pull if this_cfs_rq has more load than busy_cfs_rq */
		if (imbalance <= 0)
			continue;

		/* Don't pull more than imbalance/2 */
		imbalance /= 2;
		maxload = min(rem_load_move, imbalance);

		*this_best_prio = cfs_rq_best_prio(this_cfs_rq);
#else
# define maxload rem_load_move
#endif
		/*
		 * pass busy_cfs_rq argument into
		 * load_balance_[start|next]_fair iterators
		 */
		cfs_rq_iterator.arg = busy_cfs_rq;
		rem_load_move -= balance_tasks(this_rq, this_cpu, busiest,
					       maxload, sd, idle, all_pinned,
					       this_best_prio,
					       &cfs_rq_iterator);

		if (rem_load_move <= 0)
			break;
	}

	return max_load_move - rem_load_move;
}


static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width) { #ifdef HAVE_MMX asm volatile( "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "psrlw $8, %%mm0 \n\t" "psrlw $8, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" (-width), "r" (src+width*2), "r" (dst+width) : "%"REG_a ); #else int i; for(i=0; i<width; i++) dst[i]= src[2*i+1]; #endif }


int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags) { if(!strcmp(cmd, "ping")){ av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name); return 0; }else if(!strcmp(cmd, "enable")) { return set_enable_expr(filter, arg); }else if(filter->filter->process_command) { return filter->filter->process_command(filter, cmd, arg, res, res_len, flags); return AVERROR(ENOSYS);


static av_cold int audio_write_header(AVFormatContext *s1) { AlsaData *s = s1->priv_data; AVStream *st; unsigned int sample_rate; enum AVCodecID codec_id; int res; st = s1->streams[0]; sample_rate = st->codec->sample_rate; codec_id = st->codec->codec_id; res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate, st->codec->channels, &codec_id); if (sample_rate != st->codec->sample_rate) { av_log(s1, AV_LOG_ERROR, "sample rate %d not available, nearest is %d\n", st->codec->sample_rate, sample_rate); goto fail; } avpriv_set_pts_info(st, 64, 1, sample_rate); return res; fail: snd_pcm_close(s->h); return AVERROR(EIO); }


static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_dlog(c->fc, "keyframe_count = %d\n", entries); if (!entries) { sc->keyframe_absent = 1; if (!st->need_parsing) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(entries * sizeof(int)); if (!sc->keyframes) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->keyframes[i] = avio_rb32(pb); //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); } sc->keyframe_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; }


static void InitXCFImage ( XCFLayerInfo * outLayer , ExceptionInfo * exception ) {
 outLayer -> image -> page . x = outLayer -> offset_x ;
 outLayer -> image -> page . y = outLayer -> offset_y ;
 outLayer -> image -> page . width = outLayer -> width ;
 outLayer -> image -> page . height = outLayer -> height ;
 ( void ) SetImageProperty ( outLayer -> image , "label" , ( char * ) outLayer -> name , exception ) ;
 }


static void U_CALLCONV _UTF32Reset ( UConverter * cnv , UConverterResetChoice choice ) {
 if ( choice <= UCNV_RESET_TO_UNICODE ) {
 cnv -> mode = 0 ;
 }
 if ( choice != UCNV_RESET_TO_UNICODE ) {
 cnv -> fromUnicodeStatus = UCNV_NEED_TO_WRITE_BOM ;
 }
 }


static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, PCIHotplugState state) { int slot = PCI_SLOT(dev->devfn); PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, PCI_DEVICE(qdev)); /* Don't send event when device is enabled during qemu machine creation: * it is present on boot, no hotplug event is necessary. We do send an * event when the device is disabled later. */ if (state == PCI_COLDPLUG_ENABLED) { return 0; } s->pci0_status.up = 0; s->pci0_status.down = 0; if (state == PCI_HOTPLUG_ENABLED) { enable_device(s, slot); } else { disable_device(s, slot); } pm_update_sci(s); return 0; }


static void update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
	/*
	 * Are we enqueueing a waiting task? (for current tasks
	 * a dequeue/enqueue event is a NOP)
	 */
	if (se != cfs_rq->curr)
		update_stats_wait_start(cfs_rq, se);
}


static void qio_channel_websock_handshake_send_res_err ( QIOChannelWebsock * ioc , const char * resdata ) {
 char * date = qio_channel_websock_date_str ( ) ;
 qio_channel_websock_handshake_send_res ( ioc , resdata , date ) ;
 g_free ( date ) ;
 }


static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
{
	struct task_struct *curr = rq->curr;
	struct cfs_rq *cfs_rq = task_cfs_rq(curr);
	struct sched_entity *se = &curr->se, *pse = &p->se;
	int se_depth, pse_depth;

	if (unlikely(rt_prio(p->prio))) {
		update_rq_clock(rq);
		update_curr(cfs_rq);
		resched_task(curr);
		return;
	}

	se->last_wakeup = se->sum_exec_runtime;
	if (unlikely(se == pse))
		return;

	cfs_rq_of(pse)->next = pse;

	/*
	 * Batch tasks do not preempt (their preemption is driven by
	 * the tick):
	 */
	if (unlikely(p->policy == SCHED_BATCH))
		return;

	if (!sched_feat(WAKEUP_PREEMPT))
		return;

	/*
	 * preemption test can be made between sibling entities who are in the
	 * same cfs_rq i.e who have a common parent. Walk up the hierarchy of
	 * both tasks until we find their ancestors who are siblings of common
	 * parent.
	 */

	/* First walk up until both entities are at same depth */
	se_depth = depth_se(se);
	pse_depth = depth_se(pse);

	while (se_depth > pse_depth) {
		se_depth--;
		se = parent_entity(se);
	}

	while (pse_depth > se_depth) {
		pse_depth--;
		pse = parent_entity(pse);
	}

	while (!is_same_group(se, pse)) {
		se = parent_entity(se);
		pse = parent_entity(pse);
	}

	if (wakeup_preempt_entity(se, pse) == 1)
		resched_task(curr);
}


static int ff_estimate_motion_b(MpegEncContext * s, int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code) { MotionEstContext * const c= &s->me; int mx, my, dmin; int P[10][2]; const int shift= 1+s->quarter_sample; const int mot_stride = s->mb_stride; const int mot_xy = mb_y*mot_stride + mb_x; uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV; int mv_scale; c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= mv_penalty; get_limits(s, 16*mb_x, 16*mb_y); switch(s->me_method) { case ME_ZERO: default: no_motion_search(s, &mx, &my); dmin = 0; mx-= mb_x*16; my-= mb_y*16; break; #if 0 case ME_FULL: dmin = full_motion_search(s, &mx, &my, range, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; case ME_LOG: dmin = log_motion_search(s, &mx, &my, range / 2, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; case ME_PHODS: dmin = phods_motion_search(s, &mx, &my, range / 2, ref_picture); mx-= mb_x*16; my-= mb_y*16; break; #endif case ME_X1: case ME_EPZS: { P_LEFT[0] = mv_table[mot_xy - 1][0]; P_LEFT[1] = mv_table[mot_xy - 1][1]; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); /* special case for first line */ if (!s->first_slice_line) { P_TOP[0] = mv_table[mot_xy - mot_stride ][0]; P_TOP[1] = mv_table[mot_xy - mot_stride ][1]; P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1 ][0]; P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1 ][1]; if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1]= (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } if(mv_table == s->b_forw_mv_table){ mv_scale= (s->pb_time<<16) / (s->pp_time<<shift); }else{ mv_scale= ((s->pb_time - s->pp_time)<<16) / (s->pp_time<<shift); } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16); break; } dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= get_mb_score(s, mx, my, 0, ref_index); //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; mv_table[mot_xy][0]= mx; mv_table[mot_xy][1]= my; return dmin; }


AddressSpace *pci_device_iommu_address_space(PCIDevice *dev) { PCIBus *bus = PCI_BUS(dev->bus); if (bus->iommu_fn) { return bus->iommu_fn(bus, bus->iommu_opaque, dev->devfn); } if (bus->parent_dev) { /** We are ignoring the bus master DMA bit of the bridge * as it would complicate things such as VFIO for no good reason */ return pci_device_iommu_address_space(bus->parent_dev); } return &address_space_memory; }


static int dissect_ber_ObjectDescriptor ( gboolean implicit_tag _U_ , tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
 offset = dissect_ber_restricted_string ( implicit_tag , BER_UNI_TAG_ObjectDescriptor , actx , tree , tvb , offset , hf_index , & actx -> external . data_value_descriptor ) ;
 return offset ;
 }


size_t WriteStr ( ArchiveHandle * AH , const char * c ) {
 size_t res ;
 if ( c ) {
 int len = strlen ( c ) ;
 res = WriteInt ( AH , len ) ;
 ( * AH -> WriteBufPtr ) ( AH , c , len ) ;
 res += len ;
 }
 else res = WriteInt ( AH , - 1 ) ;
 return res ;
 }


static bluetooth_uuid_t get_uuid_from_handle ( packet_info * pinfo , guint32 handle , bluetooth_data_t * bluetooth_data ) {
 wmem_tree_key_t key [ 4 ] ;
 guint32 frame_number ;
 handle_data_t * handle_data ;
 wmem_tree_t * sub_wmemtree ;
 bluetooth_uuid_t uuid ;
 memset ( & uuid , 0 , sizeof uuid ) ;
 frame_number = pinfo -> num ;
 key [ 0 ] . length = 1 ;
 key [ 0 ] . key = & bluetooth_data -> interface_id ;
 key [ 1 ] . length = 1 ;
 key [ 1 ] . key = & bluetooth_data -> adapter_id ;
 key [ 2 ] . length = 1 ;
 key [ 2 ] . key = & handle ;
 key [ 3 ] . length = 0 ;
 key [ 3 ] . key = NULL ;
 sub_wmemtree = ( wmem_tree_t * ) wmem_tree_lookup32_array ( handle_to_uuid , key ) ;
 handle_data = ( sub_wmemtree ) ? ( handle_data_t * ) wmem_tree_lookup32_le ( sub_wmemtree , frame_number ) : NULL ;
 if ( handle_data ) uuid = handle_data -> uuid ;
 return uuid ;
 }


static int append_multiple_key_values ( smart_str * loc_name , HashTable * hash_arr , char * key_name TSRMLS_DC ) {
 zval * * ele_value = NULL ;
 int i = 0 ;
 int isFirstSubtag = 0 ;
 int max_value = 0 ;
 if ( zend_hash_find ( hash_arr , key_name , strlen ( key_name ) + 1 , ( void * * ) & ele_value ) == SUCCESS ) {
 if ( Z_TYPE_PP ( ele_value ) == IS_STRING ) {
 add_prefix ( loc_name , key_name ) ;
 smart_str_appendl ( loc_name , SEPARATOR , sizeof ( SEPARATOR ) - 1 ) ;
 smart_str_appendl ( loc_name , Z_STRVAL_PP ( ele_value ) , Z_STRLEN_PP ( ele_value ) ) ;
 return SUCCESS ;
 }
 else if ( Z_TYPE_PP ( ele_value ) == IS_ARRAY ) {
 HashPosition pos ;
 HashTable * arr = HASH_OF ( * ele_value ) ;
 zval * * data = NULL ;
 zend_hash_internal_pointer_reset_ex ( arr , & pos ) ;
 while ( zend_hash_get_current_data_ex ( arr , ( void * * ) & data , & pos ) != FAILURE ) {
 if ( Z_TYPE_PP ( data ) != IS_STRING ) {
 return FAILURE ;
 }
 if ( isFirstSubtag ++ == 0 ) {
 add_prefix ( loc_name , key_name ) ;
 }
 smart_str_appendl ( loc_name , SEPARATOR , sizeof ( SEPARATOR ) - 1 ) ;
 smart_str_appendl ( loc_name , Z_STRVAL_PP ( data ) , Z_STRLEN_PP ( data ) ) ;
 zend_hash_move_forward_ex ( arr , & pos ) ;
 }
 return SUCCESS ;
 }
 else {
 return FAILURE ;
 }
 }
 else {
 char cur_key_name [ 31 ] ;
 if ( strcmp ( key_name , LOC_VARIANT_TAG ) == 0 ) {
 max_value = MAX_NO_VARIANT ;
 }
 if ( strcmp ( key_name , LOC_EXTLANG_TAG ) == 0 ) {
 max_value = MAX_NO_EXTLANG ;
 }
 if ( strcmp ( key_name , LOC_PRIVATE_TAG ) == 0 ) {
 max_value = MAX_NO_PRIVATE ;
 }
 isFirstSubtag = 0 ;
 for ( i = 0 ;
 i < max_value ;
 i ++ ) {
 snprintf ( cur_key_name , 30 , "%s%d" , key_name , i ) ;
 if ( zend_hash_find ( hash_arr , cur_key_name , strlen ( cur_key_name ) + 1 , ( void * * ) & ele_value ) == SUCCESS ) {
 if ( Z_TYPE_PP ( ele_value ) != IS_STRING ) {
 return FAILURE ;
 }
 if ( isFirstSubtag ++ == 0 ) {
 add_prefix ( loc_name , cur_key_name ) ;
 }
 smart_str_appendl ( loc_name , SEPARATOR , sizeof ( SEPARATOR ) - 1 ) ;
 smart_str_appendl ( loc_name , Z_STRVAL_PP ( ele_value ) , Z_STRLEN_PP ( ele_value ) ) ;
 }
 }
 }
 return SUCCESS ;
 }


REGRESSION_TEST ( SDK_API_TSUrlParse ) ( RegressionTest * test , int , int * pstatus ) {
 static const char * const urls [ ] = {
 "file:///test.dat;
ab?abc=def#abc" , "http://www.example.com/" , "http://abc:def@www.example.com/" , "http://www.example.com:3426/" , "http://abc:def@www.example.com:3426/" , "http://www.example.com/homepage.cgi" , "http://www.example.com/homepage.cgi;
ab?abc=def#abc" , "http://abc:def@www.example.com:3426/homepage.cgi;
ab?abc=def#abc" , "https://abc:def@www.example.com:3426/homepage.cgi;
ab?abc=def#abc" , "ftp://abc:def@www.example.com:3426/homepage.cgi;
ab?abc=def#abc" , "file:///c:/test.dat;
ab?abc=def#abc" , "file:///test.dat;
ab?abc=def#abc" , "foo://bar.com/baz/" , "http://a.b.com/xx.jpg?newpath=http://b.c.com" }
 ;
 static int const num_urls = sizeof ( urls ) / sizeof ( urls [ 0 ] ) ;
 bool test_passed [ num_urls ] = {
 false }
 ;
 const char * start ;
 const char * end ;
 char * temp ;
 int retval ;
 TSMBuffer bufp ;
 TSMLoc url_loc = ( TSMLoc ) nullptr ;
 int length ;
 * pstatus = REGRESSION_TEST_INPROGRESS ;
 int idx ;
 for ( idx = 0 ;
 idx < num_urls ;
 idx ++ ) {
 const char * url = urls [ idx ] ;
 bufp = TSMBufferCreate ( ) ;
 if ( TSUrlCreate ( bufp , & url_loc ) != TS_SUCCESS ) {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_FAIL , "Cannot create Url for parsing the url" ) ;
 if ( TSMBufferDestroy ( bufp ) == TS_ERROR ) {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_FAIL , "Error in Destroying MBuffer" ) ;
 }
 }
 else {
 start = url ;
 end = url + strlen ( url ) ;
 if ( ( retval = TSUrlParse ( bufp , url_loc , & start , end ) ) == TS_PARSE_ERROR ) {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_FAIL , "TSUrlParse returns TS_PARSE_ERROR" ) ;
 }
 else {
 if ( retval == TS_PARSE_DONE ) {
 temp = TSUrlStringGet ( bufp , url_loc , & length ) ;
 if ( strncmp ( url , temp , length ) == 0 ) {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_PASS , "ok" ) ;
 test_passed [ idx ] = true ;
 }
 else {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_FAIL , "Value's Mismatch" ) ;
 }
 TSfree ( temp ) ;
 }
 else {
 SDK_RPRINT ( test , "TSUrlParse" , url , TC_FAIL , "Parsing Error" ) ;
 }
 }
 }
 TSHandleMLocRelease ( bufp , TS_NULL_MLOC , url_loc ) ;
 TSMBufferDestroy ( bufp ) ;
 }
 for ( idx = 0 ;
 idx < num_urls ;
 idx ++ ) {
 if ( test_passed [ idx ] != true ) {
 * pstatus = REGRESSION_TEST_FAILED ;
 break ;
 }
 }
 if ( idx >= num_urls ) {
 * pstatus = REGRESSION_TEST_PASSED ;
 }
 return ;
 }


static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) { V9fsVirtioState *v = (V9fsVirtioState *)vdev; V9fsState *s = &v->state; V9fsPDU *pdu; ssize_t len; while ((pdu = pdu_alloc(s))) { struct { uint32_t size_le; uint8_t id; uint16_t tag_le; } QEMU_PACKED out; VirtQueueElement *elem = &v->elems[pdu->idx]; len = virtqueue_pop(vq, elem); if (!len) { pdu_free(pdu); break; } BUG_ON(elem->out_num == 0 || elem->in_num == 0); QEMU_BUILD_BUG_ON(sizeof out != 7); len = iov_to_buf(elem->out_sg, elem->out_num, 0, &out, sizeof out); BUG_ON(len != sizeof out); pdu->size = le32_to_cpu(out.size_le); pdu->id = out.id; pdu->tag = le16_to_cpu(out.tag_le); qemu_co_queue_init(&pdu->complete); pdu_submit(pdu); } }


static void dumpUserConfig ( PGconn * conn , const char * username ) {
 PQExpBuffer buf = createPQExpBuffer ( ) ;
 int count = 1 ;
 for ( ;
 ;
 ) {
 PGresult * res ;
 if ( server_version >= 90000 ) printfPQExpBuffer ( buf , "SELECT setconfig[%d] FROM pg_db_role_setting WHERE " "setdatabase = 0 AND setrole = " "(SELECT oid FROM pg_authid WHERE rolname = " , count ) ;
 else if ( server_version >= 80100 ) printfPQExpBuffer ( buf , "SELECT rolconfig[%d] FROM pg_authid WHERE rolname = " , count ) ;
 else printfPQExpBuffer ( buf , "SELECT useconfig[%d] FROM pg_shadow WHERE usename = " , count ) ;
 appendStringLiteralConn ( buf , username , conn ) ;
 if ( server_version >= 90000 ) appendPQExpBufferChar ( buf , ')' ) ;
 res = executeQuery ( conn , buf -> data ) ;
 if ( PQntuples ( res ) == 1 && ! PQgetisnull ( res , 0 , 0 ) ) {
 makeAlterConfigCommand ( conn , PQgetvalue ( res , 0 , 0 ) , "ROLE" , username , NULL , NULL ) ;
 PQclear ( res ) ;
 count ++ ;
 }
 else {
 PQclear ( res ) ;
 break ;
 }
 }
 destroyPQExpBuffer ( buf ) ;
 }


static int decode_coefs ( VP9_COMMON * cm , const MACROBLOCKD * xd , PLANE_TYPE type , int16_t * dqcoeff , TX_SIZE tx_size , const int16_t * dq , int ctx , const int16_t * scan , const int16_t * nb , vp9_reader * r ) {
 const int max_eob = 16 << ( tx_size << 1 ) ;
 const FRAME_CONTEXT * const fc = & cm -> fc ;
 FRAME_COUNTS * const counts = & cm -> counts ;
 const int ref = is_inter_block ( & xd -> mi [ 0 ] -> mbmi ) ;
 int band , c = 0 ;
 const vp9_prob ( * coef_probs ) [ COEFF_CONTEXTS ] [ UNCONSTRAINED_NODES ] = fc -> coef_probs [ tx_size ] [ type ] [ ref ] ;
 const vp9_prob * prob ;
 unsigned int ( * coef_counts ) [ COEFF_CONTEXTS ] [ UNCONSTRAINED_NODES + 1 ] = counts -> coef [ tx_size ] [ type ] [ ref ] ;
 unsigned int ( * eob_branch_count ) [ COEFF_CONTEXTS ] = counts -> eob_branch [ tx_size ] [ type ] [ ref ] ;
 uint8_t token_cache [ 32 * 32 ] ;
 const uint8_t * band_translate = get_band_translate ( tx_size ) ;
 const int dq_shift = ( tx_size == TX_32X32 ) ;
 int v ;
 int16_t dqv = dq [ 0 ] ;
 while ( c < max_eob ) {
 int val ;
 band = * band_translate ++ ;
 prob = coef_probs [ band ] [ ctx ] ;
 if ( ! cm -> frame_parallel_decoding_mode ) ++ eob_branch_count [ band ] [ ctx ] ;
 if ( ! vp9_read ( r , prob [ EOB_CONTEXT_NODE ] ) ) {
 INCREMENT_COUNT ( EOB_MODEL_TOKEN ) ;
 break ;
 }
 while ( ! vp9_read ( r , prob [ ZERO_CONTEXT_NODE ] ) ) {
 INCREMENT_COUNT ( ZERO_TOKEN ) ;
 dqv = dq [ 1 ] ;
 token_cache [ scan [ c ] ] = 0 ;
 ++ c ;
 if ( c >= max_eob ) return c ;
 ctx = get_coef_context ( nb , token_cache , c ) ;
 band = * band_translate ++ ;
 prob = coef_probs [ band ] [ ctx ] ;
 }
 if ( ! vp9_read ( r , prob [ ONE_CONTEXT_NODE ] ) ) {
 INCREMENT_COUNT ( ONE_TOKEN ) ;
 WRITE_COEF_CONTINUE ( 1 , ONE_TOKEN ) ;
 }
 INCREMENT_COUNT ( TWO_TOKEN ) ;
 prob = vp9_pareto8_full [ prob [ PIVOT_NODE ] - 1 ] ;
 if ( ! vp9_read ( r , prob [ LOW_VAL_CONTEXT_NODE ] ) ) {
 if ( ! vp9_read ( r , prob [ TWO_CONTEXT_NODE ] ) ) {
 WRITE_COEF_CONTINUE ( 2 , TWO_TOKEN ) ;
 }
 if ( ! vp9_read ( r , prob [ THREE_CONTEXT_NODE ] ) ) {
 WRITE_COEF_CONTINUE ( 3 , THREE_TOKEN ) ;
 }
 WRITE_COEF_CONTINUE ( 4 , FOUR_TOKEN ) ;
 }
 if ( ! vp9_read ( r , prob [ HIGH_LOW_CONTEXT_NODE ] ) ) {
 if ( ! vp9_read ( r , prob [ CAT_ONE_CONTEXT_NODE ] ) ) {
 val = CAT1_MIN_VAL ;
 ADJUST_COEF ( vp9_cat1_prob [ 0 ] , 0 ) ;
 WRITE_COEF_CONTINUE ( val , CATEGORY1_TOKEN ) ;
 }
 val = CAT2_MIN_VAL ;
 ADJUST_COEF ( vp9_cat2_prob [ 0 ] , 1 ) ;
 ADJUST_COEF ( vp9_cat2_prob [ 1 ] , 0 ) ;
 WRITE_COEF_CONTINUE ( val , CATEGORY2_TOKEN ) ;
 }
 if ( ! vp9_read ( r , prob [ CAT_THREEFOUR_CONTEXT_NODE ] ) ) {
 if ( ! vp9_read ( r , prob [ CAT_THREE_CONTEXT_NODE ] ) ) {
 val = CAT3_MIN_VAL ;
 ADJUST_COEF ( vp9_cat3_prob [ 0 ] , 2 ) ;
 ADJUST_COEF ( vp9_cat3_prob [ 1 ] , 1 ) ;
 ADJUST_COEF ( vp9_cat3_prob [ 2 ] , 0 ) ;
 WRITE_COEF_CONTINUE ( val , CATEGORY3_TOKEN ) ;
 }
 val = CAT4_MIN_VAL ;
 ADJUST_COEF ( vp9_cat4_prob [ 0 ] , 3 ) ;
 ADJUST_COEF ( vp9_cat4_prob [ 1 ] , 2 ) ;
 ADJUST_COEF ( vp9_cat4_prob [ 2 ] , 1 ) ;
 ADJUST_COEF ( vp9_cat4_prob [ 3 ] , 0 ) ;
 WRITE_COEF_CONTINUE ( val , CATEGORY4_TOKEN ) ;
 }
 if ( ! vp9_read ( r , prob [ CAT_FIVE_CONTEXT_NODE ] ) ) {
 val = CAT5_MIN_VAL ;
 ADJUST_COEF ( vp9_cat5_prob [ 0 ] , 4 ) ;
 ADJUST_COEF ( vp9_cat5_prob [ 1 ] , 3 ) ;
 ADJUST_COEF ( vp9_cat5_prob [ 2 ] , 2 ) ;
 ADJUST_COEF ( vp9_cat5_prob [ 3 ] , 1 ) ;
 ADJUST_COEF ( vp9_cat5_prob [ 4 ] , 0 ) ;
 WRITE_COEF_CONTINUE ( val , CATEGORY5_TOKEN ) ;
 }
 val = 0 ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 0 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 1 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 2 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 3 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 4 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 5 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 6 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 7 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 8 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 9 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 10 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 11 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 12 ] ) ;
 val = ( val << 1 ) | vp9_read ( r , vp9_cat6_prob [ 13 ] ) ;
 val += CAT6_MIN_VAL ;
 WRITE_COEF_CONTINUE ( val , CATEGORY6_TOKEN ) ;
 }
 return c ;
 }


static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, size_t size) { int64_t len; if (size > INT_MAX) { return -EIO; } if (!bdrv_is_inserted(bs)) return -ENOMEDIUM; if (bs->growable) return 0; len = bdrv_getlength(bs); if (offset < 0) return -EIO; if ((offset > len) || (len - offset < size)) return -EIO; return 0; }


static Node * eval_const_expressions_mutator ( Node * node , eval_const_expressions_context * context ) {
 if ( node == NULL ) return NULL ;
 switch ( nodeTag ( node ) ) {
 case T_Param : {
 Param * param = ( Param * ) node ;
 if ( param -> paramkind == PARAM_EXTERN && context -> boundParams != NULL && param -> paramid > 0 && param -> paramid <= context -> boundParams -> numParams ) {
 ParamExternData * prm = & context -> boundParams -> params [ param -> paramid - 1 ] ;
 if ( OidIsValid ( prm -> ptype ) ) {
 if ( context -> estimate || ( prm -> pflags & PARAM_FLAG_CONST ) ) {
 int16 typLen ;
 bool typByVal ;
 Datum pval ;
 Assert ( prm -> ptype == param -> paramtype ) ;
 get_typlenbyval ( param -> paramtype , & typLen , & typByVal ) ;
 if ( prm -> isnull || typByVal ) pval = prm -> value ;
 else pval = datumCopy ( prm -> value , typByVal , typLen ) ;
 return ( Node * ) makeConst ( param -> paramtype , param -> paramtypmod , param -> paramcollid , ( int ) typLen , pval , prm -> isnull , typByVal ) ;
 }
 }
 }
 return ( Node * ) copyObject ( param ) ;
 }
 case T_WindowFunc : {
 WindowFunc * expr = ( WindowFunc * ) node ;
 Oid funcid = expr -> winfnoid ;
 List * args ;
 Expr * aggfilter ;
 HeapTuple func_tuple ;
 WindowFunc * newexpr ;
 func_tuple = SearchSysCache1 ( PROCOID , ObjectIdGetDatum ( funcid ) ) ;
 if ( ! HeapTupleIsValid ( func_tuple ) ) elog ( ERROR , "cache lookup failed for function %u" , funcid ) ;
 args = expand_function_arguments ( expr -> args , expr -> wintype , func_tuple ) ;
 ReleaseSysCache ( func_tuple ) ;
 args = ( List * ) expression_tree_mutator ( ( Node * ) args , eval_const_expressions_mutator , ( void * ) context ) ;
 aggfilter = ( Expr * ) eval_const_expressions_mutator ( ( Node * ) expr -> aggfilter , context ) ;
 newexpr = makeNode ( WindowFunc ) ;
 newexpr -> winfnoid = expr -> winfnoid ;
 newexpr -> wintype = expr -> wintype ;
 newexpr -> wincollid = expr -> wincollid ;
 newexpr -> inputcollid = expr -> inputcollid ;
 newexpr -> args = args ;
 newexpr -> aggfilter = aggfilter ;
 newexpr -> winref = expr -> winref ;
 newexpr -> winstar = expr -> winstar ;
 newexpr -> winagg = expr -> winagg ;
 newexpr -> location = expr -> location ;
 return ( Node * ) newexpr ;
 }
 case T_FuncExpr : {
 FuncExpr * expr = ( FuncExpr * ) node ;
 List * args = expr -> args ;
 Expr * simple ;
 FuncExpr * newexpr ;
 simple = simplify_function ( expr -> funcid , expr -> funcresulttype , exprTypmod ( node ) , expr -> funccollid , expr -> inputcollid , & args , expr -> funcvariadic , true , true , context ) ;
 if ( simple ) return ( Node * ) simple ;
 newexpr = makeNode ( FuncExpr ) ;
 newexpr -> funcid = expr -> funcid ;
 newexpr -> funcresulttype = expr -> funcresulttype ;
 newexpr -> funcretset = expr -> funcretset ;
 newexpr -> funcvariadic = expr -> funcvariadic ;
 newexpr -> funcformat = expr -> funcformat ;
 newexpr -> funccollid = expr -> funccollid ;
 newexpr -> inputcollid = expr -> inputcollid ;
 newexpr -> args = args ;
 newexpr -> location = expr -> location ;
 return ( Node * ) newexpr ;
 }
 case T_OpExpr : {
 OpExpr * expr = ( OpExpr * ) node ;
 List * args = expr -> args ;
 Expr * simple ;
 OpExpr * newexpr ;
 set_opfuncid ( expr ) ;
 simple = simplify_function ( expr -> opfuncid , expr -> opresulttype , - 1 , expr -> opcollid , expr -> inputcollid , & args , false , true , true , context ) ;
 if ( simple ) return ( Node * ) simple ;
 if ( expr -> opno == BooleanEqualOperator || expr -> opno == BooleanNotEqualOperator ) {
 simple = ( Expr * ) simplify_boolean_equality ( expr -> opno , args ) ;
 if ( simple ) return ( Node * ) simple ;
 }
 newexpr = makeNode ( OpExpr ) ;
 newexpr -> opno = expr -> opno ;
 newexpr -> opfuncid = expr -> opfuncid ;
 newexpr -> opresulttype = expr -> opresulttype ;
 newexpr -> opretset = expr -> opretset ;
 newexpr -> opcollid = expr -> opcollid ;
 newexpr -> inputcollid = expr -> inputcollid ;
 newexpr -> args = args ;
 newexpr -> location = expr -> location ;
 return ( Node * ) newexpr ;
 }
 case T_DistinctExpr : {
 DistinctExpr * expr = ( DistinctExpr * ) node ;
 List * args ;
 ListCell * arg ;
 bool has_null_input = false ;
 bool all_null_input = true ;
 bool has_nonconst_input = false ;
 Expr * simple ;
 DistinctExpr * newexpr ;
 args = ( List * ) expression_tree_mutator ( ( Node * ) expr -> args , eval_const_expressions_mutator , ( void * ) context ) ;
 foreach ( arg , args ) {
 if ( IsA ( lfirst ( arg ) , Const ) ) {
 has_null_input |= ( ( Const * ) lfirst ( arg ) ) -> constisnull ;
 all_null_input &= ( ( Const * ) lfirst ( arg ) ) -> constisnull ;
 }
 else has_nonconst_input = true ;
 }
 if ( ! has_nonconst_input ) {
 if ( all_null_input ) return makeBoolConst ( false , false ) ;
 if ( has_null_input ) return makeBoolConst ( true , false ) ;
 set_opfuncid ( ( OpExpr * ) expr ) ;
 simple = simplify_function ( expr -> opfuncid , expr -> opresulttype , - 1 , expr -> opcollid , expr -> inputcollid , & args , false , false , false , context ) ;
 if ( simple ) {
 Const * csimple = ( Const * ) simple ;
 Assert ( IsA ( csimple , Const ) ) ;
 csimple -> constvalue = BoolGetDatum ( ! DatumGetBool ( csimple -> constvalue ) ) ;
 return ( Node * ) csimple ;
 }
 }
 newexpr = makeNode ( DistinctExpr ) ;
 newexpr -> opno = expr -> opno ;
 newexpr -> opfuncid = expr -> opfuncid ;
 newexpr -> opresulttype = expr -> opresulttype ;
 newexpr -> opretset = expr -> opretset ;
 newexpr -> opcollid = expr -> opcollid ;
 newexpr -> inputcollid = expr -> inputcollid ;
 newexpr -> args = args ;
 newexpr -> location = expr -> location ;
 return ( Node * ) newexpr ;
 }
 case T_BoolExpr : {
 BoolExpr * expr = ( BoolExpr * ) node ;
 switch ( expr -> boolop ) {
 case OR_EXPR : {
 List * newargs ;
 bool haveNull = false ;
 bool forceTrue = false ;
 newargs = simplify_or_arguments ( expr -> args , context , & haveNull , & forceTrue ) ;
 if ( forceTrue ) return makeBoolConst ( true , false ) ;
 if ( haveNull ) newargs = lappend ( newargs , makeBoolConst ( false , true ) ) ;
 if ( newargs == NIL ) return makeBoolConst ( false , false ) ;
 if ( list_length ( newargs ) == 1 ) return ( Node * ) linitial ( newargs ) ;
 return ( Node * ) make_orclause ( newargs ) ;
 }
 case AND_EXPR : {
 List * newargs ;
 bool haveNull = false ;
 bool forceFalse = false ;
 newargs = simplify_and_arguments ( expr -> args , context , & haveNull , & forceFalse ) ;
 if ( forceFalse ) return makeBoolConst ( false , false ) ;
 if ( haveNull ) newargs = lappend ( newargs , makeBoolConst ( false , true ) ) ;
 if ( newargs == NIL ) return makeBoolConst ( true , false ) ;
 if ( list_length ( newargs ) == 1 ) return ( Node * ) linitial ( newargs ) ;
 return ( Node * ) make_andclause ( newargs ) ;
 }
 case NOT_EXPR : {
 Node * arg ;
 Assert ( list_length ( expr -> args ) == 1 ) ;
 arg = eval_const_expressions_mutator ( linitial ( expr -> args ) , context ) ;
 return negate_clause ( arg ) ;
 }
 default : elog ( ERROR , "unrecognized boolop: %d" , ( int ) expr -> boolop ) ;
 break ;
 }
 break ;
 }
 case T_SubPlan : case T_AlternativeSubPlan : return node ;
 case T_RelabelType : {
 RelabelType * relabel = ( RelabelType * ) node ;
 Node * arg ;
 arg = eval_const_expressions_mutator ( ( Node * ) relabel -> arg , context ) ;
 while ( arg && IsA ( arg , RelabelType ) ) arg = ( Node * ) ( ( RelabelType * ) arg ) -> arg ;
 if ( arg && IsA ( arg , Const ) ) {
 Const * con = ( Const * ) arg ;
 con -> consttype = relabel -> resulttype ;
 con -> consttypmod = relabel -> resulttypmod ;
 con -> constcollid = relabel -> resultcollid ;
 return ( Node * ) con ;
 }
 else {
 RelabelType * newrelabel = makeNode ( RelabelType ) ;
 newrelabel -> arg = ( Expr * ) arg ;
 newrelabel -> resulttype = relabel -> resulttype ;
 newrelabel -> resulttypmod = relabel -> resulttypmod ;
 newrelabel -> resultcollid = relabel -> resultcollid ;
 newrelabel -> relabelformat = relabel -> relabelformat ;
 newrelabel -> location = relabel -> location ;
 return ( Node * ) newrelabel ;
 }
 }
 case T_CoerceViaIO : {
 CoerceViaIO * expr = ( CoerceViaIO * ) node ;
 List * args ;
 Oid outfunc ;
 bool outtypisvarlena ;
 Oid infunc ;
 Oid intypioparam ;
 Expr * simple ;
 CoerceViaIO * newexpr ;
 args = list_make1 ( expr -> arg ) ;
 getTypeOutputInfo ( exprType ( ( Node * ) expr -> arg ) , & outfunc , & outtypisvarlena ) ;
 getTypeInputInfo ( expr -> resulttype , & infunc , & intypioparam ) ;
 simple = simplify_function ( outfunc , CSTRINGOID , - 1 , InvalidOid , InvalidOid , & args , false , true , true , context ) ;
 if ( simple ) {
 args = list_make3 ( simple , makeConst ( OIDOID , - 1 , InvalidOid , sizeof ( Oid ) , ObjectIdGetDatum ( intypioparam ) , false , true ) , makeConst ( INT4OID , - 1 , InvalidOid , sizeof ( int32 ) , Int32GetDatum ( - 1 ) , false , true ) ) ;
 simple = simplify_function ( infunc , expr -> resulttype , - 1 , expr -> resultcollid , InvalidOid , & args , false , false , true , context ) ;
 if ( simple ) return ( Node * ) simple ;
 }
 newexpr = makeNode ( CoerceViaIO ) ;
 newexpr -> arg = ( Expr * ) linitial ( args ) ;
 newexpr -> resulttype = expr -> resulttype ;
 newexpr -> resultcollid = expr -> resultcollid ;
 newexpr -> coerceformat = expr -> coerceformat ;
 newexpr -> location = expr -> location ;
 return ( Node * ) newexpr ;
 }
 case T_ArrayCoerceExpr : {
 ArrayCoerceExpr * expr = ( ArrayCoerceExpr * ) node ;
 Expr * arg ;
 ArrayCoerceExpr * newexpr ;
 arg = ( Expr * ) eval_const_expressions_mutator ( ( Node * ) expr -> arg , context ) ;
 newexpr = makeNode ( ArrayCoerceExpr ) ;
 newexpr -> arg = arg ;
 newexpr -> elemfuncid = expr -> elemfuncid ;
 newexpr -> resulttype = expr -> resulttype ;
 newexpr -> resulttypmod = expr -> resulttypmod ;
 newexpr -> resultcollid = expr -> resultcollid ;
 newexpr -> isExplicit = expr -> isExplicit ;
 newexpr -> coerceformat = expr -> coerceformat ;
 newexpr -> location = expr -> location ;
 if ( arg && IsA ( arg , Const ) && ( ! OidIsValid ( newexpr -> elemfuncid ) || func_volatile ( newexpr -> elemfuncid ) == PROVOLATILE_IMMUTABLE ) ) return ( Node * ) evaluate_expr ( ( Expr * ) newexpr , newexpr -> resulttype , newexpr -> resulttypmod , newexpr -> resultcollid ) ;
 return ( Node * ) newexpr ;
 }
 case T_CollateExpr : {
 CollateExpr * collate = ( CollateExpr * ) node ;
 Node * arg ;
 arg = eval_const_expressions_mutator ( ( Node * ) collate -> arg , context ) ;
 if ( arg && IsA ( arg , Const ) ) {
 Const * con = ( Const * ) arg ;
 con -> constcollid = collate -> collOid ;
 return ( Node * ) con ;
 }
 else if ( collate -> collOid == exprCollation ( arg ) ) {
 return arg ;
 }
 else {
 RelabelType * relabel = makeNode ( RelabelType ) ;
 relabel -> resulttype = exprType ( arg ) ;
 relabel -> resulttypmod = exprTypmod ( arg ) ;
 relabel -> resultcollid = collate -> collOid ;
 relabel -> relabelformat = COERCE_IMPLICIT_CAST ;
 relabel -> location = collate -> location ;
 while ( arg && IsA ( arg , RelabelType ) ) arg = ( Node * ) ( ( RelabelType * ) arg ) -> arg ;
 relabel -> arg = ( Expr * ) arg ;
 return ( Node * ) relabel ;
 }
 }
 case T_CaseExpr : {
 CaseExpr * caseexpr = ( CaseExpr * ) node ;
 CaseExpr * newcase ;
 Node * save_case_val ;
 Node * newarg ;
 List * newargs ;
 bool const_true_cond ;
 Node * defresult = NULL ;
 ListCell * arg ;
 newarg = eval_const_expressions_mutator ( ( Node * ) caseexpr -> arg , context ) ;
 save_case_val = context -> case_val ;
 if ( newarg && IsA ( newarg , Const ) ) {
 context -> case_val = newarg ;
 newarg = NULL ;
 }
 else context -> case_val = NULL ;
 newargs = NIL ;
 const_true_cond = false ;
 foreach ( arg , caseexpr -> args ) {
 CaseWhen * oldcasewhen = ( CaseWhen * ) lfirst ( arg ) ;
 Node * casecond ;
 Node * caseresult ;
 Assert ( IsA ( oldcasewhen , CaseWhen ) ) ;
 casecond = eval_const_expressions_mutator ( ( Node * ) oldcasewhen -> expr , context ) ;
 if ( casecond && IsA ( casecond , Const ) ) {
 Const * const_input = ( Const * ) casecond ;
 if ( const_input -> constisnull || ! DatumGetBool ( const_input -> constvalue ) ) continue ;
 const_true_cond = true ;
 }
 caseresult = eval_const_expressions_mutator ( ( Node * ) oldcasewhen -> result , context ) ;
 if ( ! const_true_cond ) {
 CaseWhen * newcasewhen = makeNode ( CaseWhen ) ;
 newcasewhen -> expr = ( Expr * ) casecond ;
 newcasewhen -> result = ( Expr * ) caseresult ;
 newcasewhen -> location = oldcasewhen -> location ;
 newargs = lappend ( newargs , newcasewhen ) ;
 continue ;
 }
 defresult = caseresult ;
 break ;
 }
 if ( ! const_true_cond ) defresult = eval_const_expressions_mutator ( ( Node * ) caseexpr -> defresult , context ) ;
 context -> case_val = save_case_val ;
 if ( newargs == NIL ) return defresult ;
 newcase = makeNode ( CaseExpr ) ;
 newcase -> casetype = caseexpr -> casetype ;
 newcase -> casecollid = caseexpr -> casecollid ;
 newcase -> arg = ( Expr * ) newarg ;
 newcase -> args = newargs ;
 newcase -> defresult = ( Expr * ) defresult ;
 newcase -> location = caseexpr -> location ;
 return ( Node * ) newcase ;
 }
 case T_CaseTestExpr : {
 if ( context -> case_val ) return copyObject ( context -> case_val ) ;
 else return copyObject ( node ) ;
 }
 case T_ArrayExpr : {
 ArrayExpr * arrayexpr = ( ArrayExpr * ) node ;
 ArrayExpr * newarray ;
 bool all_const = true ;
 List * newelems ;
 ListCell * element ;
 newelems = NIL ;
 foreach ( element , arrayexpr -> elements ) {
 Node * e ;
 e = eval_const_expressions_mutator ( ( Node * ) lfirst ( element ) , context ) ;
 if ( ! IsA ( e , Const ) ) all_const = false ;
 newelems = lappend ( newelems , e ) ;
 }
 newarray = makeNode ( ArrayExpr ) ;
 newarray -> array_typeid = arrayexpr -> array_typeid ;
 newarray -> array_collid = arrayexpr -> array_collid ;
 newarray -> element_typeid = arrayexpr -> element_typeid ;
 newarray -> elements = newelems ;
 newarray -> multidims = arrayexpr -> multidims ;
 newarray -> location = arrayexpr -> location ;
 if ( all_const ) return ( Node * ) evaluate_expr ( ( Expr * ) newarray , newarray -> array_typeid , exprTypmod ( node ) , newarray -> array_collid ) ;
 return ( Node * ) newarray ;
 }
 case T_CoalesceExpr : {
 CoalesceExpr * coalesceexpr = ( CoalesceExpr * ) node ;
 CoalesceExpr * newcoalesce ;
 List * newargs ;
 ListCell * arg ;
 newargs = NIL ;
 foreach ( arg , coalesceexpr -> args ) {
 Node * e ;
 e = eval_const_expressions_mutator ( ( Node * ) lfirst ( arg ) , context ) ;
 if ( IsA ( e , Const ) ) {
 if ( ( ( Const * ) e ) -> constisnull ) continue ;
 if ( newargs == NIL ) return e ;
 newargs = lappend ( newargs , e ) ;
 break ;
 }
 newargs = lappend ( newargs , e ) ;
 }
 if ( newargs == NIL ) return ( Node * ) makeNullConst ( coalesceexpr -> coalescetype , - 1 , coalesceexpr -> coalescecollid ) ;
 newcoalesce = makeNode ( CoalesceExpr ) ;
 newcoalesce -> coalescetype = coalesceexpr -> coalescetype ;
 newcoalesce -> coalescecollid = coalesceexpr -> coalescecollid ;
 newcoalesce -> args = newargs ;
 newcoalesce -> location = coalesceexpr -> location ;
 return ( Node * ) newcoalesce ;
 }
 case T_FieldSelect : {
 FieldSelect * fselect = ( FieldSelect * ) node ;
 FieldSelect * newfselect ;
 Node * arg ;
 arg = eval_const_expressions_mutator ( ( Node * ) fselect -> arg , context ) ;
 if ( arg && IsA ( arg , Var ) && ( ( Var * ) arg ) -> varattno == InvalidAttrNumber && ( ( Var * ) arg ) -> varlevelsup == 0 ) {
 if ( rowtype_field_matches ( ( ( Var * ) arg ) -> vartype , fselect -> fieldnum , fselect -> resulttype , fselect -> resulttypmod , fselect -> resultcollid ) ) return ( Node * ) makeVar ( ( ( Var * ) arg ) -> varno , fselect -> fieldnum , fselect -> resulttype , fselect -> resulttypmod , fselect -> resultcollid , ( ( Var * ) arg ) -> varlevelsup ) ;
 }
 if ( arg && IsA ( arg , RowExpr ) ) {
 RowExpr * rowexpr = ( RowExpr * ) arg ;
 if ( fselect -> fieldnum > 0 && fselect -> fieldnum <= list_length ( rowexpr -> args ) ) {
 Node * fld = ( Node * ) list_nth ( rowexpr -> args , fselect -> fieldnum - 1 ) ;
 if ( rowtype_field_matches ( rowexpr -> row_typeid , fselect -> fieldnum , fselect -> resulttype , fselect -> resulttypmod , fselect -> resultcollid ) && fselect -> resulttype == exprType ( fld ) && fselect -> resulttypmod == exprTypmod ( fld ) && fselect -> resultcollid == exprCollation ( fld ) ) return fld ;
 }
 }
 newfselect = makeNode ( FieldSelect ) ;
 newfselect -> arg = ( Expr * ) arg ;
 newfselect -> fieldnum = fselect -> fieldnum ;
 newfselect -> resulttype = fselect -> resulttype ;
 newfselect -> resulttypmod = fselect -> resulttypmod ;
 newfselect -> resultcollid = fselect -> resultcollid ;
 return ( Node * ) newfselect ;
 }
 case T_NullTest : {
 NullTest * ntest = ( NullTest * ) node ;
 NullTest * newntest ;
 Node * arg ;
 arg = eval_const_expressions_mutator ( ( Node * ) ntest -> arg , context ) ;
 if ( ntest -> argisrow && arg && IsA ( arg , RowExpr ) ) {
 RowExpr * rarg = ( RowExpr * ) arg ;
 List * newargs = NIL ;
 ListCell * l ;
 foreach ( l , rarg -> args ) {
 Node * relem = ( Node * ) lfirst ( l ) ;
 if ( relem && IsA ( relem , Const ) ) {
 Const * carg = ( Const * ) relem ;
 if ( carg -> constisnull ? ( ntest -> nulltesttype == IS_NOT_NULL ) : ( ntest -> nulltesttype == IS_NULL ) ) return makeBoolConst ( false , false ) ;
 continue ;
 }
 newntest = makeNode ( NullTest ) ;
 newntest -> arg = ( Expr * ) relem ;
 newntest -> nulltesttype = ntest -> nulltesttype ;
 newntest -> argisrow = false ;
 newntest -> location = ntest -> location ;
 newargs = lappend ( newargs , newntest ) ;
 }
 if ( newargs == NIL ) return makeBoolConst ( true , false ) ;
 if ( list_length ( newargs ) == 1 ) return ( Node * ) linitial ( newargs ) ;
 return ( Node * ) make_andclause ( newargs ) ;
 }
 if ( ! ntest -> argisrow && arg && IsA ( arg , Const ) ) {
 Const * carg = ( Const * ) arg ;
 bool result ;
 switch ( ntest -> nulltesttype ) {
 case IS_NULL : result = carg -> constisnull ;
 break ;
 case IS_NOT_NULL : result = ! carg -> constisnull ;
 break ;
 default : elog ( ERROR , "unrecognized nulltesttype: %d" , ( int ) ntest -> nulltesttype ) ;
 result = false ;
 break ;
 }
 return makeBoolConst ( result , false ) ;
 }
 newntest = makeNode ( NullTest ) ;
 newntest -> arg = ( Expr * ) arg ;
 newntest -> nulltesttype = ntest -> nulltesttype ;
 newntest -> argisrow = ntest -> argisrow ;
 newntest -> location = ntest -> location ;
 return ( Node * ) newntest ;
 }
 case T_BooleanTest : {
 BooleanTest * btest = ( BooleanTest * ) node ;
 BooleanTest * newbtest ;
 Node * arg ;
 arg = eval_const_expressions_mutator ( ( Node * ) btest -> arg , context ) ;
 if ( arg && IsA ( arg , Const ) ) {
 Const * carg = ( Const * ) arg ;
 bool result ;
 switch ( btest -> booltesttype ) {
 case IS_TRUE : result = ( ! carg -> constisnull && DatumGetBool ( carg -> constvalue ) ) ;
 break ;
 case IS_NOT_TRUE : result = ( carg -> constisnull || ! DatumGetBool ( carg -> constvalue ) ) ;
 break ;
 case IS_FALSE : result = ( ! carg -> constisnull && ! DatumGetBool ( carg -> constvalue ) ) ;
 break ;
 case IS_NOT_FALSE : result = ( carg -> constisnull || DatumGetBool ( carg -> constvalue ) ) ;
 break ;
 case IS_UNKNOWN : result = carg -> constisnull ;
 break ;
 case IS_NOT_UNKNOWN : result = ! carg -> constisnull ;
 break ;
 default : elog ( ERROR , "unrecognized booltesttype: %d" , ( int ) btest -> booltesttype ) ;
 result = false ;
 break ;
 }
 return makeBoolConst ( result , false ) ;
 }
 newbtest = makeNode ( BooleanTest ) ;
 newbtest -> arg = ( Expr * ) arg ;
 newbtest -> booltesttype = btest -> booltesttype ;
 newbtest -> location = btest -> location ;
 return ( Node * ) newbtest ;
 }
 case T_PlaceHolderVar : if ( context -> estimate ) {
 PlaceHolderVar * phv = ( PlaceHolderVar * ) node ;
 return eval_const_expressions_mutator ( ( Node * ) phv -> phexpr , context ) ;
 }
 break ;
 default : break ;
 }
 return expression_tree_mutator ( node , eval_const_expressions_mutator , ( void * ) context ) ;
 }


struct task_group *sched_create_group(struct task_group *parent)
{
	struct task_group *tg;
	unsigned long flags;
	int i;

	tg = kzalloc(sizeof(*tg), GFP_KERNEL);
	if (!tg)
		return ERR_PTR(-ENOMEM);

	if (!alloc_fair_sched_group(tg, parent))
		goto err;

	if (!alloc_rt_sched_group(tg, parent))
		goto err;

	spin_lock_irqsave(&task_group_lock, flags);
	for_each_possible_cpu(i) {
		register_fair_sched_group(tg, i);
		register_rt_sched_group(tg, i);
	}
	list_add_rcu(&tg->list, &task_groups);

	WARN_ON(!parent); /* root should already exist */

	tg->parent = parent;
	list_add_rcu(&tg->siblings, &parent->children);
	INIT_LIST_HEAD(&tg->children);
	spin_unlock_irqrestore(&task_group_lock, flags);

	return tg;

err:
	free_sched_group(tg);
	return ERR_PTR(-ENOMEM);
}


static void test_evbuffer_find ( void ) {
 u_char * p ;
 const char * test1 = "1234567890\r\n" ;
 const char * test2 = "1234567890\r" ;
 # define EVBUFFER_INITIAL_LENGTH 256 char test3 [ EVBUFFER_INITIAL_LENGTH ] ;
 unsigned int i ;
 struct evbuffer * buf = evbuffer_new ( ) ;
 fprintf ( stdout , "Testing evbuffer_find 1: " ) ;
 evbuffer_add ( buf , ( u_char * ) test1 , strlen ( test1 ) ) ;
 evbuffer_drain ( buf , strlen ( test1 ) ) ;
 evbuffer_add ( buf , ( u_char * ) test2 , strlen ( test2 ) ) ;
 p = evbuffer_find ( buf , ( u_char * ) "\r\n" , 2 ) ;
 if ( p == NULL ) {
 fprintf ( stdout , "OK\n" ) ;
 }
 else {
 fprintf ( stdout , "FAILED\n" ) ;
 exit ( 1 ) ;
 }
 fprintf ( stdout , "Testing evbuffer_find 2: " ) ;
 evbuffer_drain ( buf , strlen ( test2 ) ) ;
 for ( i = 0 ;
 i < EVBUFFER_INITIAL_LENGTH ;
 ++ i ) test3 [ i ] = 'a' ;
 test3 [ EVBUFFER_INITIAL_LENGTH - 1 ] = 'x' ;
 evbuffer_add ( buf , ( u_char * ) test3 , EVBUFFER_INITIAL_LENGTH ) ;
 p = evbuffer_find ( buf , ( u_char * ) "xy" , 2 ) ;
 if ( p == NULL ) {
 printf ( "OK\n" ) ;
 }
 else {
 fprintf ( stdout , "FAILED\n" ) ;
 exit ( 1 ) ;
 }
 fprintf ( stdout , "Testing evbuffer_find 3: " ) ;
 p = evbuffer_find ( buf , ( u_char * ) "ax" , 2 ) ;
 if ( p != NULL && strncmp ( ( char * ) p , "ax" , 2 ) == 0 ) {
 printf ( "OK\n" ) ;
 }
 else {
 fprintf ( stdout , "FAILED\n" ) ;
 exit ( 1 ) ;
 }
 evbuffer_free ( buf ) ;
 }


find_busiest_group(struct sched_domain *sd, int this_cpu,
		   unsigned long *imbalance, enum cpu_idle_type idle,
		   int *sd_idle, const cpumask_t *cpus, int *balance)
{
	struct sched_group *busiest = NULL, *this = NULL, *group = sd->groups;
	unsigned long max_load, avg_load, total_load, this_load, total_pwr;
	unsigned long max_pull;
	unsigned long busiest_load_per_task, busiest_nr_running;
	unsigned long this_load_per_task, this_nr_running;
	int load_idx, group_imb = 0;
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
	int power_savings_balance = 1;
	unsigned long leader_nr_running = 0, min_load_per_task = 0;
	unsigned long min_nr_running = ULONG_MAX;
	struct sched_group *group_min = NULL, *group_leader = NULL;
#endif

	max_load = this_load = total_load = total_pwr = 0;
	busiest_load_per_task = busiest_nr_running = 0;
	this_load_per_task = this_nr_running = 0;
	if (idle == CPU_NOT_IDLE)
		load_idx = sd->busy_idx;
	else if (idle == CPU_NEWLY_IDLE)
		load_idx = sd->newidle_idx;
	else
		load_idx = sd->idle_idx;

	do {
		unsigned long load, group_capacity, max_cpu_load, min_cpu_load;
		int local_group;
		int i;
		int __group_imb = 0;
		unsigned int balance_cpu = -1, first_idle_cpu = 0;
		unsigned long sum_nr_running, sum_weighted_load;

		local_group = cpu_isset(this_cpu, group->cpumask);

		if (local_group)
			balance_cpu = first_cpu(group->cpumask);

		/* Tally up the load of all CPUs in the group */
		sum_weighted_load = sum_nr_running = avg_load = 0;
		max_cpu_load = 0;
		min_cpu_load = ~0UL;

		for_each_cpu_mask(i, group->cpumask) {
			struct rq *rq;

			if (!cpu_isset(i, *cpus))
				continue;

			rq = cpu_rq(i);

			if (*sd_idle && rq->nr_running)
				*sd_idle = 0;

			/* Bias balancing toward cpus of our domain */
			if (local_group) {
				if (idle_cpu(i) && !first_idle_cpu) {
					first_idle_cpu = 1;
					balance_cpu = i;
				}

				load = target_load(i, load_idx);
			} else {
				load = source_load(i, load_idx);
				if (load > max_cpu_load)
					max_cpu_load = load;
				if (min_cpu_load > load)
					min_cpu_load = load;
			}

			avg_load += load;
			sum_nr_running += rq->nr_running;
			sum_weighted_load += weighted_cpuload(i);
		}

		/*
		 * First idle cpu or the first cpu(busiest) in this sched group
		 * is eligible for doing load balancing at this and above
		 * domains. In the newly idle case, we will allow all the cpu's
		 * to do the newly idle load balance.
		 */
		if (idle != CPU_NEWLY_IDLE && local_group &&
		    balance_cpu != this_cpu && balance) {
			*balance = 0;
			goto ret;
		}

		total_load += avg_load;
		total_pwr += group->__cpu_power;

		/* Adjust by relative CPU power of the group */
		avg_load = sg_div_cpu_power(group,
				avg_load * SCHED_LOAD_SCALE);

		if ((max_cpu_load - min_cpu_load) > SCHED_LOAD_SCALE)
			__group_imb = 1;

		group_capacity = group->__cpu_power / SCHED_LOAD_SCALE;

		if (local_group) {
			this_load = avg_load;
			this = group;
			this_nr_running = sum_nr_running;
			this_load_per_task = sum_weighted_load;
		} else if (avg_load > max_load &&
			   (sum_nr_running > group_capacity || __group_imb)) {
			max_load = avg_load;
			busiest = group;
			busiest_nr_running = sum_nr_running;
			busiest_load_per_task = sum_weighted_load;
			group_imb = __group_imb;
		}

#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
		/*
		 * Busy processors will not participate in power savings
		 * balance.
		 */
		if (idle == CPU_NOT_IDLE ||
				!(sd->flags & SD_POWERSAVINGS_BALANCE))
			goto group_next;

		/*
		 * If the local group is idle or completely loaded
		 * no need to do power savings balance at this domain
		 */
		if (local_group && (this_nr_running >= group_capacity ||
				    !this_nr_running))
			power_savings_balance = 0;

		/*
		 * If a group is already running at full capacity or idle,
		 * don't include that group in power savings calculations
		 */
		if (!power_savings_balance || sum_nr_running >= group_capacity
		    || !sum_nr_running)
			goto group_next;

		/*
		 * Calculate the group which has the least non-idle load.
		 * This is the group from where we need to pick up the load
		 * for saving power
		 */
		if ((sum_nr_running < min_nr_running) ||
		    (sum_nr_running == min_nr_running &&
		     first_cpu(group->cpumask) <
		     first_cpu(group_min->cpumask))) {
			group_min = group;
			min_nr_running = sum_nr_running;
			min_load_per_task = sum_weighted_load /
						sum_nr_running;
		}

		/*
		 * Calculate the group which is almost near its
		 * capacity but still has some space to pick up some load
		 * from other group and save more power
		 */
		if (sum_nr_running <= group_capacity - 1) {
			if (sum_nr_running > leader_nr_running ||
			    (sum_nr_running == leader_nr_running &&
			     first_cpu(group->cpumask) >
			      first_cpu(group_leader->cpumask))) {
				group_leader = group;
				leader_nr_running = sum_nr_running;
			}
		}
group_next:
#endif
		group = group->next;
	} while (group != sd->groups);

	if (!busiest || this_load >= max_load || busiest_nr_running == 0)
		goto out_balanced;

	avg_load = (SCHED_LOAD_SCALE * total_load) / total_pwr;

	if (this_load >= avg_load ||
			100*max_load <= sd->imbalance_pct*this_load)
		goto out_balanced;

	busiest_load_per_task /= busiest_nr_running;
	if (group_imb)
		busiest_load_per_task = min(busiest_load_per_task, avg_load);

	/*
	 * We're trying to get all the cpus to the average_load, so we don't
	 * want to push ourselves above the average load, nor do we wish to
	 * reduce the max loaded cpu below the average load, as either of these
	 * actions would just result in more rebalancing later, and ping-pong
	 * tasks around. Thus we look for the minimum possible imbalance.
	 * Negative imbalances (*we* are more loaded than anyone else) will
	 * be counted as no imbalance for these purposes -- we can't fix that
	 * by pulling tasks to us. Be careful of negative numbers as they'll
	 * appear as very large values with unsigned longs.
	 */
	if (max_load <= busiest_load_per_task)
		goto out_balanced;

	/*
	 * In the presence of smp nice balancing, certain scenarios can have
	 * max load less than avg load(as we skip the groups at or below
	 * its cpu_power, while calculating max_load..)
	 */
	if (max_load < avg_load) {
		*imbalance = 0;
		goto small_imbalance;
	}

	/* Don't want to pull so many tasks that a group would go idle */
	max_pull = min(max_load - avg_load, max_load - busiest_load_per_task);

	/* How much load to actually move to equalise the imbalance */
	*imbalance = min(max_pull * busiest->__cpu_power,
				(avg_load - this_load) * this->__cpu_power)
			/ SCHED_LOAD_SCALE;

	/*
	 * if *imbalance is less than the average load per runnable task
	 * there is no gaurantee that any tasks will be moved so we'll have
	 * a think about bumping its value to force at least one task to be
	 * moved
	 */
	if (*imbalance < busiest_load_per_task) {
		unsigned long tmp, pwr_now, pwr_move;
		unsigned int imbn;

small_imbalance:
		pwr_move = pwr_now = 0;
		imbn = 2;
		if (this_nr_running) {
			this_load_per_task /= this_nr_running;
			if (busiest_load_per_task > this_load_per_task)
				imbn = 1;
		} else
			this_load_per_task = SCHED_LOAD_SCALE;

		if (max_load - this_load + SCHED_LOAD_SCALE_FUZZ >=
					busiest_load_per_task * imbn) {
			*imbalance = busiest_load_per_task;
			return busiest;
		}

		/*
		 * OK, we don't have enough imbalance to justify moving tasks,
		 * however we may be able to increase total CPU power used by
		 * moving them.
		 */

		pwr_now += busiest->__cpu_power *
				min(busiest_load_per_task, max_load);
		pwr_now += this->__cpu_power *
				min(this_load_per_task, this_load);
		pwr_now /= SCHED_LOAD_SCALE;

		/* Amount of load we'd subtract */
		tmp = sg_div_cpu_power(busiest,
				busiest_load_per_task * SCHED_LOAD_SCALE);
		if (max_load > tmp)
			pwr_move += busiest->__cpu_power *
				min(busiest_load_per_task, max_load - tmp);

		/* Amount of load we'd add */
		if (max_load * busiest->__cpu_power <
				busiest_load_per_task * SCHED_LOAD_SCALE)
			tmp = sg_div_cpu_power(this,
					max_load * busiest->__cpu_power);
		else
			tmp = sg_div_cpu_power(this,
				busiest_load_per_task * SCHED_LOAD_SCALE);
		pwr_move += this->__cpu_power *
				min(this_load_per_task, this_load + tmp);
		pwr_move /= SCHED_LOAD_SCALE;

		/* Move if we gain throughput */
		if (pwr_move > pwr_now)
			*imbalance = busiest_load_per_task;
	}

	return busiest;

out_balanced:
#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
	if (idle == CPU_NOT_IDLE || !(sd->flags & SD_POWERSAVINGS_BALANCE))
		goto ret;

	if (this == group_leader && group_leader != group_min) {
		*imbalance = min_load_per_task;
		return group_min;
	}
#endif
ret:
	*imbalance = 0;
	return NULL;
}


static void ref405ep_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; MemoryRegion *bios; MemoryRegion *sram = g_new(MemoryRegion, 1); ram_addr_t bdloc; MemoryRegion *ram_memories = g_malloc(2 * sizeof(*ram_memories)); hwaddr ram_bases[2], ram_sizes[2]; target_ulong sram_size; long bios_size; //int phy_addr = 0; //static int phy_addr = 1; target_ulong kernel_base, initrd_base; long kernel_size, initrd_size; int linux_boot; int fl_idx, fl_sectors, len; DriveInfo *dinfo; MemoryRegion *sysmem = get_system_memory(); /* XXX: fix this */ memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram", 0x08000000); ram_bases[0] = 0; ram_sizes[0] = 0x08000000; memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0); ram_bases[1] = 0x00000000; ram_sizes[1] = 0x00000000; ram_size = 128 * 1024 * 1024; #ifdef DEBUG_BOARD_INIT printf("%s: register cpu\n", __func__); #endif env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes, 33333333, &pic, kernel_filename == NULL ? 0 : 1); /* allocate SRAM */ sram_size = 512 * 1024; memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size, &error_abort); vmstate_register_ram_global(sram); memory_region_add_subregion(sysmem, 0xFFF00000, sram); /* allocate and load BIOS */ #ifdef DEBUG_BOARD_INIT printf("%s: register BIOS\n", __func__); #endif fl_idx = 0; #ifdef USE_FLASH_BIOS dinfo = drive_get(IF_PFLASH, 0, fl_idx); if (dinfo) { BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo)); bios_size = bdrv_getlength(bs); fl_sectors = (bios_size + 65535) >> 16; #ifdef DEBUG_BOARD_INIT printf("Register parallel flash %d size %lx" " at addr %lx '%s' %d\n", fl_idx, bios_size, -bios_size, bdrv_get_device_name(bs), fl_sectors); #endif pflash_cfi02_register((uint32_t)(-bios_size), NULL, "ef405ep.bios", bios_size, bs, 65536, fl_sectors, 1, 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, 1); fl_idx++; } else #endif { #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif bios = g_new(MemoryRegion, 1); memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_image(filename, memory_region_get_ram_ptr(bios)); g_free(filename); if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios); } else if (!qtest_enabled() || kernel_filename != NULL) { error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } else { /* Avoid an uninitialized variable warning */ bios_size = -1; } memory_region_set_readonly(bios, true); } /* Register FPGA */ #ifdef DEBUG_BOARD_INIT printf("%s: register FPGA\n", __func__); #endif ref405ep_fpga_init(sysmem, 0xF0300000); /* Register NVRAM */ #ifdef DEBUG_BOARD_INIT printf("%s: register NVRAM\n", __func__); #endif m48t59_init(NULL, 0xF0000000, 0, 8192, 8); /* Load kernel */ linux_boot = (kernel_filename != NULL); if (linux_boot) { #ifdef DEBUG_BOARD_INIT printf("%s: load kernel\n", __func__); #endif memset(&bd, 0, sizeof(bd)); bd.bi_memstart = 0x00000000; bd.bi_memsize = ram_size; bd.bi_flashstart = -bios_size; bd.bi_flashsize = -bios_size; bd.bi_flashoffset = 0; bd.bi_sramstart = 0xFFF00000; bd.bi_sramsize = sram_size; bd.bi_bootflags = 0; bd.bi_intfreq = 133333333; bd.bi_busfreq = 33333333; bd.bi_baudrate = 115200; bd.bi_s_version[0] = 'Q'; bd.bi_s_version[1] = 'M'; bd.bi_s_version[2] = 'U'; bd.bi_s_version[3] = '\0'; bd.bi_r_version[0] = 'Q'; bd.bi_r_version[1] = 'E'; bd.bi_r_version[2] = 'M'; bd.bi_r_version[3] = 'U'; bd.bi_r_version[4] = '\0'; bd.bi_procfreq = 133333333; bd.bi_plb_busfreq = 33333333; bd.bi_pci_busfreq = 33333333; bd.bi_opbfreq = 33333333; bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001); env->gpr[3] = bdloc; kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } printf("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base); /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } env->gpr[4] = initrd_base; env->gpr[5] = initrd_size; if (kernel_cmdline != NULL) { len = strlen(kernel_cmdline); bdloc -= ((len + 255) & ~255); cpu_physical_memory_write(bdloc, kernel_cmdline, len + 1); env->gpr[6] = bdloc; env->gpr[7] = bdloc + len; } else { env->gpr[6] = 0; env->gpr[7] = 0; } env->nip = KERNEL_LOAD_ADDR; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; bdloc = 0; } #ifdef DEBUG_BOARD_INIT printf("bdloc " RAM_ADDR_FMT "\n", bdloc); printf("%s: Done\n", __func__); #endif }


int sched_group_set_rt_period(struct task_group *tg, long rt_period_us)
{
	u64 rt_runtime, rt_period;

	rt_period = (u64)rt_period_us * NSEC_PER_USEC;
	rt_runtime = tg->rt_bandwidth.rt_runtime;

	return tg_set_bandwidth(tg, rt_period, rt_runtime);
}


void sched_destroy_group(struct task_group *tg)
{
	unsigned long flags;
	int i;

	spin_lock_irqsave(&task_group_lock, flags);
	for_each_possible_cpu(i) {
		unregister_fair_sched_group(tg, i);
		unregister_rt_sched_group(tg, i);
	}
	list_del_rcu(&tg->list);
	list_del_rcu(&tg->siblings);
	spin_unlock_irqrestore(&task_group_lock, flags);

	/* wait for possible concurrent references to cfs_rqs complete */
	call_rcu(&tg->rcu, free_sched_group_rcu);
}


static void de_emphasis ( float * out , float * in , float m , float mem [ 1 ] ) {
 int i ;
 out [ 0 ] = in [ 0 ] + m * mem [ 0 ] ;
 for ( i = 1 ;
 i < AMRWB_SFR_SIZE ;
 i ++ ) out [ i ] = in [ i ] + out [ i - 1 ] * m ;
 mem [ 0 ] = out [ AMRWB_SFR_SIZE - 1 ] ;
 }


void av_thread_message_flush(AVThreadMessageQueue *mq) { #if HAVE_THREADS int used, off; void *free_func = mq->free_func; pthread_mutex_lock(&mq->lock); used = av_fifo_size(mq->fifo); if (free_func) for (off = 0; off < used; off += mq->elsize) av_fifo_generic_peek_at(mq->fifo, mq, off, mq->elsize, free_func_wrap); av_fifo_drain(mq->fifo, used); pthread_cond_broadcast(&mq->cond); pthread_mutex_unlock(&mq->lock); #endif /* HAVE_THREADS */ }


int av_open_input_stream(AVFormatContext **ic_ptr, AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; AVDictionary *opts; AVFormatContext *ic; AVFormatParameters default_ap; if(!ap){ ap=&default_ap; memset(ap, 0, sizeof(default_ap)); } opts = convert_format_parameters(ap); if(!ap->prealloced_context) ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) { err = AVERROR(ENOMEM); goto fail; } if (pb && fmt && fmt->flags & AVFMT_NOFILE) av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and " "will be ignored with AVFMT_NOFILE format.\n"); else ic->pb = pb; err = avformat_open_input(&ic, filename, fmt, &opts); ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above *ic_ptr = ic; fail: av_dict_free(&opts); return err; }


static void http_badreq_cb ( struct evhttp_request * req , void * arg ) {
 struct evbuffer * buf = evbuffer_new ( ) ;
 evhttp_add_header ( req -> output_headers , "Content-Type" , "text/xml;
 charset=UTF-8" ) ;
 evbuffer_add_printf ( buf , "Hello, %s!" , "127.0.0.1" ) ;
 evhttp_send_reply ( req , HTTP_OK , "OK" , buf ) ;
 evbuffer_free ( buf ) ;
 }


void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { if (!mon) return; if (mon->mc && !mon->mc->print_enabled) { qemu_error_new(QERR_UNDEFINED_ERROR); } else { char buf[4096]; vsnprintf(buf, sizeof(buf), fmt, ap); monitor_puts(mon, buf); } }


static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, PCIBus *bus, PIIX4PMState *s) { memory_region_init_io(&s->io_gpe, OBJECT(s), &piix4_gpe_ops, s, "acpi-gpe0", GPE_LEN); memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe); acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent, s->use_acpi_pci_hotplug); s->cpu_hotplug_legacy = true; object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy", piix4_get_cpu_hotplug_legacy, piix4_set_cpu_hotplug_legacy, NULL); legacy_acpi_cpu_hotplug_init(parent, OBJECT(s), &s->gpe_cpu, PIIX4_CPU_HOTPLUG_IO_BASE); if (s->acpi_memory_hotplug.is_enabled) { acpi_memory_hotplug_init(parent, OBJECT(s), &s->acpi_memory_hotplug); } }


static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
{
	p->sched_class->dequeue_task(rq, p, sleep);
	p->se.on_rq = 0;
}


void ber_init2 ( BerElement * ber , struct berval * bv , int options ) {
 assert ( ber != NULL ) ;
 ( void ) memset ( ( char * ) ber , '\0' , sizeof ( BerElement ) ) ;
 ber -> ber_valid = LBER_VALID_BERELEMENT ;
 ber -> ber_tag = LBER_DEFAULT ;
 ber -> ber_options = ( char ) options ;
 ber -> ber_debug = ber_int_debug ;
 if ( bv != NULL ) {
 ber -> ber_buf = bv -> bv_val ;
 ber -> ber_ptr = ber -> ber_buf ;
 ber -> ber_end = ber -> ber_buf + bv -> bv_len ;
 }
 assert ( LBER_VALID ( ber ) ) ;
 }


static void execve_shell ( const char * shellname , char * args [ ] , char * const envp [ ] ) {
 int err ;
 ( void ) execve ( shellname , ( char * * ) args , envp ) ;
 err = errno ;
 if ( access ( shellname , R_OK | X_OK ) == 0 ) {
 size_t n_args = 0 ;
 char * * targs ;
 while ( NULL != args [ n_args ] ) {
 n_args ++ ;
 }
 targs = ( char * * ) xmalloc ( ( n_args + 3 ) * sizeof ( args [ 0 ] ) ) ;
 targs [ 0 ] = "sh" ;
 targs [ 1 ] = "-" ;
 targs [ 2 ] = xstrdup ( shellname ) ;
 targs [ n_args + 2 ] = NULL ;
 while ( 1 != n_args ) {
 targs [ n_args + 1 ] = args [ n_args - 1 ] ;
 n_args -- ;
 }
 ( void ) execve ( SHELL , targs , envp ) ;
 }
 else {
 errno = err ;
 }
 }


static void unregister_sched_domain_sysctl(void)
{
}


void __kprobes sub_preempt_count(int val)
{
	/*
	 * Underflow?
	 */
	if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
		return;
	/*
	 * Is the spinlock portion underflowing?
	 */
	if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
			!(preempt_count() & PREEMPT_MASK)))
		return;

	preempt_count() -= val;
}


IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , UseCounterAnimatedCSSPropertiesMixedContent ) {
 net : : EmbeddedTestServer https_server ( net : : EmbeddedTestServer : : TYPE_HTTPS ) ;
 https_server . AddDefaultHandlers ( base : : FilePath ( FILE_PATH_LITERAL ( "chrome/test/data" ) ) ) ;
 ASSERT_TRUE ( https_server . Start ( ) ) ;
 auto waiter = CreatePageLoadMetricsWaiter ( ) ;
 waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ;
 ui_test_utils : : NavigateToURL ( browser ( ) , https_server . GetURL ( "/page_load_metrics/use_counter_features.html" ) ) ;
 waiter -> Wait ( ) ;
 NavigateToUntrackedUrl ( ) ;
 histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 161 , 1 ) ;
 histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 91 , 1 ) ;
 histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , blink : : mojom : : kTotalPagesMeasuredCSSSampleId , 1 ) ;
 }


static int effective_prio(struct task_struct *p)
{
	p->normal_prio = normal_prio(p);
	/*
	 * If we are RT tasks or we were boosted to RT priority,
	 * keep the priority unchanged. Otherwise, update priority
	 * to the normal priority:
	 */
	if (!rt_prio(p->prio))
		return p->normal_prio;
	return p->prio;
}


static gboolean fat_str_replace ( char * str , char replacement ) {
 gboolean success ;
 int i ;
 success = FALSE ;
 for ( i = 0 ;
 str [ i ] != '\0' ;
 i ++ ) {
 if ( strchr ( FAT_FORBIDDEN_CHARACTERS , str [ i ] ) || str [ i ] < 32 ) {
 success = TRUE ;
 str [ i ] = replacement ;
 }
 }
 return success ;
 }


void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, const FFTSample *input, FFTSample *tmp) { long n8, n4, n2, n; x86_reg k; const uint16_t *revtab = s->fft.revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)tmp; n = 1 << s->nbits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; /* pre rotation */ in1 = input; in2 = input + n2 - 1; for(k = 0; k < n4; k++) { // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it asm volatile( "movd %0, %%mm0 \n\t" "movd %2, %%mm1 \n\t" "punpckldq %1, %%mm0 \n\t" "punpckldq %3, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pfmul %%mm1, %%mm0 \n\t" "pswapd %%mm1, %%mm1 \n\t" "pfmul %%mm1, %%mm2 \n\t" "pfpnacc %%mm2, %%mm0 \n\t" ::"m"(in2[-2*k]), "m"(in1[2*k]), "m"(tcos[k]), "m"(tsin[k]) ); asm volatile( "movq %%mm0, %0 \n\t" :"=m"(z[revtab[k]]) ); } ff_fft_calc(&s->fft, z); /* post rotation + reordering */ for(k = 0; k < n4; k++) { asm volatile( "movq %0, %%mm0 \n\t" "movd %1, %%mm1 \n\t" "punpckldq %2, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "pfmul %%mm1, %%mm0 \n\t" "pswapd %%mm1, %%mm1 \n\t" "pfmul %%mm1, %%mm2 \n\t" "pfpnacc %%mm2, %%mm0 \n\t" "movq %%mm0, %0 \n\t" :"+m"(z[k]) :"m"(tcos[k]), "m"(tsin[k]) ); } k = n-8; asm volatile("movd %0, %%mm7" ::"r"(1<<31)); asm volatile( "1: \n\t" "movq (%4,%0), %%mm0 \n\t" // z[n8+k] "neg %0 \n\t" "pswapd -8(%4,%0), %%mm1 \n\t" // z[n8-1-k] "movq %%mm0, %%mm2 \n\t" "pxor %%mm7, %%mm2 \n\t" "punpckldq %%mm1, %%mm2 \n\t" "pswapd %%mm2, %%mm3 \n\t" "punpckhdq %%mm1, %%mm0 \n\t" "pswapd %%mm0, %%mm4 \n\t" "pxor %%mm7, %%mm0 \n\t" "pxor %%mm7, %%mm4 \n\t" "movq %%mm3, -8(%3,%0) \n\t" // output[n-2-2*k] = { z[n8-1-k].im, -z[n8+k].re } "movq %%mm4, -8(%2,%0) \n\t" // output[n2-2-2*k]= { -z[n8-1-k].re, z[n8+k].im } "neg %0 \n\t" "movq %%mm0, (%1,%0) \n\t" // output[2*k] = { -z[n8+k].im, z[n8-1-k].re } "movq %%mm2, (%2,%0) \n\t" // output[n2+2*k] = { -z[n8+k].re, z[n8-1-k].im } "sub $8, %0 \n\t" "jge 1b \n\t" :"+r"(k) :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8) :"memory" ); asm volatile("femms"); }


static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft)
{
	struct cpuacct *ca = cgroup_ca(cgrp);
	u64 totalcpuusage = 0;
	int i;

	for_each_possible_cpu(i) {
		u64 *cpuusage = percpu_ptr(ca->cpuusage, i);

		/*
		 * Take rq->lock to make 64-bit addition safe on 32-bit
		 * platforms.
		 */
		spin_lock_irq(&cpu_rq(i)->lock);
		totalcpuusage += *cpuusage;
		spin_unlock_irq(&cpu_rq(i)->lock);
	}

	return totalcpuusage;
}


int __sched wait_for_completion_killable(struct completion *x)
{
	long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE);
	if (t == -ERESTARTSYS)
		return t;
	return 0;
}


static int kq_dispatch ( struct event_base * base , void * arg , struct timeval * tv ) {
 struct kqop * kqop = arg ;
 struct kevent * changes = kqop -> changes ;
 struct kevent * events = kqop -> events ;
 struct event * ev ;
 struct timespec ts , * ts_p = NULL ;
 int i , res ;
 if ( tv != NULL ) {
 TIMEVAL_TO_TIMESPEC ( tv , & ts ) ;
 ts_p = & ts ;
 }
 res = kevent ( kqop -> kq , changes , kqop -> nchanges , events , kqop -> nevents , ts_p ) ;
 kqop -> nchanges = 0 ;
 if ( res == - 1 ) {
 if ( errno != EINTR ) {
 event_warn ( "kevent" ) ;
 return ( - 1 ) ;
 }
 return ( 0 ) ;
 }
 event_debug ( ( "%s: kevent reports %d" , __func__ , res ) ) ;
 for ( i = 0 ;
 i < res ;
 i ++ ) {
 int which = 0 ;
 if ( events [ i ] . flags & EV_ERROR ) {
 if ( events [ i ] . data == EBADF || events [ i ] . data == EINVAL || events [ i ] . data == ENOENT ) continue ;
 errno = events [ i ] . data ;
 return ( - 1 ) ;
 }
 if ( events [ i ] . filter == EVFILT_READ ) {
 which |= EV_READ ;
 }
 else if ( events [ i ] . filter == EVFILT_WRITE ) {
 which |= EV_WRITE ;
 }
 else if ( events [ i ] . filter == EVFILT_SIGNAL ) {
 which |= EV_SIGNAL ;
 }
 if ( ! which ) continue ;
 if ( events [ i ] . filter == EVFILT_SIGNAL ) {
 struct event_list * head = ( struct event_list * ) events [ i ] . udata ;
 TAILQ_FOREACH ( ev , head , ev_signal_next ) {
 event_active ( ev , which , events [ i ] . data ) ;
 }
 }
 else {
 ev = ( struct event * ) events [ i ] . udata ;
 if ( ! ( ev -> ev_events & EV_PERSIST ) ) ev -> ev_flags &= ~ EVLIST_X_KQINKERNEL ;
 event_active ( ev , which , 1 ) ;
 }
 }
 return ( 0 ) ;
 }


static int aac_decode_frame(AVCodecContext *avccontext, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AACContext *ac = avccontext->priv_data; ChannelElement *che = NULL, *che_prev = NULL; GetBitContext gb; enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; int err, elem_id, data_size_tmp; int buf_consumed; int samples = 1024, multiplier; int buf_offset; init_get_bits(&gb, buf, buf_size * 8); if (show_bits(&gb, 12) == 0xfff) { if (parse_adts_frame_header(ac, &gb) < 0) { av_log(avccontext, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); return -1; } if (ac->m4ac.sampling_index > 12) { av_log(ac->avccontext, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index); return -1; } } // parse while ((elem_type = get_bits(&gb, 3)) != TYPE_END) { elem_id = get_bits(&gb, 4); if (elem_type < TYPE_DSE && !(che=get_che(ac, elem_type, elem_id))) { av_log(ac->avccontext, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", elem_type, elem_id); return -1; } switch (elem_type) { case TYPE_SCE: err = decode_ics(ac, &che->ch[0], &gb, 0, 0); break; case TYPE_CPE: err = decode_cpe(ac, &gb, che); break; case TYPE_CCE: err = decode_cce(ac, &gb, che); break; case TYPE_LFE: err = decode_ics(ac, &che->ch[0], &gb, 0, 0); break; case TYPE_DSE: err = skip_data_stream_element(ac, &gb); break; case TYPE_PCE: { enum ChannelPosition new_che_pos[4][MAX_ELEM_ID]; memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if ((err = decode_pce(ac, new_che_pos, &gb))) break; if (ac->output_configured > OC_TRIAL_PCE) av_log(avccontext, AV_LOG_ERROR, "Not evaluating a further program_config_element as this construct is dubious at best.\n"); else err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE); break; } case TYPE_FIL: if (elem_id == 15) elem_id += get_bits(&gb, 8) - 1; if (get_bits_left(&gb) < 8 * elem_id) { av_log(avccontext, AV_LOG_ERROR, overread_err); return -1; } while (elem_id > 0) elem_id -= decode_extension_payload(ac, &gb, elem_id, che_prev, elem_type_prev); err = 0; /* FIXME */ break; default: err = -1; /* should not happen, but keeps compiler happy */ break; } che_prev = che; elem_type_prev = elem_type; if (err) return err; if (get_bits_left(&gb) < 3) { av_log(avccontext, AV_LOG_ERROR, overread_err); return -1; } } spectral_to_sample(ac); multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0; samples <<= multiplier; if (ac->output_configured < OC_LOCKED) { avccontext->sample_rate = ac->m4ac.sample_rate << multiplier; avccontext->frame_size = samples; } data_size_tmp = samples * avccontext->channels * sizeof(int16_t); if (*data_size < data_size_tmp) { av_log(avccontext, AV_LOG_ERROR, "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n", *data_size, data_size_tmp); return -1; } *data_size = data_size_tmp; ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avccontext->channels); if (ac->output_configured) ac->output_configured = OC_LOCKED; buf_consumed = (get_bits_count(&gb) + 7) >> 3; for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) if (buf[buf_offset]) break; return buf_size > buf_offset ? buf_consumed : buf_size; }


static void s390_init ( ram_addr_t ram_size , const char * boot_device , const char * kernel_filename , const char * kernel_cmdline , const char * initrd_filename , const char * cpu_model ) {
 CPUState * env = NULL ;
 ram_addr_t ram_addr ;
 ram_addr_t kernel_size = 0 ;
 ram_addr_t initrd_offset ;
 ram_addr_t initrd_size = 0 ;
 int i ;
 if ( ! kvm_enabled ( ) ) {
 fprintf ( stderr , "The S390 target only works with KVM enabled\n" ) ;
 exit ( 1 ) ;
 }
 s390_bus = s390_virtio_bus_init ( & ram_size ) ;
 ram_addr = qemu_ram_alloc ( ram_size ) ;
 cpu_register_physical_memory ( 0 , ram_size , ram_addr ) ;
 if ( cpu_model == NULL ) {
 cpu_model = "host" ;
 }
 ipi_states = qemu_malloc ( sizeof ( CPUState * ) * smp_cpus ) ;
 for ( i = 0 ;
 i < smp_cpus ;
 i ++ ) {
 CPUState * tmp_env ;
 tmp_env = cpu_init ( cpu_model ) ;
 if ( ! env ) {
 env = tmp_env ;
 }
 ipi_states [ i ] = tmp_env ;
 tmp_env -> halted = 1 ;
 tmp_env -> exception_index = EXCP_HLT ;
 }
 env -> halted = 0 ;
 env -> exception_index = 0 ;
 if ( kernel_filename ) {
 kernel_size = load_image ( kernel_filename , qemu_get_ram_ptr ( 0 ) ) ;
 if ( lduw_phys ( KERN_IMAGE_START ) != 0x0dd0 ) {
 fprintf ( stderr , "Specified image is not an s390 boot image\n" ) ;
 exit ( 1 ) ;
 }
 cpu_synchronize_state ( env ) ;
 env -> psw . addr = KERN_IMAGE_START ;
 env -> psw . mask = 0x0000000180000000ULL ;
 }
 if ( initrd_filename ) {
 initrd_offset = INITRD_START ;
 while ( kernel_size + 0x100000 > initrd_offset ) {
 initrd_offset += 0x100000 ;
 }
 initrd_size = load_image ( initrd_filename , qemu_get_ram_ptr ( initrd_offset ) ) ;
 stq_phys ( INITRD_PARM_START , initrd_offset ) ;
 stq_phys ( INITRD_PARM_SIZE , initrd_size ) ;
 }
 if ( kernel_cmdline ) {
 cpu_physical_memory_rw ( KERN_PARM_AREA , ( uint8_t * ) kernel_cmdline , strlen ( kernel_cmdline ) , 1 ) ;
 }
 for ( i = 0 ;
 i < nb_nics ;
 i ++ ) {
 NICInfo * nd = & nd_table [ i ] ;
 DeviceState * dev ;
 if ( ! nd -> model ) {
 nd -> model = qemu_strdup ( "virtio" ) ;
 }
 if ( strcmp ( nd -> model , "virtio" ) ) {
 fprintf ( stderr , "S390 only supports VirtIO nics\n" ) ;
 exit ( 1 ) ;
 }
 dev = qdev_create ( ( BusState * ) s390_bus , "virtio-net-s390" ) ;
 qdev_set_nic_properties ( dev , nd ) ;
 qdev_init_nofail ( dev ) ;
 }
 for ( i = 0 ;
 i < MAX_BLK_DEVS ;
 i ++ ) {
 DriveInfo * dinfo ;
 DeviceState * dev ;
 dinfo = drive_get ( IF_IDE , 0 , i ) ;
 if ( ! dinfo ) {
 continue ;
 }
 dev = qdev_create ( ( BusState * ) s390_bus , "virtio-blk-s390" ) ;
 qdev_prop_set_drive ( dev , "drive" , dinfo ) ;
 qdev_init_nofail ( dev ) ;
 }
 }


init_sched_build_groups(const cpumask_t *span, const cpumask_t *cpu_map,
			int (*group_fn)(int cpu, const cpumask_t *cpu_map,
					struct sched_group **sg,
					cpumask_t *tmpmask),
			cpumask_t *covered, cpumask_t *tmpmask)
{
	struct sched_group *first = NULL, *last = NULL;
	int i;

	cpus_clear(*covered);

	for_each_cpu_mask(i, *span) {
		struct sched_group *sg;
		int group = group_fn(i, cpu_map, &sg, tmpmask);
		int j;

		if (cpu_isset(i, *covered))
			continue;

		cpus_clear(sg->cpumask);
		sg->__cpu_power = 0;

		for_each_cpu_mask(j, *span) {
			if (group_fn(j, cpu_map, NULL, tmpmask) != group)
				continue;

			cpu_set(j, *covered);
			cpu_set(j, sg->cpumask);
		}
		if (!first)
			first = sg;
		if (last)
			last->next = sg;
		last = sg;
	}
	last->next = first;
}


static inline void hrtick_clear(struct rq *rq)
{
}


TEST_F ( BrowsingDataRemoverImplTest , RemoveQuotaManagedDataForeverNeither ) {
 # if BUILDFLAG ( ENABLE_EXTENSIONS ) CreateMockPolicy ( ) ;
 # endif BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , false ) ;
 EXPECT_EQ ( BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , GetRemovalMask ( ) ) ;
 EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ;
 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
 EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition : : REMOVE_DATA_MASK_WEBSQL | StoragePartition : : REMOVE_DATA_MASK_APPCACHE | StoragePartition : : REMOVE_DATA_MASK_SERVICE_WORKERS | StoragePartition : : REMOVE_DATA_MASK_CACHE_STORAGE | StoragePartition : : REMOVE_DATA_MASK_INDEXEDDB ) ;
 EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ;
 EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin1 , mock_policy ( ) ) ) ;
 EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin2 , mock_policy ( ) ) ) ;
 EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin3 , mock_policy ( ) ) ) ;
 }


	__releases(rq2->lock)
{
	spin_unlock(&rq1->lock);
	if (rq1 != rq2)
		spin_unlock(&rq2->lock);
	else
		__release(rq2->lock);
}


find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu,
		cpumask_t *tmp)
{
	unsigned long load, min_load = ULONG_MAX;
	int idlest = -1;
	int i;

	/* Traverse only the allowed CPUs */
	cpus_and(*tmp, group->cpumask, p->cpus_allowed);

	for_each_cpu_mask(i, *tmp) {
		load = weighted_cpuload(i);

		if (load < min_load || (load == min_load && i == this_cpu)) {
			min_load = load;
			idlest = i;
		}
	}

	return idlest;
}


static inline void set_intra_mode_default ( AVSContext * h ) {
 if ( h -> stream_revision > 0 ) {
 h -> pred_mode_Y [ 3 ] = h -> pred_mode_Y [ 6 ] = NOT_AVAIL ;
 h -> top_pred_Y [ h -> mbx * 2 + 0 ] = h -> top_pred_Y [ h -> mbx * 2 + 1 ] = NOT_AVAIL ;
 }
 else {
 h -> pred_mode_Y [ 3 ] = h -> pred_mode_Y [ 6 ] = INTRA_L_LP ;
 h -> top_pred_Y [ h -> mbx * 2 + 0 ] = h -> top_pred_Y [ h -> mbx * 2 + 1 ] = INTRA_L_LP ;
 }
 }


static QemuOpts *opts_parse(QemuOptsList *list, const char *params, int permit_abbrev, bool defaults) { const char *firstname; char value[1024], *id = NULL; const char *p; QemuOpts *opts; Error *local_err = NULL; assert(!permit_abbrev || list->implied_opt_name); firstname = permit_abbrev ? list->implied_opt_name : NULL; if (strncmp(params, "id=", 3) == 0) { get_opt_value(value, sizeof(value), params+3); id = value; } else if ((p = strstr(params, ",id=")) != NULL) { get_opt_value(value, sizeof(value), p+4); id = value; } opts = qemu_opts_create(list, id, !defaults, &local_err); if (opts == NULL) { if (error_is_set(&local_err)) { qerror_report_err(local_err); error_free(local_err); } return NULL; } if (opts_do_parse(opts, params, firstname, defaults) != 0) { qemu_opts_del(opts); return NULL; } return opts; }