int __exit mipv6_shutdown_bcache() { unsigned long flags; struct mipv6_bcache_entry *entry; DEBUG_FUNC(); write_lock_irqsave(&bcache->lock, flags); DEBUG((DBG_INFO, "mipv6_shutdown_bcache: Stopping the timer")); del_timer(&bcache->callback_timer); while ((entry = (struct mipv6_bcache_entry *) hashlist_get_first(bcache->entries)) != NULL) { DEBUG_FUNC(); /* hashlist_delete_first(bcache->entries); */ bcache_proxy_nd_rem(entry); hashlist_delete(bcache->entries, &entry->home_addr); mipv6_bcache_entry_free(entry); DEBUG_FUNC(); } hashlist_destroy(bcache->entries); mipv6_free_allocation_pool(bcache->entry_pool); #ifdef CONFIG_PROC_FS proc_net_remove("mip6_bcache"); #endif /* Lock must be released before freeing the memory. */ write_unlock_irqrestore(&bcache->lock, flags); kfree(bcache); return 0; }
static int procinfo_iterator(void *data, void *args, struct in6_addr *addr, unsigned long *pref) { struct procinfo_iterator_args *arg = (struct procinfo_iterator_args *)args; struct mipv6_bcache_entry *entry = (struct mipv6_bcache_entry *)data; DEBUG_FUNC(); if (entry == NULL) return ITERATOR_ERR; if (entry->type == TEMPORARY_ENTRY) return ITERATOR_CONT; if (arg->skip < arg->offset / BC_INFO_LEN) { arg->skip++; return ITERATOR_CONT; } if (arg->len >= arg->length) return ITERATOR_CONT; arg->len += sprintf(arg->buffer + arg->len, "h=%04x%04x%04x%04x%04x%04x%04x%04x " "c=%04x%04x%04x%04x%04x%04x%04x%04x " "(e=%010lu,t=%02d)\n", NIPV6ADDR(&entry->home_addr), NIPV6ADDR(&entry->coa), ((entry->callback_time) - jiffies) / HZ, (int)entry->type); return ITERATOR_CONT; }
static int halist_proc_info(char *buffer, char **start, off_t offset, int length) { unsigned long flags; struct procinfo_iterator_args args; DEBUG_FUNC(); args.buffer = buffer; args.offset = offset; args.length = length; args.skip = 0; args.len = 0; read_lock_irqsave(&home_agents->lock, flags); hashlist_iterate(home_agents->entries, &args, procinfo_iterator); read_unlock_irqrestore(&home_agents->lock, flags); *start = buffer; if (offset) *start += offset % HALIST_INFO_LEN; args.len -= offset % HALIST_INFO_LEN; if (args.len > length) args.len = length; if (args.len < 0) args.len = 0; return args.len; }
/* code_delete */ int code_delete(Code * code) { int ret = 0; CodeScope * scope; size_t i; DEBUG_FUNC(); if(code->plugin != NULL) { if(code->target != NULL) ret = _code_target_exit(code); plugin_delete(code->plugin); } /* free the context */ _code_context_flush(code); /* free the scopes */ /* do it ourselves as code_scope_pop() stops at the global */ for(; code->scopes_cnt > 0; code->scopes_cnt--) { scope = &code->scopes[code->scopes_cnt - 1]; for(i = 0; i < scope->variables_cnt; i++) free(scope->variables[i].name); free(scope->variables); } free(code->scopes); /* free the types */ for(i = 0; i < code->types_cnt; i++) free(code->types[i].name); free(code->types); object_delete(code); return ret; }
static int s353xxa_rtc_read_time(struct device *dev, struct rtc_time *t) { struct i2c_client *client = to_i2c_client(dev); struct i2c_msg msgs[1]; u8 buf[7]; int ret; DEBUG_FUNC(); set_i2c_msg(&msgs[0], client->addr | 0x2, I2C_M_RD, 7, buf); ret = i2c_transfer(client->adapter, msgs, 1); if (ret != 1) return -EIO; t->tm_year = BCD2BIN(REVERSE(buf[0])); t->tm_mon = BCD2BIN(REVERSE(buf[1])); t->tm_mday = BCD2BIN(REVERSE(buf[2])); t->tm_wday = BCD2BIN(REVERSE(buf[3])); t->tm_hour = BCD2BIN(REVERSE(buf[4]) & 0x3f); t->tm_min = BCD2BIN(REVERSE(buf[5])); t->tm_sec = BCD2BIN(REVERSE(buf[6])); t->tm_year += 100; t->tm_mon -= 1; DEBUG_INFO("READ: %d/%d/%d(%d) %d:%d:%d\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec); return 0; }
/* * Get memory for a new bcache entry. If bcache if full, a cache * entry may deleted to get space for a home registration, but not * vice versa. */ static struct mipv6_bcache_entry *mipv6_bcache_get_entry(__u8 type) { struct mipv6_bcache_entry *entry; struct cache_entry_iterator_args args; DEBUG_FUNC(); entry = (struct mipv6_bcache_entry *) mipv6_allocate_element(bcache->entry_pool); if (entry == NULL && type == HOME_REGISTRATION) { /* cache full, but need space for a home registration */ args.entry = &entry; hashlist_iterate(bcache->entries, &args, find_first_cache_entry_iterator); if (entry != NULL) { DEBUG((DBG_INFO, "cache entry: %x", entry)); if (hashlist_delete(bcache->entries, &entry->home_addr) < 0) DEBUG((DBG_ERROR, "bcache entry delete failed")); else entry = (struct mipv6_bcache_entry *) mipv6_allocate_element(bcache->entry_pool); } } return entry; }
/** * mipv6_mn_move_homeaddr - Move home address from one interface to another. * @ifindex: interface index to which home address is moved * @haddr: home address * * When an interface is stopped home addresses on that if need to be * moved to another interface. **/ int mipv6_mn_move_homeaddr(int ifindex, struct in6_addr *haddr) { struct in6_ifreq ifreq; #ifdef CONFIG_IPV6_MOBILITY_DEBUG struct net_device *dev = NULL; #endif DEBUG_FUNC(); /* TODO!! */ ifreq.ifr6_prefixlen = 64; ipv6_addr_copy(&ifreq.ifr6_addr, haddr); addrconf_del_ifaddr((void *)&ifreq); ifreq.ifr6_ifindex = ifindex; addrconf_add_ifaddr((void *)&ifreq); #ifdef CONFIG_IPV6_MOBILITY_DEBUG dev = dev_get_by_index(ifindex); if (dev) { DEBUG((DBG_INFO, "Moved HA to %s", dev->name)); dev_put(dev); } #endif return 0; }
int mipv6_ah_rt_header( struct rt0_hdr *rthdr, struct in6_addr *daddr) { struct in6_addr tmp; DEBUG_FUNC(); if (rthdr == NULL) return -1; /* Nothing to do */ if (rthdr->rt_hdr.segments_left==0) return 0; /* exchange address from routing header with daddr */ if (rthdr->rt_hdr.segments_left == 1){ ipv6_addr_copy(&tmp, rthdr->addr); ipv6_addr_copy(rthdr->addr, daddr); ipv6_addr_copy(daddr, &tmp); rthdr->rt_hdr.segments_left=0; return 0; } else { DEBUG((DBG_ERROR, "don't know how to handle a routing header with more than one intermediary destination")); return -1; } }
void mipv6_check_tunneled_packet(struct sk_buff *skb) { DEBUG_FUNC(); /* If tunnel flag was set */ if (skb->security & RCV_TUNNEL) { struct in6_addr coa; __u32 lifetime; mipv6_get_care_of_address(&skb->nh.ipv6h->daddr, &coa); lifetime = mipv6_mn_get_bulifetime(&skb->nh.ipv6h->daddr, &coa, 0); DEBUG((DBG_WARNING, "packet was tunneled. Sending BU to CN" "%x:%x:%x:%x:%x:%x:%x:%x", NIPV6ADDR(&skb->nh.ipv6h->saddr))); /* This should work also with home address option */ mipv6_send_upd_option( &skb->nh.ipv6h->daddr, &skb->nh.ipv6h->saddr, CN_BU_DELAY, INITIAL_BINDACK_TIMEOUT, MAX_BINDACK_TIMEOUT, 1, #ifdef CN_REQ_ACK MIPV6_BU_F_ACK, /* ack */ #else 0, /* no ack */ #endif 64, lifetime, NULL); } }
static int dvb_hdhomerun_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) #endif { struct dvb_hdhomerun_fe_state* state = fe->demodulator_priv; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) struct dtv_frontend_properties *p = &fe->dtv_property_cache; #endif DEBUG_FUNC(1); if (fe->ops.tuner_ops.set_params) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) fe->ops.tuner_ops.set_params(fe); #else fe->ops.tuner_ops.set_params(fe,p); #endif if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } DEBUG_OUT(HDHOMERUN_FE, "FE_SET_FRONTEND, freq: %d\n", p->frequency); { struct dvbhdhomerun_control_mesg mesg; mesg.type = DVB_HDHOMERUN_FE_SET_FRONTEND; mesg.id = state->id; mesg.u.frequency = p->frequency; hdhomerun_control_post_and_wait(&mesg); } return 0; }
static void set_timer(void) { struct mipv6_bcache_entry *entry; unsigned long callback_time; DEBUG_FUNC(); entry = (struct mipv6_bcache_entry *) hashlist_get_first(bcache->entries); if (entry != NULL) { if (entry->callback_time == EXPIRE_INFINITE) { DEBUG((DBG_WARNING, "bcache.c: set_timer: expire at infinity, " "not setting a new timer")); } else { if (entry->br_callback_time > 0) callback_time = entry->br_callback_time; else if (entry->callback_time > jiffies) callback_time = entry->callback_time; else { DEBUG((DBG_WARNING, "bcache.c: set_timer: bcache timer attempted " "to schedule for a historical jiffies count!")); callback_time = jiffies+TIMERDELAY; } DEBUG((DBG_INFO, "bcache.c: set_timer: setting timer to now")); mod_timer(&bcache->callback_timer, callback_time); } } else { del_timer(&bcache->callback_timer); DEBUG((DBG_INFO, "bcache.c: set_timer: BC empty, not setting a new timer")); } return; }
/* code_target_exit */ static int _code_target_exit(Code * code) { DEBUG_FUNC(); if(code->target->exit == NULL) return 0; return code->target->exit(); }
/* code_target_init */ static int _code_target_init(Code * code, char const * outfile, int optlevel) { DEBUG_FUNC(); if(code->target->init == NULL) return 0; return code->target->init(outfile, optlevel); }
static int dvb_hdhomerun_fe_read_ber(struct dvb_frontend* fe, u32* ber) { DEBUG_FUNC(1); *ber = 0; return 0; }
/* code_target_token */ static int _code_target_token(Code * code, Token * token) { DEBUG_FUNC(); if(code->target->token == NULL) return 0; return code->target->token(token); }
/* code_target_function_end */ static int _code_target_function_end(Code * code) { DEBUG_FUNC(); if(code->target->function_end == NULL) return 0; return code->target->function_end(); }
/** * mipv6_mn_add_info - Adds a new home info for MN * @home_addr: Home address of MN, must be set * @plen: prefix length of the home address, must be set * @lifetime: lifetime of the home address, 0 is infinite * @ha: home agent for the home address * @ha_plen: prefix length of home agent's address, can be zero * @ha_lifetime: Lifetime of the home address, 0 is infinite * * The function adds a new home info entry for MN, allowing it to * register the home address with the home agent. Starts home * registration process. If @ha is ADDRANY, DHAAD is performed to * find a home agent. Returns 0 on success, a negative value * otherwise. Caller MUST NOT hold mn_info_lock. **/ void mipv6_mn_add_info(struct in6_addr *home_addr, int plen, unsigned long lifetime, struct in6_addr *ha, int ha_plen, unsigned long ha_lifetime) { struct mn_info *minfo = NULL, minfo_init; struct in6_addr coa; DEBUG_FUNC(); minfo = kmalloc(sizeof(struct mn_info), GFP_ATOMIC); if (!minfo) return; memset(minfo, 0, sizeof(struct mn_info)); ipv6_addr_copy(&minfo->home_addr, home_addr); if (ha) ipv6_addr_copy(&minfo->ha, ha); minfo->home_plen = plen; minfo->home_addr_expires = jiffies + lifetime * HZ; /* TODO: Look up interface for home address and set home address * flag on the address */ /* Add new mn_info_entry to list */ write_lock_bh(&mn_info_lock); minfo->next = mn_info_base; mn_info_base = minfo; memcpy(&minfo_init, minfo, sizeof(minfo_init)); write_unlock_bh(&mn_info_lock); mipv6_get_care_of_address(&minfo_init.home_addr, &coa); init_home_registration(&minfo_init, &coa); }
static int s353xxa_rtc_set_time(struct device *dev, struct rtc_time *t) { struct i2c_client *client = to_i2c_client(dev); struct i2c_msg msgs[1]; u8 buf[7]; int ret; DEBUG_FUNC(); DEBUG_INFO("SET : %d/%d/%d(%d) %d:%d:%d\n", t->tm_year + 2000, t->tm_mon + 1, t->tm_mday, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec); t->tm_year -= 100; t->tm_mon += 1; buf[0] = REVERSE(BIN2BCD(t->tm_year)); buf[1] = REVERSE(BIN2BCD(t->tm_mon)); buf[2] = REVERSE(BIN2BCD(t->tm_mday)); buf[3] = REVERSE(BIN2BCD(t->tm_wday)); buf[4] = REVERSE(BIN2BCD(t->tm_hour)); buf[5] = REVERSE(BIN2BCD(t->tm_min)); buf[6] = REVERSE(BIN2BCD(t->tm_sec)); set_i2c_msg(&msgs[0], client->addr | 0x2, 0, 7, buf); ret = i2c_transfer(client->adapter, msgs, 1); if (ret != 1) { return -EIO; } return 0; }
void CChildFrame::ActivateFrame(int nCmdShow) //------------------------------------------- { if ((glMdiOpenCount == 1) && (CMainFrame::gbMdiMaximize) && (nCmdShow == -1)) { nCmdShow = SW_SHOWMAXIMIZED; } CMDIChildWnd::ActivateFrame(nCmdShow); //rewbs.fix3185: When song first loads, initialise patternViewState // to point to start of song. CView *pView = GetActiveView(); CModDoc *pModDoc = NULL; if (pView) pModDoc = (CModDoc *)pView->GetDocument(); if ((m_hWndCtrl) && (pModDoc)) { if (m_bInitialActivation && m_ViewPatterns.nPattern==0) { m_ViewPatterns.nPattern=pModDoc->GetSoundFile()->Order[0]; m_ViewPatterns.nOrder=0; //just in case (should already be 0) m_ViewPatterns.nRow=0; //just in case m_bInitialActivation=false; } if (!pattern_test) { DEBUG_FUNC("creating my homie"); DEBUG_FUNC("pModDoc = %p", pModDoc); auto pSndFile = pModDoc->GetSoundFile(); if (pSndFile) { pattern_test = new modplug::gui::qt5::document_window( pSndFile, CMainFrame::GetMainFrame()->global_config, nullptr ); /* pattern_test->resize(400, 400); pattern_test->show(); */ CMainFrame::GetMainFrame() ->ui_root ->mainwindow.add_document_window(pattern_test); } } } //end rewbs.fix3185 }
static void dvb_hdhomerun_fe_release(struct dvb_frontend* fe) { struct dvb_hdhomerun_fe_state* state = fe->demodulator_priv; DEBUG_FUNC(1); kfree(state); }
static int dvb_hdhomerun_fe_init(struct dvb_frontend* fe) { DEBUG_FUNC(1); /* Don't really need to do anything here */ return 0; }
void dvb_hdhomerun_control_exit() { DEBUG_FUNC(1); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) kfifo_free(&control_fifo_user); kfifo_free(&control_fifo_kernel); #endif misc_deregister(&hdhomerun_control_device); }
static int hdhomerun_control_ioctl(struct inode *inode,struct file *f, unsigned int cmd, unsigned long arg) #endif { int retval = 0; int err = 1; DEBUG_FUNC(1); if (_IOC_DIR(cmd) & _IOC_READ) { err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); } else if (_IOC_DIR(cmd) & _IOC_WRITE) { err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); } if (err) { printk(KERN_ERR "access_ok() fails\n"); return -EFAULT; } switch(cmd) { case HDHOMERUN_REGISTER_TUNER: { struct hdhomerun_register_tuner_data tuner_data; retval = copy_from_user(&tuner_data, (struct hdhomerun_register_tuner_data*)arg, sizeof(struct hdhomerun_register_tuner_data)); if(retval != 0) { printk(KERN_ERR "hdhomerun: get_user() failed, no dvb device created!\n"); } else { printk(KERN_INFO "hdhomerun: creating dvb device for %s\n", tuner_data.name); retval = dvb_hdhomerun_data_init(tuner_data.num_of_devices); if(retval != 0) { printk(KERN_ERR "hdhomerun: hdhomerun_data_init() failed, no dvb device created\n"); return -EFAULT; } retval = dvb_hdhomerun_register_hdhomerun(&tuner_data); if(retval != 0) { printk(KERN_ERR "hdhomerun: register_hdhomerun() failed, no dvb device created\n"); return -EFAULT; } retval = copy_to_user((void *)arg, &tuner_data, sizeof(struct hdhomerun_register_tuner_data)); break; } } default: retval = -ENOTTY; DEBUG_OUT(1,"Unknown/unhandled ioctl cmd: %x, nr:%d, type:%d\n", cmd, _IOC_NR(cmd), _IOC_TYPE(cmd)); } return retval; }
static int hdhomerun_control_open(struct inode *inode, struct file *file) { DEBUG_FUNC(1); printk(KERN_INFO "hdhomerun: userhdhomerun connected\n"); userspace_ready = 1; /* need mutex here */ return 0; }
static void mipv6_halist_expire(unsigned long dummy) { unsigned long flags; DEBUG_FUNC(); write_lock_irqsave(&home_agents->lock, flags); mipv6_halist_gc(0); write_unlock_irqrestore(&home_agents->lock, flags); }
static struct mipv6_halist_entry *mipv6_halist_new_entry(void) { struct mipv6_halist_entry *entry; DEBUG_FUNC(); entry = kmalloc(sizeof(struct mipv6_halist_entry), GFP_ATOMIC); return entry; }
void app_config::change_audio_settings(const paudio_settings_t &settings) { DEBUG_FUNC("thread id = %x, settings = %s", GetCurrentThreadId(), debug_json_dump(json_of_paudio_settings( settings, globals->pa_system )).c_str() ); store->audio = settings; emit audio_settings_changed(); }
/* Called from nf_hook which is set in mipv6.c initialization */ unsigned int mipv6_finalize_ah(unsigned int hook, struct sk_buff **pskb, const struct net_device *indev, const struct net_device *outdev, int (*okfn) (struct sk_buff *)) { struct sec_as *sa; struct ah_processing ahp; __u32 signature [4]; struct sk_buff *buff = NULL; struct mipv6_ah *ah = NULL, *ah_orig = NULL; DEBUG_FUNC(); if (!pskb || !(*pskb)) { DEBUG((DBG_ERROR, "finalize_ah: received null argument: skb\n")); return NF_ACCEPT; } /* TODO: This is really inefficient, but as we don't know * whether the datagram has home address option or routing * header (in mipv6 it has always either one of them or * both), we can't feed the datagram linearly to the security * hash function. Also it would be good to know whether the * datagram has AH in the first place to avoid copying all * outgoing datagrams */ buff = mipv6_prepare_dgram(pskb, &ah, &ah_orig, AH_SEND); if (buff == NULL){ DEBUG((DBG_ERROR,"mipv6_parse_dgram returned null buffer!")); return NF_ACCEPT; } if (!ah || !ah->ah_data || !ah_orig || !ah_orig->ah_data){ DEBUG((AH_DUMP, "mipv6_prepare_dgram returned null" "pointer to ah or ah->ah_data")); kfree_skb(buff); return NF_ACCEPT; } /* get the sadb entry, actually this should be done also before * adding the AH */ if ((sa = mipv6_sa_get(&buff->nh.ipv6h->daddr, OUTBOUND, 0)) == NULL) { DEBUG((DBG_WARNING, "SA Missing for address %x:%x:%x:%x:%x:%x:%x:%x", NIPV6ADDR(&buff->nh.ipv6h->daddr))); kfree_skb(buff); return NF_DROP; /* drop the packet*/ }
static enum dvbfe_algo dvb_hdhomerun_fe_get_frontend_algo(struct dvb_frontend *fe) #endif { DEBUG_FUNC(1); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) return 1; // The two drivers that use get_grontend_algo in debian lenny return 1 for HW. #else return DVBFE_ALGO_HW; // This is actually 0. hmm. #endif }
static int mipv6_halist_gc(int type) { int args; DEBUG_FUNC(); args = type; hashlist_iterate(home_agents->entries, &args, gc_iterator); return 0; }