static bool r_bin_mdmp_init_directory_entry(struct r_bin_mdmp_obj *obj, struct minidump_directory *entry) {
	int i;

	struct minidump_handle_operation_list *handle_operation_list;
	struct minidump_memory_list *memory_list;
	struct minidump_memory64_list *memory64_list;
	struct minidump_memory_info_list *memory_info_list;
	struct minidump_module_list *module_list;
	struct minidump_thread_list *thread_list;
	struct minidump_thread_ex_list *thread_ex_list;
	struct minidump_thread_info_list *thread_info_list;
	struct minidump_unloaded_module_list *unloaded_module_list;

	struct avrf_handle_operation *handle_operations;
	struct minidump_memory_descriptor *memories;
	struct minidump_memory_descriptor64 *memories64;
	struct minidump_memory_info *memory_infos;
	struct minidump_module *modules;
	struct minidump_thread *threads;
	struct minidump_thread_ex *ex_threads;
	struct minidump_thread_info *thread_infos;
	struct minidump_unloaded_module *unloaded_modules;

 	/* We could confirm data sizes but a malcious MDMP will always get around
 	** this! But we can ensure that the data is not outside of the file */
 	if (entry->location.rva + entry->location.data_size > obj->b->length) {
		eprintf ("[ERROR] Size Mismatch - Stream data is larger than file size!\n");
 		return false;
 	}

	switch (entry->stream_type) {
	case THREAD_LIST_STREAM:
		thread_list = (struct minidump_thread_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_thread.format", "ddddq?? "
			"ThreadId SuspendCount PriorityClass Priority "
			"Teb (mdmp_memory_descriptor)Stack "
			"(mdmp_location_descriptor)ThreadContext", 0);
		sdb_num_set (obj->kv, "mdmp_thread_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_thread_list.format",
			sdb_fmt ("d[%i]? "
				"NumberOfThreads (mdmp_thread)Threads",
				thread_list->number_of_threads),
			0);

		/* TODO: Not yet fully parsed or utilised */
		for (i = 0; i < thread_list->number_of_threads; i++) {
			threads = (struct minidump_thread *)(&(thread_list->threads));
			r_list_append (obj->streams.threads, &(threads[i]));
		}
		break;
	case MODULE_LIST_STREAM:
		module_list = (struct minidump_module_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_module.format", "qddtd???qq "
			"BaseOfImage SizeOfImage CheckSum "
			"TimeDateStamp ModuleNameRVA "
			"(mdmp_vs_fixedfileinfo)VersionInfo "
			"(mdmp_location_descriptor)CvRecord "
			"(mdmp_location_descriptor)MiscRecord "
			"Reserved0 Reserved1", 0);
		sdb_num_set (obj->kv, "mdmp_module_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_module_list.format",
			sdb_fmt ("d[%i]? "
				"NumberOfModule (mdmp_module)Modules",
				module_list->number_of_modules,
				0),
			0);

		for (i = 0; i < module_list->number_of_modules; i++) {
			modules = (struct minidump_module *)(&(module_list->modules));
			r_list_append(obj->streams.modules, &(modules[i]));
		}
		break;
	case MEMORY_LIST_STREAM:
		memory_list = (struct minidump_memory_list *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_memory_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_memory_list.format",
			sdb_fmt ("d[%i]? "
				"NumberOfMemoryRanges "
				"(mdmp_memory_descriptor)MemoryRanges ",
				memory_list->number_of_memory_ranges,
				0),
			0);

		for (i = 0; i < memory_list->number_of_memory_ranges; i++) {
			memories = (struct minidump_memory_descriptor *)(&(memory_list->memory_ranges));
			r_list_append (obj->streams.memories, &(memories[i]));
		}
		break;
	case EXCEPTION_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.exception = (struct minidump_exception_stream *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_exception.format", "[4]E[4]Eqqdd[15]q "
			"(mdmp_exception_code)ExceptionCode "
			"(mdmp_exception_flags)ExceptionFlags "
			"ExceptionRecord ExceptionAddress "
			"NumberParameters __UnusedAlignment "
			"ExceptionInformation", 0);
		sdb_num_set (obj->kv, "mdmp_exception_stream.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_exception_stream.format", "dd?? "
			"ThreadId __Alignment "
			"(mdmp_exception)ExceptionRecord "
			"(mdmp_location_descriptor)ThreadContext", 0);

		break;
	case SYSTEM_INFO_STREAM:
		obj->streams.system_info = (struct minidump_system_info *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_system_info.offset",
			entry->location.rva, 0);
		/* TODO: We need E as a byte! */
		sdb_set (obj->kv, "mdmp_system_info.format", "[2]EwwbBddd[4]Ed[2]Ew[2]q "
			"(mdmp_processor_architecture)ProcessorArchitecture "
			"ProcessorLevel ProcessorRevision NumberOfProcessors "
			"(mdmp_product_type)ProductType "
			"MajorVersion MinorVersion BuildNumber (mdmp_platform_id)PlatformId "
			"CsdVersionRva (mdmp_suite_mask)SuiteMask Reserved2 ProcessorFeatures", 0);

		break;
	case THREAD_EX_LIST_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		thread_ex_list = (struct minidump_thread_ex_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_thread_ex.format", "ddddq??? "
			"ThreadId SuspendCount PriorityClass Priority "
			"Teb (mdmp_memory_descriptor)Stack "
			"(mdmp_location_descriptor)ThreadContext "
			"(mdmp_memory_descriptor)BackingStore", 0);
		sdb_num_set (obj->kv, "mdmp_thread_ex_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_thread_ex_list.format",
			sdb_fmt ("d[%i]? NumberOfThreads "
				"(mdmp_thread_ex)Threads",
				thread_ex_list->number_of_threads, 0),
			0);

		for (i = 0; i < thread_ex_list->number_of_threads; i++) {
			ex_threads = (struct minidump_thread_ex *)(&(thread_ex_list->threads));
			r_list_append (obj->streams.ex_threads, &(ex_threads[i]));
		}
		break;
	case MEMORY_64_LIST_STREAM:
		memory64_list = (struct minidump_memory64_list *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_memory64_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_memory64_list.format",
			sdb_fmt ("qq[%i]? NumberOfMemoryRanges "
				"BaseRva "
				"(mdmp_memory_descriptor64)MemoryRanges",
				memory64_list->number_of_memory_ranges),
			0);

		obj->streams.memories64.base_rva = memory64_list->base_rva;
		for (i = 0; i < memory64_list->number_of_memory_ranges; i++) {
			memories64 = (struct minidump_memory_descriptor64 *)(&(memory64_list->memory_ranges));
			r_list_append (obj->streams.memories64.memories, &(memories64[i]));
		}
		break;
	case COMMENT_STREAM_A:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.comments_a = obj->b->buf + entry->location.rva;

		sdb_num_set (obj->kv, "mdmp_comment_stream_a.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_comment_stream_a.format",
			"s CommentA", 0);

		break;
	case COMMENT_STREAM_W:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.comments_w = obj->b->buf + entry->location.rva;

		sdb_num_set (obj->kv, "mdmp_comment_stream_w.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_comment_stream_w.format",
				"s CommentW", 0);

		break;
	case HANDLE_DATA_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.handle_data = (struct minidump_handle_data_stream *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_handle_data_stream.offset",
				entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_handle_data_stream.format", "dddd "
				"SizeOfHeader SizeOfDescriptor "
				"NumberOfDescriptors Reserved", 0);
		break;
	case FUNCTION_TABLE_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.function_table = (struct minidump_function_table_stream *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_function_table_stream.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_function_table_stream.format", "dddddd "
			"SizeOfHeader SizeOfDescriptor SizeOfNativeDescriptor "
			"SizeOfFunctionEntry NumberOfDescriptors SizeOfAlignPad",
			0);
		break;
	case UNLOADED_MODULE_LIST_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		unloaded_module_list = (struct minidump_unloaded_module_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_unloaded_module.format", "qddtd "
			"BaseOfImage SizeOfImage CheckSum TimeDateStamp "
			"ModuleNameRva", 0);
		sdb_num_set (obj->kv, "mdmp_unloaded_module_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_unloaded_module_list.format", "ddd "
			"SizeOfHeader SizeOfEntry NumberOfEntries", 0);

		for (i = 0; i < unloaded_module_list->number_of_entries; i++) {
			unloaded_modules = (struct minidump_unloaded_module *)((ut8 *)&unloaded_module_list + sizeof (struct minidump_unloaded_module_list));
			r_list_append (obj->streams.unloaded_modules, &(unloaded_modules[i]));
		}
		break;
	case MISC_INFO_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		obj->streams.misc_info.misc_info_1 = (struct minidump_misc_info *)(obj->b->buf + entry->location.rva);

		/* TODO: Handle different sizes */
		sdb_num_set (obj->kv, "mdmp_misc_info.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_misc_info.format", "d[4]Bdtttddddd "
			"SizeOfInfo (mdmp_misc1_flags)Flags1 ProcessId "
			"ProcessCreateTime ProcessUserTime ProcessKernelTime "
			"ProcessorMaxMhz ProcessorCurrentMhz "
			"ProcessorMhzLimit ProcessorMaxIdleState "
			"ProcessorCurrentIdleState", 0);

		break;
	case MEMORY_INFO_LIST_STREAM:
		memory_info_list = (struct minidump_memory_info_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_memory_info.format",
			"qq[4]Edq[4]E[4]E[4]Ed BaseAddress AllocationBase "
			"(mdmp_page_protect)AllocationProtect __Alignment1 RegionSize "
			"(mdmp_mem_state)State (mdmp_page_protect)Protect "
			"(mdmp_mem_type)Type __Alignment2", 0);
		sdb_num_set (obj->kv, "mdmp_memory_info_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_memory_info_list.format",
			sdb_fmt ("ddq[%i]? SizeOfHeader SizeOfEntry "
				"NumberOfEntries (mdmp_memory_info)MemoryInfo",
				memory_info_list->number_of_entries),
			0);

		for (i = 0; i < memory_info_list->number_of_entries; i++) {
			memory_infos = (struct minidump_memory_info *)((ut8 *)memory_info_list + sizeof (struct minidump_memory_info_list));
			r_list_append (obj->streams.memory_infos, &(memory_infos[i]));
		}
		break;
	case THREAD_INFO_LIST_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		thread_info_list = (struct minidump_thread_info_list *)(obj->b->buf + entry->location.rva);

		sdb_set (obj->kv, "mdmp_thread_info.format", "ddddttttqq "
			"ThreadId DumpFlags DumpError ExitStatus CreateTime "
			"ExitTime KernelTime UserTime StartAddress Affinity",
			0);
		sdb_num_set (obj->kv, "mdmp_thread_info_list.offset",
				entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_thread_info_list.format", "ddd "
			"SizeOfHeader SizeOfEntry NumberOfEntries", 0);

		for (i = 0; i < thread_info_list->number_of_entries; i++) {
			thread_infos = (struct minidump_thread_info *)((ut8 *)thread_info_list + sizeof (struct minidump_thread_info_list));
			r_list_append (obj->streams.thread_infos, &(thread_infos[i]));
		}
		break;
	case HANDLE_OPERATION_LIST_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		handle_operation_list = (struct minidump_handle_operation_list *)(obj->b->buf + entry->location.rva);

		sdb_num_set (obj->kv, "mdmp_handle_operation_list.offset",
			entry->location.rva, 0);
		sdb_set (obj->kv, "mdmp_handle_operation_list.format", "dddd "
			"SizeOfHeader SizeOfEntry NumberOfEntries Reserved", 0);

		for (i = 0; i < handle_operation_list->number_of_entries; i++) {
			handle_operations = (struct avrf_handle_operation *)((ut8 *)handle_operation_list + sizeof (struct minidump_handle_operation_list));
			r_list_append (obj->streams.operations, &(handle_operations[i]));
		}

		break;
	case LAST_RESERVED_STREAM:
		/* TODO: Not yet fully parsed or utilised */
		break;
	case UNUSED_STREAM:
	case RESERVED_STREAM_0:
	case RESERVED_STREAM_1:
		/* Silently ignore reserved streams */
		break;
	default:
		eprintf ("[WARN] Invalid or unsupported enumeration encountered %i\n", entry->stream_type);
		return false;
	}
	return true;
}


static int qeth_cm_enable_cb(struct qeth_card *card, struct qeth_reply *reply,
		unsigned long data)
{
	struct qeth_cmd_buffer *iob;

	QETH_DBF_TEXT(SETUP, 2, "cmenblcb");

	iob = (struct qeth_cmd_buffer *) data;
	memcpy(&card->token.cm_filter_r,
	       QETH_CM_ENABLE_RESP_FILTER_TOKEN(iob->data),
	       QETH_MPC_TOKEN_LENGTH);
	QETH_DBF_TEXT_(SETUP, 2, "  rc%d", iob->rc);
	return 0;
}


static int copy_verifier_state(struct bpf_verifier_state *dst_state,
			       const struct bpf_verifier_state *src)
{
	struct bpf_func_state *dst;
	u32 jmp_sz = sizeof(struct bpf_idx_pair) * src->jmp_history_cnt;
	int i, err;

	if (dst_state->jmp_history_cnt < src->jmp_history_cnt) {
		kfree(dst_state->jmp_history);
		dst_state->jmp_history = kmalloc(jmp_sz, GFP_USER);
		if (!dst_state->jmp_history)
			return -ENOMEM;
	}
	memcpy(dst_state->jmp_history, src->jmp_history, jmp_sz);
	dst_state->jmp_history_cnt = src->jmp_history_cnt;

	/* if dst has more stack frames then src frame, free them */
	for (i = src->curframe + 1; i <= dst_state->curframe; i++) {
		free_func_state(dst_state->frame[i]);
		dst_state->frame[i] = NULL;
	}
	dst_state->speculative = src->speculative;
	dst_state->curframe = src->curframe;
	dst_state->active_spin_lock = src->active_spin_lock;
	dst_state->branches = src->branches;
	dst_state->parent = src->parent;
	dst_state->first_insn_idx = src->first_insn_idx;
	dst_state->last_insn_idx = src->last_insn_idx;
	for (i = 0; i <= src->curframe; i++) {
		dst = dst_state->frame[i];
		if (!dst) {
			dst = kzalloc(sizeof(*dst), GFP_KERNEL);
			if (!dst)
				return -ENOMEM;
			dst_state->frame[i] = dst;
		}
		err = copy_func_state(dst, src->frame[i]);
		if (err)
			return err;
	}
	return 0;
}


  void Compute(OpKernelContext* ctx) final {
    // Extract inputs and validate shapes and types.
    const CSRSparseMatrix* input_matrix;
    OP_REQUIRES_OK(ctx, ExtractVariantFromInput(ctx, 0, &input_matrix));
    const Tensor& input_permutation_indices = ctx->input(1);

    int64 num_rows;
    int batch_size;
    ValidateInputs(ctx, *input_matrix, input_permutation_indices, &batch_size,
                   &num_rows);

    // Allocate batch pointers.
    Tensor batch_ptr(cpu_allocator(), DT_INT32, TensorShape({batch_size + 1}));
    auto batch_ptr_vec = batch_ptr.vec<int32>();
    batch_ptr_vec(0) = 0;

    // Temporary vector of Eigen SparseMatrices to store the Sparse Cholesky
    // factors.
    // Note: we use column-compressed (CSC) SparseMatrix because SimplicialLLT
    // returns the factors in column major format. Since our input should be
    // symmetric, column major and row major is identical in storage. We just
    // have to switch to reading the upper triangular part of the input, which
    // corresponds to the lower triangular part in row major format.
    std::vector<SparseMatrix> sparse_cholesky_factors(batch_size);

    // TODO(anudhyan): Tune the cost per unit based on benchmarks.
    const double nnz_per_row =
        (input_matrix->total_nnz() / batch_size) / num_rows;
    const int64 sparse_cholesky_cost_per_batch =
        nnz_per_row * nnz_per_row * num_rows;
    // Perform sparse Cholesky factorization of each batch in parallel.
    auto worker_threads = *(ctx->device()->tensorflow_cpu_worker_threads());
    std::atomic<int64> invalid_input_index(-1);
    Shard(worker_threads.num_threads, worker_threads.workers, batch_size,
          sparse_cholesky_cost_per_batch,
          [&](int64 batch_begin, int64 batch_end) {
            for (int64 batch_index = batch_begin; batch_index < batch_end;
                 ++batch_index) {
              // Define an Eigen SparseMatrix Map to operate on the
              // CSRSparseMatrix component without copying the data.
              Eigen::Map<const SparseMatrix> sparse_matrix(
                  num_rows, num_rows, input_matrix->nnz(batch_index),
                  input_matrix->row_pointers_vec(batch_index).data(),
                  input_matrix->col_indices_vec(batch_index).data(),
                  input_matrix->values_vec<T>(batch_index).data());

              Eigen::SimplicialLLT<SparseMatrix, Eigen::Upper,
                                   Eigen::NaturalOrdering<int>>
                  solver;
              auto permutation_indices_flat =
                  input_permutation_indices.flat<int32>().data();

              // Invert the fill-in reducing ordering and apply it to the input
              // sparse matrix.
              Eigen::Map<
                  Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int>>
                  permutation(permutation_indices_flat + batch_index * num_rows,
                              num_rows);
              auto permutation_inverse = permutation.inverse();

              SparseMatrix permuted_sparse_matrix;
              permuted_sparse_matrix.template selfadjointView<Eigen::Upper>() =
                  sparse_matrix.template selfadjointView<Eigen::Upper>()
                      .twistedBy(permutation_inverse);

              // Compute the Cholesky decomposition.
              solver.compute(permuted_sparse_matrix);
              if (solver.info() != Eigen::Success) {
                invalid_input_index = batch_index;
                return;
              }

              // Get the upper triangular factor, which would end up in the
              // lower triangular part of the output CSRSparseMatrix when
              // interpreted in row major format.
              sparse_cholesky_factors[batch_index] =
                  std::move(solver.matrixU());
              // For now, batch_ptr contains the number of nonzeros in each
              // batch.
              batch_ptr_vec(batch_index + 1) =
                  sparse_cholesky_factors[batch_index].nonZeros();
            }
          });

    // Check for invalid input.
    OP_REQUIRES(
        ctx, invalid_input_index == -1,
        errors::InvalidArgument(
            "Sparse Cholesky factorization failed for batch index ",
            invalid_input_index.load(), ". The input might not be valid."));

    // Compute a cumulative sum to obtain the batch pointers.
    std::partial_sum(batch_ptr_vec.data(),
                     batch_ptr_vec.data() + batch_size + 1,
                     batch_ptr_vec.data());

    // Allocate output Tensors.
    const int64 total_nnz = batch_ptr_vec(batch_size);
    Tensor output_row_ptr(cpu_allocator(), DT_INT32,
                          TensorShape({(num_rows + 1) * batch_size}));
    Tensor output_col_ind(cpu_allocator(), DT_INT32, TensorShape({total_nnz}));
    Tensor output_values(cpu_allocator(), DataTypeToEnum<T>::value,
                         TensorShape({total_nnz}));
    auto output_row_ptr_ptr = output_row_ptr.flat<int32>().data();
    auto output_col_ind_ptr = output_col_ind.flat<int32>().data();
    auto output_values_ptr = output_values.flat<T>().data();

    // Copy the output matrices from each batch into the CSRSparseMatrix
    // Tensors.
    // TODO(b/129906419): Factor out the copy from Eigen SparseMatrix to
    // CSRSparseMatrix into common utils. This is also used in
    // SparseMatrixSparseMatMul.
    Shard(worker_threads.num_threads, worker_threads.workers, batch_size,
          (3 * total_nnz) / batch_size /* cost per unit */,
          [&](int64 batch_begin, int64 batch_end) {
            for (int64 batch_index = batch_begin; batch_index < batch_end;
                 ++batch_index) {
              const SparseMatrix& cholesky_factor =
                  sparse_cholesky_factors[batch_index];
              const int64 nnz = cholesky_factor.nonZeros();

              std::copy(cholesky_factor.outerIndexPtr(),
                        cholesky_factor.outerIndexPtr() + num_rows + 1,
                        output_row_ptr_ptr + batch_index * (num_rows + 1));
              std::copy(cholesky_factor.innerIndexPtr(),
                        cholesky_factor.innerIndexPtr() + nnz,
                        output_col_ind_ptr + batch_ptr_vec(batch_index));
              std::copy(cholesky_factor.valuePtr(),
                        cholesky_factor.valuePtr() + nnz,
                        output_values_ptr + batch_ptr_vec(batch_index));
            }
          });

    // Create the CSRSparseMatrix instance from its component Tensors and
    // prepare the Variant output Tensor.
    CSRSparseMatrix output_csr_matrix;
    OP_REQUIRES_OK(
        ctx,
        CSRSparseMatrix::CreateCSRSparseMatrix(
            DataTypeToEnum<T>::value, input_matrix->dense_shape(), batch_ptr,
            output_row_ptr, output_col_ind, output_values, &output_csr_matrix));
    Tensor* output_csr_matrix_tensor;
    AllocatorAttributes cpu_alloc;
    cpu_alloc.set_on_host(true);
    OP_REQUIRES_OK(
        ctx, ctx->allocate_output(0, TensorShape({}), &output_csr_matrix_tensor,
                                  cpu_alloc));
    output_csr_matrix_tensor->scalar<Variant>()() =
        std::move(output_csr_matrix);
  }


static inline int ext4_begin_ordered_truncate(struct inode *inode,
					      loff_t new_size)
{
	return jbd2_journal_begin_ordered_truncate(
					EXT4_SB(inode->i_sb)->s_journal,
					&EXT4_I(inode)->jinode,
					new_size);
}


int kvm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
{
	return kvm_x86_ops->get_msr(vcpu, msr);
}


void FrameLoader::didLayout(LayoutMilestones milestones)
{
    m_client->dispatchDidLayout(milestones);
}


  CudnnHandle(gpu::ScopedActivateExecutorContext context,
              std::unique_ptr<absl::MutexLock> lock, cudnnHandle_t handle)
      : context_(std::move(context)), lock_(std::move(lock)), handle_(handle) {}


  void ResetMaxCapacityBytes(size_t max_capacity_bytes) {
    max_capacity_bytes_ = max_capacity_bytes;
    Initialize();
  }


int Reverb_command(effect_handle_t  self,
 uint32_t            cmdCode,
 uint32_t            cmdSize,
 void *pCmdData,
 uint32_t *replySize,
 void *pReplyData){
    android::ReverbContext * pContext = (android::ReverbContext *) self;
    LVREV_ControlParams_st    ActiveParams; /* Current control Parameters */
    LVREV_ReturnStatus_en     LvmStatus=LVREV_SUCCESS; /* Function call status */

 if (pContext == NULL){
        ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
 return -EINVAL;
 }

 switch (cmdCode){
 case EFFECT_CMD_INIT:

 if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_INIT: ERROR");
 return -EINVAL;
 }
 *(int *) pReplyData = 0;
 break;

 case EFFECT_CMD_SET_CONFIG:
 if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) ||
                    pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_SET_CONFIG: ERROR");
 return -EINVAL;
 }
 *(int *) pReplyData = android::Reverb_setConfig(pContext,
 (effect_config_t *) pCmdData);
 break;

 case EFFECT_CMD_GET_CONFIG:
 if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(effect_config_t)) {
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_GET_CONFIG: ERROR");
 return -EINVAL;
 }

            android::Reverb_getConfig(pContext, (effect_config_t *)pReplyData);
 break;

 case EFFECT_CMD_RESET:
 Reverb_setConfig(pContext, &pContext->config);
 break;

 case EFFECT_CMD_GET_PARAM:{
 effect_param_t *p = (effect_param_t *)pCmdData;
 if (SIZE_MAX - sizeof(effect_param_t) < (size_t)p->psize) {
                android_errorWriteLog(0x534e4554, "26347509");
 return -EINVAL;
 }
 if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
                    cmdSize < (sizeof(effect_param_t) + p->psize) ||
                    pReplyData == NULL || replySize == NULL ||
 *replySize < (sizeof(effect_param_t) + p->psize)) {
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_GET_PARAM: ERROR");
 return -EINVAL;
 }

            memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);

            p = (effect_param_t *)pReplyData;

 int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);

            p->status = android::Reverb_getParameter(pContext,
 (void *)p->data,
 &p->vsize,
                                                          p->data + voffset);

 *replySize = sizeof(effect_param_t) + voffset + p->vsize;

 } break;
 case EFFECT_CMD_SET_PARAM:{

 if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))) ||
                    pReplyData == NULL ||  replySize == NULL || *replySize != sizeof(int32_t)) {
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_SET_PARAM: ERROR");
 return -EINVAL;
 }

 effect_param_t *p = (effect_param_t *) pCmdData;

 if (p->psize != sizeof(int32_t)){
                ALOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
 return -EINVAL;
 }

             *(int *)pReplyData = android::Reverb_setParameter(pContext,
                                                              (void *)p->data,
                                                              p->data + p->psize,
                                                              p->vsize);
         } break;

         case EFFECT_CMD_ENABLE:

 if (pReplyData == NULL || *replySize != sizeof(int)){
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_ENABLE: ERROR");
 return -EINVAL;
 }
 if(pContext->bEnabled == LVM_TRUE){
                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_ENABLE: ERROR-Effect is already enabled");
 return -EINVAL;
 }
 *(int *)pReplyData = 0;
            pContext->bEnabled = LVM_TRUE;
 /* Get the current settings */
 LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
            LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "EFFECT_CMD_ENABLE")
            pContext->SamplesToExitCount =
 (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
            pContext->volumeMode = android::REVERB_VOLUME_FLAT;
 break;
 case EFFECT_CMD_DISABLE:

 if (pReplyData == NULL || *replySize != sizeof(int)){
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_DISABLE: ERROR");
 return -EINVAL;
 }
 if(pContext->bEnabled == LVM_FALSE){
                 ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_DISABLE: ERROR-Effect is not yet enabled");
 return -EINVAL;
 }
 *(int *)pReplyData = 0;
            pContext->bEnabled = LVM_FALSE;
 break;

 case EFFECT_CMD_SET_VOLUME:
 if (pCmdData == NULL ||
                cmdSize != 2 * sizeof(uint32_t)) {
                ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "EFFECT_CMD_SET_VOLUME: ERROR");
 return -EINVAL;
 }

 if (pReplyData != NULL) { // we have volume control
                pContext->leftVolume = (LVM_INT16)((*(uint32_t *)pCmdData + (1 << 11)) >> 12);
                pContext->rightVolume = (LVM_INT16)((*((uint32_t *)pCmdData + 1) + (1 << 11)) >> 12);
 *(uint32_t *)pReplyData = (1 << 24);
 *((uint32_t *)pReplyData + 1) = (1 << 24);
 if (pContext->volumeMode == android::REVERB_VOLUME_OFF) {
                    pContext->volumeMode = android::REVERB_VOLUME_FLAT;
 }
 } else { // we don't have volume control
                pContext->leftVolume = REVERB_UNIT_VOLUME;
                pContext->rightVolume = REVERB_UNIT_VOLUME;
                pContext->volumeMode = android::REVERB_VOLUME_OFF;
 }
            ALOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
                    pContext->leftVolume, pContext->rightVolume,  pContext->volumeMode);
 break;

 case EFFECT_CMD_SET_DEVICE:
 case EFFECT_CMD_SET_AUDIO_MODE:
 break;

 default:
            ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
 "DEFAULT start %d ERROR",cmdCode);
 return -EINVAL;
 }

 return 0;
} /* end Reverb_command */


int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx)
{
    return ctx->error_depth;
}


static PyObject * get_value ( PyObject * self , const char * buffer , int * position , int type , int max , PyObject * as_class , unsigned char tz_aware , unsigned char uuid_subtype ) {
 struct module_state * state = GETSTATE ( self ) ;
 PyObject * value ;
 PyObject * error ;
 switch ( type ) {
 case 1 : {
 double d ;
 if ( max < 8 ) {
 goto invalid ;
 }
 memcpy ( & d , buffer + * position , 8 ) ;
 value = PyFloat_FromDouble ( d ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += 8 ;
 break ;
 }
 case 2 : case 14 : {
 int value_length = ( ( int * ) ( buffer + * position ) ) [ 0 ] - 1 ;
 if ( max < value_length ) {
 goto invalid ;
 }
 * position += 4 ;
 value = PyUnicode_DecodeUTF8 ( buffer + * position , value_length , "strict" ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += value_length + 1 ;
 break ;
 }
 case 3 : {
 int size ;
 memcpy ( & size , buffer + * position , 4 ) ;
 if ( max < size ) {
 goto invalid ;
 }
 value = elements_to_dict ( self , buffer + * position + 4 , size - 5 , as_class , tz_aware , uuid_subtype ) ;
 if ( ! value ) {
 return NULL ;
 }
 if ( strcmp ( buffer + * position + 5 , "$ref" ) == 0 ) {
 PyObject * dbref ;
 PyObject * collection = PyDict_GetItemString ( value , "$ref" ) ;
 PyObject * id = PyDict_GetItemString ( value , "$id" ) ;
 PyObject * database = PyDict_GetItemString ( value , "$db" ) ;
 Py_INCREF ( collection ) ;
 PyDict_DelItemString ( value , "$ref" ) ;
 if ( id == NULL ) {
 id = Py_None ;
 Py_INCREF ( id ) ;
 }
 else {
 Py_INCREF ( id ) ;
 PyDict_DelItemString ( value , "$id" ) ;
 }
 if ( database == NULL ) {
 database = Py_None ;
 Py_INCREF ( database ) ;
 }
 else {
 Py_INCREF ( database ) ;
 PyDict_DelItemString ( value , "$db" ) ;
 }
 dbref = PyObject_CallFunctionObjArgs ( state -> DBRef , collection , id , database , value , NULL ) ;
 Py_DECREF ( value ) ;
 value = dbref ;
 Py_DECREF ( id ) ;
 Py_DECREF ( collection ) ;
 Py_DECREF ( database ) ;
 if ( ! value ) {
 return NULL ;
 }
 }
 * position += size ;
 break ;
 }
 case 4 : {
 int size , end ;
 memcpy ( & size , buffer + * position , 4 ) ;
 if ( max < size ) {
 goto invalid ;
 }
 end = * position + size - 1 ;
 * position += 4 ;
 value = PyList_New ( 0 ) ;
 if ( ! value ) {
 return NULL ;
 }
 while ( * position < end ) {
 PyObject * to_append ;
 int type = ( int ) buffer [ ( * position ) ++ ] ;
 int key_size = strlen ( buffer + * position ) ;
 * position += key_size + 1 ;
 to_append = get_value ( self , buffer , position , type , max - key_size , as_class , tz_aware , uuid_subtype ) ;
 if ( ! to_append ) {
 Py_DECREF ( value ) ;
 return NULL ;
 }
 PyList_Append ( value , to_append ) ;
 Py_DECREF ( to_append ) ;
 }
 ( * position ) ++ ;
 break ;
 }
 case 5 : {
 PyObject * data ;
 PyObject * st ;
 int length , subtype ;
 memcpy ( & length , buffer + * position , 4 ) ;
 if ( max < length ) {
 goto invalid ;
 }
 subtype = ( unsigned char ) buffer [ * position + 4 ] ;
 # if PY_MAJOR_VERSION >= 3 if ( subtype == 0 ) {
 value = PyBytes_FromStringAndSize ( buffer + * position + 5 , length ) ;
 * position += length + 5 ;
 break ;
 }
 if ( subtype == 2 ) {
 data = PyBytes_FromStringAndSize ( buffer + * position + 9 , length - 4 ) ;
 }
 else {
 data = PyBytes_FromStringAndSize ( buffer + * position + 5 , length ) ;
 }
 # else if ( subtype == 2 ) {
 data = PyString_FromStringAndSize ( buffer + * position + 9 , length - 4 ) ;
 }
 else {
 data = PyString_FromStringAndSize ( buffer + * position + 5 , length ) ;
 }
 # endif if ( ! data ) {
 return NULL ;
 }
 if ( ( subtype == 3 || subtype == 4 ) && state -> UUID ) {
 PyObject * kwargs ;
 PyObject * args = PyTuple_New ( 0 ) ;
 if ( ! args ) {
 Py_DECREF ( data ) ;
 return NULL ;
 }
 kwargs = PyDict_New ( ) ;
 if ( ! kwargs ) {
 Py_DECREF ( data ) ;
 Py_DECREF ( args ) ;
 return NULL ;
 }
 assert ( length == 16 ) ;
 if ( uuid_subtype == CSHARP_LEGACY ) {
 PyDict_SetItemString ( kwargs , "bytes_le" , data ) ;
 }
 else {
 if ( uuid_subtype == JAVA_LEGACY ) {
 char big_endian [ 16 ] ;
 _fix_java ( buffer + * position + 5 , big_endian ) ;
 Py_DECREF ( data ) ;
 # if PY_MAJOR_VERSION >= 3 data = PyBytes_FromStringAndSize ( big_endian , length ) ;
 # else data = PyString_FromStringAndSize ( big_endian , length ) ;
 # endif }
 PyDict_SetItemString ( kwargs , "bytes" , data ) ;
 }
 value = PyObject_Call ( state -> UUID , args , kwargs ) ;
 Py_DECREF ( args ) ;
 Py_DECREF ( kwargs ) ;
 Py_DECREF ( data ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += length + 5 ;
 break ;
 }
 # if PY_MAJOR_VERSION >= 3 st = PyLong_FromLong ( subtype ) ;
 # else st = PyInt_FromLong ( subtype ) ;
 # endif if ( ! st ) {
 Py_DECREF ( data ) ;
 return NULL ;
 }
 value = PyObject_CallFunctionObjArgs ( state -> Binary , data , st , NULL ) ;
 Py_DECREF ( st ) ;
 Py_DECREF ( data ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += length + 5 ;
 break ;
 }
 case 6 : case 10 : {
 value = Py_None ;
 Py_INCREF ( value ) ;
 break ;
 }
 case 7 : {
 if ( max < 12 ) {
 goto invalid ;
 }
 # if PY_MAJOR_VERSION >= 3 value = PyObject_CallFunction ( state -> ObjectId , "y#" , buffer + * position , 12 ) ;
 # else value = PyObject_CallFunction ( state -> ObjectId , "s#" , buffer + * position , 12 ) ;
 # endif if ( ! value ) {
 return NULL ;
 }
 * position += 12 ;
 break ;
 }
 case 8 : {
 value = buffer [ ( * position ) ++ ] ? Py_True : Py_False ;
 Py_INCREF ( value ) ;
 break ;
 }
 case 9 : {
 PyObject * naive ;
 PyObject * replace ;
 PyObject * args ;
 PyObject * kwargs ;
 if ( max < 8 ) {
 goto invalid ;
 }
 naive = datetime_from_millis ( * ( long long * ) ( buffer + * position ) ) ;
 * position += 8 ;
 if ( ! tz_aware ) {
 value = naive ;
 break ;
 }
 if ( ! naive ) {
 return NULL ;
 }
 replace = PyObject_GetAttrString ( naive , "replace" ) ;
 Py_DECREF ( naive ) ;
 if ( ! replace ) {
 return NULL ;
 }
 args = PyTuple_New ( 0 ) ;
 if ( ! args ) {
 Py_DECREF ( replace ) ;
 return NULL ;
 }
 kwargs = PyDict_New ( ) ;
 if ( ! kwargs ) {
 Py_DECREF ( replace ) ;
 Py_DECREF ( args ) ;
 return NULL ;
 }
 if ( PyDict_SetItemString ( kwargs , "tzinfo" , state -> UTC ) == - 1 ) {
 Py_DECREF ( replace ) ;
 Py_DECREF ( args ) ;
 Py_DECREF ( kwargs ) ;
 return NULL ;
 }
 value = PyObject_Call ( replace , args , kwargs ) ;
 Py_DECREF ( replace ) ;
 Py_DECREF ( args ) ;
 Py_DECREF ( kwargs ) ;
 break ;
 }
 case 11 : {
 PyObject * pattern ;
 int flags_length , flags , i ;
 int pattern_length = strlen ( buffer + * position ) ;
 if ( max < pattern_length ) {
 goto invalid ;
 }
 pattern = PyUnicode_DecodeUTF8 ( buffer + * position , pattern_length , "strict" ) ;
 if ( ! pattern ) {
 return NULL ;
 }
 * position += pattern_length + 1 ;
 flags_length = strlen ( buffer + * position ) ;
 if ( max < pattern_length + flags_length ) {
 Py_DECREF ( pattern ) ;
 goto invalid ;
 }
 flags = 0 ;
 for ( i = 0 ;
 i < flags_length ;
 i ++ ) {
 if ( buffer [ * position + i ] == 'i' ) {
 flags |= 2 ;
 }
 else if ( buffer [ * position + i ] == 'l' ) {
 flags |= 4 ;
 }
 else if ( buffer [ * position + i ] == 'm' ) {
 flags |= 8 ;
 }
 else if ( buffer [ * position + i ] == 's' ) {
 flags |= 16 ;
 }
 else if ( buffer [ * position + i ] == 'u' ) {
 flags |= 32 ;
 }
 else if ( buffer [ * position + i ] == 'x' ) {
 flags |= 64 ;
 }
 }
 * position += flags_length + 1 ;
 value = PyObject_CallFunction ( state -> RECompile , "Oi" , pattern , flags ) ;
 Py_DECREF ( pattern ) ;
 break ;
 }
 case 12 : {
 int collection_length ;
 PyObject * collection ;
 PyObject * id ;
 * position += 4 ;
 collection_length = strlen ( buffer + * position ) ;
 if ( max < collection_length ) {
 goto invalid ;
 }
 collection = PyUnicode_DecodeUTF8 ( buffer + * position , collection_length , "strict" ) ;
 if ( ! collection ) {
 return NULL ;
 }
 * position += collection_length + 1 ;
 if ( max < collection_length + 12 ) {
 Py_DECREF ( collection ) ;
 goto invalid ;
 }
 id = PyObject_CallFunction ( state -> ObjectId , "s#" , buffer + * position , 12 ) ;
 if ( ! id ) {
 Py_DECREF ( collection ) ;
 return NULL ;
 }
 * position += 12 ;
 value = PyObject_CallFunctionObjArgs ( state -> DBRef , collection , id , NULL ) ;
 Py_DECREF ( collection ) ;
 Py_DECREF ( id ) ;
 break ;
 }
 case 13 : {
 PyObject * code ;
 int value_length = ( ( int * ) ( buffer + * position ) ) [ 0 ] - 1 ;
 if ( max < value_length ) {
 goto invalid ;
 }
 * position += 4 ;
 code = PyUnicode_DecodeUTF8 ( buffer + * position , value_length , "strict" ) ;
 if ( ! code ) {
 return NULL ;
 }
 * position += value_length + 1 ;
 value = PyObject_CallFunctionObjArgs ( state -> Code , code , NULL , NULL ) ;
 Py_DECREF ( code ) ;
 break ;
 }
 case 15 : {
 int code_length , scope_size ;
 PyObject * code ;
 PyObject * scope ;
 * position += 8 ;
 code_length = strlen ( buffer + * position ) ;
 if ( max < 8 + code_length ) {
 goto invalid ;
 }
 code = PyUnicode_DecodeUTF8 ( buffer + * position , code_length , "strict" ) ;
 if ( ! code ) {
 return NULL ;
 }
 * position += code_length + 1 ;
 memcpy ( & scope_size , buffer + * position , 4 ) ;
 scope = elements_to_dict ( self , buffer + * position + 4 , scope_size - 5 , ( PyObject * ) & PyDict_Type , tz_aware , uuid_subtype ) ;
 if ( ! scope ) {
 Py_DECREF ( code ) ;
 return NULL ;
 }
 * position += scope_size ;
 value = PyObject_CallFunctionObjArgs ( state -> Code , code , scope , NULL ) ;
 Py_DECREF ( code ) ;
 Py_DECREF ( scope ) ;
 break ;
 }
 case 16 : {
 int i ;
 if ( max < 4 ) {
 goto invalid ;
 }
 memcpy ( & i , buffer + * position , 4 ) ;
 # if PY_MAJOR_VERSION >= 3 value = PyLong_FromLong ( i ) ;
 # else value = PyInt_FromLong ( i ) ;
 # endif if ( ! value ) {
 return NULL ;
 }
 * position += 4 ;
 break ;
 }
 case 17 : {
 unsigned int time , inc ;
 if ( max < 8 ) {
 goto invalid ;
 }
 memcpy ( & inc , buffer + * position , 4 ) ;
 memcpy ( & time , buffer + * position + 4 , 4 ) ;
 value = PyObject_CallFunction ( state -> Timestamp , "II" , time , inc ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += 8 ;
 break ;
 }
 case 18 : {
 long long ll ;
 if ( max < 8 ) {
 goto invalid ;
 }
 memcpy ( & ll , buffer + * position , 8 ) ;
 value = PyLong_FromLongLong ( ll ) ;
 if ( ! value ) {
 return NULL ;
 }
 * position += 8 ;
 break ;
 }
 case - 1 : {
 value = PyObject_CallFunctionObjArgs ( state -> MinKey , NULL ) ;
 break ;
 }
 case 127 : {
 value = PyObject_CallFunctionObjArgs ( state -> MaxKey , NULL ) ;
 break ;
 }
 default : {
 PyObject * InvalidDocument = _error ( "InvalidDocument" ) ;
 PyErr_SetString ( InvalidDocument , "no c decoder for this type yet" ) ;
 Py_DECREF ( InvalidDocument ) ;
 return NULL ;
 }
 }
 return value ;
 invalid : error = _error ( "InvalidBSON" ) ;
 PyErr_SetNone ( error ) ;
 Py_DECREF ( error ) ;
 return NULL ;
 }


OAuthProviderInfo OAuthProviderInfo::GetDefault() {
  OAuthProviderInfo result;
  result.access_token_url = kDefaultOAuth2TokenUrl;
  result.user_info_url = kDefaultOAuth2UserInfoUrl;
  return result;
 }


call_func_retnr(
    char_u      *func,
    int		argc,
    typval_T	*argv)
{
    typval_T	rettv;
    varnumber_T	retval;

    if (call_vim_function(func, argc, argv, &rettv) == FAIL)
	return -1;

    retval = tv_get_number_chk(&rettv, NULL);
    clear_tv(&rettv);
    return retval;
}


static inline bool tcp_packet_delayed(const struct tcp_sock *tp)
{
	return !tp->retrans_stamp ||
	       tcp_tsopt_ecr_before(tp, tp->retrans_stamp);
}


pvscsi_cleanup_msi(PVSCSIState *s)

{

    PCIDevice *d = PCI_DEVICE(s);

    if (s->msi_used) {

        msi_uninit(d);

    }

}


void ext4_free_group_clusters_set(struct super_block *sb,
				  struct ext4_group_desc *bg, __u32 count)
{
	bg->bg_free_blocks_count_lo = cpu_to_le16((__u16)count);
	if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
		bg->bg_free_blocks_count_hi = cpu_to_le16(count >> 16);
}


static ssize_t ims_pcu_attribute_show(struct device *dev,
				      struct device_attribute *dattr,
				      char *buf)
{
	struct usb_interface *intf = to_usb_interface(dev);
	struct ims_pcu *pcu = usb_get_intfdata(intf);
	struct ims_pcu_attribute *attr =
			container_of(dattr, struct ims_pcu_attribute, dattr);
	char *field = (char *)pcu + attr->field_offset;

	return scnprintf(buf, PAGE_SIZE, "%.*s\n", attr->field_length, field);


nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
{
	return xdr_argsize_check(rqstp, p);
}


static ZIPARCHIVE_METHOD(setArchiveComment)
{
	struct zip *intern;
	zval *this = getThis();
	int comment_len;
	char * comment;

	if (!this) {
		RETURN_FALSE;
	}

	ZIP_FROM_OBJECT(intern, this);

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) {
		return;
	}
	if (zip_set_archive_comment(intern, (const char *)comment, (int)comment_len)) {
		RETURN_FALSE;
	} else {
		RETURN_TRUE;
	}
}


void vsock_remove_bound(struct vsock_sock *vsk)
{
	spin_lock_bh(&vsock_table_lock);
	__vsock_remove_bound(vsk);
	spin_unlock_bh(&vsock_table_lock);
}


void _cmsAllocTagPluginChunk ( struct _cmsContext_struct * ctx , const struct _cmsContext_struct * src ) {
 if ( src != NULL ) {
 DupTagList ( ctx , src ) ;
 }
 else {
 static _cmsTagPluginChunkType TagPluginChunk = {
 NULL }
 ;
 ctx -> chunks [ TagPlugin ] = _cmsSubAllocDup ( ctx -> MemPool , & TagPluginChunk , sizeof ( _cmsTagPluginChunkType ) ) ;
 }
 }


bool CModules::OnUserNotice(CString& sTarget, CString& sMessage) {
    MODHALTCHK(OnUserNotice(sTarget, sMessage));
}


xfs_inode_set_eofblocks_tag(
	xfs_inode_t	*ip)
{
	trace_xfs_inode_set_eofblocks_tag(ip);
	return __xfs_inode_set_blocks_tag(ip, xfs_queue_eofblocks,
			trace_xfs_perag_set_eofblocks,
			XFS_ICI_EOFBLOCKS_TAG);
}


static void free_saved_parents(struct rev_info *revs)
{
	if (revs->saved_parents_slab)
		clear_saved_parents(revs->saved_parents_slab);
}


void BookmarkManagerView::SelectInTree(BookmarkNode* node) {
  if (!node)
    return;

  BookmarkNode* parent = node->is_url() ? node->GetParent() : node;
  FolderNode* folder_node = tree_model_->GetFolderNodeForBookmarkNode(parent);
  if (!folder_node) {
    NOTREACHED();
    return;
  }

  tree_view_->SetSelectedNode(folder_node);

  if (node->is_url()) {
    int index = table_model_->IndexOfNode(node);
    if (index != -1)
      table_view_->Select(index);
    table_view_->RequestFocus();
  }
}


void RenderWidgetHostImpl::StartHangMonitorTimeout(base::TimeDelta delay) {
  if (hang_monitor_timeout_)
    hang_monitor_timeout_->Start(delay);
}


static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
					 struct sock_iocb *siocb)
{
	if (!is_sync_kiocb(iocb))
		BUG();

	siocb->kiocb = iocb;
	iocb->private = siocb;
	return siocb;
}


lspci_send(const char *output)
{
	STREAM s;
	size_t len;

	len = strlen(output);
	s = channel_init(lspci_channel, len);
	out_uint8p(s, output, len) s_mark_end(s);
	channel_send(s, lspci_channel);
}


  static ghobject_t make_pg_biginfo_oid(spg_t pg) {
    stringstream ss;
    ss << "pginfo_" << pg;
    string s;
    getline(ss, s);
    return ghobject_t(hobject_t(sobject_t(object_t(s.c_str()), 0)));
  }


  ShapeHandle GetMergedShape(InferenceContext* ic, ShapeHandle s) {
    const auto& actual_shape = shapes_.GetMergedValue(s);
    if (!InferenceContext::RankKnown(actual_shape)) {
      return ic->UnknownShape();
    } else {
      std::vector<DimensionHandle> dims;
      for (int j = 0; j < InferenceContext::Rank(actual_shape); ++j) {
        shape_inference::DimensionHandle dim =
            InferenceContext::DimKnownRank(actual_shape, j);
        int64_t d = dims_.GetMergedValue(dim);
        // Symbolic shape manager may made some dims < -1, which causes errors
        // in creating Dimension.
        if (d < -1) {
          d = -1;
        }
        dims.push_back(ic->MakeDim(d));
      }
      return ic->MakeShape(dims);
    }
  }


struct vfsmount *collect_mounts(struct path *path)
{
	struct mount *tree;
	namespace_lock();
	if (!check_mnt(real_mount(path->mnt)))
		tree = ERR_PTR(-EINVAL);
	else
		tree = copy_tree(real_mount(path->mnt), path->dentry,
				 CL_COPY_ALL | CL_PRIVATE);
	namespace_unlock();
	if (IS_ERR(tree))
		return ERR_CAST(tree);
	return &tree->mnt;
}


	__releases(seq->private->l->lock)
{
	struct bt_seq_state *s = seq->private;
	struct bt_sock_list *l = s->l;

	read_unlock(&l->lock);
}


void dtls1_set_message_header ( SSL * s , unsigned char mt , unsigned long len , unsigned long frag_off , unsigned long frag_len ) {
 if ( frag_off == 0 ) {
 s -> d1 -> handshake_write_seq = s -> d1 -> next_handshake_write_seq ;
 s -> d1 -> next_handshake_write_seq ++ ;
 }
 dtls1_set_message_header_int ( s , mt , len , s -> d1 -> handshake_write_seq , frag_off , frag_len ) ;
 }


static inline Quantum GetPixelReadMask(const Image *magick_restrict image,
  const Quantum *magick_restrict pixel)
{
  if (image->channel_map[ReadMaskPixelChannel].traits == UndefinedPixelTrait)
    return((Quantum) QuantumRange);
  return(pixel[image->channel_map[ReadMaskPixelChannel].offset]);
}


void NotifyProcessKilled(const ChildProcessData& data, int exit_code) {
  for (auto& observer : g_browser_child_process_observers.Get())
    observer.BrowserChildProcessKilled(data, exit_code);
}


static pj_status_t and_media_codec_parse(pjmedia_codec *codec,
					 void *pkt,
					 pj_size_t pkt_size,
					 const pj_timestamp *ts,
					 unsigned *frame_cnt,
					 pjmedia_frame frames[])
{
    and_media_private_t *codec_data = (and_media_private_t*) codec->codec_data;
    struct and_media_codec *and_media_data =
					&and_media_codec[codec_data->codec_idx];
    unsigned count = 0;

    PJ_ASSERT_RETURN(frame_cnt, PJ_EINVAL);

    if (and_media_data->parse != NULL) {
	return and_media_data->parse(codec_data, pkt,  pkt_size, ts, frame_cnt,
				     frames);
    }

    while (pkt_size >= codec_data->frame_size && count < *frame_cnt) {
	frames[count].type = PJMEDIA_FRAME_TYPE_AUDIO;
	frames[count].buf = pkt;
	frames[count].size = codec_data->frame_size;
	frames[count].timestamp.u64 = ts->u64 +
				      count*and_media_data->samples_per_frame;
	pkt = ((char*)pkt) + codec_data->frame_size;
	pkt_size -= codec_data->frame_size;
	++count;
    }

    if (pkt_size && count < *frame_cnt) {
	frames[count].type = PJMEDIA_FRAME_TYPE_AUDIO;
	frames[count].buf = pkt;
	frames[count].size = pkt_size;
	frames[count].timestamp.u64 = ts->u64 +
				      count*and_media_data->samples_per_frame;
	++count;
    }

    *frame_cnt = count;
    return PJ_SUCCESS;
}


otp_edata(krb5_context context, krb5_kdc_req *request,
          krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock,
          krb5_kdcpreauth_moddata moddata, krb5_preauthtype pa_type,
          krb5_kdcpreauth_edata_respond_fn respond, void *arg)
{
    krb5_otp_tokeninfo ti, *tis[2] = { &ti, NULL };
    krb5_keyblock *armor_key = NULL;
    krb5_pa_otp_challenge chl;
    krb5_pa_data *pa = NULL;
    krb5_error_code retval;
    krb5_data *encoding;
    char *config;

    /* Determine if otp is enabled for the user. */
    retval = cb->get_string(context, rock, "otp", &config);
    if (retval == 0 && config == NULL)
        retval = ENOENT;
    if (retval != 0)
        goto out;
    cb->free_string(context, rock, config);

    /* Get the armor key.  This indicates the length of random data to use in
     * the nonce. */
    armor_key = cb->fast_armor(context, rock);
    if (armor_key == NULL) {
        retval = ENOENT;
        goto out;
    }

    /* Build the (mostly empty) challenge. */
    memset(&ti, 0, sizeof(ti));
    memset(&chl, 0, sizeof(chl));
    chl.tokeninfo = tis;
    ti.format = -1;
    ti.length = -1;
    ti.iteration_count = -1;

    /* Generate the nonce. */
    retval = nonce_generate(context, armor_key->length, &chl.nonce);
    if (retval != 0)
        goto out;

    /* Build the output pa-data. */
    retval = encode_krb5_pa_otp_challenge(&chl, &encoding);
    if (retval != 0)
        goto out;
    pa = k5alloc(sizeof(krb5_pa_data), &retval);
    if (pa == NULL) {
        krb5_free_data(context, encoding);
        goto out;
    }
    pa->pa_type = KRB5_PADATA_OTP_CHALLENGE;
    pa->contents = (krb5_octet *)encoding->data;
    pa->length = encoding->length;
    free(encoding);

out:
    (*respond)(arg, retval, pa);
}


Config::SimpleRouteImpl::SimpleRouteImpl(const Config& parent, absl::string_view cluster_name)
    : parent_(parent), cluster_name_(cluster_name) {}


f_winbufnr(typval_T *argvars, typval_T *rettv)
{
    win_T	*wp;

    wp = find_win_by_nr_or_id(&argvars[0]);
    if (wp == NULL)
	rettv->vval.v_number = -1;
    else
	rettv->vval.v_number = wp->w_buffer->b_fnum;
}


void gf_sys_close()
{
	if (sys_init > 0) {
		sys_init --;
		if (sys_init) return;
		/*prevent any call*/
		last_update_time = 0xFFFFFFFF;

#if defined(WIN32) && !defined(_WIN32_WCE)
		timeEndPeriod(1);

		MyGetSystemTimes = NULL;
		MyGetProcessMemoryInfo = NULL;
		MyQuerySystemInfo = NULL;
		if (psapi_hinst) FreeLibrary(psapi_hinst);
		psapi_hinst = NULL;
#endif
	}
}


static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)

{

    AVStream *st = c->fc->streams[c->fc->nb_streams-1];

    MOVStreamContext *sc = st->priv_data;

    int j, entries, pseudo_stream_id;

    get_byte(pb); /* version */

    get_be24(pb); /* flags */

    entries = get_be32(pb);

    for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {

        //Parsing Sample description table

        enum CodecID id;

        int dref_id;

        MOV_atom_t a = { 0, 0, 0 };

        offset_t start_pos = url_ftell(pb);

        int size = get_be32(pb); /* size */

        uint32_t format = get_le32(pb); /* data format */

        get_be32(pb); /* reserved */

        get_be16(pb); /* reserved */

        dref_id = get_be16(pb);

        if (st->codec->codec_tag &&

            st->codec->codec_tag != format &&

            (c->fc->video_codec_id ? codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id

                                   : st->codec->codec_tag != MKTAG('j','p','e','g'))

           ){

            /* Multiple fourcc, we skip JPEG. This is not correct, we should

             * export it as a separate AVStream but this needs a few changes

             * in the MOV demuxer, patch welcome. */

            av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");

            url_fskip(pb, size - (url_ftell(pb) - start_pos));

            continue;

        }

        sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id;

        sc->dref_id= dref_id;

        st->codec->codec_tag = format;

        id = codec_get_id(codec_movaudio_tags, format);

        if (id<=0 && (format&0xFFFF) == 'm'+('s'<<8))

            id = codec_get_id(codec_wav_tags, bswap_32(format)&0xFFFF);

        if (st->codec->codec_type != CODEC_TYPE_VIDEO && id > 0) {

            st->codec->codec_type = CODEC_TYPE_AUDIO;

        } else if (st->codec->codec_type != CODEC_TYPE_AUDIO && /* do not overwrite codec type */

                   format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */

            id = codec_get_id(codec_movvideo_tags, format);

            if (id <= 0)

                id = codec_get_id(codec_bmp_tags, format);

            if (id > 0)

                st->codec->codec_type = CODEC_TYPE_VIDEO;

            else if(st->codec->codec_type == CODEC_TYPE_DATA){

                id = codec_get_id(ff_codec_movsubtitle_tags, format);

                if(id > 0)

                    st->codec->codec_type = CODEC_TYPE_SUBTITLE;

            }

        }

        dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,

                (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,

                (format >> 24) & 0xff, st->codec->codec_type);

        if(st->codec->codec_type==CODEC_TYPE_VIDEO) {

            uint8_t codec_name[32];

            unsigned int color_depth;

            int color_greyscale;

            st->codec->codec_id = id;

            get_be16(pb); /* version */

            get_be16(pb); /* revision level */

            get_be32(pb); /* vendor */

            get_be32(pb); /* temporal quality */

            get_be32(pb); /* spatial quality */

            st->codec->width = get_be16(pb); /* width */

            st->codec->height = get_be16(pb); /* height */

            get_be32(pb); /* horiz resolution */

            get_be32(pb); /* vert resolution */

            get_be32(pb); /* data size, always 0 */

            get_be16(pb); /* frames per samples */

            get_buffer(pb, codec_name, 32); /* codec name, pascal string */

            if (codec_name[0] <= 31) {

                memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]);

                st->codec->codec_name[codec_name[0]] = 0;

            }

            st->codec->bits_per_coded_sample = get_be16(pb); /* depth */

            st->codec->color_table_id = get_be16(pb); /* colortable id */

            dprintf(c->fc, "depth %d, ctab id %d\n",

                   st->codec->bits_per_coded_sample, st->codec->color_table_id);

            /* figure out the palette situation */

            color_depth = st->codec->bits_per_coded_sample & 0x1F;

            color_greyscale = st->codec->bits_per_coded_sample & 0x20;

            /* if the depth is 2, 4, or 8 bpp, file is palettized */

            if ((color_depth == 2) || (color_depth == 4) ||

                (color_depth == 8)) {

                /* for palette traversal */

                unsigned int color_start, color_count, color_end;

                unsigned char r, g, b;

                if (color_greyscale) {

                    int color_index, color_dec;

                    /* compute the greyscale palette */

                    st->codec->bits_per_coded_sample = color_depth;

                    color_count = 1 << color_depth;

                    color_index = 255;

                    color_dec = 256 / (color_count - 1);

                    for (j = 0; j < color_count; j++) {

                        r = g = b = color_index;

                        c->palette_control.palette[j] =

                            (r << 16) | (g << 8) | (b);

                        color_index -= color_dec;

                        if (color_index < 0)

                            color_index = 0;

                    }

                } else if (st->codec->color_table_id) {

                    const uint8_t *color_table;

                    /* if flag bit 3 is set, use the default palette */

                    color_count = 1 << color_depth;

                    if (color_depth == 2)

                        color_table = ff_qt_default_palette_4;

                    else if (color_depth == 4)

                        color_table = ff_qt_default_palette_16;

                    else

                        color_table = ff_qt_default_palette_256;

                    for (j = 0; j < color_count; j++) {

                        r = color_table[j * 4 + 0];

                        g = color_table[j * 4 + 1];

                        b = color_table[j * 4 + 2];

                        c->palette_control.palette[j] =

                            (r << 16) | (g << 8) | (b);

                    }

                } else {

                    /* load the palette from the file */

                    color_start = get_be32(pb);

                    color_count = get_be16(pb);

                    color_end = get_be16(pb);

                    if ((color_start <= 255) &&

                        (color_end <= 255)) {

                        for (j = color_start; j <= color_end; j++) {

                            /* each R, G, or B component is 16 bits;

                             * only use the top 8 bits; skip alpha bytes

                             * up front */

                            get_byte(pb);

                            get_byte(pb);

                            r = get_byte(pb);

                            get_byte(pb);

                            g = get_byte(pb);

                            get_byte(pb);

                            b = get_byte(pb);

                            get_byte(pb);

                            c->palette_control.palette[j] =

                                (r << 16) | (g << 8) | (b);

                        }

                    }

                }

                st->codec->palctrl = &c->palette_control;

                st->codec->palctrl->palette_changed = 1;

            } else

                st->codec->palctrl = NULL;

        } else if(st->codec->codec_type==CODEC_TYPE_AUDIO) {

            int bits_per_sample, flags;

            uint16_t version = get_be16(pb);

            st->codec->codec_id = id;

            get_be16(pb); /* revision level */

            get_be32(pb); /* vendor */

            st->codec->channels = get_be16(pb);             /* channel count */

            dprintf(c->fc, "audio channels %d\n", st->codec->channels);

            st->codec->bits_per_coded_sample = get_be16(pb);      /* sample size */

            sc->audio_cid = get_be16(pb);

            get_be16(pb); /* packet size = 0 */

            st->codec->sample_rate = ((get_be32(pb) >> 16));

            //Read QT version 1 fields. In version 0 these do not exist.

            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);

            if(!c->isom) {

                if(version==1) {

                    sc->samples_per_frame = get_be32(pb);

                    get_be32(pb); /* bytes per packet */

                    sc->bytes_per_frame = get_be32(pb);

                    get_be32(pb); /* bytes per sample */

                } else if(version==2) {

                    get_be32(pb); /* sizeof struct only */

                    st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */

                    st->codec->channels = get_be32(pb);

                    get_be32(pb); /* always 0x7F000000 */

                    st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */

                    flags = get_be32(pb); /* lcpm format specific flag */

                    sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */

                    sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */

                    if (format == MKTAG('l','p','c','m'))

                        st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);

                }

            }

            switch (st->codec->codec_id) {

            case CODEC_ID_PCM_S8:

            case CODEC_ID_PCM_U8:

                if (st->codec->bits_per_coded_sample == 16)

                    st->codec->codec_id = CODEC_ID_PCM_S16BE;

                break;

            case CODEC_ID_PCM_S16LE:

            case CODEC_ID_PCM_S16BE:

                if (st->codec->bits_per_coded_sample == 8)

                    st->codec->codec_id = CODEC_ID_PCM_S8;

                else if (st->codec->bits_per_coded_sample == 24)

                    st->codec->codec_id =

                        st->codec->codec_id == CODEC_ID_PCM_S16BE ?

                        CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;

                break;

            /* set values for old format before stsd version 1 appeared */

            case CODEC_ID_MACE3:

                sc->samples_per_frame = 6;

                sc->bytes_per_frame = 2*st->codec->channels;

                break;

            case CODEC_ID_MACE6:

                sc->samples_per_frame = 6;

                sc->bytes_per_frame = 1*st->codec->channels;

                break;

            case CODEC_ID_ADPCM_IMA_QT:

                sc->samples_per_frame = 64;

                sc->bytes_per_frame = 34*st->codec->channels;

                break;

            case CODEC_ID_GSM:

                sc->samples_per_frame = 160;

                sc->bytes_per_frame = 33;

                break;

            default:

                break;

            }

            bits_per_sample = av_get_bits_per_sample(st->codec->codec_id);

            if (bits_per_sample) {

                st->codec->bits_per_coded_sample = bits_per_sample;

                sc->sample_size = (bits_per_sample >> 3) * st->codec->channels;

            }

        } else if(st->codec->codec_type==CODEC_TYPE_SUBTITLE){

            st->codec->codec_id= id;

        } else {

            /* other codec type, just skip (rtp, mp4s, tmcd ...) */

            url_fskip(pb, size - (url_ftell(pb) - start_pos));

        }

        /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */

        a.size = size - (url_ftell(pb) - start_pos);

        if (a.size > 8) {

            if (mov_read_default(c, pb, a) < 0)

                return -1;

        } else if (a.size > 0)

            url_fskip(pb, a.size);

    }

    if(st->codec->codec_type==CODEC_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)

        st->codec->sample_rate= sc->time_scale;

    /* special codec parameters handling */

    switch (st->codec->codec_id) {

#ifdef CONFIG_DV_DEMUXER

    case CODEC_ID_DVAUDIO:

        c->dv_fctx = av_alloc_format_context();

        c->dv_demux = dv_init_demux(c->dv_fctx);

        if (!c->dv_demux) {

            av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");

            return -1;

        }

        sc->dv_audio_container = 1;

        st->codec->codec_id = CODEC_ID_PCM_S16LE;

        break;

#endif

    /* no ifdef since parameters are always those */

    case CODEC_ID_AMR_WB:

        st->codec->sample_rate= 16000;

        st->codec->channels= 1; /* really needed */

        break;

    case CODEC_ID_QCELP:

    case CODEC_ID_AMR_NB:

        st->codec->frame_size= sc->samples_per_frame;

        st->codec->sample_rate= 8000;

        st->codec->channels= 1; /* really needed */

        break;

    case CODEC_ID_MP2:

    case CODEC_ID_MP3:

        st->codec->codec_type = CODEC_TYPE_AUDIO; /* force type after stsd for m1a hdlr */

        st->need_parsing = AVSTREAM_PARSE_FULL;

        break;

    case CODEC_ID_GSM:

    case CODEC_ID_ADPCM_MS:

    case CODEC_ID_ADPCM_IMA_WAV:

        st->codec->block_align = sc->bytes_per_frame;

        break;

    case CODEC_ID_ALAC:

        if (st->codec->extradata_size == 36)

            st->codec->frame_size = AV_RB32((st->codec->extradata+12));

        break;

    default:

        break;

    }

    return 0;

}


static void print_long_term ( H264Context * h ) {
 uint32_t i ;
 if ( h -> avctx -> debug & FF_DEBUG_MMCO ) {
 av_log ( h -> avctx , AV_LOG_DEBUG , "long term list:\n" ) ;
 for ( i = 0 ;
 i < 16 ;
 i ++ ) {
 Picture * pic = h -> long_ref [ i ] ;
 if ( pic ) {
 av_log ( h -> avctx , AV_LOG_DEBUG , "%d fn:%d poc:%d %p\n" , i , pic -> frame_num , pic -> poc , pic -> f . data [ 0 ] ) ;
 }
 }
 }
 }