target
int64
0
1
func
stringlengths
7
484k
func_no_comments
stringlengths
7
484k
idx
int64
1
368k
0
static uint64_t pxa2xx_i2s_read(void *opaque, hwaddr addr, unsigned size) { PXA2xxI2SState *s = (PXA2xxI2SState *) opaque; switch (addr) { case SACR0: return s->control[0]; case SACR1: return s->control[1]; case SASR0: return s->status; case SAIMR: return s->mask; case SAICR: return 0; case SADIV: return s->clk; case SADR: if (s->rx_len > 0) { s->rx_len --; pxa2xx_i2s_update(s); return s->codec_in(s->opaque); } return 0; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
static uint64_t pxa2xx_i2s_read(void *opaque, hwaddr addr, unsigned size) { PXA2xxI2SState *s = (PXA2xxI2SState *) opaque; switch (addr) { case SACR0: return s->control[0]; case SACR1: return s->control[1]; case SASR0: return s->status; case SAIMR: return s->mask; case SAICR: return 0; case SADIV: return s->clk; case SADR: if (s->rx_len > 0) { s->rx_len --; pxa2xx_i2s_update(s); return s->codec_in(s->opaque); } return 0; default: printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr); break; } return 0; }
1,667
1
static bool get_variable_range ( PlannerInfo * root , VariableStatData * vardata , Oid sortop , Datum * min , Datum * max ) { Datum tmin = 0 ; Datum tmax = 0 ; bool have_data = false ; int16 typLen ; bool typByVal ; Datum * values ; int nvalues ; int i ; # ifdef NOT_USED if ( get_actual_variable_range ( root , vardata , sortop , min , max ) ) return true ; # endif if ( ! HeapTupleIsValid ( vardata -> statsTuple ) ) { return false ; } get_typlenbyval ( vardata -> atttype , & typLen , & typByVal ) ; if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , sortop , NULL , & values , & nvalues , NULL , NULL ) ) { if ( nvalues > 0 ) { tmin = datumCopy ( values [ 0 ] , typByVal , typLen ) ; tmax = datumCopy ( values [ nvalues - 1 ] , typByVal , typLen ) ; have_data = true ; } free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; } else if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) { free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; return false ; } if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) { bool tmin_is_mcv = false ; bool tmax_is_mcv = false ; FmgrInfo opproc ; fmgr_info ( get_opcode ( sortop ) , & opproc ) ; for ( i = 0 ; i < nvalues ; i ++ ) { if ( ! have_data ) { tmin = tmax = values [ i ] ; tmin_is_mcv = tmax_is_mcv = have_data = true ; continue ; } if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , values [ i ] , tmin ) ) ) { tmin = values [ i ] ; tmin_is_mcv = true ; } if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , tmax , values [ i ] ) ) ) { tmax = values [ i ] ; tmax_is_mcv = true ; } } if ( tmin_is_mcv ) tmin = datumCopy ( tmin , typByVal , typLen ) ; if ( tmax_is_mcv ) tmax = datumCopy ( tmax , typByVal , typLen ) ; free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; } * min = tmin ; * max = tmax ; return have_data ; }
static bool get_variable_range ( PlannerInfo * root , VariableStatData * vardata , Oid sortop , Datum * min , Datum * max ) { Datum tmin = 0 ; Datum tmax = 0 ; bool have_data = false ; int16 typLen ; bool typByVal ; Datum * values ; int nvalues ; int i ; # ifdef NOT_USED if ( get_actual_variable_range ( root , vardata , sortop , min , max ) ) return true ; # endif if ( ! HeapTupleIsValid ( vardata -> statsTuple ) ) { return false ; } get_typlenbyval ( vardata -> atttype , & typLen , & typByVal ) ; if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , sortop , NULL , & values , & nvalues , NULL , NULL ) ) { if ( nvalues > 0 ) { tmin = datumCopy ( values [ 0 ] , typByVal , typLen ) ; tmax = datumCopy ( values [ nvalues - 1 ] , typByVal , typLen ) ; have_data = true ; } free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; } else if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) { free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; return false ; } if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) { bool tmin_is_mcv = false ; bool tmax_is_mcv = false ; FmgrInfo opproc ; fmgr_info ( get_opcode ( sortop ) , & opproc ) ; for ( i = 0 ; i < nvalues ; i ++ ) { if ( ! have_data ) { tmin = tmax = values [ i ] ; tmin_is_mcv = tmax_is_mcv = have_data = true ; continue ; } if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , values [ i ] , tmin ) ) ) { tmin = values [ i ] ; tmin_is_mcv = true ; } if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , tmax , values [ i ] ) ) ) { tmax = values [ i ] ; tmax_is_mcv = true ; } } if ( tmin_is_mcv ) tmin = datumCopy ( tmin , typByVal , typLen ) ; if ( tmax_is_mcv ) tmax = datumCopy ( tmax , typByVal , typLen ) ; free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ; } * min = tmin ; * max = tmax ; return have_data ; }
1,668
0
char *desc_get_buf(DescInfo *info, bool read_only) { PCIDevice *dev = PCI_DEVICE(info->ring->r); size_t size = read_only ? le16_to_cpu(info->desc.tlv_size) : le16_to_cpu(info->desc.buf_size); if (size > info->buf_size) { info->buf = g_realloc(info->buf, size); info->buf_size = size; } if (!info->buf) { return NULL; } if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) { return NULL; } return info->buf; }
char *desc_get_buf(DescInfo *info, bool read_only) { PCIDevice *dev = PCI_DEVICE(info->ring->r); size_t size = read_only ? le16_to_cpu(info->desc.tlv_size) : le16_to_cpu(info->desc.buf_size); if (size > info->buf_size) { info->buf = g_realloc(info->buf, size); info->buf_size = size; } if (!info->buf) { return NULL; } if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) { return NULL; } return info->buf; }
1,670
0
Variant HHVM_FUNCTION(mcrypt_create_iv, int size, int source /* = 0 */) { if (size <= 0 || size >= INT_MAX) { raise_warning("Can not create an IV with a size of less than 1 or " "greater than %d", INT_MAX); return false; } int n = 0; char *iv = (char*)calloc(size + 1, 1); if (source == RANDOM || source == URANDOM) { int fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY); if (fd < 0) { free(iv); raise_warning("Cannot open source device"); return false; } int read_bytes; for (read_bytes = 0; read_bytes < size && n >= 0; read_bytes += n) { n = read(fd, iv + read_bytes, size - read_bytes); } n = read_bytes; close(fd); if (n < size) { free(iv); raise_warning("Could not gather sufficient random data"); return false; } } else { n = size; while (size) { // Use userspace rand() function because it handles auto-seeding iv[--size] = (char)f_rand(0, 255); } } return String(iv, n, AttachString); }
Variant HHVM_FUNCTION(mcrypt_create_iv, int size, int source ) { if (size <= 0 || size >= INT_MAX) { raise_warning("Can not create an IV with a size of less than 1 or " "greater than %d", INT_MAX); return false; } int n = 0; char *iv = (char*)calloc(size + 1, 1); if (source == RANDOM || source == URANDOM) { int fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY); if (fd < 0) { free(iv); raise_warning("Cannot open source device"); return false; } int read_bytes; for (read_bytes = 0; read_bytes < size && n >= 0; read_bytes += n) { n = read(fd, iv + read_bytes, size - read_bytes); } n = read_bytes; close(fd); if (n < size) { free(iv); raise_warning("Could not gather sufficient random data"); return false; } } else { n = size; while (size) { iv[--size] = (char)f_rand(0, 255); } } return String(iv, n, AttachString); }
1,671
0
struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet_request_sock *ireq; struct inet_sock *newinet; struct sock *newsk; if (sk_acceptq_is_full(sk)) goto exit_overflow; if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL) goto exit; newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto exit_nonewsk; sk_setup_caps(newsk, dst); newinet = inet_sk(newsk); ireq = inet_rsk(req); newinet->inet_daddr = ireq->rmt_addr; newinet->inet_rcv_saddr = ireq->loc_addr; newinet->inet_saddr = ireq->loc_addr; newinet->inet_opt = ireq->opt; ireq->opt = NULL; newinet->mc_index = inet_iif(skb); newinet->mc_ttl = ip_hdr(skb)->ttl; newinet->inet_id = jiffies; dccp_sync_mss(newsk, dst_mtu(dst)); if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto exit; } __inet_hash_nolisten(newsk, NULL); return newsk; exit_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); exit_nonewsk: dst_release(dst); exit: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return NULL; }
struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet_request_sock *ireq; struct inet_sock *newinet; struct sock *newsk; if (sk_acceptq_is_full(sk)) goto exit_overflow; if (dst == NULL && (dst = inet_csk_route_req(sk, req)) == NULL) goto exit; newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto exit_nonewsk; sk_setup_caps(newsk, dst); newinet = inet_sk(newsk); ireq = inet_rsk(req); newinet->inet_daddr = ireq->rmt_addr; newinet->inet_rcv_saddr = ireq->loc_addr; newinet->inet_saddr = ireq->loc_addr; newinet->inet_opt = ireq->opt; ireq->opt = NULL; newinet->mc_index = inet_iif(skb); newinet->mc_ttl = ip_hdr(skb)->ttl; newinet->inet_id = jiffies; dccp_sync_mss(newsk, dst_mtu(dst)); if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto exit; } __inet_hash_nolisten(newsk, NULL); return newsk; exit_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); exit_nonewsk: dst_release(dst); exit: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return NULL; }
1,672
1
add_connection_real (NMAGConfSettings *self, NMAGConfConnection *connection) { NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self); g_return_if_fail (connection != NULL); priv->connections = g_slist_prepend (priv->connections, connection); g_signal_connect (connection, "new-secrets-requested", G_CALLBACK (connection_new_secrets_requested_cb), self); g_signal_connect (connection, "removed", G_CALLBACK (connection_removed), self); /* Export the connection over dbus if requested */ if (priv->bus) { nm_exported_connection_register_object (NM_EXPORTED_CONNECTION (connection), NM_CONNECTION_SCOPE_USER, priv->bus); dbus_g_connection_unref (priv->bus); } nm_settings_signal_new_connection (NM_SETTINGS (self), NM_EXPORTED_CONNECTION (connection)); }
add_connection_real (NMAGConfSettings *self, NMAGConfConnection *connection) { NMAGConfSettingsPrivate *priv = NMA_GCONF_SETTINGS_GET_PRIVATE (self); g_return_if_fail (connection != NULL); priv->connections = g_slist_prepend (priv->connections, connection); g_signal_connect (connection, "new-secrets-requested", G_CALLBACK (connection_new_secrets_requested_cb), self); g_signal_connect (connection, "removed", G_CALLBACK (connection_removed), self); if (priv->bus) { nm_exported_connection_register_object (NM_EXPORTED_CONNECTION (connection), NM_CONNECTION_SCOPE_USER, priv->bus); dbus_g_connection_unref (priv->bus); } nm_settings_signal_new_connection (NM_SETTINGS (self), NM_EXPORTED_CONNECTION (connection)); }
1,673
0
static int selinux_ptrace_access_check ( struct task_struct * child , unsigned int mode ) { if ( mode & PTRACE_MODE_READ ) { u32 sid = current_sid ( ) ; u32 csid = task_sid ( child ) ; return avc_has_perm ( sid , csid , SECCLASS_FILE , FILE__READ , NULL ) ; } return current_has_perm ( child , PROCESS__PTRACE ) ; }
static int selinux_ptrace_access_check ( struct task_struct * child , unsigned int mode ) { if ( mode & PTRACE_MODE_READ ) { u32 sid = current_sid ( ) ; u32 csid = task_sid ( child ) ; return avc_has_perm ( sid , csid , SECCLASS_FILE , FILE__READ , NULL ) ; } return current_has_perm ( child , PROCESS__PTRACE ) ; }
1,674
0
Oid get_opfamily_proc ( Oid opfamily , Oid lefttype , Oid righttype , int16 procnum ) { HeapTuple tp ; Form_pg_amproc amproc_tup ; RegProcedure result ; tp = SearchSysCache4 ( AMPROCNUM , ObjectIdGetDatum ( opfamily ) , ObjectIdGetDatum ( lefttype ) , ObjectIdGetDatum ( righttype ) , Int16GetDatum ( procnum ) ) ; if ( ! HeapTupleIsValid ( tp ) ) return InvalidOid ; amproc_tup = ( Form_pg_amproc ) GETSTRUCT ( tp ) ; result = amproc_tup -> amproc ; ReleaseSysCache ( tp ) ; return result ; }
Oid get_opfamily_proc ( Oid opfamily , Oid lefttype , Oid righttype , int16 procnum ) { HeapTuple tp ; Form_pg_amproc amproc_tup ; RegProcedure result ; tp = SearchSysCache4 ( AMPROCNUM , ObjectIdGetDatum ( opfamily ) , ObjectIdGetDatum ( lefttype ) , ObjectIdGetDatum ( righttype ) , Int16GetDatum ( procnum ) ) ; if ( ! HeapTupleIsValid ( tp ) ) return InvalidOid ; amproc_tup = ( Form_pg_amproc ) GETSTRUCT ( tp ) ; result = amproc_tup -> amproc ; ReleaseSysCache ( tp ) ; return result ; }
1,677
0
static void copy_context_after_encode(MpegEncContext *d, MpegEncContext *s, int type){ int i; memcpy(d->mv, s->mv, 2*4*2*sizeof(int)); memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop? /* mpeg1 */ d->mb_incr= s->mb_incr; for(i=0; i<3; i++) d->last_dc[i]= s->last_dc[i]; /* statistics */ d->mv_bits= s->mv_bits; d->i_tex_bits= s->i_tex_bits; d->p_tex_bits= s->p_tex_bits; d->i_count= s->i_count; d->p_count= s->p_count; d->skip_count= s->skip_count; d->misc_bits= s->misc_bits; d->mb_intra= s->mb_intra; d->mb_skiped= s->mb_skiped; d->mv_type= s->mv_type; d->mv_dir= s->mv_dir; d->pb= s->pb; d->block= s->block; for(i=0; i<6; i++) d->block_last_index[i]= s->block_last_index[i]; }
static void copy_context_after_encode(MpegEncContext *d, MpegEncContext *s, int type){ int i; memcpy(d->mv, s->mv, 2*4*2*sizeof(int)); memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int));
1,678
0
static inline int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, int search_pc) { DisasContext ctx, *ctxp = &ctx; opc_handler_t **table, *handler; target_ulong pc_start; uint16_t *gen_opc_end; int j, lj = -1; pc_start = tb->pc; gen_opc_ptr = gen_opc_buf; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; gen_opparam_ptr = gen_opparam_buf; nb_gen_labels = 0; ctx.nip = pc_start; ctx.tb = tb; ctx.exception = EXCP_NONE; ctx.spr_cb = env->spr_cb; #if defined(CONFIG_USER_ONLY) ctx.mem_idx = msr_le; #if defined(TARGET_PPC64) ctx.mem_idx |= msr_sf << 1; #endif #else ctx.supervisor = 1 - msr_pr; ctx.mem_idx = ((1 - msr_pr) << 1) | msr_le; #if defined(TARGET_PPC64) ctx.mem_idx |= msr_sf << 2; #endif #endif #if defined(TARGET_PPC64) ctx.sf_mode = msr_sf; #endif ctx.fpu_enabled = msr_fp; #if defined(TARGET_PPCEMB) ctx.spe_enabled = msr_spe; #endif ctx.singlestep_enabled = env->singlestep_enabled; #if defined (DO_SINGLE_STEP) && 0 /* Single step trace mode */ msr_se = 1; #endif /* Set env in case of segfault during code fetch */ while (ctx.exception == EXCP_NONE && gen_opc_ptr < gen_opc_end) { if (unlikely(env->nb_breakpoints > 0)) { for (j = 0; j < env->nb_breakpoints; j++) { if (env->breakpoints[j] == ctx.nip) { gen_update_nip(&ctx, ctx.nip); gen_op_debug(); break; } } } if (unlikely(search_pc)) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; gen_opc_pc[lj] = ctx.nip; gen_opc_instr_start[lj] = 1; } } #if defined PPC_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "----------------\n"); fprintf(logfile, "nip=" ADDRX " super=%d ir=%d\n", ctx.nip, 1 - msr_pr, msr_ir); } #endif ctx.opcode = ldl_code(ctx.nip); if (msr_le) { ctx.opcode = ((ctx.opcode & 0xFF000000) >> 24) | ((ctx.opcode & 0x00FF0000) >> 8) | ((ctx.opcode & 0x0000FF00) << 8) | ((ctx.opcode & 0x000000FF) << 24); } #if defined PPC_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "translate opcode %08x (%02x %02x %02x) (%s)\n", ctx.opcode, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), msr_le ? "little" : "big"); } #endif ctx.nip += 4; table = env->opcodes; handler = table[opc1(ctx.opcode)]; if (is_indirect_opcode(handler)) { table = ind_table(handler); handler = table[opc2(ctx.opcode)]; if (is_indirect_opcode(handler)) { table = ind_table(handler); handler = table[opc3(ctx.opcode)]; } } /* Is opcode *REALLY* valid ? */ if (unlikely(handler->handler == &gen_invalid)) { if (loglevel != 0) { fprintf(logfile, "invalid/unsupported opcode: " "%02x - %02x - %02x (%08x) 0x" ADDRX " %d\n", opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, msr_ir); } else { printf("invalid/unsupported opcode: " "%02x - %02x - %02x (%08x) 0x" ADDRX " %d\n", opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, msr_ir); } } else { if (unlikely((ctx.opcode & handler->inval) != 0)) { if (loglevel != 0) { fprintf(logfile, "invalid bits: %08x for opcode: " "%02x -%02x - %02x (%08x) 0x" ADDRX "\n", ctx.opcode & handler->inval, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4); } else { printf("invalid bits: %08x for opcode: " "%02x -%02x - %02x (%08x) 0x" ADDRX "\n", ctx.opcode & handler->inval, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4); } RET_INVAL(ctxp); break; } } (*(handler->handler))(&ctx); #if defined(DO_PPC_STATISTICS) handler->count++; #endif /* Check trace mode exceptions */ #if 0 // XXX: buggy on embedded PowerPC if (unlikely((msr_be && ctx.exception == EXCP_BRANCH) || /* Check in single step trace mode * we need to stop except if: * - rfi, trap or syscall * - first instruction of an exception handler */ (msr_se && (ctx.nip < 0x100 || ctx.nip > 0xF00 || (ctx.nip & 0xFC) != 0x04) && ctx.exception != EXCP_SYSCALL && ctx.exception != EXCP_SYSCALL_USER && ctx.exception != EXCP_TRAP))) { RET_EXCP(ctxp, EXCP_TRACE, 0); } #endif /* if we reach a page boundary or are single stepping, stop * generation */ if (unlikely(((ctx.nip & (TARGET_PAGE_SIZE - 1)) == 0) || (env->singlestep_enabled))) { break; } #if defined (DO_SINGLE_STEP) break; #endif } if (ctx.exception == EXCP_NONE) { gen_goto_tb(&ctx, 0, ctx.nip); } else if (ctx.exception != EXCP_BRANCH) { gen_op_reset_T0(); /* Generate the return instruction */ gen_op_exit_tb(); } *gen_opc_ptr = INDEX_op_end; if (unlikely(search_pc)) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } else { tb->size = ctx.nip - pc_start; } #if defined(DEBUG_DISAS) if (loglevel & CPU_LOG_TB_CPU) { fprintf(logfile, "---------------- excp: %04x\n", ctx.exception); cpu_dump_state(env, logfile, fprintf, 0); } if (loglevel & CPU_LOG_TB_IN_ASM) { int flags; flags = env->bfd_mach; flags |= msr_le << 16; fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start)); target_disas(logfile, pc_start, ctx.nip - pc_start, flags); fprintf(logfile, "\n"); } if (loglevel & CPU_LOG_TB_OP) { fprintf(logfile, "OP:\n"); dump_ops(gen_opc_buf, gen_opparam_buf); fprintf(logfile, "\n"); } #endif return 0; }
static inline int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb, int search_pc) { DisasContext ctx, *ctxp = &ctx; opc_handler_t **table, *handler; target_ulong pc_start; uint16_t *gen_opc_end; int j, lj = -1; pc_start = tb->pc; gen_opc_ptr = gen_opc_buf; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; gen_opparam_ptr = gen_opparam_buf; nb_gen_labels = 0; ctx.nip = pc_start; ctx.tb = tb; ctx.exception = EXCP_NONE; ctx.spr_cb = env->spr_cb; #if defined(CONFIG_USER_ONLY) ctx.mem_idx = msr_le; #if defined(TARGET_PPC64) ctx.mem_idx |= msr_sf << 1; #endif #else ctx.supervisor = 1 - msr_pr; ctx.mem_idx = ((1 - msr_pr) << 1) | msr_le; #if defined(TARGET_PPC64) ctx.mem_idx |= msr_sf << 2; #endif #endif #if defined(TARGET_PPC64) ctx.sf_mode = msr_sf; #endif ctx.fpu_enabled = msr_fp; #if defined(TARGET_PPCEMB) ctx.spe_enabled = msr_spe; #endif ctx.singlestep_enabled = env->singlestep_enabled; #if defined (DO_SINGLE_STEP) && 0 msr_se = 1; #endif while (ctx.exception == EXCP_NONE && gen_opc_ptr < gen_opc_end) { if (unlikely(env->nb_breakpoints > 0)) { for (j = 0; j < env->nb_breakpoints; j++) { if (env->breakpoints[j] == ctx.nip) { gen_update_nip(&ctx, ctx.nip); gen_op_debug(); break; } } } if (unlikely(search_pc)) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; gen_opc_pc[lj] = ctx.nip; gen_opc_instr_start[lj] = 1; } } #if defined PPC_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "----------------\n"); fprintf(logfile, "nip=" ADDRX " super=%d ir=%d\n", ctx.nip, 1 - msr_pr, msr_ir); } #endif ctx.opcode = ldl_code(ctx.nip); if (msr_le) { ctx.opcode = ((ctx.opcode & 0xFF000000) >> 24) | ((ctx.opcode & 0x00FF0000) >> 8) | ((ctx.opcode & 0x0000FF00) << 8) | ((ctx.opcode & 0x000000FF) << 24); } #if defined PPC_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "translate opcode %08x (%02x %02x %02x) (%s)\n", ctx.opcode, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), msr_le ? "little" : "big"); } #endif ctx.nip += 4; table = env->opcodes; handler = table[opc1(ctx.opcode)]; if (is_indirect_opcode(handler)) { table = ind_table(handler); handler = table[opc2(ctx.opcode)]; if (is_indirect_opcode(handler)) { table = ind_table(handler); handler = table[opc3(ctx.opcode)]; } } if (unlikely(handler->handler == &gen_invalid)) { if (loglevel != 0) { fprintf(logfile, "invalid/unsupported opcode: " "%02x - %02x - %02x (%08x) 0x" ADDRX " %d\n", opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, msr_ir); } else { printf("invalid/unsupported opcode: " "%02x - %02x - %02x (%08x) 0x" ADDRX " %d\n", opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, msr_ir); } } else { if (unlikely((ctx.opcode & handler->inval) != 0)) { if (loglevel != 0) { fprintf(logfile, "invalid bits: %08x for opcode: " "%02x -%02x - %02x (%08x) 0x" ADDRX "\n", ctx.opcode & handler->inval, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4); } else { printf("invalid bits: %08x for opcode: " "%02x -%02x - %02x (%08x) 0x" ADDRX "\n", ctx.opcode & handler->inval, opc1(ctx.opcode), opc2(ctx.opcode), opc3(ctx.opcode), ctx.opcode, ctx.nip - 4); } RET_INVAL(ctxp); break; } } (*(handler->handler))(&ctx); #if defined(DO_PPC_STATISTICS) handler->count++; #endif #if 0
1,682
0
String string_chunk_split(const char *src, int srclen, const char *end, int endlen, int chunklen) { int chunks = srclen / chunklen; // complete chunks! int restlen = srclen - chunks * chunklen; /* srclen % chunklen */ String ret( safe_address( chunks + 1, endlen, srclen ), ReserveString ); char *dest = ret.bufferSlice().ptr; const char *p; char *q; const char *pMax = src + srclen - chunklen + 1; for (p = src, q = dest; p < pMax; ) { memcpy(q, p, chunklen); q += chunklen; memcpy(q, end, endlen); q += endlen; p += chunklen; } if (restlen) { memcpy(q, p, restlen); q += restlen; memcpy(q, end, endlen); q += endlen; } ret.setSize(q - dest); return ret; }
String string_chunk_split(const char *src, int srclen, const char *end, int endlen, int chunklen) { int chunks = srclen / chunklen; int restlen = srclen - chunks * chunklen; String ret( safe_address( chunks + 1, endlen, srclen ), ReserveString ); char *dest = ret.bufferSlice().ptr; const char *p; char *q; const char *pMax = src + srclen - chunklen + 1; for (p = src, q = dest; p < pMax; ) { memcpy(q, p, chunklen); q += chunklen; memcpy(q, end, endlen); q += endlen; p += chunklen; } if (restlen) { memcpy(q, p, restlen); q += restlen; memcpy(q, end, endlen); q += endlen; } ret.setSize(q - dest); return ret; }
1,683
0
static struct sock *dccp_v6_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct inet_sock *newinet; struct dccp6_sock *newdp6; struct sock *newsk; struct ipv6_txoptions *opt; if (skb->protocol == htons(ETH_P_IP)) { /* * v6 mapped */ newsk = dccp_v4_request_recv_sock(sk, skb, req, dst); if (newsk == NULL) return NULL; newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; newsk->sk_backlog_rcv = dccp_v4_do_rcv; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks count * here, dccp_create_openreq_child now does this for us, see the comment in * that function for the gory details. -acme */ /* It is tricky place. Until this moment IPv4 tcp worked with IPv6 icsk.icsk_af_ops. Sync it now. */ dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } opt = np->opt; if (sk_acceptq_is_full(sk)) goto out_overflow; if (dst == NULL) { struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); final_p = fl6_update_dst(&fl6, opt, &final); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) goto out; } newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto out_nonewsk; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks * count here, dccp_create_openreq_child now does this for us, see the * comment in that function for the gory details. -acme */ __ip6_dst_store(newsk, dst, NULL, NULL); newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM | NETIF_F_TSO); newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_copy(&newnp->daddr, &ireq6->rmt_addr); ipv6_addr_copy(&newnp->saddr, &ireq6->loc_addr); ipv6_addr_copy(&newnp->rcv_saddr, &ireq6->loc_addr); newsk->sk_bound_dev_if = ireq6->iif; /* Now IPv6 options... First: no IPv4 options. */ newinet->inet_opt = NULL; /* Clone RX bits */ newnp->rxopt.all = np->rxopt.all; /* Clone pktoptions received with SYN */ newnp->pktoptions = NULL; if (ireq6->pktopts != NULL) { newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); kfree_skb(ireq6->pktopts); ireq6->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* * Clone native IPv6 options from listening socket (if any) * * Yes, keeping reference count would be much more clever, but we make * one more one thing there: reattach optmem to newsk. */ if (opt != NULL) { newnp->opt = ipv6_dup_options(newsk, opt); if (opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (newnp->opt != NULL) inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); dccp_sync_mss(newsk, dst_mtu(dst)); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto out; } __inet6_hash(newsk, NULL); return newsk; out_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: dst_release(dst); out: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); return NULL; }
static struct sock *dccp_v6_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct inet_sock *newinet; struct dccp6_sock *newdp6; struct sock *newsk; struct ipv6_txoptions *opt; if (skb->protocol == htons(ETH_P_IP)) { newsk = dccp_v4_request_recv_sock(sk, skb, req, dst); if (newsk == NULL) return NULL; newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; newsk->sk_backlog_rcv = dccp_v4_do_rcv; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } opt = np->opt; if (sk_acceptq_is_full(sk)) goto out_overflow; if (dst == NULL) { struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); final_p = fl6_update_dst(&fl6, opt, &final); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) goto out; } newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto out_nonewsk; __ip6_dst_store(newsk, dst, NULL, NULL); newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM | NETIF_F_TSO); newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_copy(&newnp->daddr, &ireq6->rmt_addr); ipv6_addr_copy(&newnp->saddr, &ireq6->loc_addr); ipv6_addr_copy(&newnp->rcv_saddr, &ireq6->loc_addr); newsk->sk_bound_dev_if = ireq6->iif; newinet->inet_opt = NULL; newnp->rxopt.all = np->rxopt.all; newnp->pktoptions = NULL; if (ireq6->pktopts != NULL) { newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); kfree_skb(ireq6->pktopts); ireq6->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; if (opt != NULL) { newnp->opt = ipv6_dup_options(newsk, opt); if (opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (newnp->opt != NULL) inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); dccp_sync_mss(newsk, dst_mtu(dst)); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto out; } __inet6_hash(newsk, NULL); return newsk; out_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: dst_release(dst); out: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); return NULL; }
1,684
1
static struct sock *dccp_v6_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct inet_sock *newinet; struct dccp6_sock *newdp6; struct sock *newsk; struct ipv6_txoptions *opt; if (skb->protocol == htons(ETH_P_IP)) { /* * v6 mapped */ newsk = dccp_v4_request_recv_sock(sk, skb, req, dst); if (newsk == NULL) return NULL; newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; newsk->sk_backlog_rcv = dccp_v4_do_rcv; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks count * here, dccp_create_openreq_child now does this for us, see the comment in * that function for the gory details. -acme */ /* It is tricky place. Until this moment IPv4 tcp worked with IPv6 icsk.icsk_af_ops. Sync it now. */ dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } opt = np->opt; if (sk_acceptq_is_full(sk)) goto out_overflow; if (dst == NULL) { struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); final_p = fl6_update_dst(&fl6, opt, &final); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) goto out; } newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto out_nonewsk; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks * count here, dccp_create_openreq_child now does this for us, see the * comment in that function for the gory details. -acme */ __ip6_dst_store(newsk, dst, NULL, NULL); newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM | NETIF_F_TSO); newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_copy(&newnp->daddr, &ireq6->rmt_addr); ipv6_addr_copy(&newnp->saddr, &ireq6->loc_addr); ipv6_addr_copy(&newnp->rcv_saddr, &ireq6->loc_addr); newsk->sk_bound_dev_if = ireq6->iif; /* Now IPv6 options... First: no IPv4 options. */ newinet->opt = NULL; /* Clone RX bits */ newnp->rxopt.all = np->rxopt.all; /* Clone pktoptions received with SYN */ newnp->pktoptions = NULL; if (ireq6->pktopts != NULL) { newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); kfree_skb(ireq6->pktopts); ireq6->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; /* * Clone native IPv6 options from listening socket (if any) * * Yes, keeping reference count would be much more clever, but we make * one more one thing there: reattach optmem to newsk. */ if (opt != NULL) { newnp->opt = ipv6_dup_options(newsk, opt); if (opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (newnp->opt != NULL) inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); dccp_sync_mss(newsk, dst_mtu(dst)); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto out; } __inet6_hash(newsk, NULL); return newsk; out_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: dst_release(dst); out: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); return NULL; }
static struct sock *dccp_v6_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct inet_sock *newinet; struct dccp6_sock *newdp6; struct sock *newsk; struct ipv6_txoptions *opt; if (skb->protocol == htons(ETH_P_IP)) { newsk = dccp_v4_request_recv_sock(sk, skb, req, dst); if (newsk == NULL) return NULL; newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; newsk->sk_backlog_rcv = dccp_v4_do_rcv; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } opt = np->opt; if (sk_acceptq_is_full(sk)) goto out_overflow; if (dst == NULL) { struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); final_p = fl6_update_dst(&fl6, opt, &final); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) goto out; } newsk = dccp_create_openreq_child(sk, req, skb); if (newsk == NULL) goto out_nonewsk; __ip6_dst_store(newsk, dst, NULL, NULL); newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM | NETIF_F_TSO); newdp6 = (struct dccp6_sock *)newsk; newinet = inet_sk(newsk); newinet->pinet6 = &newdp6->inet6; newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); ipv6_addr_copy(&newnp->daddr, &ireq6->rmt_addr); ipv6_addr_copy(&newnp->saddr, &ireq6->loc_addr); ipv6_addr_copy(&newnp->rcv_saddr, &ireq6->loc_addr); newsk->sk_bound_dev_if = ireq6->iif; newinet->opt = NULL; newnp->rxopt.all = np->rxopt.all; newnp->pktoptions = NULL; if (ireq6->pktopts != NULL) { newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); kfree_skb(ireq6->pktopts); ireq6->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } newnp->opt = NULL; newnp->mcast_oif = inet6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; if (opt != NULL) { newnp->opt = ipv6_dup_options(newsk, opt); if (opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (newnp->opt != NULL) inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + newnp->opt->opt_flen); dccp_sync_mss(newsk, dst_mtu(dst)); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; if (__inet_inherit_port(sk, newsk) < 0) { sock_put(newsk); goto out; } __inet6_hash(newsk, NULL); return newsk; out_overflow: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: dst_release(dst); out: NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); return NULL; }
1,687
0
TSReturnCode TSUrlHostSet ( TSMBuffer bufp , TSMLoc obj , const char * value , int length ) { return URLPartSet ( bufp , obj , value , length , & URL : : host_set ) ; }
TSReturnCode TSUrlHostSet ( TSMBuffer bufp , TSMLoc obj , const char * value , int length ) { return URLPartSet ( bufp , obj , value , length , & URL : : host_set ) ; }
1,688
0
void *address_space_map(AddressSpace *as, target_phys_addr_t addr, target_phys_addr_t *plen, bool is_write) { AddressSpaceDispatch *d = as->dispatch; target_phys_addr_t len = *plen; target_phys_addr_t todo = 0; int l; target_phys_addr_t page; MemoryRegionSection *section; ram_addr_t raddr = RAM_ADDR_MAX; ram_addr_t rlen; void *ret; while (len > 0) { page = addr & TARGET_PAGE_MASK; l = (page + TARGET_PAGE_SIZE) - addr; if (l > len) l = len; section = phys_page_find(d, page >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) && !section->readonly)) { if (todo || bounce.buffer) { break; } bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, TARGET_PAGE_SIZE); bounce.addr = addr; bounce.len = l; if (!is_write) { address_space_read(as, addr, bounce.buffer, l); } *plen = l; return bounce.buffer; } if (!todo) { raddr = memory_region_get_ram_addr(section->mr) + memory_region_section_addr(section, addr); } len -= l; addr += l; todo += l; } rlen = todo; ret = qemu_ram_ptr_length(raddr, &rlen); *plen = rlen; return ret; }
void *address_space_map(AddressSpace *as, target_phys_addr_t addr, target_phys_addr_t *plen, bool is_write) { AddressSpaceDispatch *d = as->dispatch; target_phys_addr_t len = *plen; target_phys_addr_t todo = 0; int l; target_phys_addr_t page; MemoryRegionSection *section; ram_addr_t raddr = RAM_ADDR_MAX; ram_addr_t rlen; void *ret; while (len > 0) { page = addr & TARGET_PAGE_MASK; l = (page + TARGET_PAGE_SIZE) - addr; if (l > len) l = len; section = phys_page_find(d, page >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) && !section->readonly)) { if (todo || bounce.buffer) { break; } bounce.buffer = qemu_memalign(TARGET_PAGE_SIZE, TARGET_PAGE_SIZE); bounce.addr = addr; bounce.len = l; if (!is_write) { address_space_read(as, addr, bounce.buffer, l); } *plen = l; return bounce.buffer; } if (!todo) { raddr = memory_region_get_ram_addr(section->mr) + memory_region_section_addr(section, addr); } len -= l; addr += l; todo += l; } rlen = todo; ret = qemu_ram_ptr_length(raddr, &rlen); *plen = rlen; return ret; }
1,689
1
update_connection (NMConnectionList *list, NMConnectionEditor *editor, NMExportedConnection *original, NMConnection *modified, ConnectionUpdatedFn callback, gpointer user_data) { NMConnectionScope original_scope; ConnectionUpdateInfo *info; info = g_slice_new0 (ConnectionUpdateInfo); info->list = list; info->editor = editor; info->original = g_object_ref (original); info->modified = g_object_ref (modified); info->callback = callback; info->user_data = user_data; original_scope = nm_connection_get_scope (nm_exported_connection_get_connection (original)); if (nm_connection_get_scope (modified) == original_scope) { /* The easy part: Connection is updated */ GHashTable *new_settings; GError *error = NULL; gboolean success; gboolean pending_auth = FALSE; GtkWindow *parent; utils_fill_connection_certs (modified); new_settings = nm_connection_to_hash (modified); /* Hack; make sure that gconf private values are copied */ nm_gconf_copy_private_connection_values (nm_exported_connection_get_connection (original), modified); success = nm_exported_connection_update (original, new_settings, &error); g_hash_table_destroy (new_settings); utils_clear_filled_connection_certs (modified); parent = nm_connection_editor_get_window (editor); if (!success) { if (pk_helper_is_permission_denied_error (error)) { GError *auth_error = NULL; pending_auth = pk_helper_obtain_auth (error, parent, update_connection_cb, info, &auth_error); if (auth_error) { error_dialog (parent, _("Could not update connection"), "%s", auth_error->message); g_error_free (auth_error); } } else { error_dialog (parent, _("Could not update connection"), "%s", error->message); } g_error_free (error); } else { /* Save user-connection vpn secrets */ if (editor && (original_scope == NM_CONNECTION_SCOPE_USER)) nm_connection_editor_save_vpn_secrets (editor); } if (!pending_auth) connection_update_done (info, success); } else { /* The hard part: Connection scope changed: Add the exported connection, if it succeeds, remove the old one. */ add_connection (list, editor, modified, connection_update_add_done, info); } }
update_connection (NMConnectionList *list, NMConnectionEditor *editor, NMExportedConnection *original, NMConnection *modified, ConnectionUpdatedFn callback, gpointer user_data) { NMConnectionScope original_scope; ConnectionUpdateInfo *info; info = g_slice_new0 (ConnectionUpdateInfo); info->list = list; info->editor = editor; info->original = g_object_ref (original); info->modified = g_object_ref (modified); info->callback = callback; info->user_data = user_data; original_scope = nm_connection_get_scope (nm_exported_connection_get_connection (original)); if (nm_connection_get_scope (modified) == original_scope) { GHashTable *new_settings; GError *error = NULL; gboolean success; gboolean pending_auth = FALSE; GtkWindow *parent; utils_fill_connection_certs (modified); new_settings = nm_connection_to_hash (modified); nm_gconf_copy_private_connection_values (nm_exported_connection_get_connection (original), modified); success = nm_exported_connection_update (original, new_settings, &error); g_hash_table_destroy (new_settings); utils_clear_filled_connection_certs (modified); parent = nm_connection_editor_get_window (editor); if (!success) { if (pk_helper_is_permission_denied_error (error)) { GError *auth_error = NULL; pending_auth = pk_helper_obtain_auth (error, parent, update_connection_cb, info, &auth_error); if (auth_error) { error_dialog (parent, _("Could not update connection"), "%s", auth_error->message); g_error_free (auth_error); } } else { error_dialog (parent, _("Could not update connection"), "%s", error->message); } g_error_free (error); } else { if (editor && (original_scope == NM_CONNECTION_SCOPE_USER)) nm_connection_editor_save_vpn_secrets (editor); } if (!pending_auth) connection_update_done (info, success); } else { add_connection (list, editor, modified, connection_update_add_done, info); } }
1,690
1
int inet_sk_rebuild_header(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); __be32 daddr; int err; /* Route is OK, nothing to do. */ if (rt) return 0; /* Reroute. */ daddr = inet->inet_daddr; if (inet->opt && inet->opt->srr) daddr = inet->opt->faddr; rt = ip_route_output_ports(sock_net(sk), sk, daddr, inet->inet_saddr, inet->inet_dport, inet->inet_sport, sk->sk_protocol, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); if (!IS_ERR(rt)) { err = 0; sk_setup_caps(sk, &rt->dst); } else { err = PTR_ERR(rt); /* Routing failed... */ sk->sk_route_caps = 0; /* * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme */ if (!sysctl_ip_dynaddr || sk->sk_state != TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err = inet_sk_reselect_saddr(sk)) != 0) sk->sk_err_soft = -err; } return err; }
int inet_sk_rebuild_header(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); __be32 daddr; int err; if (rt) return 0; daddr = inet->inet_daddr; if (inet->opt && inet->opt->srr) daddr = inet->opt->faddr; rt = ip_route_output_ports(sock_net(sk), sk, daddr, inet->inet_saddr, inet->inet_dport, inet->inet_sport, sk->sk_protocol, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); if (!IS_ERR(rt)) { err = 0; sk_setup_caps(sk, &rt->dst); } else { err = PTR_ERR(rt); sk->sk_route_caps = 0; if (!sysctl_ip_dynaddr || sk->sk_state != TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err = inet_sk_reselect_saddr(sk)) != 0) sk->sk_err_soft = -err; } return err; }
1,691
0
GenericList *visit_next_list(Visitor *v, GenericList **list, size_t size) { assert(list && size >= sizeof(GenericList)); return v->next_list(v, list, size); }
GenericList *visit_next_list(Visitor *v, GenericList **list, size_t size) { assert(list && size >= sizeof(GenericList)); return v->next_list(v, list, size); }
1,693
0
static guint32 dissect_netb_unknown ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ) { proto_tree_add_expert ( tree , pinfo , & ei_netb_unknown_command_data , tvb , offset + NB_COMMAND + 1 , - 1 ) ; return 0 ; }
static guint32 dissect_netb_unknown ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ) { proto_tree_add_expert ( tree , pinfo , & ei_netb_unknown_command_data , tvb , offset + NB_COMMAND + 1 , - 1 ) ; return 0 ; }
1,694
1
explicit HashContext(const HashContext* ctx) { assert(ctx->ops); assert(ctx->ops->context_size >= 0); ops = ctx->ops; context = malloc(ops->context_size); ops->hash_copy(context, ctx->context); options = ctx->options; key = ctx->key ? strdup(ctx->key) : nullptr; }
explicit HashContext(const HashContext* ctx) { assert(ctx->ops); assert(ctx->ops->context_size >= 0); ops = ctx->ops; context = malloc(ops->context_size); ops->hash_copy(context, ctx->context); options = ctx->options; key = ctx->key ? strdup(ctx->key) : nullptr; }
1,695
0
int inet_sk_rebuild_header(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); __be32 daddr; struct ip_options_rcu *inet_opt; int err; /* Route is OK, nothing to do. */ if (rt) return 0; /* Reroute. */ rcu_read_lock(); inet_opt = rcu_dereference(inet->inet_opt); daddr = inet->inet_daddr; if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; rcu_read_unlock(); rt = ip_route_output_ports(sock_net(sk), sk, daddr, inet->inet_saddr, inet->inet_dport, inet->inet_sport, sk->sk_protocol, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); if (!IS_ERR(rt)) { err = 0; sk_setup_caps(sk, &rt->dst); } else { err = PTR_ERR(rt); /* Routing failed... */ sk->sk_route_caps = 0; /* * Other protocols have to map its equivalent state to TCP_SYN_SENT. * DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme */ if (!sysctl_ip_dynaddr || sk->sk_state != TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err = inet_sk_reselect_saddr(sk)) != 0) sk->sk_err_soft = -err; } return err; }
int inet_sk_rebuild_header(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0); __be32 daddr; struct ip_options_rcu *inet_opt; int err; if (rt) return 0; rcu_read_lock(); inet_opt = rcu_dereference(inet->inet_opt); daddr = inet->inet_daddr; if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; rcu_read_unlock(); rt = ip_route_output_ports(sock_net(sk), sk, daddr, inet->inet_saddr, inet->inet_dport, inet->inet_sport, sk->sk_protocol, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); if (!IS_ERR(rt)) { err = 0; sk_setup_caps(sk, &rt->dst); } else { err = PTR_ERR(rt); sk->sk_route_caps = 0; if (!sysctl_ip_dynaddr || sk->sk_state != TCP_SYN_SENT || (sk->sk_userlocks & SOCK_BINDADDR_LOCK) || (err = inet_sk_reselect_saddr(sk)) != 0) sk->sk_err_soft = -err; } return err; }
1,696
0
static void unset_active_map ( const vpx_codec_enc_cfg_t * cfg , vpx_codec_ctx_t * codec ) { vpx_active_map_t map = { 0 , 0 , 0 } ; map . rows = ( cfg -> g_h + 15 ) / 16 ; map . cols = ( cfg -> g_w + 15 ) / 16 ; map . active_map = NULL ; if ( vpx_codec_control ( codec , VP8E_SET_ACTIVEMAP , & map ) ) die_codec ( codec , "Failed to set active map" ) ; }
static void unset_active_map ( const vpx_codec_enc_cfg_t * cfg , vpx_codec_ctx_t * codec ) { vpx_active_map_t map = { 0 , 0 , 0 } ; map . rows = ( cfg -> g_h + 15 ) / 16 ; map . cols = ( cfg -> g_w + 15 ) / 16 ; map . active_map = NULL ; if ( vpx_codec_control ( codec , VP8E_SET_ACTIVEMAP , & map ) ) die_codec ( codec , "Failed to set active map" ) ; }
1,698
1
add_connection (NMConnectionList *self, NMConnectionEditor *editor, NMConnection *connection, ConnectionAddedFn callback, gpointer user_data) { NMExportedConnection *exported = NULL; NMConnectionScope scope; gboolean success = FALSE; scope = nm_connection_get_scope (connection); if (scope == NM_CONNECTION_SCOPE_SYSTEM) { GError *error = NULL; utils_fill_connection_certs (connection); success = nm_dbus_settings_system_add_connection (self->system_settings, connection, &error); utils_clear_filled_connection_certs (connection); if (!success) { gboolean pending_auth = FALSE; GtkWindow *parent; parent = nm_connection_editor_get_window (editor); if (pk_helper_is_permission_denied_error (error)) { ConnectionAddInfo *info; GError *auth_error = NULL; info = g_slice_new (ConnectionAddInfo); info->list = self; info->editor = editor; info->connection = g_object_ref (connection); info->callback = callback; info->user_data = user_data; pending_auth = pk_helper_obtain_auth (error, parent, add_connection_cb, info, &auth_error); if (auth_error) { error_dialog (parent, _("Could not add connection"), "%s", auth_error->message); g_error_free (auth_error); } if (!pending_auth) { g_object_unref (info->connection); g_slice_free (ConnectionAddInfo, info); } } else { error_dialog (parent, _("Could not add connection"), "%s", error->message); } g_error_free (error); if (pending_auth) return; } } else if (scope == NM_CONNECTION_SCOPE_USER) { exported = (NMExportedConnection *) nma_gconf_settings_add_connection (self->gconf_settings, connection); success = exported != NULL; if (success && editor) nm_connection_editor_save_vpn_secrets (editor); } else g_warning ("%s: unhandled connection scope %d!", __func__, scope); if (callback) callback (exported, success, user_data); if (exported) g_object_unref (exported); }
add_connection (NMConnectionList *self, NMConnectionEditor *editor, NMConnection *connection, ConnectionAddedFn callback, gpointer user_data) { NMExportedConnection *exported = NULL; NMConnectionScope scope; gboolean success = FALSE; scope = nm_connection_get_scope (connection); if (scope == NM_CONNECTION_SCOPE_SYSTEM) { GError *error = NULL; utils_fill_connection_certs (connection); success = nm_dbus_settings_system_add_connection (self->system_settings, connection, &error); utils_clear_filled_connection_certs (connection); if (!success) { gboolean pending_auth = FALSE; GtkWindow *parent; parent = nm_connection_editor_get_window (editor); if (pk_helper_is_permission_denied_error (error)) { ConnectionAddInfo *info; GError *auth_error = NULL; info = g_slice_new (ConnectionAddInfo); info->list = self; info->editor = editor; info->connection = g_object_ref (connection); info->callback = callback; info->user_data = user_data; pending_auth = pk_helper_obtain_auth (error, parent, add_connection_cb, info, &auth_error); if (auth_error) { error_dialog (parent, _("Could not add connection"), "%s", auth_error->message); g_error_free (auth_error); } if (!pending_auth) { g_object_unref (info->connection); g_slice_free (ConnectionAddInfo, info); } } else { error_dialog (parent, _("Could not add connection"), "%s", error->message); } g_error_free (error); if (pending_auth) return; } } else if (scope == NM_CONNECTION_SCOPE_USER) { exported = (NMExportedConnection *) nma_gconf_settings_add_connection (self->gconf_settings, connection); success = exported != NULL; if (success && editor) nm_connection_editor_save_vpn_secrets (editor); } else g_warning ("%s: unhandled connection scope %d!", __func__, scope); if (callback) callback (exported, success, user_data); if (exported) g_object_unref (exported); }
1,699
1
read_one_cert (ReadFromGConfInfo *info, const char *setting_name, const char *key) { char *value = NULL; if (!nm_gconf_get_string_helper (info->client, info->dir, key, setting_name, &value)) return; g_object_set_data_full (G_OBJECT (info->connection), key, value, (GDestroyNotify) g_free); }
read_one_cert (ReadFromGConfInfo *info, const char *setting_name, const char *key) { char *value = NULL; if (!nm_gconf_get_string_helper (info->client, info->dir, key, setting_name, &value)) return; g_object_set_data_full (G_OBJECT (info->connection), key, value, (GDestroyNotify) g_free); }
1,700
0
uint32_t ldl_be_phys(target_phys_addr_t addr) { return ldl_phys_internal(addr, DEVICE_BIG_ENDIAN); }
uint32_t ldl_be_phys(target_phys_addr_t addr) { return ldl_phys_internal(addr, DEVICE_BIG_ENDIAN); }
1,701
1
bool WddxPacket::recursiveAddVar(const String& varName, const Variant& varVariant, bool hasVarTag) { bool isArray = varVariant.isArray(); bool isObject = varVariant.isObject(); if (isArray || isObject) { if (hasVarTag) { m_packetString += "<var name='"; m_packetString += varName.data(); m_packetString += "'>"; } Array varAsArray; Object varAsObject = varVariant.toObject(); if (isArray) varAsArray = varVariant.toArray(); if (isObject) varAsArray = varAsObject.toArray(); int length = varAsArray.length(); if (length > 0) { ArrayIter it = ArrayIter(varAsArray); if (it.first().isString()) isObject = true; if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } } else { m_packetString += "<array length='"; m_packetString += std::to_string(length); m_packetString += "'>"; } for (ArrayIter it(varAsArray); it; ++it) { Variant key = it.first(); Variant value = it.second(); recursiveAddVar(key.toString(), value, isObject); } if (isObject) { m_packetString += "</struct>"; } else { m_packetString += "</array>"; } } else { //empty object if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } m_packetString += "</struct>"; } } if (hasVarTag) { m_packetString += "</var>"; } return true; } std::string varType = getDataTypeString(varVariant.getType()).data(); if (!getWddxEncoded(varType, "", varName, false).empty()) { std::string varValue = varVariant.toString().data(); if (varType.compare("boolean") == 0) { varValue = varVariant.toBoolean() ? "true" : "false"; } m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag); return true; } return false; }
bool WddxPacket::recursiveAddVar(const String& varName, const Variant& varVariant, bool hasVarTag) { bool isArray = varVariant.isArray(); bool isObject = varVariant.isObject(); if (isArray || isObject) { if (hasVarTag) { m_packetString += "<var name='"; m_packetString += varName.data(); m_packetString += "'>"; } Array varAsArray; Object varAsObject = varVariant.toObject(); if (isArray) varAsArray = varVariant.toArray(); if (isObject) varAsArray = varAsObject.toArray(); int length = varAsArray.length(); if (length > 0) { ArrayIter it = ArrayIter(varAsArray); if (it.first().isString()) isObject = true; if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } } else { m_packetString += "<array length='"; m_packetString += std::to_string(length); m_packetString += "'>"; } for (ArrayIter it(varAsArray); it; ++it) { Variant key = it.first(); Variant value = it.second(); recursiveAddVar(key.toString(), value, isObject); } if (isObject) { m_packetString += "</struct>"; } else { m_packetString += "</array>"; } } else { if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } m_packetString += "</struct>"; } } if (hasVarTag) { m_packetString += "</var>"; } return true; } std::string varType = getDataTypeString(varVariant.getType()).data(); if (!getWddxEncoded(varType, "", varName, false).empty()) { std::string varValue = varVariant.toString().data(); if (varType.compare("boolean") == 0) { varValue = varVariant.toBoolean() ? "true" : "false"; } m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag); return true; } return false; }
1,702
0
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 fl4; struct rtable *rt; __be32 new_saddr; struct ip_options_rcu *inet_opt; inet_opt = rcu_dereference_protected(inet->inet_opt, sock_owned_by_user(sk)); if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; /* Query new route. */ rt = ip_route_connect(&fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk, false); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = rt->rt_src; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; /* * XXX The only one ugly spot where we need to * XXX really change the sockets identity after * XXX it has entered the hashes. -DaveM * * Besides that, it does not check for connection * uniqueness. Wait for troubles. */ __sk_prot_rehash(sk); return 0; }
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 fl4; struct rtable *rt; __be32 new_saddr; struct ip_options_rcu *inet_opt; inet_opt = rcu_dereference_protected(inet->inet_opt, sock_owned_by_user(sk)); if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; rt = ip_route_connect(&fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk, false); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = rt->rt_src; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; __sk_prot_rehash(sk); return 0; }
1,703
0
CURLcode Curl_http_auth_act ( struct connectdata * conn ) { struct Curl_easy * data = conn -> data ; bool pickhost = FALSE ; bool pickproxy = FALSE ; CURLcode result = CURLE_OK ; if ( 100 <= data -> req . httpcode && 199 >= data -> req . httpcode ) return CURLE_OK ; if ( data -> state . authproblem ) return data -> set . http_fail_on_error ? CURLE_HTTP_RETURNED_ERROR : CURLE_OK ; if ( conn -> bits . user_passwd && ( ( data -> req . httpcode == 401 ) || ( conn -> bits . authneg && data -> req . httpcode < 300 ) ) ) { pickhost = pickoneauth ( & data -> state . authhost ) ; if ( ! pickhost ) data -> state . authproblem = TRUE ; } if ( conn -> bits . proxy_user_passwd && ( ( data -> req . httpcode == 407 ) || ( conn -> bits . authneg && data -> req . httpcode < 300 ) ) ) { pickproxy = pickoneauth ( & data -> state . authproxy ) ; if ( ! pickproxy ) data -> state . authproblem = TRUE ; } if ( pickhost || pickproxy ) { Curl_safefree ( data -> req . newurl ) ; data -> req . newurl = strdup ( data -> change . url ) ; if ( ! data -> req . newurl ) return CURLE_OUT_OF_MEMORY ; if ( ( data -> set . httpreq != HTTPREQ_GET ) && ( data -> set . httpreq != HTTPREQ_HEAD ) && ! conn -> bits . rewindaftersend ) { result = http_perhapsrewind ( conn ) ; if ( result ) return result ; } } else if ( ( data -> req . httpcode < 300 ) && ( ! data -> state . authhost . done ) && conn -> bits . authneg ) { if ( ( data -> set . httpreq != HTTPREQ_GET ) && ( data -> set . httpreq != HTTPREQ_HEAD ) ) { data -> req . newurl = strdup ( data -> change . url ) ; if ( ! data -> req . newurl ) return CURLE_OUT_OF_MEMORY ; data -> state . authhost . done = TRUE ; } } if ( http_should_fail ( conn ) ) { failf ( data , "The requested URL returned error: %d" , data -> req . httpcode ) ; result = CURLE_HTTP_RETURNED_ERROR ; } return result ; }
CURLcode Curl_http_auth_act ( struct connectdata * conn ) { struct Curl_easy * data = conn -> data ; bool pickhost = FALSE ; bool pickproxy = FALSE ; CURLcode result = CURLE_OK ; if ( 100 <= data -> req . httpcode && 199 >= data -> req . httpcode ) return CURLE_OK ; if ( data -> state . authproblem ) return data -> set . http_fail_on_error ? CURLE_HTTP_RETURNED_ERROR : CURLE_OK ; if ( conn -> bits . user_passwd && ( ( data -> req . httpcode == 401 ) || ( conn -> bits . authneg && data -> req . httpcode < 300 ) ) ) { pickhost = pickoneauth ( & data -> state . authhost ) ; if ( ! pickhost ) data -> state . authproblem = TRUE ; } if ( conn -> bits . proxy_user_passwd && ( ( data -> req . httpcode == 407 ) || ( conn -> bits . authneg && data -> req . httpcode < 300 ) ) ) { pickproxy = pickoneauth ( & data -> state . authproxy ) ; if ( ! pickproxy ) data -> state . authproblem = TRUE ; } if ( pickhost || pickproxy ) { Curl_safefree ( data -> req . newurl ) ; data -> req . newurl = strdup ( data -> change . url ) ; if ( ! data -> req . newurl ) return CURLE_OUT_OF_MEMORY ; if ( ( data -> set . httpreq != HTTPREQ_GET ) && ( data -> set . httpreq != HTTPREQ_HEAD ) && ! conn -> bits . rewindaftersend ) { result = http_perhapsrewind ( conn ) ; if ( result ) return result ; } } else if ( ( data -> req . httpcode < 300 ) && ( ! data -> state . authhost . done ) && conn -> bits . authneg ) { if ( ( data -> set . httpreq != HTTPREQ_GET ) && ( data -> set . httpreq != HTTPREQ_HEAD ) ) { data -> req . newurl = strdup ( data -> change . url ) ; if ( ! data -> req . newurl ) return CURLE_OUT_OF_MEMORY ; data -> state . authhost . done = TRUE ; } } if ( http_should_fail ( conn ) ) { failf ( data , "The requested URL returned error: %d" , data -> req . httpcode ) ; result = CURLE_HTTP_RETURNED_ERROR ; } return result ; }
1,704
0
stream_push(StreamSlave *sink, uint8_t *buf, size_t len, uint32_t *app) { StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink); return k->push(sink, buf, len, app); }
stream_push(StreamSlave *sink, uint8_t *buf, size_t len, uint32_t *app) { StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink); return k->push(sink, buf, len, app); }
1,705
1
read_applet_private_values_from_gconf (NMSetting *setting, ReadFromGConfInfo *info) { if (NM_IS_SETTING_802_1X (setting)) { const char *setting_name = nm_setting_get_name (setting); gboolean value; if (nm_gconf_get_bool_helper (info->client, info->dir, NMA_CA_CERT_IGNORE_TAG, setting_name, &value)) { g_object_set_data (G_OBJECT (info->connection), NMA_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (value)); } if (nm_gconf_get_bool_helper (info->client, info->dir, NMA_PHASE2_CA_CERT_IGNORE_TAG, setting_name, &value)) { g_object_set_data (G_OBJECT (info->connection), NMA_PHASE2_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (value)); } /* Binary certificate and key data doesn't get stored in GConf. Instead, * the path to the certificate gets stored in a special key and the * certificate is read and stuffed into the setting right before * the connection is sent to NM */ read_one_cert (info, setting_name, NMA_PATH_CA_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_CLIENT_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PRIVATE_KEY_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_CA_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_CLIENT_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_PRIVATE_KEY_TAG); } }
read_applet_private_values_from_gconf (NMSetting *setting, ReadFromGConfInfo *info) { if (NM_IS_SETTING_802_1X (setting)) { const char *setting_name = nm_setting_get_name (setting); gboolean value; if (nm_gconf_get_bool_helper (info->client, info->dir, NMA_CA_CERT_IGNORE_TAG, setting_name, &value)) { g_object_set_data (G_OBJECT (info->connection), NMA_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (value)); } if (nm_gconf_get_bool_helper (info->client, info->dir, NMA_PHASE2_CA_CERT_IGNORE_TAG, setting_name, &value)) { g_object_set_data (G_OBJECT (info->connection), NMA_PHASE2_CA_CERT_IGNORE_TAG, GUINT_TO_POINTER (value)); } read_one_cert (info, setting_name, NMA_PATH_CA_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_CLIENT_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PRIVATE_KEY_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_CA_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_CLIENT_CERT_TAG); read_one_cert (info, setting_name, NMA_PATH_PHASE2_PRIVATE_KEY_TAG); } }
1,706
0
bool WddxPacket::recursiveAddVar(const String& varName, const Variant& varVariant, bool hasVarTag) { bool isArray = varVariant.isArray(); bool isObject = varVariant.isObject(); if (isArray || isObject) { if (hasVarTag) { m_packetString += "<var name='"; m_packetString += varName.data(); m_packetString += "'>"; } Array varAsArray; Object varAsObject = varVariant.toObject(); if (isArray) varAsArray = varVariant.toArray(); if (isObject) varAsArray = varAsObject.toArray(); int length = varAsArray.length(); if (length > 0) { ArrayIter it = ArrayIter(varAsArray); if (it.first().isString()) isObject = true; if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } } else { m_packetString += "<array length='"; m_packetString += std::to_string(length); m_packetString += "'>"; } for (ArrayIter it(varAsArray); it; ++it) { Variant key = it.first(); Variant value = it.second(); recursiveAddVar(key.toString(), value, isObject); } if (isObject) { m_packetString += "</struct>"; } else { m_packetString += "</array>"; } } else { //empty object if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } m_packetString += "</struct>"; } } if (hasVarTag) { m_packetString += "</var>"; } return true; } std::string varType = getDataTypeString(varVariant.getType()).data(); if (!getWddxEncoded(varType, "", varName, false).empty()) { std::string varValue; if (varType.compare("boolean") == 0) { varValue = varVariant.toBoolean() ? "true" : "false"; } else { varValue = StringUtil::HtmlEncode(varVariant.toString(), StringUtil::QuoteStyle::Double, "UTF-8", false, false).toCppString(); } m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag); return true; } return false; }
bool WddxPacket::recursiveAddVar(const String& varName, const Variant& varVariant, bool hasVarTag) { bool isArray = varVariant.isArray(); bool isObject = varVariant.isObject(); if (isArray || isObject) { if (hasVarTag) { m_packetString += "<var name='"; m_packetString += varName.data(); m_packetString += "'>"; } Array varAsArray; Object varAsObject = varVariant.toObject(); if (isArray) varAsArray = varVariant.toArray(); if (isObject) varAsArray = varAsObject.toArray(); int length = varAsArray.length(); if (length > 0) { ArrayIter it = ArrayIter(varAsArray); if (it.first().isString()) isObject = true; if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } } else { m_packetString += "<array length='"; m_packetString += std::to_string(length); m_packetString += "'>"; } for (ArrayIter it(varAsArray); it; ++it) { Variant key = it.first(); Variant value = it.second(); recursiveAddVar(key.toString(), value, isObject); } if (isObject) { m_packetString += "</struct>"; } else { m_packetString += "</array>"; } } else { if (isObject) { m_packetString += "<struct>"; if (!isArray) { m_packetString += "<var name='php_class_name'><string>"; m_packetString += varAsObject->o_getClassName().c_str(); m_packetString += "</string></var>"; } m_packetString += "</struct>"; } } if (hasVarTag) { m_packetString += "</var>"; } return true; } std::string varType = getDataTypeString(varVariant.getType()).data(); if (!getWddxEncoded(varType, "", varName, false).empty()) { std::string varValue; if (varType.compare("boolean") == 0) { varValue = varVariant.toBoolean() ? "true" : "false"; } else { varValue = StringUtil::HtmlEncode(varVariant.toString(), StringUtil::QuoteStyle::Double, "UTF-8", false, false).toCppString(); } m_packetString += getWddxEncoded(varType, varValue, varName, hasVarTag); return true; } return false; }
1,707
1
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 fl4; struct rtable *rt; __be32 new_saddr; if (inet->opt && inet->opt->srr) daddr = inet->opt->faddr; /* Query new route. */ rt = ip_route_connect(&fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk, false); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = rt->rt_src; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; /* * XXX The only one ugly spot where we need to * XXX really change the sockets identity after * XXX it has entered the hashes. -DaveM * * Besides that, it does not check for connection * uniqueness. Wait for troubles. */ __sk_prot_rehash(sk); return 0; }
static int inet_sk_reselect_saddr(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __be32 old_saddr = inet->inet_saddr; __be32 daddr = inet->inet_daddr; struct flowi4 fl4; struct rtable *rt; __be32 new_saddr; if (inet->opt && inet->opt->srr) daddr = inet->opt->faddr; rt = ip_route_connect(&fl4, daddr, 0, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, sk->sk_protocol, inet->inet_sport, inet->inet_dport, sk, false); if (IS_ERR(rt)) return PTR_ERR(rt); sk_setup_caps(sk, &rt->dst); new_saddr = rt->rt_src; if (new_saddr == old_saddr) return 0; if (sysctl_ip_dynaddr > 1) { printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", __func__, &old_saddr, &new_saddr); } inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; __sk_prot_rehash(sk); return 0; }
1,708
0
void ps2_write_mouse ( void * opaque , int val ) { PS2MouseState * s = ( PS2MouseState * ) opaque ; trace_ps2_write_mouse ( opaque , val ) ; # ifdef DEBUG_MOUSE printf ( "kbd: write mouse 0x%02x\n" , val ) ; # endif switch ( s -> common . write_cmd ) { default : case - 1 : if ( s -> mouse_wrap ) { if ( val == AUX_RESET_WRAP ) { s -> mouse_wrap = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; return ; } else if ( val != AUX_RESET ) { ps2_queue ( & s -> common , val ) ; return ; } } switch ( val ) { case AUX_SET_SCALE11 : s -> mouse_status &= ~ MOUSE_STATUS_SCALE21 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_SCALE21 : s -> mouse_status |= MOUSE_STATUS_SCALE21 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_STREAM : s -> mouse_status &= ~ MOUSE_STATUS_REMOTE ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_WRAP : s -> mouse_wrap = 1 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_REMOTE : s -> mouse_status |= MOUSE_STATUS_REMOTE ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_GET_TYPE : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , s -> mouse_type ) ; break ; case AUX_SET_RES : case AUX_SET_SAMPLE : s -> common . write_cmd = val ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_GET_SCALE : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , s -> mouse_status ) ; ps2_queue ( & s -> common , s -> mouse_resolution ) ; ps2_queue ( & s -> common , s -> mouse_sample_rate ) ; break ; case AUX_POLL : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_mouse_send_packet ( s ) ; break ; case AUX_ENABLE_DEV : s -> mouse_status |= MOUSE_STATUS_ENABLED ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_DISABLE_DEV : s -> mouse_status &= ~ MOUSE_STATUS_ENABLED ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_DEFAULT : s -> mouse_sample_rate = 100 ; s -> mouse_resolution = 2 ; s -> mouse_status = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_RESET : s -> mouse_sample_rate = 100 ; s -> mouse_resolution = 2 ; s -> mouse_status = 0 ; s -> mouse_type = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , 0xaa ) ; ps2_queue ( & s -> common , s -> mouse_type ) ; break ; default : break ; } break ; case AUX_SET_SAMPLE : s -> mouse_sample_rate = val ; switch ( s -> mouse_detect_state ) { default : case 0 : if ( val == 200 ) s -> mouse_detect_state = 1 ; break ; case 1 : if ( val == 100 ) s -> mouse_detect_state = 2 ; else if ( val == 200 ) s -> mouse_detect_state = 3 ; else s -> mouse_detect_state = 0 ; break ; case 2 : if ( val == 80 ) s -> mouse_type = 3 ; s -> mouse_detect_state = 0 ; break ; case 3 : if ( val == 80 ) s -> mouse_type = 4 ; s -> mouse_detect_state = 0 ; break ; } ps2_queue ( & s -> common , AUX_ACK ) ; s -> common . write_cmd = - 1 ; break ; case AUX_SET_RES : s -> mouse_resolution = val ; ps2_queue ( & s -> common , AUX_ACK ) ; s -> common . write_cmd = - 1 ; break ; } }
void ps2_write_mouse ( void * opaque , int val ) { PS2MouseState * s = ( PS2MouseState * ) opaque ; trace_ps2_write_mouse ( opaque , val ) ; # ifdef DEBUG_MOUSE printf ( "kbd: write mouse 0x%02x\n" , val ) ; # endif switch ( s -> common . write_cmd ) { default : case - 1 : if ( s -> mouse_wrap ) { if ( val == AUX_RESET_WRAP ) { s -> mouse_wrap = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; return ; } else if ( val != AUX_RESET ) { ps2_queue ( & s -> common , val ) ; return ; } } switch ( val ) { case AUX_SET_SCALE11 : s -> mouse_status &= ~ MOUSE_STATUS_SCALE21 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_SCALE21 : s -> mouse_status |= MOUSE_STATUS_SCALE21 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_STREAM : s -> mouse_status &= ~ MOUSE_STATUS_REMOTE ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_WRAP : s -> mouse_wrap = 1 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_REMOTE : s -> mouse_status |= MOUSE_STATUS_REMOTE ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_GET_TYPE : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , s -> mouse_type ) ; break ; case AUX_SET_RES : case AUX_SET_SAMPLE : s -> common . write_cmd = val ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_GET_SCALE : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , s -> mouse_status ) ; ps2_queue ( & s -> common , s -> mouse_resolution ) ; ps2_queue ( & s -> common , s -> mouse_sample_rate ) ; break ; case AUX_POLL : ps2_queue ( & s -> common , AUX_ACK ) ; ps2_mouse_send_packet ( s ) ; break ; case AUX_ENABLE_DEV : s -> mouse_status |= MOUSE_STATUS_ENABLED ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_DISABLE_DEV : s -> mouse_status &= ~ MOUSE_STATUS_ENABLED ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_SET_DEFAULT : s -> mouse_sample_rate = 100 ; s -> mouse_resolution = 2 ; s -> mouse_status = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; break ; case AUX_RESET : s -> mouse_sample_rate = 100 ; s -> mouse_resolution = 2 ; s -> mouse_status = 0 ; s -> mouse_type = 0 ; ps2_queue ( & s -> common , AUX_ACK ) ; ps2_queue ( & s -> common , 0xaa ) ; ps2_queue ( & s -> common , s -> mouse_type ) ; break ; default : break ; } break ; case AUX_SET_SAMPLE : s -> mouse_sample_rate = val ; switch ( s -> mouse_detect_state ) { default : case 0 : if ( val == 200 ) s -> mouse_detect_state = 1 ; break ; case 1 : if ( val == 100 ) s -> mouse_detect_state = 2 ; else if ( val == 200 ) s -> mouse_detect_state = 3 ; else s -> mouse_detect_state = 0 ; break ; case 2 : if ( val == 80 ) s -> mouse_type = 3 ; s -> mouse_detect_state = 0 ; break ; case 3 : if ( val == 80 ) s -> mouse_type = 4 ; s -> mouse_detect_state = 0 ; break ; } ps2_queue ( & s -> common , AUX_ACK ) ; s -> common . write_cmd = - 1 ; break ; case AUX_SET_RES : s -> mouse_resolution = val ; ps2_queue ( & s -> common , AUX_ACK ) ; s -> common . write_cmd = - 1 ; break ; } }
1,712
0
static int raw_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { return bdrv_write(bs->file, sector_num, buf, nb_sectors); }
static int raw_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors) { return bdrv_write(bs->file, sector_num, buf, nb_sectors); }
1,714
1
add_one_setting (GHashTable *settings, NMConnection *connection, NMSetting *setting, GError **error) { GHashTable *secrets; g_return_val_if_fail (settings != NULL, FALSE); g_return_val_if_fail (connection != NULL, FALSE); g_return_val_if_fail (setting != NULL, FALSE); g_return_val_if_fail (error != NULL, FALSE); g_return_val_if_fail (*error == NULL, FALSE); utils_fill_connection_certs (connection); secrets = nm_setting_to_hash (setting); utils_clear_filled_connection_certs (connection); if (secrets) { g_hash_table_insert (settings, g_strdup (nm_setting_get_name (setting)), secrets); } else { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR, "%s.%d (%s): failed to hash setting '%s'.", __FILE__, __LINE__, __func__, nm_setting_get_name (setting)); } return secrets ? TRUE : FALSE; }
add_one_setting (GHashTable *settings, NMConnection *connection, NMSetting *setting, GError **error) { GHashTable *secrets; g_return_val_if_fail (settings != NULL, FALSE); g_return_val_if_fail (connection != NULL, FALSE); g_return_val_if_fail (setting != NULL, FALSE); g_return_val_if_fail (error != NULL, FALSE); g_return_val_if_fail (*error == NULL, FALSE); utils_fill_connection_certs (connection); secrets = nm_setting_to_hash (setting); utils_clear_filled_connection_certs (connection); if (secrets) { g_hash_table_insert (settings, g_strdup (nm_setting_get_name (setting)), secrets); } else { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR, "%s.%d (%s): failed to hash setting '%s'.", __FILE__, __LINE__, __func__, nm_setting_get_name (setting)); } return secrets ? TRUE : FALSE; }
1,715
0
TEST_F ( SSLErrorAssistantTest , DynamicInterstitialListOrganizationMismatch ) { ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ; EXPECT_EQ ( 1u , ssl_info ( ) . public_key_hashes . size ( ) ) ; auto config_proto = std : : make_unique < chrome_browser_ssl : : SSLErrorAssistantConfig > ( ) ; config_proto -> set_version_id ( kLargeVersionId ) ; chrome_browser_ssl : : DynamicInterstitial * filter = config_proto -> add_dynamic_interstitial ( ) ; filter -> set_interstitial_type ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_SSL ) ; filter -> set_cert_error ( chrome_browser_ssl : : DynamicInterstitial : : UNKNOWN_CERT_ERROR ) ; filter -> add_sha256_hash ( "sha256uthatch" ) ; filter -> add_sha256_hash ( ssl_info ( ) . public_key_hashes [ 0 ] . ToString ( ) ) ; filter -> add_sha256_hash ( "sha256/treecreeper" ) ; filter -> set_issuer_common_name_regex ( issuer_common_name ( ) ) ; filter -> set_issuer_organization_regex ( "beeeater" ) ; filter -> set_mitm_software_name ( "UwS" ) ; error_assistant ( ) -> SetErrorAssistantProto ( std : : move ( config_proto ) ) ; EXPECT_FALSE ( error_assistant ( ) -> MatchDynamicInterstitial ( ssl_info ( ) ) ) ; }
TEST_F ( SSLErrorAssistantTest , DynamicInterstitialListOrganizationMismatch ) { ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ; EXPECT_EQ ( 1u , ssl_info ( ) . public_key_hashes . size ( ) ) ; auto config_proto = std : : make_unique < chrome_browser_ssl : : SSLErrorAssistantConfig > ( ) ; config_proto -> set_version_id ( kLargeVersionId ) ; chrome_browser_ssl : : DynamicInterstitial * filter = config_proto -> add_dynamic_interstitial ( ) ; filter -> set_interstitial_type ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_SSL ) ; filter -> set_cert_error ( chrome_browser_ssl : : DynamicInterstitial : : UNKNOWN_CERT_ERROR ) ; filter -> add_sha256_hash ( "sha256uthatch" ) ; filter -> add_sha256_hash ( ssl_info ( ) . public_key_hashes [ 0 ] . ToString ( ) ) ; filter -> add_sha256_hash ( "sha256/treecreeper" ) ; filter -> set_issuer_common_name_regex ( issuer_common_name ( ) ) ; filter -> set_issuer_organization_regex ( "beeeater" ) ; filter -> set_mitm_software_name ( "UwS" ) ; error_assistant ( ) -> SetErrorAssistantProto ( std : : move ( config_proto ) ) ; EXPECT_FALSE ( error_assistant ( ) -> MatchDynamicInterstitial ( ssl_info ( ) ) ) ; }
1,716
0
static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen) { struct tftp_session *spt; int s, k; size_t prefix_len; char *req_fname; /* check if a session already exists and if so terminate it */ s = tftp_session_find(slirp, tp); if (s >= 0) { tftp_session_terminate(&slirp->tftp_sessions[s]); } s = tftp_session_allocate(slirp, tp); if (s < 0) { return; } spt = &slirp->tftp_sessions[s]; /* unspecifed prefix means service disabled */ if (!slirp->tftp_prefix) { tftp_send_error(spt, 2, "Access violation", tp); return; } /* skip header fields */ k = 0; pktlen -= ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp); /* prepend tftp_prefix */ prefix_len = strlen(slirp->tftp_prefix); spt->filename = qemu_malloc(prefix_len + TFTP_FILENAME_MAX + 2); memcpy(spt->filename, slirp->tftp_prefix, prefix_len); spt->filename[prefix_len] = '/'; /* get name */ req_fname = spt->filename + prefix_len + 1; while (1) { if (k >= TFTP_FILENAME_MAX || k >= pktlen) { tftp_send_error(spt, 2, "Access violation", tp); return; } req_fname[k] = (char)tp->x.tp_buf[k]; if (req_fname[k++] == '\0') { break; } } /* check mode */ if ((pktlen - k) < 6) { tftp_send_error(spt, 2, "Access violation", tp); return; } if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) { tftp_send_error(spt, 4, "Unsupported transfer mode", tp); return; } k += 6; /* skipping octet */ /* do sanity checks on the filename */ if (!strncmp(req_fname, "../", 3) || req_fname[strlen(req_fname) - 1] == '/' || strstr(req_fname, "/../")) { tftp_send_error(spt, 2, "Access violation", tp); return; } /* check if the file exists */ if (tftp_read_data(spt, 0, NULL, 0) < 0) { tftp_send_error(spt, 1, "File not found", tp); return; } if (tp->x.tp_buf[pktlen - 1] != 0) { tftp_send_error(spt, 2, "Access violation", tp); return; } while (k < pktlen) { const char *key, *value; key = (const char *)&tp->x.tp_buf[k]; k += strlen(key) + 1; if (k >= pktlen) { tftp_send_error(spt, 2, "Access violation", tp); return; } value = (const char *)&tp->x.tp_buf[k]; k += strlen(value) + 1; if (strcmp(key, "tsize") == 0) { int tsize = atoi(value); struct stat stat_p; if (tsize == 0) { if (stat(spt->filename, &stat_p) == 0) tsize = stat_p.st_size; else { tftp_send_error(spt, 1, "File not found", tp); return; } } tftp_send_oack(spt, "tsize", tsize, tp); return; } } tftp_send_data(spt, 1, tp); }
static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen) { struct tftp_session *spt; int s, k; size_t prefix_len; char *req_fname; s = tftp_session_find(slirp, tp); if (s >= 0) { tftp_session_terminate(&slirp->tftp_sessions[s]); } s = tftp_session_allocate(slirp, tp); if (s < 0) { return; } spt = &slirp->tftp_sessions[s]; if (!slirp->tftp_prefix) { tftp_send_error(spt, 2, "Access violation", tp); return; } k = 0; pktlen -= ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp); prefix_len = strlen(slirp->tftp_prefix); spt->filename = qemu_malloc(prefix_len + TFTP_FILENAME_MAX + 2); memcpy(spt->filename, slirp->tftp_prefix, prefix_len); spt->filename[prefix_len] = '/'; req_fname = spt->filename + prefix_len + 1; while (1) { if (k >= TFTP_FILENAME_MAX || k >= pktlen) { tftp_send_error(spt, 2, "Access violation", tp); return; } req_fname[k] = (char)tp->x.tp_buf[k]; if (req_fname[k++] == '\0') { break; } } if ((pktlen - k) < 6) { tftp_send_error(spt, 2, "Access violation", tp); return; } if (memcmp(&tp->x.tp_buf[k], "octet\0", 6) != 0) { tftp_send_error(spt, 4, "Unsupported transfer mode", tp); return; } k += 6; if (!strncmp(req_fname, "../", 3) || req_fname[strlen(req_fname) - 1] == '/' || strstr(req_fname, "/../")) { tftp_send_error(spt, 2, "Access violation", tp); return; } if (tftp_read_data(spt, 0, NULL, 0) < 0) { tftp_send_error(spt, 1, "File not found", tp); return; } if (tp->x.tp_buf[pktlen - 1] != 0) { tftp_send_error(spt, 2, "Access violation", tp); return; } while (k < pktlen) { const char *key, *value; key = (const char *)&tp->x.tp_buf[k]; k += strlen(key) + 1; if (k >= pktlen) { tftp_send_error(spt, 2, "Access violation", tp); return; } value = (const char *)&tp->x.tp_buf[k]; k += strlen(value) + 1; if (strcmp(key, "tsize") == 0) { int tsize = atoi(value); struct stat stat_p; if (tsize == 0) { if (stat(spt->filename, &stat_p) == 0) tsize = stat_p.st_size; else { tftp_send_error(spt, 1, "File not found", tp); return; } } tftp_send_oack(spt, "tsize", tsize, tp); return; } } tftp_send_data(spt, 1, tp); }
1,717
0
void inet_sock_destruct(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __skb_queue_purge(&sk->sk_receive_queue); __skb_queue_purge(&sk->sk_error_queue); sk_mem_reclaim(sk); if (sk->sk_type == SOCK_STREAM && sk->sk_state != TCP_CLOSE) { pr_err("Attempt to release TCP socket in state %d %p\n", sk->sk_state, sk); return; } if (!sock_flag(sk, SOCK_DEAD)) { pr_err("Attempt to release alive inet socket %p\n", sk); return; } WARN_ON(atomic_read(&sk->sk_rmem_alloc)); WARN_ON(atomic_read(&sk->sk_wmem_alloc)); WARN_ON(sk->sk_wmem_queued); WARN_ON(sk->sk_forward_alloc); kfree(rcu_dereference_protected(inet->inet_opt, 1)); dst_release(rcu_dereference_check(sk->sk_dst_cache, 1)); sk_refcnt_debug_dec(sk); }
void inet_sock_destruct(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); __skb_queue_purge(&sk->sk_receive_queue); __skb_queue_purge(&sk->sk_error_queue); sk_mem_reclaim(sk); if (sk->sk_type == SOCK_STREAM && sk->sk_state != TCP_CLOSE) { pr_err("Attempt to release TCP socket in state %d %p\n", sk->sk_state, sk); return; } if (!sock_flag(sk, SOCK_DEAD)) { pr_err("Attempt to release alive inet socket %p\n", sk); return; } WARN_ON(atomic_read(&sk->sk_rmem_alloc)); WARN_ON(atomic_read(&sk->sk_wmem_alloc)); WARN_ON(sk->sk_wmem_queued); WARN_ON(sk->sk_forward_alloc); kfree(rcu_dereference_protected(inet->inet_opt, 1)); dst_release(rcu_dereference_check(sk->sk_dst_cache, 1)); sk_refcnt_debug_dec(sk); }
1,718
1
int64_t MemFile::readImpl(char *buffer, int64_t length) { assertx(m_len != -1); assertx(length > 0); int64_t remaining = m_len - m_cursor; if (remaining < length) length = remaining; if (length > 0) { memcpy(buffer, (const void *)(m_data + m_cursor), length); } m_cursor += length; return length; }
int64_t MemFile::readImpl(char *buffer, int64_t length) { assertx(m_len != -1); assertx(length > 0); int64_t remaining = m_len - m_cursor; if (remaining < length) length = remaining; if (length > 0) { memcpy(buffer, (const void *)(m_data + m_cursor), length); } m_cursor += length; return length; }
1,719
1
static int cipso_v4_delopt(struct ip_options **opt_ptr) { int hdr_delta = 0; struct ip_options *opt = *opt_ptr; if (opt->srr || opt->rr || opt->ts || opt->router_alert) { u8 cipso_len; u8 cipso_off; unsigned char *cipso_ptr; int iter; int optlen_new; cipso_off = opt->cipso - sizeof(struct iphdr); cipso_ptr = &opt->__data[cipso_off]; cipso_len = cipso_ptr[1]; if (opt->srr > opt->cipso) opt->srr -= cipso_len; if (opt->rr > opt->cipso) opt->rr -= cipso_len; if (opt->ts > opt->cipso) opt->ts -= cipso_len; if (opt->router_alert > opt->cipso) opt->router_alert -= cipso_len; opt->cipso = 0; memmove(cipso_ptr, cipso_ptr + cipso_len, opt->optlen - cipso_off - cipso_len); /* determining the new total option length is tricky because of * the padding necessary, the only thing i can think to do at * this point is walk the options one-by-one, skipping the * padding at the end to determine the actual option size and * from there we can determine the new total option length */ iter = 0; optlen_new = 0; while (iter < opt->optlen) if (opt->__data[iter] != IPOPT_NOP) { iter += opt->__data[iter + 1]; optlen_new = iter; } else iter++; hdr_delta = opt->optlen; opt->optlen = (optlen_new + 3) & ~3; hdr_delta -= opt->optlen; } else { /* only the cipso option was present on the socket so we can * remove the entire option struct */ *opt_ptr = NULL; hdr_delta = opt->optlen; kfree(opt); } return hdr_delta; }
static int cipso_v4_delopt(struct ip_options **opt_ptr) { int hdr_delta = 0; struct ip_options *opt = *opt_ptr; if (opt->srr || opt->rr || opt->ts || opt->router_alert) { u8 cipso_len; u8 cipso_off; unsigned char *cipso_ptr; int iter; int optlen_new; cipso_off = opt->cipso - sizeof(struct iphdr); cipso_ptr = &opt->__data[cipso_off]; cipso_len = cipso_ptr[1]; if (opt->srr > opt->cipso) opt->srr -= cipso_len; if (opt->rr > opt->cipso) opt->rr -= cipso_len; if (opt->ts > opt->cipso) opt->ts -= cipso_len; if (opt->router_alert > opt->cipso) opt->router_alert -= cipso_len; opt->cipso = 0; memmove(cipso_ptr, cipso_ptr + cipso_len, opt->optlen - cipso_off - cipso_len); iter = 0; optlen_new = 0; while (iter < opt->optlen) if (opt->__data[iter] != IPOPT_NOP) { iter += opt->__data[iter + 1]; optlen_new = iter; } else iter++; hdr_delta = opt->optlen; opt->optlen = (optlen_new + 3) & ~3; hdr_delta -= opt->optlen; } else { *opt_ptr = NULL; hdr_delta = opt->optlen; kfree(opt); } return hdr_delta; }
1,721
1
get_settings (NMExportedConnection *exported) { NMConnection *connection; GHashTable *settings; connection = nm_exported_connection_get_connection (exported); utils_fill_connection_certs (connection); settings = nm_connection_to_hash (connection); utils_clear_filled_connection_certs (connection); return settings; }
get_settings (NMExportedConnection *exported) { NMConnection *connection; GHashTable *settings; connection = nm_exported_connection_get_connection (exported); utils_fill_connection_certs (connection); settings = nm_connection_to_hash (connection); utils_clear_filled_connection_certs (connection); return settings; }
1,722
0
int qemuMonitorTextCreateSnapshot ( qemuMonitorPtr mon , const char * name ) { char * cmd = NULL ; char * reply = NULL ; int ret = - 1 ; char * safename ; if ( ! ( safename = qemuMonitorEscapeArg ( name ) ) || virAsprintf ( & cmd , "savevm \"%s\"" , safename ) < 0 ) { virReportOOMError ( ) ; goto cleanup ; } if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to take snapshot using command '%s'" ) , cmd ) ; goto cleanup ; } if ( strstr ( reply , "Error while creating snapshot" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "Failed to take snapshot: %s" ) , reply ) ; goto cleanup ; } else if ( strstr ( reply , "No block device can accept snapshots" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_INVALID , "%s" , _ ( "this domain does not have a device to take snapshots" ) ) ; goto cleanup ; } else if ( strstr ( reply , "Could not open VM state file" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , reply ) ; goto cleanup ; } else if ( strstr ( reply , "Error" ) != NULL && strstr ( reply , "while writing VM" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , reply ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( safename ) ; VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; return ret ; }
int qemuMonitorTextCreateSnapshot ( qemuMonitorPtr mon , const char * name ) { char * cmd = NULL ; char * reply = NULL ; int ret = - 1 ; char * safename ; if ( ! ( safename = qemuMonitorEscapeArg ( name ) ) || virAsprintf ( & cmd , "savevm \"%s\"" , safename ) < 0 ) { virReportOOMError ( ) ; goto cleanup ; } if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to take snapshot using command '%s'" ) , cmd ) ; goto cleanup ; } if ( strstr ( reply , "Error while creating snapshot" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "Failed to take snapshot: %s" ) , reply ) ; goto cleanup ; } else if ( strstr ( reply , "No block device can accept snapshots" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_INVALID , "%s" , _ ( "this domain does not have a device to take snapshots" ) ) ; goto cleanup ; } else if ( strstr ( reply , "Could not open VM state file" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , reply ) ; goto cleanup ; } else if ( strstr ( reply , "Error" ) != NULL && strstr ( reply , "while writing VM" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , reply ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( safename ) ; VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; return ret ; }
1,723
1
bool MemFile::seek(int64_t offset, int whence /* = SEEK_SET */) { assertx(m_len != -1); if (whence == SEEK_CUR) { if (offset > 0 && offset < bufferedLen()) { setReadPosition(getReadPosition() + offset); setPosition(getPosition() + offset); return true; } offset += getPosition(); whence = SEEK_SET; } // invalidate the current buffer setWritePosition(0); setReadPosition(0); if (whence == SEEK_SET) { m_cursor = offset; } else { assertx(whence == SEEK_END); m_cursor = m_len + offset; } setPosition(m_cursor); return true; }
bool MemFile::seek(int64_t offset, int whence ) { assertx(m_len != -1); if (whence == SEEK_CUR) { if (offset > 0 && offset < bufferedLen()) { setReadPosition(getReadPosition() + offset); setPosition(getPosition() + offset); return true; } offset += getPosition(); whence = SEEK_SET; } setWritePosition(0); setReadPosition(0); if (whence == SEEK_SET) { m_cursor = offset; } else { assertx(whence == SEEK_END); m_cursor = m_len + offset; } setPosition(m_cursor); return true; }
1,724
0
bool MemFile::seek(int64_t offset, int whence /* = SEEK_SET */) { assertx(m_len != -1); if (whence == SEEK_CUR) { if (offset >= 0 && offset < bufferedLen()) { setReadPosition(getReadPosition() + offset); setPosition(getPosition() + offset); return true; } offset += getPosition(); whence = SEEK_SET; } // invalidate the current buffer setWritePosition(0); setReadPosition(0); if (whence == SEEK_SET) { if (offset < 0) return false; m_cursor = offset; } else if (whence == SEEK_END) { if (m_len + offset < 0) return false; m_cursor = m_len + offset; } else { return false; } setPosition(m_cursor); return true; }
bool MemFile::seek(int64_t offset, int whence ) { assertx(m_len != -1); if (whence == SEEK_CUR) { if (offset >= 0 && offset < bufferedLen()) { setReadPosition(getReadPosition() + offset); setPosition(getPosition() + offset); return true; } offset += getPosition(); whence = SEEK_SET; } setWritePosition(0); setReadPosition(0); if (whence == SEEK_SET) { if (offset < 0) return false; m_cursor = offset; } else if (whence == SEEK_END) { if (m_len + offset < 0) return false; m_cursor = m_len + offset; } else { return false; } setPosition(m_cursor); return true; }
1,725
1
static int hnm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; Hnm4VideoContext *hnm = avctx->priv_data; int ret; uint16_t chunk_id; if (avpkt->size < 8) { if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; chunk_id = AV_RL16(avpkt->data + 4); if (chunk_id == HNM4_CHUNK_ID_PL) { hnm_update_palette(avctx, avpkt->data, avpkt->size); frame->palette_has_changed = 1; } else if (chunk_id == HNM4_CHUNK_ID_IZ) { unpack_intraframe(avctx, avpkt->data + 12, avpkt->size - 12); memcpy(hnm->previous, hnm->current, hnm->width * hnm->height); if (hnm->version == 0x4a) memcpy(hnm->processed, hnm->current, hnm->width * hnm->height); else postprocess_current_frame(avctx); copy_processed_frame(avctx, frame); frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; memcpy(frame->data[1], hnm->palette, 256 * 4); *got_frame = 1; } else if (chunk_id == HNM4_CHUNK_ID_IU) { if (hnm->version == 0x4a) { decode_interframe_v4a(avctx, avpkt->data + 8, avpkt->size - 8); memcpy(hnm->processed, hnm->current, hnm->width * hnm->height); } else { decode_interframe_v4(avctx, avpkt->data + 8, avpkt->size - 8); postprocess_current_frame(avctx); copy_processed_frame(avctx, frame); frame->pict_type = AV_PICTURE_TYPE_P; frame->key_frame = 0; memcpy(frame->data[1], hnm->palette, 256 * 4); *got_frame = 1; hnm_flip_buffers(hnm); } else { av_log(avctx, AV_LOG_ERROR, "invalid chunk id: %d\n", chunk_id); return avpkt->size;
static int hnm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; Hnm4VideoContext *hnm = avctx->priv_data; int ret; uint16_t chunk_id; if (avpkt->size < 8) { if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; chunk_id = AV_RL16(avpkt->data + 4); if (chunk_id == HNM4_CHUNK_ID_PL) { hnm_update_palette(avctx, avpkt->data, avpkt->size); frame->palette_has_changed = 1; } else if (chunk_id == HNM4_CHUNK_ID_IZ) { unpack_intraframe(avctx, avpkt->data + 12, avpkt->size - 12); memcpy(hnm->previous, hnm->current, hnm->width * hnm->height); if (hnm->version == 0x4a) memcpy(hnm->processed, hnm->current, hnm->width * hnm->height); else postprocess_current_frame(avctx); copy_processed_frame(avctx, frame); frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; memcpy(frame->data[1], hnm->palette, 256 * 4); *got_frame = 1; } else if (chunk_id == HNM4_CHUNK_ID_IU) { if (hnm->version == 0x4a) { decode_interframe_v4a(avctx, avpkt->data + 8, avpkt->size - 8); memcpy(hnm->processed, hnm->current, hnm->width * hnm->height); } else { decode_interframe_v4(avctx, avpkt->data + 8, avpkt->size - 8); postprocess_current_frame(avctx); copy_processed_frame(avctx, frame); frame->pict_type = AV_PICTURE_TYPE_P; frame->key_frame = 0; memcpy(frame->data[1], hnm->palette, 256 * 4); *got_frame = 1; hnm_flip_buffers(hnm); } else { av_log(avctx, AV_LOG_ERROR, "invalid chunk id: %d\n", chunk_id); return avpkt->size;
1,726
0
static int cipso_v4_delopt(struct ip_options_rcu **opt_ptr) { int hdr_delta = 0; struct ip_options_rcu *opt = *opt_ptr; if (opt->opt.srr || opt->opt.rr || opt->opt.ts || opt->opt.router_alert) { u8 cipso_len; u8 cipso_off; unsigned char *cipso_ptr; int iter; int optlen_new; cipso_off = opt->opt.cipso - sizeof(struct iphdr); cipso_ptr = &opt->opt.__data[cipso_off]; cipso_len = cipso_ptr[1]; if (opt->opt.srr > opt->opt.cipso) opt->opt.srr -= cipso_len; if (opt->opt.rr > opt->opt.cipso) opt->opt.rr -= cipso_len; if (opt->opt.ts > opt->opt.cipso) opt->opt.ts -= cipso_len; if (opt->opt.router_alert > opt->opt.cipso) opt->opt.router_alert -= cipso_len; opt->opt.cipso = 0; memmove(cipso_ptr, cipso_ptr + cipso_len, opt->opt.optlen - cipso_off - cipso_len); /* determining the new total option length is tricky because of * the padding necessary, the only thing i can think to do at * this point is walk the options one-by-one, skipping the * padding at the end to determine the actual option size and * from there we can determine the new total option length */ iter = 0; optlen_new = 0; while (iter < opt->opt.optlen) if (opt->opt.__data[iter] != IPOPT_NOP) { iter += opt->opt.__data[iter + 1]; optlen_new = iter; } else iter++; hdr_delta = opt->opt.optlen; opt->opt.optlen = (optlen_new + 3) & ~3; hdr_delta -= opt->opt.optlen; } else { /* only the cipso option was present on the socket so we can * remove the entire option struct */ *opt_ptr = NULL; hdr_delta = opt->opt.optlen; call_rcu(&opt->rcu, opt_kfree_rcu); } return hdr_delta; }
static int cipso_v4_delopt(struct ip_options_rcu **opt_ptr) { int hdr_delta = 0; struct ip_options_rcu *opt = *opt_ptr; if (opt->opt.srr || opt->opt.rr || opt->opt.ts || opt->opt.router_alert) { u8 cipso_len; u8 cipso_off; unsigned char *cipso_ptr; int iter; int optlen_new; cipso_off = opt->opt.cipso - sizeof(struct iphdr); cipso_ptr = &opt->opt.__data[cipso_off]; cipso_len = cipso_ptr[1]; if (opt->opt.srr > opt->opt.cipso) opt->opt.srr -= cipso_len; if (opt->opt.rr > opt->opt.cipso) opt->opt.rr -= cipso_len; if (opt->opt.ts > opt->opt.cipso) opt->opt.ts -= cipso_len; if (opt->opt.router_alert > opt->opt.cipso) opt->opt.router_alert -= cipso_len; opt->opt.cipso = 0; memmove(cipso_ptr, cipso_ptr + cipso_len, opt->opt.optlen - cipso_off - cipso_len); iter = 0; optlen_new = 0; while (iter < opt->opt.optlen) if (opt->opt.__data[iter] != IPOPT_NOP) { iter += opt->opt.__data[iter + 1]; optlen_new = iter; } else iter++; hdr_delta = opt->opt.optlen; opt->opt.optlen = (optlen_new + 3) & ~3; hdr_delta -= opt->opt.optlen; } else { *opt_ptr = NULL; hdr_delta = opt->opt.optlen; call_rcu(&opt->rcu, opt_kfree_rcu); } return hdr_delta; }
1,727
1
constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { GObject *object; NMAGConfConnectionPrivate *priv; NMConnection *connection; GError *error = NULL; object = G_OBJECT_CLASS (nma_gconf_connection_parent_class)->constructor (type, n_construct_params, construct_params); if (!object) return NULL; priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object); if (!priv->client) { nm_warning ("GConfClient not provided."); goto err; } if (!priv->dir) { nm_warning ("GConf directory not provided."); goto err; } connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (object)); utils_fill_connection_certs (connection); if (!nm_connection_verify (connection, &error)) { utils_clear_filled_connection_certs (connection); g_warning ("Invalid connection: '%s' / '%s' invalid: %d", g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)), error->message, error->code); g_error_free (error); goto err; } utils_clear_filled_connection_certs (connection); fill_vpn_user_name (connection); return object; err: g_object_unref (object); return NULL; }
constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { GObject *object; NMAGConfConnectionPrivate *priv; NMConnection *connection; GError *error = NULL; object = G_OBJECT_CLASS (nma_gconf_connection_parent_class)->constructor (type, n_construct_params, construct_params); if (!object) return NULL; priv = NMA_GCONF_CONNECTION_GET_PRIVATE (object); if (!priv->client) { nm_warning ("GConfClient not provided."); goto err; } if (!priv->dir) { nm_warning ("GConf directory not provided."); goto err; } connection = nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (object)); utils_fill_connection_certs (connection); if (!nm_connection_verify (connection, &error)) { utils_clear_filled_connection_certs (connection); g_warning ("Invalid connection: '%s' / '%s' invalid: %d", g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)), error->message, error->code); g_error_free (error); goto err; } utils_clear_filled_connection_certs (connection); fill_vpn_user_name (connection); return object; err: g_object_unref (object); return NULL; }
1,729
1
void cipso_v4_req_delattr(struct request_sock *req) { struct ip_options *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->cipso == 0) return; cipso_v4_delopt(&req_inet->opt); }
void cipso_v4_req_delattr(struct request_sock *req) { struct ip_options *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->cipso == 0) return; cipso_v4_delopt(&req_inet->opt); }
1,731
1
static void super_block_uvrd ( const VP9_COMP * cpi , MACROBLOCK * x , int * rate , int64_t * distortion , int * skippable , int64_t * sse , BLOCK_SIZE bsize , int64_t ref_best_rd ) { MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] -> mbmi ; const TX_SIZE uv_tx_size = get_uv_tx_size ( mbmi , & xd -> plane [ 1 ] ) ; int plane ; int pnrate = 0 , pnskip = 1 ; int64_t pndist = 0 , pnsse = 0 ; if ( ref_best_rd < 0 ) goto term ; if ( is_inter_block ( mbmi ) ) { int plane ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) vp9_subtract_plane ( x , bsize , plane ) ; } * rate = 0 ; * distortion = 0 ; * sse = 0 ; * skippable = 1 ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) { txfm_rd_in_plane ( x , & pnrate , & pndist , & pnskip , & pnsse , ref_best_rd , plane , bsize , uv_tx_size , cpi -> sf . use_fast_coef_costing ) ; if ( pnrate == INT_MAX ) goto term ; * rate += pnrate ; * distortion += pndist ; * sse += pnsse ; * skippable &= pnskip ; } return ; term : * rate = INT_MAX ; * distortion = INT64_MAX ; * sse = INT64_MAX ; * skippable = 0 ; return ; }
static void super_block_uvrd ( const VP9_COMP * cpi , MACROBLOCK * x , int * rate , int64_t * distortion , int * skippable , int64_t * sse , BLOCK_SIZE bsize , int64_t ref_best_rd ) { MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] -> mbmi ; const TX_SIZE uv_tx_size = get_uv_tx_size ( mbmi , & xd -> plane [ 1 ] ) ; int plane ; int pnrate = 0 , pnskip = 1 ; int64_t pndist = 0 , pnsse = 0 ; if ( ref_best_rd < 0 ) goto term ; if ( is_inter_block ( mbmi ) ) { int plane ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) vp9_subtract_plane ( x , bsize , plane ) ; } * rate = 0 ; * distortion = 0 ; * sse = 0 ; * skippable = 1 ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) { txfm_rd_in_plane ( x , & pnrate , & pndist , & pnskip , & pnsse , ref_best_rd , plane , bsize , uv_tx_size , cpi -> sf . use_fast_coef_costing ) ; if ( pnrate == INT_MAX ) goto term ; * rate += pnrate ; * distortion += pndist ; * sse += pnsse ; * skippable &= pnskip ; } return ; term : * rate = INT_MAX ; * distortion = INT64_MAX ; * sse = INT64_MAX ; * skippable = 0 ; return ; }
1,733
1
nm_gconf_read_connection (GConfClient *client, const char *dir) { ReadFromGConfInfo info; GSList *list; GError *err = NULL; list = gconf_client_all_dirs (client, dir, &err); if (err) { g_warning ("Error while reading connection: %s", err->message); g_error_free (err); return NULL; } if (!list) { g_warning ("Invalid connection (empty)"); return NULL; } info.connection = nm_connection_new (); info.client = client; info.dir = dir; info.dir_len = strlen (dir); g_slist_foreach (list, read_one_setting, &info); g_slist_free (list); return info.connection; }
nm_gconf_read_connection (GConfClient *client, const char *dir) { ReadFromGConfInfo info; GSList *list; GError *err = NULL; list = gconf_client_all_dirs (client, dir, &err); if (err) { g_warning ("Error while reading connection: %s", err->message); g_error_free (err); return NULL; } if (!list) { g_warning ("Invalid connection (empty)"); return NULL; } info.connection = nm_connection_new (); info.client = client; info.dir = dir; info.dir_len = strlen (dir); g_slist_foreach (list, read_one_setting, &info); g_slist_free (list); return info.connection; }
1,734
0
void cipso_v4_req_delattr(struct request_sock *req) { struct ip_options_rcu *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->opt.cipso == 0) return; cipso_v4_delopt(&req_inet->opt); }
void cipso_v4_req_delattr(struct request_sock *req) { struct ip_options_rcu *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->opt.cipso == 0) return; cipso_v4_delopt(&req_inet->opt); }
1,735
1
inline void StringData::setSize(int len) { assertx(!isImmutable() && !hasMultipleRefs()); assertx(len >= 0 && len <= capacity()); mutableData()[len] = 0; m_lenAndHash = len; assertx(m_hash == 0); assertx(checkSane()); }
inline void StringData::setSize(int len) { assertx(!isImmutable() && !hasMultipleRefs()); assertx(len >= 0 && len <= capacity()); mutableData()[len] = 0; m_lenAndHash = len; assertx(m_hash == 0); assertx(checkSane()); }
1,737
1
static int fdctrl_connect_drives(FDCtrl *fdctrl) { unsigned int i; FDrive *drive; for (i = 0; i < MAX_FD; i++) { drive = &fdctrl->drives[i]; drive->fdctrl = fdctrl; if (drive->bs) { if (bdrv_get_on_error(drive->bs, 0) != BLOCK_ERR_STOP_ENOSPC) { error_report("fdc doesn't support drive option werror"); return -1; } if (bdrv_get_on_error(drive->bs, 1) != BLOCK_ERR_REPORT) { error_report("fdc doesn't support drive option rerror"); return -1; } } fd_init(drive); fd_revalidate(drive); if (drive->bs) { bdrv_set_dev_ops(drive->bs, &fdctrl_block_ops, drive); } } return 0; }
static int fdctrl_connect_drives(FDCtrl *fdctrl) { unsigned int i; FDrive *drive; for (i = 0; i < MAX_FD; i++) { drive = &fdctrl->drives[i]; drive->fdctrl = fdctrl; if (drive->bs) { if (bdrv_get_on_error(drive->bs, 0) != BLOCK_ERR_STOP_ENOSPC) { error_report("fdc doesn't support drive option werror"); return -1; } if (bdrv_get_on_error(drive->bs, 1) != BLOCK_ERR_REPORT) { error_report("fdc doesn't support drive option rerror"); return -1; } } fd_init(drive); fd_revalidate(drive); if (drive->bs) { bdrv_set_dev_ops(drive->bs, &fdctrl_block_ops, drive); } } return 0; }
1,738
0
static inline void write_IRQreg_ilr ( OpenPICState * opp , int n_IRQ , uint32_t val ) { if ( opp -> flags & OPENPIC_FLAG_ILR ) { IRQSource * src = & opp -> src [ n_IRQ ] ; src -> output = inttgt_to_output ( val & ILR_INTTGT_MASK ) ; DPRINTF ( "Set ILR %d to 0x%08x, output %d\n" , n_IRQ , src -> idr , src -> output ) ; } }
static inline void write_IRQreg_ilr ( OpenPICState * opp , int n_IRQ , uint32_t val ) { if ( opp -> flags & OPENPIC_FLAG_ILR ) { IRQSource * src = & opp -> src [ n_IRQ ] ; src -> output = inttgt_to_output ( val & ILR_INTTGT_MASK ) ; DPRINTF ( "Set ILR %d to 0x%08x, output %d\n" , n_IRQ , src -> idr , src -> output ) ; } }
1,739
0
inline void StringData::setSize(int64_t len) { assertx(!isImmutable() && !hasMultipleRefs()); assertx(len >= 0 && len <= capacity()); mutableData()[len] = 0; m_lenAndHash = len; assertx(m_hash == 0); assertx(checkSane()); }
inline void StringData::setSize(int64_t len) { assertx(!isImmutable() && !hasMultipleRefs()); assertx(len >= 0 && len <= capacity()); mutableData()[len] = 0; m_lenAndHash = len; assertx(m_hash == 0); assertx(checkSane()); }
1,740
1
static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, struct fw_iso_packet *packet, struct fw_iso_buffer *buffer, unsigned long payload) { struct iso_context *ctx = container_of(base, struct iso_context, base); struct db_descriptor *db = NULL; struct descriptor *d; struct fw_iso_packet *p; dma_addr_t d_bus, page_bus; u32 z, header_z, length, rest; int page, offset, packet_count, header_size; /* * FIXME: Cycle lost behavior should be configurable: lose * packet, retransmit or terminate.. */ p = packet; z = 2; /* * The OHCI controller puts the isochronous header and trailer in the * buffer, so we need at least 8 bytes. */ packet_count = p->header_length / ctx->base.header_size; header_size = packet_count * max(ctx->base.header_size, (size_t)8); /* Get header size in number of descriptors. */ header_z = DIV_ROUND_UP(header_size, sizeof(*d)); page = payload >> PAGE_SHIFT; offset = payload & ~PAGE_MASK; rest = p->payload_length; /* FIXME: make packet-per-buffer/dual-buffer a context option */ while (rest > 0) { d = context_get_descriptors(&ctx->context, z + header_z, &d_bus); if (d == NULL) return -ENOMEM; db = (struct db_descriptor *) d; db->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_BRANCH_ALWAYS); db->first_size = cpu_to_le16(max(ctx->base.header_size, (size_t)8)); if (p->skip && rest == p->payload_length) { db->control |= cpu_to_le16(DESCRIPTOR_WAIT); db->first_req_count = db->first_size; } else { db->first_req_count = cpu_to_le16(header_size); } db->first_res_count = db->first_req_count; db->first_buffer = cpu_to_le32(d_bus + sizeof(*db)); if (p->skip && rest == p->payload_length) length = 4; else if (offset + rest < PAGE_SIZE) length = rest; else length = PAGE_SIZE - offset; db->second_req_count = cpu_to_le16(length); db->second_res_count = db->second_req_count; page_bus = page_private(buffer->pages[page]); db->second_buffer = cpu_to_le32(page_bus + offset); if (p->interrupt && length == rest) db->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS); context_append(&ctx->context, d, z, header_z); offset = (offset + length) & ~PAGE_MASK; rest -= length; if (offset == 0) page++; } return 0; }
static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, struct fw_iso_packet *packet, struct fw_iso_buffer *buffer, unsigned long payload) { struct iso_context *ctx = container_of(base, struct iso_context, base); struct db_descriptor *db = NULL; struct descriptor *d; struct fw_iso_packet *p; dma_addr_t d_bus, page_bus; u32 z, header_z, length, rest; int page, offset, packet_count, header_size; p = packet; z = 2; packet_count = p->header_length / ctx->base.header_size; header_size = packet_count * max(ctx->base.header_size, (size_t)8); header_z = DIV_ROUND_UP(header_size, sizeof(*d)); page = payload >> PAGE_SHIFT; offset = payload & ~PAGE_MASK; rest = p->payload_length; while (rest > 0) { d = context_get_descriptors(&ctx->context, z + header_z, &d_bus); if (d == NULL) return -ENOMEM; db = (struct db_descriptor *) d; db->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_BRANCH_ALWAYS); db->first_size = cpu_to_le16(max(ctx->base.header_size, (size_t)8)); if (p->skip && rest == p->payload_length) { db->control |= cpu_to_le16(DESCRIPTOR_WAIT); db->first_req_count = db->first_size; } else { db->first_req_count = cpu_to_le16(header_size); } db->first_res_count = db->first_req_count; db->first_buffer = cpu_to_le32(d_bus + sizeof(*db)); if (p->skip && rest == p->payload_length) length = 4; else if (offset + rest < PAGE_SIZE) length = rest; else length = PAGE_SIZE - offset; db->second_req_count = cpu_to_le16(length); db->second_res_count = db->second_req_count; page_bus = page_private(buffer->pages[page]); db->second_buffer = cpu_to_le32(page_bus + offset); if (p->interrupt && length == rest) db->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS); context_append(&ctx->context, d, z, header_z); offset = (offset + length) & ~PAGE_MASK; rest -= length; if (offset == 0) page++; } return 0; }
1,741
0
int vp9_rc_clamp_pframe_target_size ( const VP9_COMP * const cpi , int target ) { const RATE_CONTROL * rc = & cpi -> rc ; const int min_frame_target = MAX ( rc -> min_frame_bandwidth , rc -> avg_frame_bandwidth >> 5 ) ; if ( target < min_frame_target ) target = min_frame_target ; if ( cpi -> refresh_golden_frame && rc -> is_src_frame_alt_ref ) { target = min_frame_target ; } if ( target > rc -> max_frame_bandwidth ) target = rc -> max_frame_bandwidth ; return target ; }
int vp9_rc_clamp_pframe_target_size ( const VP9_COMP * const cpi , int target ) { const RATE_CONTROL * rc = & cpi -> rc ; const int min_frame_target = MAX ( rc -> min_frame_bandwidth , rc -> avg_frame_bandwidth >> 5 ) ; if ( target < min_frame_target ) target = min_frame_target ; if ( cpi -> refresh_golden_frame && rc -> is_src_frame_alt_ref ) { target = min_frame_target ; } if ( target > rc -> max_frame_bandwidth ) target = rc -> max_frame_bandwidth ; return target ; }
1,743
1
int cipso_v4_req_setattr(struct request_sock *req, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options *opt = NULL; struct inet_request_sock *req_inet; /* We allocate the maximum CIPSO option size here so we are probably * being a little wasteful, but it makes our life _much_ easier later * on and after all we are only talking about 40 bytes. */ buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto req_setattr_failure; buf_len = ret_val; /* We can't use ip_options_get() directly because it makes a call to * ip_options_get_alloc() which allocates memory with GFP_KERNEL and * we won't always have CAP_NET_RAW even though we _always_ want to * set the IPOPT_CIPSO option. */ opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } memcpy(opt->__data, buf, buf_len); opt->optlen = opt_len; opt->cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; req_inet = inet_rsk(req); opt = xchg(&req_inet->opt, opt); kfree(opt); return 0; req_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
int cipso_v4_req_setattr(struct request_sock *req, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options *opt = NULL; struct inet_request_sock *req_inet; buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto req_setattr_failure; buf_len = ret_val; opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } memcpy(opt->__data, buf, buf_len); opt->optlen = opt_len; opt->cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; req_inet = inet_rsk(req); opt = xchg(&req_inet->opt, opt); kfree(opt); return 0; req_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
1,744
1
static bool use_goto_tb(DisasContext *ctx, target_ulong dest) { /* Suppress goto_tb in the case of single-steping and IO. */ if ((ctx->base.tb->cflags & CF_LAST_IO) || ctx->base.singlestep_enabled) { return false; } return true; }
static bool use_goto_tb(DisasContext *ctx, target_ulong dest) { if ((ctx->base.tb->cflags & CF_LAST_IO) || ctx->base.singlestep_enabled) { return false; } return true; }
1,745
1
static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, struct fw_iso_packet *packet, struct fw_iso_buffer *buffer, unsigned long payload) { struct iso_context *ctx = container_of(base, struct iso_context, base); struct descriptor *d = NULL, *pd = NULL; struct fw_iso_packet *p = packet; dma_addr_t d_bus, page_bus; u32 z, header_z, rest; int i, j, length; int page, offset, packet_count, header_size, payload_per_buffer; /* * The OHCI controller puts the isochronous header and trailer in the * buffer, so we need at least 8 bytes. */ packet_count = p->header_length / ctx->base.header_size; header_size = max(ctx->base.header_size, (size_t)8); /* Get header size in number of descriptors. */ header_z = DIV_ROUND_UP(header_size, sizeof(*d)); page = payload >> PAGE_SHIFT; offset = payload & ~PAGE_MASK; payload_per_buffer = p->payload_length / packet_count; for (i = 0; i < packet_count; i++) { /* d points to the header descriptor */ z = DIV_ROUND_UP(payload_per_buffer + offset, PAGE_SIZE) + 1; d = context_get_descriptors(&ctx->context, z + header_z, &d_bus); if (d == NULL) return -ENOMEM; d->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_MORE); if (p->skip && i == 0) d->control |= cpu_to_le16(DESCRIPTOR_WAIT); d->req_count = cpu_to_le16(header_size); d->res_count = d->req_count; d->transfer_status = 0; d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d))); rest = payload_per_buffer; for (j = 1; j < z; j++) { pd = d + j; pd->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_MORE); if (offset + rest < PAGE_SIZE) length = rest; else length = PAGE_SIZE - offset; pd->req_count = cpu_to_le16(length); pd->res_count = pd->req_count; pd->transfer_status = 0; page_bus = page_private(buffer->pages[page]); pd->data_address = cpu_to_le32(page_bus + offset); offset = (offset + length) & ~PAGE_MASK; rest -= length; if (offset == 0) page++; } pd->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_LAST | DESCRIPTOR_BRANCH_ALWAYS); if (p->interrupt && i == packet_count - 1) pd->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS); context_append(&ctx->context, d, z, header_z); } return 0; }
static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base, struct fw_iso_packet *packet, struct fw_iso_buffer *buffer, unsigned long payload) { struct iso_context *ctx = container_of(base, struct iso_context, base); struct descriptor *d = NULL, *pd = NULL; struct fw_iso_packet *p = packet; dma_addr_t d_bus, page_bus; u32 z, header_z, rest; int i, j, length; int page, offset, packet_count, header_size, payload_per_buffer; packet_count = p->header_length / ctx->base.header_size; header_size = max(ctx->base.header_size, (size_t)8); header_z = DIV_ROUND_UP(header_size, sizeof(*d)); page = payload >> PAGE_SHIFT; offset = payload & ~PAGE_MASK; payload_per_buffer = p->payload_length / packet_count; for (i = 0; i < packet_count; i++) { z = DIV_ROUND_UP(payload_per_buffer + offset, PAGE_SIZE) + 1; d = context_get_descriptors(&ctx->context, z + header_z, &d_bus); if (d == NULL) return -ENOMEM; d->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_MORE); if (p->skip && i == 0) d->control |= cpu_to_le16(DESCRIPTOR_WAIT); d->req_count = cpu_to_le16(header_size); d->res_count = d->req_count; d->transfer_status = 0; d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d))); rest = payload_per_buffer; for (j = 1; j < z; j++) { pd = d + j; pd->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_MORE); if (offset + rest < PAGE_SIZE) length = rest; else length = PAGE_SIZE - offset; pd->req_count = cpu_to_le16(length); pd->res_count = pd->req_count; pd->transfer_status = 0; page_bus = page_private(buffer->pages[page]); pd->data_address = cpu_to_le32(page_bus + offset); offset = (offset + length) & ~PAGE_MASK; rest -= length; if (offset == 0) page++; } pd->control = cpu_to_le16(DESCRIPTOR_STATUS | DESCRIPTOR_INPUT_LAST | DESCRIPTOR_BRANCH_ALWAYS); if (p->interrupt && i == packet_count - 1) pd->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS); context_append(&ctx->context, d, z, header_z); } return 0; }
1,746
1
inline int StringData::size() const { return m_len; }
inline int StringData::size() const { return m_len; }
1,747
0
int cipso_v4_req_setattr(struct request_sock *req, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options_rcu *opt = NULL; struct inet_request_sock *req_inet; /* We allocate the maximum CIPSO option size here so we are probably * being a little wasteful, but it makes our life _much_ easier later * on and after all we are only talking about 40 bytes. */ buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto req_setattr_failure; buf_len = ret_val; /* We can't use ip_options_get() directly because it makes a call to * ip_options_get_alloc() which allocates memory with GFP_KERNEL and * we won't always have CAP_NET_RAW even though we _always_ want to * set the IPOPT_CIPSO option. */ opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } memcpy(opt->opt.__data, buf, buf_len); opt->opt.optlen = opt_len; opt->opt.cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; req_inet = inet_rsk(req); opt = xchg(&req_inet->opt, opt); if (opt) call_rcu(&opt->rcu, opt_kfree_rcu); return 0; req_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
int cipso_v4_req_setattr(struct request_sock *req, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options_rcu *opt = NULL; struct inet_request_sock *req_inet; buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto req_setattr_failure; buf_len = ret_val; opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto req_setattr_failure; } memcpy(opt->opt.__data, buf, buf_len); opt->opt.optlen = opt_len; opt->opt.cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; req_inet = inet_rsk(req); opt = xchg(&req_inet->opt, opt); if (opt) call_rcu(&opt->rcu, opt_kfree_rcu); return 0; req_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
1,748
0
static int selinux_file_ioctl ( struct file * file , unsigned int cmd , unsigned long arg ) { const struct cred * cred = current_cred ( ) ; int error = 0 ; switch ( cmd ) { case FIONREAD : case FIBMAP : case FIGETBSZ : case FS_IOC_GETFLAGS : case FS_IOC_GETVERSION : error = file_has_perm ( cred , file , FILE__GETATTR ) ; break ; case FS_IOC_SETFLAGS : case FS_IOC_SETVERSION : error = file_has_perm ( cred , file , FILE__SETATTR ) ; break ; case FIONBIO : case FIOASYNC : error = file_has_perm ( cred , file , 0 ) ; break ; case KDSKBENT : case KDSKBSENT : error = cred_has_capability ( cred , CAP_SYS_TTY_CONFIG , SECURITY_CAP_AUDIT , true ) ; break ; default : error = ioctl_has_perm ( cred , file , FILE__IOCTL , ( u16 ) cmd ) ; } return error ; }
static int selinux_file_ioctl ( struct file * file , unsigned int cmd , unsigned long arg ) { const struct cred * cred = current_cred ( ) ; int error = 0 ; switch ( cmd ) { case FIONREAD : case FIBMAP : case FIGETBSZ : case FS_IOC_GETFLAGS : case FS_IOC_GETVERSION : error = file_has_perm ( cred , file , FILE__GETATTR ) ; break ; case FS_IOC_SETFLAGS : case FS_IOC_SETVERSION : error = file_has_perm ( cred , file , FILE__SETATTR ) ; break ; case FIONBIO : case FIOASYNC : error = file_has_perm ( cred , file , 0 ) ; break ; case KDSKBENT : case KDSKBSENT : error = cred_has_capability ( cred , CAP_SYS_TTY_CONFIG , SECURITY_CAP_AUDIT , true ) ; break ; default : error = ioctl_has_perm ( cred , file , FILE__IOCTL , ( u16 ) cmd ) ; } return error ; }
1,749
1
QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input) { QEMUBuffer *s; if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != '\0') { error_report("qemu_bufopen: Argument validity check failed"); return NULL; } s = g_malloc0(sizeof(QEMUBuffer)); if (mode[0] == 'r') { s->qsb = input; } if (s->qsb == NULL) { s->qsb = qsb_create(NULL, 0); } if (!s->qsb) { g_free(s); error_report("qemu_bufopen: qsb_create failed"); return NULL; } if (mode[0] == 'r') { s->file = qemu_fopen_ops(s, &buf_read_ops); } else { s->file = qemu_fopen_ops(s, &buf_write_ops); } return s->file; }
QEMUFile *qemu_bufopen(const char *mode, QEMUSizedBuffer *input) { QEMUBuffer *s; if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != '\0') { error_report("qemu_bufopen: Argument validity check failed"); return NULL; } s = g_malloc0(sizeof(QEMUBuffer)); if (mode[0] == 'r') { s->qsb = input; } if (s->qsb == NULL) { s->qsb = qsb_create(NULL, 0); } if (!s->qsb) { g_free(s); error_report("qemu_bufopen: qsb_create failed"); return NULL; } if (mode[0] == 'r') { s->file = qemu_fopen_ops(s, &buf_read_ops); } else { s->file = qemu_fopen_ops(s, &buf_write_ops); } return s->file; }
1,750
0
static void decode_zcl_ota_req_time ( gchar * s , guint32 value ) { if ( value == ZBEE_ZCL_OTA_TIME_WAIT ) { g_snprintf ( s , ITEM_LABEL_LENGTH , "Wrong Value" ) ; } else { gchar * tmp = time_secs_to_str ( NULL , value ) ; g_snprintf ( s , ITEM_LABEL_LENGTH , "%s from now" , tmp ) ; wmem_free ( NULL , tmp ) ; } return ; }
static void decode_zcl_ota_req_time ( gchar * s , guint32 value ) { if ( value == ZBEE_ZCL_OTA_TIME_WAIT ) { g_snprintf ( s , ITEM_LABEL_LENGTH , "Wrong Value" ) ; } else { gchar * tmp = time_secs_to_str ( NULL , value ) ; g_snprintf ( s , ITEM_LABEL_LENGTH , "%s from now" , tmp ) ; wmem_free ( NULL , tmp ) ; } return ; }
1,751
0
inline int64_t StringData::size() const { return m_len; }
inline int64_t StringData::size() const { return m_len; }
1,752
1
void cipso_v4_sock_delattr(struct sock *sk) { int hdr_delta; struct ip_options *opt; struct inet_sock *sk_inet; sk_inet = inet_sk(sk); opt = sk_inet->opt; if (opt == NULL || opt->cipso == 0) return; hdr_delta = cipso_v4_delopt(&sk_inet->opt); if (sk_inet->is_icsk && hdr_delta > 0) { struct inet_connection_sock *sk_conn = inet_csk(sk); sk_conn->icsk_ext_hdr_len -= hdr_delta; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } }
void cipso_v4_sock_delattr(struct sock *sk) { int hdr_delta; struct ip_options *opt; struct inet_sock *sk_inet; sk_inet = inet_sk(sk); opt = sk_inet->opt; if (opt == NULL || opt->cipso == 0) return; hdr_delta = cipso_v4_delopt(&sk_inet->opt); if (sk_inet->is_icsk && hdr_delta > 0) { struct inet_connection_sock *sk_conn = inet_csk(sk); sk_conn->icsk_ext_hdr_len -= hdr_delta; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } }
1,754
1
link_info_done (NautilusDirectory *directory, NautilusFile *file, const char *uri, const char *name, const char *icon, gboolean is_launcher, gboolean is_foreign) { file->details->link_info_is_up_to_date = TRUE; nautilus_file_set_display_name (file, name, name, TRUE); file->details->got_link_info = TRUE; g_free (file->details->custom_icon); if (uri) { if (file->details->activation_location) { g_object_unref (file->details->activation_location); file->details->activation_location = NULL; } file->details->got_custom_activation_location = TRUE; file->details->activation_location = g_file_new_for_uri (uri); } file->details->custom_icon = g_strdup (icon); file->details->is_launcher = is_launcher; file->details->is_foreign_link = is_foreign; nautilus_directory_async_state_changed (directory); }
link_info_done (NautilusDirectory *directory, NautilusFile *file, const char *uri, const char *name, const char *icon, gboolean is_launcher, gboolean is_foreign) { file->details->link_info_is_up_to_date = TRUE; nautilus_file_set_display_name (file, name, name, TRUE); file->details->got_link_info = TRUE; g_free (file->details->custom_icon); if (uri) { if (file->details->activation_location) { g_object_unref (file->details->activation_location); file->details->activation_location = NULL; } file->details->got_custom_activation_location = TRUE; file->details->activation_location = g_file_new_for_uri (uri); } file->details->custom_icon = g_strdup (icon); file->details->is_launcher = is_launcher; file->details->is_foreign_link = is_foreign; nautilus_directory_async_state_changed (directory); }
1,757
0
int64_t length() const { return m_str ? m_str->size() : 0; }
int64_t length() const { return m_str ? m_str->size() : 0; }
1,761
0
inline static bool is_localhost ( const char * name , int len ) { static const char local [ ] = "127.0.0.1" ; return ( len == ( sizeof ( local ) - 1 ) ) && ( memcmp ( name , local , len ) == 0 ) ; }
inline static bool is_localhost ( const char * name , int len ) { static const char local [ ] = "127.0.0.1" ; return ( len == ( sizeof ( local ) - 1 ) ) && ( memcmp ( name , local , len ) == 0 ) ; }
1,763
1
const String& setSize(int len) { assertx(m_str); m_str->setSize(len); return *this; }
const String& setSize(int len) { assertx(m_str); m_str->setSize(len); return *this; }
1,765
1
activate_files (ActivateParameters *parameters) { NautilusWindowInfo *window_info; NautilusWindowOpenFlags flags; NautilusFile *file; GList *launch_desktop_files; GList *launch_files; GList *launch_in_terminal_files; GList *open_in_app_files; GList *open_in_app_parameters; GList *unhandled_open_in_app_files; ApplicationLaunchParameters *one_parameters; GList *open_in_view_files; GList *l; int count; char *uri; char *executable_path, *quoted_path, *name; char *old_working_dir; ActivationAction action; GdkScreen *screen; screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); launch_desktop_files = NULL; launch_files = NULL; launch_in_terminal_files = NULL; open_in_app_files = NULL; open_in_view_files = NULL; for (l = parameters->files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); if (file_was_cancelled (file)) { continue; } action = get_activation_action (file); if (action == ACTIVATION_ACTION_ASK) { /* Special case for executable text files, since it might be * dangerous & unexpected to launch these. */ pause_activation_timed_cancel (parameters); action = get_executable_text_file_action (parameters->parent_window, file); unpause_activation_timed_cancel (parameters); } switch (action) { case ACTIVATION_ACTION_LAUNCH_DESKTOP_FILE : launch_desktop_files = g_list_prepend (launch_desktop_files, file); break; case ACTIVATION_ACTION_LAUNCH : launch_files = g_list_prepend (launch_files, file); break; case ACTIVATION_ACTION_LAUNCH_IN_TERMINAL : launch_in_terminal_files = g_list_prepend (launch_in_terminal_files, file); break; case ACTIVATION_ACTION_OPEN_IN_VIEW : open_in_view_files = g_list_prepend (open_in_view_files, file); break; case ACTIVATION_ACTION_OPEN_IN_APPLICATION : open_in_app_files = g_list_prepend (open_in_app_files, file); break; case ACTIVATION_ACTION_DO_NOTHING : break; case ACTIVATION_ACTION_ASK : g_assert_not_reached (); break; } } launch_desktop_files = g_list_reverse (launch_desktop_files); for (l = launch_desktop_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_uri (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); } old_working_dir = NULL; if (parameters->activation_directory && (launch_files != NULL || launch_in_terminal_files != NULL)) { old_working_dir = g_get_current_dir (); g_chdir (parameters->activation_directory); } launch_files = g_list_reverse (launch_files); for (l = launch_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); executable_path = g_filename_from_uri (uri, NULL, NULL); quoted_path = g_shell_quote (executable_path); name = nautilus_file_get_name (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_file window=%p: %s", parameters->parent_window, quoted_path); nautilus_launch_application_from_command (screen, name, quoted_path, FALSE, NULL); g_free (name); g_free (quoted_path); g_free (executable_path); g_free (uri); } launch_in_terminal_files = g_list_reverse (launch_in_terminal_files); for (l = launch_in_terminal_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); executable_path = g_filename_from_uri (uri, NULL, NULL); quoted_path = g_shell_quote (executable_path); name = nautilus_file_get_name (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_in_terminal window=%p: %s", parameters->parent_window, quoted_path); nautilus_launch_application_from_command (screen, name, quoted_path, TRUE, NULL); g_free (name); g_free (quoted_path); g_free (executable_path); g_free (uri); } if (old_working_dir != NULL) { g_chdir (old_working_dir); g_free (old_working_dir); } open_in_view_files = g_list_reverse (open_in_view_files); count = g_list_length (open_in_view_files); flags = parameters->flags; if (count > 1) { if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ENABLE_TABS) && (parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) { flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB; } else { flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW; } } if (parameters->slot_info != NULL && (!parameters->user_confirmation || confirm_multiple_windows (parameters->parent_window, count, (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0))) { if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0 && eel_preferences_get_enum (NAUTILUS_PREFERENCES_NEW_TAB_POSITION) == NAUTILUS_NEW_TAB_POSITION_AFTER_CURRENT_TAB) { /* When inserting N tabs after the current one, * we first open tab N, then tab N-1, ..., then tab 0. * Each of them is appended to the current tab, i.e. * prepended to the list of tabs to open. */ open_in_view_files = g_list_reverse (open_in_view_files); } for (l = open_in_view_files; l != NULL; l = l->next) { GFile *f; /* The ui should ask for navigation or object windows * depending on what the current one is */ file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); f = g_file_new_for_uri (uri); nautilus_window_slot_info_open_location (parameters->slot_info, f, parameters->mode, flags, NULL); g_object_unref (f); g_free (uri); } } open_in_app_parameters = NULL; unhandled_open_in_app_files = NULL; if (open_in_app_files != NULL) { open_in_app_files = g_list_reverse (open_in_app_files); open_in_app_parameters = fm_directory_view_make_activation_parameters (open_in_app_files, &unhandled_open_in_app_files); } for (l = open_in_app_parameters; l != NULL; l = l->next) { one_parameters = l->data; nautilus_launch_application (one_parameters->application, one_parameters->files, parameters->parent_window); application_launch_parameters_free (one_parameters); } for (l = unhandled_open_in_app_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); /* this does not block */ application_unhandled_file (parameters, file); } window_info = NULL; if (parameters->slot_info != NULL) { window_info = nautilus_window_slot_info_get_window (parameters->slot_info); } if (open_in_app_parameters != NULL || unhandled_open_in_app_files != NULL) { if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0 && window_info != NULL && nautilus_window_info_get_window_type (window_info) == NAUTILUS_WINDOW_SPATIAL) { nautilus_window_info_close (window_info); } } g_list_free (launch_desktop_files); g_list_free (launch_files); g_list_free (launch_in_terminal_files); g_list_free (open_in_view_files); g_list_free (open_in_app_files); g_list_free (open_in_app_parameters); g_list_free (unhandled_open_in_app_files); activation_parameters_free (parameters); }
activate_files (ActivateParameters *parameters) { NautilusWindowInfo *window_info; NautilusWindowOpenFlags flags; NautilusFile *file; GList *launch_desktop_files; GList *launch_files; GList *launch_in_terminal_files; GList *open_in_app_files; GList *open_in_app_parameters; GList *unhandled_open_in_app_files; ApplicationLaunchParameters *one_parameters; GList *open_in_view_files; GList *l; int count; char *uri; char *executable_path, *quoted_path, *name; char *old_working_dir; ActivationAction action; GdkScreen *screen; screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); launch_desktop_files = NULL; launch_files = NULL; launch_in_terminal_files = NULL; open_in_app_files = NULL; open_in_view_files = NULL; for (l = parameters->files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); if (file_was_cancelled (file)) { continue; } action = get_activation_action (file); if (action == ACTIVATION_ACTION_ASK) { pause_activation_timed_cancel (parameters); action = get_executable_text_file_action (parameters->parent_window, file); unpause_activation_timed_cancel (parameters); } switch (action) { case ACTIVATION_ACTION_LAUNCH_DESKTOP_FILE : launch_desktop_files = g_list_prepend (launch_desktop_files, file); break; case ACTIVATION_ACTION_LAUNCH : launch_files = g_list_prepend (launch_files, file); break; case ACTIVATION_ACTION_LAUNCH_IN_TERMINAL : launch_in_terminal_files = g_list_prepend (launch_in_terminal_files, file); break; case ACTIVATION_ACTION_OPEN_IN_VIEW : open_in_view_files = g_list_prepend (open_in_view_files, file); break; case ACTIVATION_ACTION_OPEN_IN_APPLICATION : open_in_app_files = g_list_prepend (open_in_app_files, file); break; case ACTIVATION_ACTION_DO_NOTHING : break; case ACTIVATION_ACTION_ASK : g_assert_not_reached (); break; } } launch_desktop_files = g_list_reverse (launch_desktop_files); for (l = launch_desktop_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_uri (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); } old_working_dir = NULL; if (parameters->activation_directory && (launch_files != NULL || launch_in_terminal_files != NULL)) { old_working_dir = g_get_current_dir (); g_chdir (parameters->activation_directory); } launch_files = g_list_reverse (launch_files); for (l = launch_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); executable_path = g_filename_from_uri (uri, NULL, NULL); quoted_path = g_shell_quote (executable_path); name = nautilus_file_get_name (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_file window=%p: %s", parameters->parent_window, quoted_path); nautilus_launch_application_from_command (screen, name, quoted_path, FALSE, NULL); g_free (name); g_free (quoted_path); g_free (executable_path); g_free (uri); } launch_in_terminal_files = g_list_reverse (launch_in_terminal_files); for (l = launch_in_terminal_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); executable_path = g_filename_from_uri (uri, NULL, NULL); quoted_path = g_shell_quote (executable_path); name = nautilus_file_get_name (file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_in_terminal window=%p: %s", parameters->parent_window, quoted_path); nautilus_launch_application_from_command (screen, name, quoted_path, TRUE, NULL); g_free (name); g_free (quoted_path); g_free (executable_path); g_free (uri); } if (old_working_dir != NULL) { g_chdir (old_working_dir); g_free (old_working_dir); } open_in_view_files = g_list_reverse (open_in_view_files); count = g_list_length (open_in_view_files); flags = parameters->flags; if (count > 1) { if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ENABLE_TABS) && (parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) { flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB; } else { flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW; } } if (parameters->slot_info != NULL && (!parameters->user_confirmation || confirm_multiple_windows (parameters->parent_window, count, (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0))) { if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0 && eel_preferences_get_enum (NAUTILUS_PREFERENCES_NEW_TAB_POSITION) == NAUTILUS_NEW_TAB_POSITION_AFTER_CURRENT_TAB) { open_in_view_files = g_list_reverse (open_in_view_files); } for (l = open_in_view_files; l != NULL; l = l->next) { GFile *f; file = NAUTILUS_FILE (l->data); uri = nautilus_file_get_activation_uri (file); f = g_file_new_for_uri (uri); nautilus_window_slot_info_open_location (parameters->slot_info, f, parameters->mode, flags, NULL); g_object_unref (f); g_free (uri); } } open_in_app_parameters = NULL; unhandled_open_in_app_files = NULL; if (open_in_app_files != NULL) { open_in_app_files = g_list_reverse (open_in_app_files); open_in_app_parameters = fm_directory_view_make_activation_parameters (open_in_app_files, &unhandled_open_in_app_files); } for (l = open_in_app_parameters; l != NULL; l = l->next) { one_parameters = l->data; nautilus_launch_application (one_parameters->application, one_parameters->files, parameters->parent_window); application_launch_parameters_free (one_parameters); } for (l = unhandled_open_in_app_files; l != NULL; l = l->next) { file = NAUTILUS_FILE (l->data); application_unhandled_file (parameters, file); } window_info = NULL; if (parameters->slot_info != NULL) { window_info = nautilus_window_slot_info_get_window (parameters->slot_info); } if (open_in_app_parameters != NULL || unhandled_open_in_app_files != NULL) { if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0 && window_info != NULL && nautilus_window_info_get_window_type (window_info) == NAUTILUS_WINDOW_SPATIAL) { nautilus_window_info_close (window_info); } } g_list_free (launch_desktop_files); g_list_free (launch_files); g_list_free (launch_in_terminal_files); g_list_free (open_in_view_files); g_list_free (open_in_app_files); g_list_free (open_in_app_parameters); g_list_free (unhandled_open_in_app_files); activation_parameters_free (parameters); }
1,766
0
static my_bool get_one_option ( int optid , const struct my_option * opt , char * argument ) { switch ( optid ) { case '#' : # ifndef DBUG_OFF DBUG_PUSH ( argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace" ) ; debug_check_flag = 1 ; debug_info_flag = 1 ; # endif break ; case 'r' : record = 1 ; break ; case 'x' : { char buff [ FN_REFLEN ] ; if ( ! test_if_hard_path ( argument ) ) { strxmov ( buff , opt_basedir , argument , NullS ) ; argument = buff ; } fn_format ( buff , argument , "" , "" , MY_UNPACK_FILENAME ) ; DBUG_ASSERT ( cur_file == file_stack && cur_file -> file == 0 ) ; if ( ! ( cur_file -> file = fopen ( buff , "rb" ) ) ) die ( "Could not open '%s' for reading, errno: %d" , buff , errno ) ; cur_file -> file_name = my_strdup ( buff , MYF ( MY_FAE ) ) ; cur_file -> lineno = 1 ; break ; } case 'm' : { static char buff [ FN_REFLEN ] ; if ( ! test_if_hard_path ( argument ) ) { strxmov ( buff , opt_basedir , argument , NullS ) ; argument = buff ; } fn_format ( buff , argument , "" , "" , MY_UNPACK_FILENAME ) ; timer_file = buff ; unlink ( timer_file ) ; break ; } case 'p' : if ( argument == disabled_my_option ) argument = ( char * ) "" ; if ( argument ) { my_free ( opt_pass ) ; opt_pass = my_strdup ( argument , MYF ( MY_FAE ) ) ; while ( * argument ) * argument ++ = 'x' ; tty_password = 0 ; } else tty_password = 1 ; break ; # include < sslopt - case . h > case 't' : strnmov ( TMPDIR , argument , sizeof ( TMPDIR ) ) ; break ; case 'A' : if ( ! embedded_server_arg_count ) { embedded_server_arg_count = 1 ; embedded_server_args [ 0 ] = ( char * ) "" ; } if ( embedded_server_arg_count == MAX_EMBEDDED_SERVER_ARGS - 1 || ! ( embedded_server_args [ embedded_server_arg_count ++ ] = my_strdup ( argument , MYF ( MY_FAE ) ) ) ) { die ( "Can't use server argument" ) ; } break ; case OPT_LOG_DIR : if ( access ( opt_logdir , F_OK ) != 0 ) die ( "The specified log directory does not exist: '%s'" , opt_logdir ) ; break ; case 'F' : read_embedded_server_arguments ( argument ) ; break ; case OPT_RESULT_FORMAT_VERSION : set_result_format_version ( opt_result_format_version ) ; break ; case 'V' : print_version ( ) ; exit ( 0 ) ; case OPT_MYSQL_PROTOCOL : # ifndef EMBEDDED_LIBRARY opt_protocol = find_type_or_exit ( argument , & sql_protocol_typelib , opt -> name ) ; # endif break ; case '?' : usage ( ) ; exit ( 0 ) ; } return 0 ; }
static my_bool get_one_option ( int optid , const struct my_option * opt , char * argument ) { switch ( optid ) { case '#' : # ifndef DBUG_OFF DBUG_PUSH ( argument ? argument : "d:t:S:i:O,/tmp/mysqltest.trace" ) ; debug_check_flag = 1 ; debug_info_flag = 1 ; # endif break ; case 'r' : record = 1 ; break ; case 'x' : { char buff [ FN_REFLEN ] ; if ( ! test_if_hard_path ( argument ) ) { strxmov ( buff , opt_basedir , argument , NullS ) ; argument = buff ; } fn_format ( buff , argument , "" , "" , MY_UNPACK_FILENAME ) ; DBUG_ASSERT ( cur_file == file_stack && cur_file -> file == 0 ) ; if ( ! ( cur_file -> file = fopen ( buff , "rb" ) ) ) die ( "Could not open '%s' for reading, errno: %d" , buff , errno ) ; cur_file -> file_name = my_strdup ( buff , MYF ( MY_FAE ) ) ; cur_file -> lineno = 1 ; break ; } case 'm' : { static char buff [ FN_REFLEN ] ; if ( ! test_if_hard_path ( argument ) ) { strxmov ( buff , opt_basedir , argument , NullS ) ; argument = buff ; } fn_format ( buff , argument , "" , "" , MY_UNPACK_FILENAME ) ; timer_file = buff ; unlink ( timer_file ) ; break ; } case 'p' : if ( argument == disabled_my_option ) argument = ( char * ) "" ; if ( argument ) { my_free ( opt_pass ) ; opt_pass = my_strdup ( argument , MYF ( MY_FAE ) ) ; while ( * argument ) * argument ++ = 'x' ; tty_password = 0 ; } else tty_password = 1 ; break ; # include < sslopt - case . h > case 't' : strnmov ( TMPDIR , argument , sizeof ( TMPDIR ) ) ; break ; case 'A' : if ( ! embedded_server_arg_count ) { embedded_server_arg_count = 1 ; embedded_server_args [ 0 ] = ( char * ) "" ; } if ( embedded_server_arg_count == MAX_EMBEDDED_SERVER_ARGS - 1 || ! ( embedded_server_args [ embedded_server_arg_count ++ ] = my_strdup ( argument , MYF ( MY_FAE ) ) ) ) { die ( "Can't use server argument" ) ; } break ; case OPT_LOG_DIR : if ( access ( opt_logdir , F_OK ) != 0 ) die ( "The specified log directory does not exist: '%s'" , opt_logdir ) ; break ; case 'F' : read_embedded_server_arguments ( argument ) ; break ; case OPT_RESULT_FORMAT_VERSION : set_result_format_version ( opt_result_format_version ) ; break ; case 'V' : print_version ( ) ; exit ( 0 ) ; case OPT_MYSQL_PROTOCOL : # ifndef EMBEDDED_LIBRARY opt_protocol = find_type_or_exit ( argument , & sql_protocol_typelib , opt -> name ) ; # endif break ; case '?' : usage ( ) ; exit ( 0 ) ; } return 0 ; }
1,767
1
static MMSSCPacketType get_tcp_server_response(MMSContext *mms) { int read_result; MMSSCPacketType packet_type= -1; for(;;) { if((read_result= url_read_complete(mms->mms_hd, mms->in_buffer, 8))==8) { // handle command packet. if(AV_RL32(mms->in_buffer + 4)==0xb00bface) { mms->incoming_flags= mms->in_buffer[3]; read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4); if(read_result == 4) { int length_remaining= AV_RL32(mms->in_buffer+8) + 4; int hr; dprintf(NULL, "Length remaining is %d\n", length_remaining); // read the rest of the packet. if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 12) { dprintf(NULL, "Incoming message len %d exceeds buffer len %d\n", length_remaining, sizeof(mms->in_buffer) - 12); read_result = url_read_complete(mms->mms_hd, mms->in_buffer + 12, length_remaining) ; if (read_result == length_remaining) { packet_type= AV_RL16(mms->in_buffer+36); } else { dprintf(NULL, "read for packet type failed%d!\n", read_result); } else { dprintf(NULL, "read for length remaining failed%d!\n", read_result); } else { int length_remaining; int packet_id_type; int tmp; assert(mms->remaining_in_len==0); // note we cache the first 8 bytes, // then fill up the buffer with the others tmp = AV_RL16(mms->in_buffer + 6); length_remaining = (tmp - 8) & 0xffff; mms->incoming_packet_seq = AV_RL32(mms->in_buffer); packet_id_type = mms->in_buffer[4]; mms->incoming_flags = mms->in_buffer[5]; if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 8) { dprintf(NULL, "Incoming data len %d exceeds buffer len %d\n", length_remaining, sizeof(mms->in_buffer)); mms->remaining_in_len = length_remaining; mms->read_in_ptr = mms->in_buffer; read_result= url_read_complete(mms->mms_hd, mms->in_buffer, length_remaining); if(read_result != length_remaining) { dprintf(NULL, "read_bytes result: %d asking for %d\n", read_result, length_remaining); } else { // if we successfully read everything. if(packet_id_type == mms->header_packet_id) { packet_type = SC_PKT_ASF_HEADER; // Store the asf header if(!mms->header_parsed) { void *p = av_realloc(mms->asf_header, mms->asf_header_size + mms->remaining_in_len); if (!p) { av_freep(&mms->asf_header); return AVERROR(ENOMEM); mms->asf_header = p; memcpy(mms->asf_header + mms->asf_header_size, mms->read_in_ptr, mms->remaining_in_len); mms->asf_header_size += mms->remaining_in_len; } else if(packet_id_type == mms->packet_id) { packet_type = SC_PKT_ASF_MEDIA; } else { dprintf(NULL, "packet id type %d is old.", packet_id_type); continue; // preprocess some packet type if(packet_type == SC_PKT_KEEPALIVE) { send_keepalive_packet(mms); continue; } else if(packet_type == SC_PKT_STREAM_CHANGING) { handle_packet_stream_changing_type(mms); } else if(packet_type == SC_PKT_ASF_MEDIA) { pad_media_packet(mms); return packet_type; } else { if(read_result<0) { dprintf(NULL, "Read error (or cancelled) returned %d!\n", read_result); packet_type = SC_PKT_CANCEL; } else { dprintf(NULL, "Read result of zero?!\n"); packet_type = SC_PKT_NO_DATA; return packet_type;
static MMSSCPacketType get_tcp_server_response(MMSContext *mms) { int read_result; MMSSCPacketType packet_type= -1; for(;;) { if((read_result= url_read_complete(mms->mms_hd, mms->in_buffer, 8))==8) {
1,768
0
const String& setSize(int64_t len) { assertx(m_str); m_str->setSize(len); return *this; }
const String& setSize(int64_t len) { assertx(m_str); m_str->setSize(len); return *this; }
1,769
0
static inline void e1000e_clear_ims_bits ( E1000ECore * core , uint32_t bits ) { trace_e1000e_irq_clear_ims ( bits , core -> mac [ IMS ] , core -> mac [ IMS ] & ~ bits ) ; core -> mac [ IMS ] &= ~ bits ; }
static inline void e1000e_clear_ims_bits ( E1000ECore * core , uint32_t bits ) { trace_e1000e_irq_clear_ims ( bits , core -> mac [ IMS ] , core -> mac [ IMS ] & ~ bits ) ; core -> mac [ IMS ] &= ~ bits ; }
1,770
1
get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size) { unsigned long esp; /* Default to using normal stack */ esp = env->regs[R_ESP]; #if 0 /* This is the X/Open sanctioned signal stack switching. */ if (ka->sa.sa_flags & SA_ONSTACK) { if (sas_ss_flags(esp) == 0) esp = current->sas_ss_sp + current->sas_ss_size; } /* This is the legacy signal stack switching. */ else if ((regs->xss & 0xffff) != __USER_DS && !(ka->sa.sa_flags & SA_RESTORER) && ka->sa.sa_restorer) { esp = (unsigned long) ka->sa.sa_restorer; } #endif return (void *)((esp - frame_size) & -8ul); }
get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size) { unsigned long esp; esp = env->regs[R_ESP]; #if 0 if (ka->sa.sa_flags & SA_ONSTACK) { if (sas_ss_flags(esp) == 0) esp = current->sas_ss_sp + current->sas_ss_size; } else if ((regs->xss & 0xffff) != __USER_DS && !(ka->sa.sa_flags & SA_RESTORER) && ka->sa.sa_restorer) { esp = (unsigned long) ka->sa.sa_restorer; } #endif return (void *)((esp - frame_size) & -8ul); }
1,771
1
nautilus_file_clear_info (NautilusFile *file) { file->details->got_file_info = FALSE; if (file->details->get_info_error) { g_error_free (file->details->get_info_error); file->details->get_info_error = NULL; } /* Reset to default type, which might be other than unknown for special kinds of files like the desktop or a search directory */ file->details->type = NAUTILUS_FILE_GET_CLASS (file)->default_file_type; if (!file->details->got_custom_display_name) { nautilus_file_clear_display_name (file); } if (!file->details->got_custom_activation_location && file->details->activation_location != NULL) { g_object_unref (file->details->activation_location); file->details->activation_location = NULL; } if (file->details->icon != NULL) { g_object_unref (file->details->icon); file->details->icon = NULL; } g_free (file->details->thumbnail_path); file->details->thumbnail_path = NULL; file->details->thumbnailing_failed = FALSE; file->details->is_launcher = FALSE; file->details->is_foreign_link = FALSE; file->details->is_symlink = FALSE; file->details->is_hidden = FALSE; file->details->is_backup = FALSE; file->details->is_mountpoint = FALSE; file->details->uid = -1; file->details->gid = -1; file->details->can_read = TRUE; file->details->can_write = TRUE; file->details->can_execute = TRUE; file->details->can_delete = TRUE; file->details->can_trash = TRUE; file->details->can_rename = TRUE; file->details->can_mount = FALSE; file->details->can_unmount = FALSE; file->details->can_eject = FALSE; file->details->has_permissions = FALSE; file->details->permissions = 0; file->details->size = -1; file->details->sort_order = 0; file->details->mtime = 0; file->details->atime = 0; file->details->ctime = 0; g_free (file->details->symlink_name); file->details->symlink_name = NULL; eel_ref_str_unref (file->details->mime_type); file->details->mime_type = NULL; g_free (file->details->selinux_context); file->details->selinux_context = NULL; g_free (file->details->description); file->details->description = NULL; eel_ref_str_unref (file->details->filesystem_id); file->details->filesystem_id = NULL; }
nautilus_file_clear_info (NautilusFile *file) { file->details->got_file_info = FALSE; if (file->details->get_info_error) { g_error_free (file->details->get_info_error); file->details->get_info_error = NULL; } file->details->type = NAUTILUS_FILE_GET_CLASS (file)->default_file_type; if (!file->details->got_custom_display_name) { nautilus_file_clear_display_name (file); } if (!file->details->got_custom_activation_location && file->details->activation_location != NULL) { g_object_unref (file->details->activation_location); file->details->activation_location = NULL; } if (file->details->icon != NULL) { g_object_unref (file->details->icon); file->details->icon = NULL; } g_free (file->details->thumbnail_path); file->details->thumbnail_path = NULL; file->details->thumbnailing_failed = FALSE; file->details->is_launcher = FALSE; file->details->is_foreign_link = FALSE; file->details->is_symlink = FALSE; file->details->is_hidden = FALSE; file->details->is_backup = FALSE; file->details->is_mountpoint = FALSE; file->details->uid = -1; file->details->gid = -1; file->details->can_read = TRUE; file->details->can_write = TRUE; file->details->can_execute = TRUE; file->details->can_delete = TRUE; file->details->can_trash = TRUE; file->details->can_rename = TRUE; file->details->can_mount = FALSE; file->details->can_unmount = FALSE; file->details->can_eject = FALSE; file->details->has_permissions = FALSE; file->details->permissions = 0; file->details->size = -1; file->details->sort_order = 0; file->details->mtime = 0; file->details->atime = 0; file->details->ctime = 0; g_free (file->details->symlink_name); file->details->symlink_name = NULL; eel_ref_str_unref (file->details->mime_type); file->details->mime_type = NULL; g_free (file->details->selinux_context); file->details->selinux_context = NULL; g_free (file->details->description); file->details->description = NULL; eel_ref_str_unref (file->details->filesystem_id); file->details->filesystem_id = NULL; }
1,772
1
int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options *opt = NULL; struct inet_sock *sk_inet; struct inet_connection_sock *sk_conn; /* In the case of sock_create_lite(), the sock->sk field is not * defined yet but it is not a problem as the only users of these * "lite" PF_INET sockets are functions which do an accept() call * afterwards so we will label the socket as part of the accept(). */ if (sk == NULL) return 0; /* We allocate the maximum CIPSO option size here so we are probably * being a little wasteful, but it makes our life _much_ easier later * on and after all we are only talking about 40 bytes. */ buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto socket_setattr_failure; buf_len = ret_val; /* We can't use ip_options_get() directly because it makes a call to * ip_options_get_alloc() which allocates memory with GFP_KERNEL and * we won't always have CAP_NET_RAW even though we _always_ want to * set the IPOPT_CIPSO option. */ opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } memcpy(opt->__data, buf, buf_len); opt->optlen = opt_len; opt->cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; sk_inet = inet_sk(sk); if (sk_inet->is_icsk) { sk_conn = inet_csk(sk); if (sk_inet->opt) sk_conn->icsk_ext_hdr_len -= sk_inet->opt->optlen; sk_conn->icsk_ext_hdr_len += opt->optlen; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } opt = xchg(&sk_inet->opt, opt); kfree(opt); return 0; socket_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options *opt = NULL; struct inet_sock *sk_inet; struct inet_connection_sock *sk_conn; if (sk == NULL) return 0; buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto socket_setattr_failure; buf_len = ret_val; opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } memcpy(opt->__data, buf, buf_len); opt->optlen = opt_len; opt->cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; sk_inet = inet_sk(sk); if (sk_inet->is_icsk) { sk_conn = inet_csk(sk); if (sk_inet->opt) sk_conn->icsk_ext_hdr_len -= sk_inet->opt->optlen; sk_conn->icsk_ext_hdr_len += opt->optlen; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } opt = xchg(&sk_inet->opt, opt); kfree(opt); return 0; socket_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
1,773
0
static const gchar * get_register_name_from_address ( guint64 addr , gboolean * is_custom_register , u3v_conv_info_t * u3v_conv_info ) { const gchar * address_string = NULL ; guint32 offset_address ; if ( is_custom_register != NULL ) { * is_custom_register = FALSE ; } if ( addr < 0x10000 ) { offset_address = ( guint32 ) addr ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_abrm ) ; } if ( u3v_conv_info && u3v_conv_info -> sbrm_addr != 0 && ( addr >= u3v_conv_info -> sbrm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> sbrm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_sbrm ) ; } if ( u3v_conv_info && u3v_conv_info -> sirm_addr != 0 && ( addr >= u3v_conv_info -> sirm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> sirm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_sirm ) ; } if ( u3v_conv_info && u3v_conv_info -> eirm_addr != 0 && ( addr >= u3v_conv_info -> eirm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> eirm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_eirm ) ; } if ( ! address_string ) { address_string = wmem_strdup_printf ( wmem_packet_scope ( ) , "[Addr:0x%016" G_GINT64_MODIFIER "X]" , addr ) ; if ( is_custom_register != NULL ) { * is_custom_register = TRUE ; } } return address_string ; }
static const gchar * get_register_name_from_address ( guint64 addr , gboolean * is_custom_register , u3v_conv_info_t * u3v_conv_info ) { const gchar * address_string = NULL ; guint32 offset_address ; if ( is_custom_register != NULL ) { * is_custom_register = FALSE ; } if ( addr < 0x10000 ) { offset_address = ( guint32 ) addr ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_abrm ) ; } if ( u3v_conv_info && u3v_conv_info -> sbrm_addr != 0 && ( addr >= u3v_conv_info -> sbrm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> sbrm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_sbrm ) ; } if ( u3v_conv_info && u3v_conv_info -> sirm_addr != 0 && ( addr >= u3v_conv_info -> sirm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> sirm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_sirm ) ; } if ( u3v_conv_info && u3v_conv_info -> eirm_addr != 0 && ( addr >= u3v_conv_info -> eirm_addr ) ) { offset_address = ( guint32 ) ( addr - u3v_conv_info -> eirm_addr ) ; address_string = try_val_to_str ( offset_address , bootstrap_register_names_eirm ) ; } if ( ! address_string ) { address_string = wmem_strdup_printf ( wmem_packet_scope ( ) , "[Addr:0x%016" G_GINT64_MODIFIER "X]" , addr ) ; if ( is_custom_register != NULL ) { * is_custom_register = TRUE ; } } return address_string ; }
1,774
0
int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options_rcu *old, *opt = NULL; struct inet_sock *sk_inet; struct inet_connection_sock *sk_conn; /* In the case of sock_create_lite(), the sock->sk field is not * defined yet but it is not a problem as the only users of these * "lite" PF_INET sockets are functions which do an accept() call * afterwards so we will label the socket as part of the accept(). */ if (sk == NULL) return 0; /* We allocate the maximum CIPSO option size here so we are probably * being a little wasteful, but it makes our life _much_ easier later * on and after all we are only talking about 40 bytes. */ buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto socket_setattr_failure; buf_len = ret_val; /* We can't use ip_options_get() directly because it makes a call to * ip_options_get_alloc() which allocates memory with GFP_KERNEL and * we won't always have CAP_NET_RAW even though we _always_ want to * set the IPOPT_CIPSO option. */ opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } memcpy(opt->opt.__data, buf, buf_len); opt->opt.optlen = opt_len; opt->opt.cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; sk_inet = inet_sk(sk); old = rcu_dereference_protected(sk_inet->inet_opt, sock_owned_by_user(sk)); if (sk_inet->is_icsk) { sk_conn = inet_csk(sk); if (old) sk_conn->icsk_ext_hdr_len -= old->opt.optlen; sk_conn->icsk_ext_hdr_len += opt->opt.optlen; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } rcu_assign_pointer(sk_inet->inet_opt, opt); if (old) call_rcu(&old->rcu, opt_kfree_rcu); return 0; socket_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options_rcu *old, *opt = NULL; struct inet_sock *sk_inet; struct inet_connection_sock *sk_conn; if (sk == NULL) return 0; buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto socket_setattr_failure; buf_len = ret_val; opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } memcpy(opt->opt.__data, buf, buf_len); opt->opt.optlen = opt_len; opt->opt.cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; sk_inet = inet_sk(sk); old = rcu_dereference_protected(sk_inet->inet_opt, sock_owned_by_user(sk)); if (sk_inet->is_icsk) { sk_conn = inet_csk(sk); if (old) sk_conn->icsk_ext_hdr_len -= old->opt.optlen; sk_conn->icsk_ext_hdr_len += opt->opt.optlen; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } rcu_assign_pointer(sk_inet->inet_opt, opt); if (old) call_rcu(&old->rcu, opt_kfree_rcu); return 0; socket_setattr_failure: kfree(buf); kfree(opt); return ret_val; }
1,775
1
mark_trusted_callback (NautilusFile *file, GFile *result_location, GError *error, gpointer callback_data) { ActivateParametersDesktop *parameters; parameters = callback_data; if (error) { eel_show_error_dialog (_("Unable to mark launcher trusted (executable)"), error->message, parameters->parent_window); } activate_parameters_desktop_free (parameters); }
mark_trusted_callback (NautilusFile *file, GFile *result_location, GError *error, gpointer callback_data) { ActivateParametersDesktop *parameters; parameters = callback_data; if (error) { eel_show_error_dialog (_("Unable to mark launcher trusted (executable)"), error->message, parameters->parent_window); } activate_parameters_desktop_free (parameters); }
1,776
1
int size() const { return m_str ? m_str->size() : 0; }
int size() const { return m_str ? m_str->size() : 0; }
1,777
1
static uint32_t add_weights(uint32_t w1, uint32_t w2) { uint32_t max = (w1 & 0xFF) > (w2 & 0xFF) ? (w1 & 0xFF) : (w2 & 0xFF); return ((w1 & 0xFFFFFF00) + (w2 & 0xFFFFFF00)) | (1 + max); }
static uint32_t add_weights(uint32_t w1, uint32_t w2) { uint32_t max = (w1 & 0xFF) > (w2 & 0xFF) ? (w1 & 0xFF) : (w2 & 0xFF); return ((w1 & 0xFFFFFF00) + (w2 & 0xFFFFFF00)) | (1 + max); }
1,778
1
static void decode_rlc_opc(CPUTriCoreState *env, DisasContext *ctx, uint32_t op1) { int32_t const16; int r1, r2; const16 = MASK_OP_RLC_CONST16_SEXT(ctx->opcode); r1 = MASK_OP_RLC_S1(ctx->opcode); r2 = MASK_OP_RLC_D(ctx->opcode); switch (op1) { case OPC1_32_RLC_ADDI: gen_addi_d(cpu_gpr_d[r2], cpu_gpr_d[r1], const16); break; case OPC1_32_RLC_ADDIH: gen_addi_d(cpu_gpr_d[r2], cpu_gpr_d[r1], const16 << 16); break; case OPC1_32_RLC_ADDIH_A: tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r1], const16 << 16); break; case OPC1_32_RLC_MFCR: const16 = MASK_OP_RLC_CONST16(ctx->opcode); gen_mfcr(env, cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV: tcg_gen_movi_tl(cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV_64: if (tricore_feature(env, TRICORE_FEATURE_16)) { if ((r2 & 0x1) != 0) { /* TODO: raise OPD trap */ } tcg_gen_movi_tl(cpu_gpr_d[r2], const16); tcg_gen_movi_tl(cpu_gpr_d[r2+1], const16 >> 15); } else { /* TODO: raise illegal opcode trap */ } break; case OPC1_32_RLC_MOV_U: const16 = MASK_OP_RLC_CONST16(ctx->opcode); tcg_gen_movi_tl(cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV_H: tcg_gen_movi_tl(cpu_gpr_d[r2], const16 << 16); break; case OPC1_32_RLC_MOVH_A: tcg_gen_movi_tl(cpu_gpr_a[r2], const16 << 16); break; case OPC1_32_RLC_MTCR: const16 = MASK_OP_RLC_CONST16(ctx->opcode); gen_mtcr(env, ctx, cpu_gpr_d[r1], const16); break; } }
static void decode_rlc_opc(CPUTriCoreState *env, DisasContext *ctx, uint32_t op1) { int32_t const16; int r1, r2; const16 = MASK_OP_RLC_CONST16_SEXT(ctx->opcode); r1 = MASK_OP_RLC_S1(ctx->opcode); r2 = MASK_OP_RLC_D(ctx->opcode); switch (op1) { case OPC1_32_RLC_ADDI: gen_addi_d(cpu_gpr_d[r2], cpu_gpr_d[r1], const16); break; case OPC1_32_RLC_ADDIH: gen_addi_d(cpu_gpr_d[r2], cpu_gpr_d[r1], const16 << 16); break; case OPC1_32_RLC_ADDIH_A: tcg_gen_addi_tl(cpu_gpr_a[r2], cpu_gpr_a[r1], const16 << 16); break; case OPC1_32_RLC_MFCR: const16 = MASK_OP_RLC_CONST16(ctx->opcode); gen_mfcr(env, cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV: tcg_gen_movi_tl(cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV_64: if (tricore_feature(env, TRICORE_FEATURE_16)) { if ((r2 & 0x1) != 0) { } tcg_gen_movi_tl(cpu_gpr_d[r2], const16); tcg_gen_movi_tl(cpu_gpr_d[r2+1], const16 >> 15); } else { } break; case OPC1_32_RLC_MOV_U: const16 = MASK_OP_RLC_CONST16(ctx->opcode); tcg_gen_movi_tl(cpu_gpr_d[r2], const16); break; case OPC1_32_RLC_MOV_H: tcg_gen_movi_tl(cpu_gpr_d[r2], const16 << 16); break; case OPC1_32_RLC_MOVH_A: tcg_gen_movi_tl(cpu_gpr_a[r2], const16 << 16); break; case OPC1_32_RLC_MTCR: const16 = MASK_OP_RLC_CONST16(ctx->opcode); gen_mtcr(env, ctx, cpu_gpr_d[r1], const16); break; } }
1,779
0
int64_t size() const { return m_str ? m_str->size() : 0; }
int64_t size() const { return m_str ? m_str->size() : 0; }
1,780
1
untrusted_launcher_response_callback (GtkDialog *dialog, int response_id, ActivateParametersDesktop *parameters) { GdkScreen *screen; char *uri; gboolean free_params; free_params = TRUE; switch (response_id) { case RESPONSE_RUN: screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); uri = nautilus_file_get_uri (parameters->file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); break; case RESPONSE_MARK_TRUSTED: nautilus_file_set_permissions (parameters->file, nautilus_file_get_permissions (parameters->file) | S_IXGRP | S_IXUSR | S_IXOTH, mark_trusted_callback, parameters); free_params = FALSE; break; default: /* Just destroy dialog */ break; } gtk_widget_destroy (GTK_WIDGET (dialog)); if (free_params) { activate_parameters_desktop_free (parameters); } }
untrusted_launcher_response_callback (GtkDialog *dialog, int response_id, ActivateParametersDesktop *parameters) { GdkScreen *screen; char *uri; gboolean free_params; free_params = TRUE; switch (response_id) { case RESPONSE_RUN: screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); uri = nautilus_file_get_uri (parameters->file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); break; case RESPONSE_MARK_TRUSTED: nautilus_file_set_permissions (parameters->file, nautilus_file_get_permissions (parameters->file) | S_IXGRP | S_IXUSR | S_IXOTH, mark_trusted_callback, parameters); free_params = FALSE; break; default: break; } gtk_widget_destroy (GTK_WIDGET (dialog)); if (free_params) { activate_parameters_desktop_free (parameters); } }
1,782
0
static int exif_scan_thumbnail(image_info_type *ImageInfo) { unsigned char c, *data = (unsigned char*)ImageInfo->Thumbnail.data; int n, marker; size_t length=2, pos=0; jpeg_sof_info sof_info; if (!data || ImageInfo->Thumbnail.size < 4) { return 0; /* nothing to do here */ } if (memcmp(data, "\xFF\xD8\xFF", 3)) { if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { raise_warning("Thumbnail is not a JPEG image"); } return 0; } for (;;) { pos += length; if (pos>=ImageInfo->Thumbnail.size) return 0; c = data[pos++]; if (pos>=ImageInfo->Thumbnail.size) return 0; if (c != 0xFF) { return 0; } n = 8; while ((c = data[pos++]) == 0xFF && n--) { if (pos+3>=ImageInfo->Thumbnail.size) return 0; /* +3 = pos++ of next check when reaching marker + 2 bytes for length */ } if (c == 0xFF) return 0; marker = c; if (ImageInfo->Thumbnail.size - 2 < pos) return 0; length = php_jpg_get16(data+pos); if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) { return 0; } switch (marker) { case M_SOF0: case M_SOF1: case M_SOF2: case M_SOF3: case M_SOF5: case M_SOF6: case M_SOF7: case M_SOF9: case M_SOF10: case M_SOF11: case M_SOF13: case M_SOF14: case M_SOF15: /* handle SOFn block */ if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) { /* exif_process_SOFn needs 8 bytes */ return 0; } exif_process_SOFn(data+pos, marker, &sof_info); ImageInfo->Thumbnail.height = sof_info.height; ImageInfo->Thumbnail.width = sof_info.width; return 1; case M_SOS: case M_EOI: raise_warning("Could not compute size of thumbnail"); return 0; break; default: /* just skip */ break; } } raise_warning("Could not compute size of thumbnail"); return 0; }
static int exif_scan_thumbnail(image_info_type *ImageInfo) { unsigned char c, *data = (unsigned char*)ImageInfo->Thumbnail.data; int n, marker; size_t length=2, pos=0; jpeg_sof_info sof_info; if (!data || ImageInfo->Thumbnail.size < 4) { return 0; } if (memcmp(data, "\xFF\xD8\xFF", 3)) { if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { raise_warning("Thumbnail is not a JPEG image"); } return 0; } for (;;) { pos += length; if (pos>=ImageInfo->Thumbnail.size) return 0; c = data[pos++]; if (pos>=ImageInfo->Thumbnail.size) return 0; if (c != 0xFF) { return 0; } n = 8; while ((c = data[pos++]) == 0xFF && n--) { if (pos+3>=ImageInfo->Thumbnail.size) return 0; } if (c == 0xFF) return 0; marker = c; if (ImageInfo->Thumbnail.size - 2 < pos) return 0; length = php_jpg_get16(data+pos); if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) { return 0; } switch (marker) { case M_SOF0: case M_SOF1: case M_SOF2: case M_SOF3: case M_SOF5: case M_SOF6: case M_SOF7: case M_SOF9: case M_SOF10: case M_SOF11: case M_SOF13: case M_SOF14: case M_SOF15: if (length < 8 || ImageInfo->Thumbnail.size - 8 < pos) { return 0; } exif_process_SOFn(data+pos, marker, &sof_info); ImageInfo->Thumbnail.height = sof_info.height; ImageInfo->Thumbnail.width = sof_info.width; return 1; case M_SOS: case M_EOI: raise_warning("Could not compute size of thumbnail"); return 0; break; default: break; } } raise_warning("Could not compute size of thumbnail"); return 0; }
1,783
1
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) { struct ipcm_cookie ipc; struct rtable *rt = skb_rtable(skb); struct net *net = dev_net(rt->dst.dev); struct sock *sk; struct inet_sock *inet; __be32 daddr; if (ip_options_echo(&icmp_param->replyopts, skb)) return; sk = icmp_xmit_lock(net); if (sk == NULL) return; inet = inet_sk(sk); icmp_param->data.icmph.checksum = 0; inet->tos = ip_hdr(skb)->tos; daddr = ipc.addr = rt->rt_src; ipc.opt = NULL; ipc.tx_flags = 0; if (icmp_param->replyopts.optlen) { ipc.opt = &icmp_param->replyopts; if (ipc.opt->srr) daddr = icmp_param->replyopts.faddr; } { struct flowi4 fl4 = { .daddr = daddr, .saddr = rt->rt_spec_dst, .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), .flowi4_proto = IPPROTO_ICMP, }; security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); rt = ip_route_output_key(net, &fl4); if (IS_ERR(rt)) goto out_unlock; } if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, icmp_param->data.icmph.code)) icmp_push_reply(icmp_param, &ipc, &rt); ip_rt_put(rt); out_unlock: icmp_xmit_unlock(sk); }
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) { struct ipcm_cookie ipc; struct rtable *rt = skb_rtable(skb); struct net *net = dev_net(rt->dst.dev); struct sock *sk; struct inet_sock *inet; __be32 daddr; if (ip_options_echo(&icmp_param->replyopts, skb)) return; sk = icmp_xmit_lock(net); if (sk == NULL) return; inet = inet_sk(sk); icmp_param->data.icmph.checksum = 0; inet->tos = ip_hdr(skb)->tos; daddr = ipc.addr = rt->rt_src; ipc.opt = NULL; ipc.tx_flags = 0; if (icmp_param->replyopts.optlen) { ipc.opt = &icmp_param->replyopts; if (ipc.opt->srr) daddr = icmp_param->replyopts.faddr; } { struct flowi4 fl4 = { .daddr = daddr, .saddr = rt->rt_spec_dst, .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), .flowi4_proto = IPPROTO_ICMP, }; security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); rt = ip_route_output_key(net, &fl4); if (IS_ERR(rt)) goto out_unlock; } if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, icmp_param->data.icmph.code)) icmp_push_reply(icmp_param, &ipc, &rt); ip_rt_put(rt); out_unlock: icmp_xmit_unlock(sk); }
1,784
1
static const char * _CompoundTextgetName ( const UConverter * cnv ) { return "x11-compound-text" ; }
static const char * _CompoundTextgetName ( const UConverter * cnv ) { return "x11-compound-text" ; }
1,785
1
static bool ga_open_pidfile(const char *pidfile) { int pidfd; char pidstr[32]; pidfd = open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); if (pidfd == -1 || lockf(pidfd, F_TLOCK, 0)) { g_critical("Cannot lock pid file, %s", strerror(errno)); if (pidfd != -1) { close(pidfd); } return false; } if (ftruncate(pidfd, 0) || lseek(pidfd, 0, SEEK_SET)) { g_critical("Failed to truncate pid file"); goto fail; } snprintf(pidstr, sizeof(pidstr), "%d\n", getpid()); if (write(pidfd, pidstr, strlen(pidstr)) != strlen(pidstr)) { g_critical("Failed to write pid file"); goto fail; } return true; fail: unlink(pidfile); return false; }
static bool ga_open_pidfile(const char *pidfile) { int pidfd; char pidstr[32]; pidfd = open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR); if (pidfd == -1 || lockf(pidfd, F_TLOCK, 0)) { g_critical("Cannot lock pid file, %s", strerror(errno)); if (pidfd != -1) { close(pidfd); } return false; } if (ftruncate(pidfd, 0) || lseek(pidfd, 0, SEEK_SET)) { g_critical("Failed to truncate pid file"); goto fail; } snprintf(pidstr, sizeof(pidstr), "%d\n", getpid()); if (write(pidfd, pidstr, strlen(pidstr)) != strlen(pidstr)) { g_critical("Failed to write pid file"); goto fail; } return true; fail: unlink(pidfile); return false; }
1,786
1
finish_startup (NautilusApplication *application) { GList *drives; /* initialize nautilus modules */ nautilus_module_setup (); /* attach menu-provider module callback */ menu_provider_init_callback (); /* Initialize the desktop link monitor singleton */ nautilus_desktop_link_monitor_get (); /* Watch for mounts so we can restore open windows This used * to be for showing new window on mount, but is not used * anymore */ /* Watch for unmounts so we can close open windows */ /* TODO-gio: This should be using the UNMOUNTED feature of GFileMonitor instead */ application->volume_monitor = g_volume_monitor_get (); g_signal_connect_object (application->volume_monitor, "mount_removed", G_CALLBACK (mount_removed_callback), application, 0); g_signal_connect_object (application->volume_monitor, "mount_pre_unmount", G_CALLBACK (mount_removed_callback), application, 0); g_signal_connect_object (application->volume_monitor, "mount_added", G_CALLBACK (mount_added_callback), application, 0); g_signal_connect_object (application->volume_monitor, "volume_added", G_CALLBACK (volume_added_callback), application, 0); g_signal_connect_object (application->volume_monitor, "drive_connected", G_CALLBACK (drive_connected_callback), application, 0); /* listen for eject button presses */ drives = g_volume_monitor_get_connected_drives (application->volume_monitor); g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application); g_list_foreach (drives, (GFunc) g_object_unref, NULL); g_list_free (drives); application->automount_idle_id = g_idle_add_full (G_PRIORITY_LOW, automount_all_volumes_idle_cb, application, NULL); }
finish_startup (NautilusApplication *application) { GList *drives; nautilus_module_setup (); menu_provider_init_callback (); nautilus_desktop_link_monitor_get (); application->volume_monitor = g_volume_monitor_get (); g_signal_connect_object (application->volume_monitor, "mount_removed", G_CALLBACK (mount_removed_callback), application, 0); g_signal_connect_object (application->volume_monitor, "mount_pre_unmount", G_CALLBACK (mount_removed_callback), application, 0); g_signal_connect_object (application->volume_monitor, "mount_added", G_CALLBACK (mount_added_callback), application, 0); g_signal_connect_object (application->volume_monitor, "volume_added", G_CALLBACK (volume_added_callback), application, 0); g_signal_connect_object (application->volume_monitor, "drive_connected", G_CALLBACK (drive_connected_callback), application, 0); drives = g_volume_monitor_get_connected_drives (application->volume_monitor); g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application); g_list_foreach (drives, (GFunc) g_object_unref, NULL); g_list_free (drives); application->automount_idle_id = g_idle_add_full (G_PRIORITY_LOW, automount_all_volumes_idle_cb, application, NULL); }
1,787
1
mark_trusted_job (GIOSchedulerJob *io_job, GCancellable *cancellable, gpointer user_data) { MarkTrustedJob *job = user_data; CommonJob *common; char *contents, *new_contents; gsize length, new_length; GError *error; guint32 current; int response; GFileInfo *info; common = (CommonJob *)job; common->io_job = io_job; nautilus_progress_info_start (job->common.progress); retry: error = NULL; if (!g_file_load_contents (job->file, cancellable, &contents, &length, NULL, &error)) { response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } if (!g_str_has_prefix (contents, "#!")) { new_length = length + strlen (TRUSTED_SHEBANG); new_contents = g_malloc (new_length); strcpy (new_contents, TRUSTED_SHEBANG); memcpy (new_contents + strlen (TRUSTED_SHEBANG), contents, length); if (!g_file_replace_contents (job->file, new_contents, new_length, NULL, FALSE, 0, NULL, cancellable, &error)) { g_free (contents); g_free (new_contents); response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } g_free (new_contents); } g_free (contents); info = g_file_query_info (job->file, G_FILE_ATTRIBUTE_STANDARD_TYPE"," G_FILE_ATTRIBUTE_UNIX_MODE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, &error); if (info == NULL) { response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) { current = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); current = current | S_IXGRP | S_IXUSR | S_IXOTH; if (!g_file_set_attribute_uint32 (job->file, G_FILE_ATTRIBUTE_UNIX_MODE, current, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, &error)) { g_object_unref (info); response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } } g_object_unref (info); out: g_io_scheduler_job_send_to_mainloop_async (io_job, mark_trusted_job_done, job, NULL); return FALSE; }
mark_trusted_job (GIOSchedulerJob *io_job, GCancellable *cancellable, gpointer user_data) { MarkTrustedJob *job = user_data; CommonJob *common; char *contents, *new_contents; gsize length, new_length; GError *error; guint32 current; int response; GFileInfo *info; common = (CommonJob *)job; common->io_job = io_job; nautilus_progress_info_start (job->common.progress); retry: error = NULL; if (!g_file_load_contents (job->file, cancellable, &contents, &length, NULL, &error)) { response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } if (!g_str_has_prefix (contents, "#!")) { new_length = length + strlen (TRUSTED_SHEBANG); new_contents = g_malloc (new_length); strcpy (new_contents, TRUSTED_SHEBANG); memcpy (new_contents + strlen (TRUSTED_SHEBANG), contents, length); if (!g_file_replace_contents (job->file, new_contents, new_length, NULL, FALSE, 0, NULL, cancellable, &error)) { g_free (contents); g_free (new_contents); response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } g_free (new_contents); } g_free (contents); info = g_file_query_info (job->file, G_FILE_ATTRIBUTE_STANDARD_TYPE"," G_FILE_ATTRIBUTE_UNIX_MODE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, &error); if (info == NULL) { response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) { current = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); current = current | S_IXGRP | S_IXUSR | S_IXOTH; if (!g_file_set_attribute_uint32 (job->file, G_FILE_ATTRIBUTE_UNIX_MODE, current, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, &error)) { g_object_unref (info); response = run_error (common, g_strdup (_("Unable to mark launcher trusted (executable)")), error->message, NULL, FALSE, GTK_STOCK_CANCEL, RETRY, NULL); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) { goto retry; } else { g_assert_not_reached (); } goto out; } } g_object_unref (info); out: g_io_scheduler_job_send_to_mainloop_async (io_job, mark_trusted_job_done, job, NULL); return FALSE; }
1,788
0
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) { struct ipcm_cookie ipc; struct rtable *rt = skb_rtable(skb); struct net *net = dev_net(rt->dst.dev); struct sock *sk; struct inet_sock *inet; __be32 daddr; if (ip_options_echo(&icmp_param->replyopts.opt.opt, skb)) return; sk = icmp_xmit_lock(net); if (sk == NULL) return; inet = inet_sk(sk); icmp_param->data.icmph.checksum = 0; inet->tos = ip_hdr(skb)->tos; daddr = ipc.addr = rt->rt_src; ipc.opt = NULL; ipc.tx_flags = 0; if (icmp_param->replyopts.opt.opt.optlen) { ipc.opt = &icmp_param->replyopts.opt; if (ipc.opt->opt.srr) daddr = icmp_param->replyopts.opt.opt.faddr; } { struct flowi4 fl4 = { .daddr = daddr, .saddr = rt->rt_spec_dst, .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), .flowi4_proto = IPPROTO_ICMP, }; security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); rt = ip_route_output_key(net, &fl4); if (IS_ERR(rt)) goto out_unlock; } if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, icmp_param->data.icmph.code)) icmp_push_reply(icmp_param, &ipc, &rt); ip_rt_put(rt); out_unlock: icmp_xmit_unlock(sk); }
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) { struct ipcm_cookie ipc; struct rtable *rt = skb_rtable(skb); struct net *net = dev_net(rt->dst.dev); struct sock *sk; struct inet_sock *inet; __be32 daddr; if (ip_options_echo(&icmp_param->replyopts.opt.opt, skb)) return; sk = icmp_xmit_lock(net); if (sk == NULL) return; inet = inet_sk(sk); icmp_param->data.icmph.checksum = 0; inet->tos = ip_hdr(skb)->tos; daddr = ipc.addr = rt->rt_src; ipc.opt = NULL; ipc.tx_flags = 0; if (icmp_param->replyopts.opt.opt.optlen) { ipc.opt = &icmp_param->replyopts.opt; if (ipc.opt->opt.srr) daddr = icmp_param->replyopts.opt.opt.faddr; } { struct flowi4 fl4 = { .daddr = daddr, .saddr = rt->rt_spec_dst, .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), .flowi4_proto = IPPROTO_ICMP, }; security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); rt = ip_route_output_key(net, &fl4); if (IS_ERR(rt)) goto out_unlock; } if (icmpv4_xrlim_allow(net, rt, icmp_param->data.icmph.type, icmp_param->data.icmph.code)) icmp_push_reply(icmp_param, &ipc, &rt); ip_rt_put(rt); out_unlock: icmp_xmit_unlock(sk); }
1,789
1
static void video_image_display(VideoState *is) { Frame *vp; Frame *sp = NULL; SDL_Rect rect; vp = frame_queue_peek_last(&is->pictq); if (vp->bmp) { if (is->subtitle_st) { if (frame_queue_nb_remaining(&is->subpq) > 0) { sp = frame_queue_peek(&is->subpq); if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000)) { if (!sp->uploaded) { uint8_t *pixels; int pitch; int i; if (!sp->width || !sp->height) { sp->width = vp->width; sp->height = vp->height; } if (realloc_texture(&is->sub_texture, SDL_PIXELFORMAT_ARGB8888, sp->width, sp->height, SDL_BLENDMODE_BLEND, 1) < 0) return; for (i = 0; i < sp->sub.num_rects; i++) { AVSubtitleRect *sub_rect = sp->sub.rects[i]; sub_rect->x = av_clip(sub_rect->x, 0, sp->width ); sub_rect->y = av_clip(sub_rect->y, 0, sp->height); sub_rect->w = av_clip(sub_rect->w, 0, sp->width - sub_rect->x); sub_rect->h = av_clip(sub_rect->h, 0, sp->height - sub_rect->y); is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx, sub_rect->w, sub_rect->h, AV_PIX_FMT_PAL8, sub_rect->w, sub_rect->h, AV_PIX_FMT_BGRA, 0, NULL, NULL, NULL); if (!is->sub_convert_ctx) { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n"); return; } if (!SDL_LockTexture(is->sub_texture, (SDL_Rect *)sub_rect, (void **)&pixels, &pitch)) { sws_scale(is->sub_convert_ctx, (const uint8_t * const *)sub_rect->data, sub_rect->linesize, 0, sub_rect->h, &pixels, &pitch); SDL_UnlockTexture(is->sub_texture); } } sp->uploaded = 1; } } else sp = NULL; } } calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar); if (!vp->uploaded) { if (upload_texture(vp->bmp, vp->frame, &is->img_convert_ctx) < 0) return; vp->uploaded = 1; vp->flip_v = vp->frame->linesize[0] < 0; } SDL_RenderCopyEx(renderer, vp->bmp, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0); if (sp) { #if USE_ONEPASS_SUBTITLE_RENDER SDL_RenderCopy(renderer, is->sub_texture, NULL, &rect); #else int i; double xratio = (double)rect.w / (double)sp->width; double yratio = (double)rect.h / (double)sp->height; for (i = 0; i < sp->sub.num_rects; i++) { SDL_Rect *sub_rect = (SDL_Rect*)sp->sub.rects[i]; SDL_Rect target = {.x = rect.x + sub_rect->x * xratio, .y = rect.y + sub_rect->y * yratio, .w = sub_rect->w * xratio, .h = sub_rect->h * yratio}; SDL_RenderCopy(renderer, is->sub_texture, sub_rect, &target); } #endif } } }
static void video_image_display(VideoState *is) { Frame *vp; Frame *sp = NULL; SDL_Rect rect; vp = frame_queue_peek_last(&is->pictq); if (vp->bmp) { if (is->subtitle_st) { if (frame_queue_nb_remaining(&is->subpq) > 0) { sp = frame_queue_peek(&is->subpq); if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000)) { if (!sp->uploaded) { uint8_t *pixels; int pitch; int i; if (!sp->width || !sp->height) { sp->width = vp->width; sp->height = vp->height; } if (realloc_texture(&is->sub_texture, SDL_PIXELFORMAT_ARGB8888, sp->width, sp->height, SDL_BLENDMODE_BLEND, 1) < 0) return; for (i = 0; i < sp->sub.num_rects; i++) { AVSubtitleRect *sub_rect = sp->sub.rects[i]; sub_rect->x = av_clip(sub_rect->x, 0, sp->width ); sub_rect->y = av_clip(sub_rect->y, 0, sp->height); sub_rect->w = av_clip(sub_rect->w, 0, sp->width - sub_rect->x); sub_rect->h = av_clip(sub_rect->h, 0, sp->height - sub_rect->y); is->sub_convert_ctx = sws_getCachedContext(is->sub_convert_ctx, sub_rect->w, sub_rect->h, AV_PIX_FMT_PAL8, sub_rect->w, sub_rect->h, AV_PIX_FMT_BGRA, 0, NULL, NULL, NULL); if (!is->sub_convert_ctx) { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n"); return; } if (!SDL_LockTexture(is->sub_texture, (SDL_Rect *)sub_rect, (void **)&pixels, &pitch)) { sws_scale(is->sub_convert_ctx, (const uint8_t * const *)sub_rect->data, sub_rect->linesize, 0, sub_rect->h, &pixels, &pitch); SDL_UnlockTexture(is->sub_texture); } } sp->uploaded = 1; } } else sp = NULL; } } calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar); if (!vp->uploaded) { if (upload_texture(vp->bmp, vp->frame, &is->img_convert_ctx) < 0) return; vp->uploaded = 1; vp->flip_v = vp->frame->linesize[0] < 0; } SDL_RenderCopyEx(renderer, vp->bmp, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0); if (sp) { #if USE_ONEPASS_SUBTITLE_RENDER SDL_RenderCopy(renderer, is->sub_texture, NULL, &rect); #else int i; double xratio = (double)rect.w / (double)sp->width; double yratio = (double)rect.h / (double)sp->height; for (i = 0; i < sp->sub.num_rects; i++) { SDL_Rect *sub_rect = (SDL_Rect*)sp->sub.rects[i]; SDL_Rect target = {.x = rect.x + sub_rect->x * xratio, .y = rect.y + sub_rect->y * yratio, .w = sub_rect->w * xratio, .h = sub_rect->h * yratio}; SDL_RenderCopy(renderer, is->sub_texture, sub_rect, &target); } #endif } } }
1,791
1
void writeStats(Array& /*ret*/) override { fprintf(stderr, "writeStats start\n"); // RetSame: the return value is the same instance every time // HasThis: call has a this argument // AllSame: all returns were the same data even though args are different // MemberCount: number of different arg sets (including this) fprintf(stderr, "Count Function MinSerLen MaxSerLen RetSame HasThis " "AllSame MemberCount\n"); for (auto& me : m_memos) { if (me.second.m_ignore) continue; if (me.second.m_count == 1) continue; int min_ser_len = 999999999; int max_ser_len = 0; int count = 0; int member_count = 0; bool all_same = true; if (me.second.m_has_this) { bool any_multiple = false; auto& fr = me.second.m_member_memos.begin()->second.m_return_value; member_count = me.second.m_member_memos.size(); for (auto& mme : me.second.m_member_memos) { if (mme.second.m_return_value != fr) all_same = false; count += mme.second.m_count; auto ser_len = mme.second.m_return_value.length(); min_ser_len = std::min(min_ser_len, ser_len); max_ser_len = std::max(max_ser_len, ser_len); if (mme.second.m_count > 1) any_multiple = true; } if (!any_multiple && !all_same) continue; } else { min_ser_len = max_ser_len = me.second.m_return_value.length(); count = me.second.m_count; all_same = me.second.m_ret_tv_same; } fprintf(stderr, "%d %s %d %d %s %s %s %d\n", count, me.first.data(), min_ser_len, max_ser_len, me.second.m_ret_tv_same ? " true" : "false", me.second.m_has_this ? " true" : "false", all_same ? " true" : "false", member_count ); } fprintf(stderr, "writeStats end\n"); }
void writeStats(Array& ) override { fprintf(stderr, "writeStats start\n"); fprintf(stderr, "Count Function MinSerLen MaxSerLen RetSame HasThis " "AllSame MemberCount\n"); for (auto& me : m_memos) { if (me.second.m_ignore) continue; if (me.second.m_count == 1) continue; int min_ser_len = 999999999; int max_ser_len = 0; int count = 0; int member_count = 0; bool all_same = true; if (me.second.m_has_this) { bool any_multiple = false; auto& fr = me.second.m_member_memos.begin()->second.m_return_value; member_count = me.second.m_member_memos.size(); for (auto& mme : me.second.m_member_memos) { if (mme.second.m_return_value != fr) all_same = false; count += mme.second.m_count; auto ser_len = mme.second.m_return_value.length(); min_ser_len = std::min(min_ser_len, ser_len); max_ser_len = std::max(max_ser_len, ser_len); if (mme.second.m_count > 1) any_multiple = true; } if (!any_multiple && !all_same) continue; } else { min_ser_len = max_ser_len = me.second.m_return_value.length(); count = me.second.m_count; all_same = me.second.m_ret_tv_same; } fprintf(stderr, "%d %s %d %d %s %s %s %d\n", count, me.first.data(), min_ser_len, max_ser_len, me.second.m_ret_tv_same ? " true" : "false", me.second.m_has_this ? " true" : "false", all_same ? " true" : "false", member_count ); } fprintf(stderr, "writeStats end\n"); }
1,792
0
static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, const struct iphdr *iph, __be32 saddr, u8 tos, int type, int code, struct icmp_bxm *param) { struct flowi4 fl4 = { .daddr = (param->replyopts.opt.opt.srr ? param->replyopts.opt.opt.faddr : iph->saddr), .saddr = saddr, .flowi4_tos = RT_TOS(tos), .flowi4_proto = IPPROTO_ICMP, .fl4_icmp_type = type, .fl4_icmp_code = code, }; struct rtable *rt, *rt2; int err; security_skb_classify_flow(skb_in, flowi4_to_flowi(&fl4)); rt = __ip_route_output_key(net, &fl4); if (IS_ERR(rt)) return rt; /* No need to clone since we're just using its address. */ rt2 = rt; if (!fl4.saddr) fl4.saddr = rt->rt_src; rt = (struct rtable *) xfrm_lookup(net, &rt->dst, flowi4_to_flowi(&fl4), NULL, 0); if (!IS_ERR(rt)) { if (rt != rt2) return rt; } else if (PTR_ERR(rt) == -EPERM) { rt = NULL; } else return rt; err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4), AF_INET); if (err) goto relookup_failed; if (inet_addr_type(net, fl4.saddr) == RTN_LOCAL) { rt2 = __ip_route_output_key(net, &fl4); if (IS_ERR(rt2)) err = PTR_ERR(rt2); } else { struct flowi4 fl4_2 = {}; unsigned long orefdst; fl4_2.daddr = fl4.saddr; rt2 = ip_route_output_key(net, &fl4_2); if (IS_ERR(rt2)) { err = PTR_ERR(rt2); goto relookup_failed; } /* Ugh! */ orefdst = skb_in->_skb_refdst; /* save old refdst */ err = ip_route_input(skb_in, fl4.daddr, fl4.saddr, RT_TOS(tos), rt2->dst.dev); dst_release(&rt2->dst); rt2 = skb_rtable(skb_in); skb_in->_skb_refdst = orefdst; /* restore old refdst */ } if (err) goto relookup_failed; rt2 = (struct rtable *) xfrm_lookup(net, &rt2->dst, flowi4_to_flowi(&fl4), NULL, XFRM_LOOKUP_ICMP); if (!IS_ERR(rt2)) { dst_release(&rt->dst); rt = rt2; } else if (PTR_ERR(rt2) == -EPERM) { if (rt) dst_release(&rt->dst); return rt2; } else { err = PTR_ERR(rt2); goto relookup_failed; } return rt; relookup_failed: if (rt) return rt; return ERR_PTR(err); }
static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, const struct iphdr *iph, __be32 saddr, u8 tos, int type, int code, struct icmp_bxm *param) { struct flowi4 fl4 = { .daddr = (param->replyopts.opt.opt.srr ? param->replyopts.opt.opt.faddr : iph->saddr), .saddr = saddr, .flowi4_tos = RT_TOS(tos), .flowi4_proto = IPPROTO_ICMP, .fl4_icmp_type = type, .fl4_icmp_code = code, }; struct rtable *rt, *rt2; int err; security_skb_classify_flow(skb_in, flowi4_to_flowi(&fl4)); rt = __ip_route_output_key(net, &fl4); if (IS_ERR(rt)) return rt; rt2 = rt; if (!fl4.saddr) fl4.saddr = rt->rt_src; rt = (struct rtable *) xfrm_lookup(net, &rt->dst, flowi4_to_flowi(&fl4), NULL, 0); if (!IS_ERR(rt)) { if (rt != rt2) return rt; } else if (PTR_ERR(rt) == -EPERM) { rt = NULL; } else return rt; err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4), AF_INET); if (err) goto relookup_failed; if (inet_addr_type(net, fl4.saddr) == RTN_LOCAL) { rt2 = __ip_route_output_key(net, &fl4); if (IS_ERR(rt2)) err = PTR_ERR(rt2); } else { struct flowi4 fl4_2 = {}; unsigned long orefdst; fl4_2.daddr = fl4.saddr; rt2 = ip_route_output_key(net, &fl4_2); if (IS_ERR(rt2)) { err = PTR_ERR(rt2); goto relookup_failed; } orefdst = skb_in->_skb_refdst; err = ip_route_input(skb_in, fl4.daddr, fl4.saddr, RT_TOS(tos), rt2->dst.dev); dst_release(&rt2->dst); rt2 = skb_rtable(skb_in); skb_in->_skb_refdst = orefdst; } if (err) goto relookup_failed; rt2 = (struct rtable *) xfrm_lookup(net, &rt2->dst, flowi4_to_flowi(&fl4), NULL, XFRM_LOOKUP_ICMP); if (!IS_ERR(rt2)) { dst_release(&rt->dst); rt = rt2; } else if (PTR_ERR(rt2) == -EPERM) { if (rt) dst_release(&rt->dst); return rt2; } else { err = PTR_ERR(rt2); goto relookup_failed; } return rt; relookup_failed: if (rt) return rt; return ERR_PTR(err); }
1,793
1
untrusted_launcher_response_callback (GtkDialog *dialog, int response_id, ActivateParametersDesktop *parameters) { GdkScreen *screen; char *uri; GFile *file; switch (response_id) { case RESPONSE_RUN: screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); uri = nautilus_file_get_uri (parameters->file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); break; case RESPONSE_MARK_TRUSTED: file = nautilus_file_get_location (parameters->file); nautilus_file_mark_desktop_file_trusted (file, parameters->parent_window, NULL, NULL); g_object_unref (file); break; default: /* Just destroy dialog */ break; } gtk_widget_destroy (GTK_WIDGET (dialog)); activate_parameters_desktop_free (parameters); }
untrusted_launcher_response_callback (GtkDialog *dialog, int response_id, ActivateParametersDesktop *parameters) { GdkScreen *screen; char *uri; GFile *file; switch (response_id) { case RESPONSE_RUN: screen = gtk_widget_get_screen (GTK_WIDGET (parameters->parent_window)); uri = nautilus_file_get_uri (parameters->file); nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, "directory view activate_callback launch_desktop_file window=%p: %s", parameters->parent_window, uri); nautilus_launch_desktop_file (screen, uri, NULL, parameters->parent_window); g_free (uri); break; case RESPONSE_MARK_TRUSTED: file = nautilus_file_get_location (parameters->file); nautilus_file_mark_desktop_file_trusted (file, parameters->parent_window, NULL, NULL); g_object_unref (file); break; default: break; } gtk_widget_destroy (GTK_WIDGET (dialog)); activate_parameters_desktop_free (parameters); }
1,795
0
void writeStats(Array& /*ret*/) override { fprintf(stderr, "writeStats start\n"); // RetSame: the return value is the same instance every time // HasThis: call has a this argument // AllSame: all returns were the same data even though args are different // MemberCount: number of different arg sets (including this) fprintf(stderr, "Count Function MinSerLen MaxSerLen RetSame HasThis " "AllSame MemberCount\n"); for (auto& me : m_memos) { if (me.second.m_ignore) continue; if (me.second.m_count == 1) continue; int min_ser_len = 999999999; int max_ser_len = 0; int count = 0; int member_count = 0; bool all_same = true; if (me.second.m_has_this) { bool any_multiple = false; auto& fr = me.second.m_member_memos.begin()->second.m_return_value; member_count = me.second.m_member_memos.size(); for (auto& mme : me.second.m_member_memos) { if (mme.second.m_return_value != fr) all_same = false; count += mme.second.m_count; auto ser_len = mme.second.m_return_value.length(); min_ser_len = std::min<int64_t>(min_ser_len, ser_len); max_ser_len = std::max<int64_t>(max_ser_len, ser_len); if (mme.second.m_count > 1) any_multiple = true; } if (!any_multiple && !all_same) continue; } else { min_ser_len = max_ser_len = me.second.m_return_value.length(); count = me.second.m_count; all_same = me.second.m_ret_tv_same; } fprintf(stderr, "%d %s %d %d %s %s %s %d\n", count, me.first.data(), min_ser_len, max_ser_len, me.second.m_ret_tv_same ? " true" : "false", me.second.m_has_this ? " true" : "false", all_same ? " true" : "false", member_count ); } fprintf(stderr, "writeStats end\n"); }
void writeStats(Array& ) override { fprintf(stderr, "writeStats start\n"); fprintf(stderr, "Count Function MinSerLen MaxSerLen RetSame HasThis " "AllSame MemberCount\n"); for (auto& me : m_memos) { if (me.second.m_ignore) continue; if (me.second.m_count == 1) continue; int min_ser_len = 999999999; int max_ser_len = 0; int count = 0; int member_count = 0; bool all_same = true; if (me.second.m_has_this) { bool any_multiple = false; auto& fr = me.second.m_member_memos.begin()->second.m_return_value; member_count = me.second.m_member_memos.size(); for (auto& mme : me.second.m_member_memos) { if (mme.second.m_return_value != fr) all_same = false; count += mme.second.m_count; auto ser_len = mme.second.m_return_value.length(); min_ser_len = std::min<int64_t>(min_ser_len, ser_len); max_ser_len = std::max<int64_t>(max_ser_len, ser_len); if (mme.second.m_count > 1) any_multiple = true; } if (!any_multiple && !all_same) continue; } else { min_ser_len = max_ser_len = me.second.m_return_value.length(); count = me.second.m_count; all_same = me.second.m_ret_tv_same; } fprintf(stderr, "%d %s %d %d %s %s %s %d\n", count, me.first.data(), min_ser_len, max_ser_len, me.second.m_ret_tv_same ? " true" : "false", me.second.m_has_this ? " true" : "false", all_same ? " true" : "false", member_count ); } fprintf(stderr, "writeStats end\n"); }
1,796
1
static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, const struct iphdr *iph, __be32 saddr, u8 tos, int type, int code, struct icmp_bxm *param) { struct flowi4 fl4 = { .daddr = (param->replyopts.srr ? param->replyopts.faddr : iph->saddr), .saddr = saddr, .flowi4_tos = RT_TOS(tos), .flowi4_proto = IPPROTO_ICMP, .fl4_icmp_type = type, .fl4_icmp_code = code, }; struct rtable *rt, *rt2; int err; security_skb_classify_flow(skb_in, flowi4_to_flowi(&fl4)); rt = __ip_route_output_key(net, &fl4); if (IS_ERR(rt)) return rt; /* No need to clone since we're just using its address. */ rt2 = rt; if (!fl4.saddr) fl4.saddr = rt->rt_src; rt = (struct rtable *) xfrm_lookup(net, &rt->dst, flowi4_to_flowi(&fl4), NULL, 0); if (!IS_ERR(rt)) { if (rt != rt2) return rt; } else if (PTR_ERR(rt) == -EPERM) { rt = NULL; } else return rt; err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4), AF_INET); if (err) goto relookup_failed; if (inet_addr_type(net, fl4.saddr) == RTN_LOCAL) { rt2 = __ip_route_output_key(net, &fl4); if (IS_ERR(rt2)) err = PTR_ERR(rt2); } else { struct flowi4 fl4_2 = {}; unsigned long orefdst; fl4_2.daddr = fl4.saddr; rt2 = ip_route_output_key(net, &fl4_2); if (IS_ERR(rt2)) { err = PTR_ERR(rt2); goto relookup_failed; } /* Ugh! */ orefdst = skb_in->_skb_refdst; /* save old refdst */ err = ip_route_input(skb_in, fl4.daddr, fl4.saddr, RT_TOS(tos), rt2->dst.dev); dst_release(&rt2->dst); rt2 = skb_rtable(skb_in); skb_in->_skb_refdst = orefdst; /* restore old refdst */ } if (err) goto relookup_failed; rt2 = (struct rtable *) xfrm_lookup(net, &rt2->dst, flowi4_to_flowi(&fl4), NULL, XFRM_LOOKUP_ICMP); if (!IS_ERR(rt2)) { dst_release(&rt->dst); rt = rt2; } else if (PTR_ERR(rt2) == -EPERM) { if (rt) dst_release(&rt->dst); return rt2; } else { err = PTR_ERR(rt2); goto relookup_failed; } return rt; relookup_failed: if (rt) return rt; return ERR_PTR(err); }
static struct rtable *icmp_route_lookup(struct net *net, struct sk_buff *skb_in, const struct iphdr *iph, __be32 saddr, u8 tos, int type, int code, struct icmp_bxm *param) { struct flowi4 fl4 = { .daddr = (param->replyopts.srr ? param->replyopts.faddr : iph->saddr), .saddr = saddr, .flowi4_tos = RT_TOS(tos), .flowi4_proto = IPPROTO_ICMP, .fl4_icmp_type = type, .fl4_icmp_code = code, }; struct rtable *rt, *rt2; int err; security_skb_classify_flow(skb_in, flowi4_to_flowi(&fl4)); rt = __ip_route_output_key(net, &fl4); if (IS_ERR(rt)) return rt; rt2 = rt; if (!fl4.saddr) fl4.saddr = rt->rt_src; rt = (struct rtable *) xfrm_lookup(net, &rt->dst, flowi4_to_flowi(&fl4), NULL, 0); if (!IS_ERR(rt)) { if (rt != rt2) return rt; } else if (PTR_ERR(rt) == -EPERM) { rt = NULL; } else return rt; err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4), AF_INET); if (err) goto relookup_failed; if (inet_addr_type(net, fl4.saddr) == RTN_LOCAL) { rt2 = __ip_route_output_key(net, &fl4); if (IS_ERR(rt2)) err = PTR_ERR(rt2); } else { struct flowi4 fl4_2 = {}; unsigned long orefdst; fl4_2.daddr = fl4.saddr; rt2 = ip_route_output_key(net, &fl4_2); if (IS_ERR(rt2)) { err = PTR_ERR(rt2); goto relookup_failed; } orefdst = skb_in->_skb_refdst; err = ip_route_input(skb_in, fl4.daddr, fl4.saddr, RT_TOS(tos), rt2->dst.dev); dst_release(&rt2->dst); rt2 = skb_rtable(skb_in); skb_in->_skb_refdst = orefdst; } if (err) goto relookup_failed; rt2 = (struct rtable *) xfrm_lookup(net, &rt2->dst, flowi4_to_flowi(&fl4), NULL, XFRM_LOOKUP_ICMP); if (!IS_ERR(rt2)) { dst_release(&rt->dst); rt = rt2; } else if (PTR_ERR(rt2) == -EPERM) { if (rt) dst_release(&rt->dst); return rt2; } else { err = PTR_ERR(rt2); goto relookup_failed; } return rt; relookup_failed: if (rt) return rt; return ERR_PTR(err); }
1,798