type
stringclasses
5 values
content
stringlengths
9
163k
functions
__init hci_sock_init(void) { int err; BUILD_BUG_ON(sizeof(struct sockaddr_hci) > sizeof(struct sockaddr)); err = proto_register(&hci_sk_proto, 0); if (err < 0) return err; err = bt_sock_register(BTPROTO_HCI, &hci_sock_family_ops); if (err < 0) { BT_ERR("HCI socket registration failed"); goto error; }
functions
void hci_sock_cleanup(void) { bt_procfs_cleanup(&init_net, "hci"); bt_sock_unregister(BTPROTO_HCI); proto_unregister(&hci_sk_proto); }
includes
#include <linux/config.h>
includes
#include <linux/errno.h>
includes
#include <linux/types.h>
includes
#include <linux/string.h>
includes
#include <linux/socket.h>
includes
#include <linux/net.h>
includes
#include <linux/netdevice.h>
includes
#include <linux/if_arp.h>
includes
#include <linux/in6.h>
includes
#include <linux/tcp.h>
includes
#include <linux/route.h>
includes
#include <linux/netfilter.h>
includes
#include <linux/netfilter_ipv6.h>
includes
#include <net/sock.h>
includes
#include <net/snmp.h>
includes
#include <net/ipv6.h>
includes
#include <net/ndisc.h>
includes
#include <net/protocol.h>
includes
#include <net/ip6_route.h>
includes
#include <net/addrconf.h>
includes
#include <net/rawv6.h>
includes
#include <net/icmp.h>
includes
#include <net/xfrm.h>
includes
#include <net/checksum.h>
functions
void ipv6_select_ident(struct sk_buff *skb, struct frag_hdr *fhdr) { static u32 ipv6_fragmentation_id = 1; static DEFINE_SPINLOCK(ip6_id_lock); spin_lock_bh(&ip6_id_lock); fhdr->identification = htonl(ipv6_fragmentation_id); if (++ipv6_fragmentation_id == 0) ipv6_fragmentation_id = 1; spin_unlock_bh(&ip6_id_lo...
functions
int ip6_output_finish(struct sk_buff *skb) { struct dst_entry *dst = skb->dst; struct hh_cache *hh = dst->hh; if (hh) { int hh_alen; read_lock_bh(&hh->hh_lock); hh_alen = HH_DATA_ALIGN(hh->hh_len); memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); read_unlock_bh(&hh->hh_lock); skb_push(skb, hh...
functions
int ip6_dev_loopback_xmit(struct sk_buff *newskb) { newskb->mac.raw = newskb->data; __skb_pull(newskb, newskb->nh.raw - newskb->data); newskb->pkt_type = PACKET_LOOPBACK; newskb->ip_summed = CHECKSUM_UNNECESSARY; BUG_TRAP(newskb->dst); netif_rx(newskb); return 0; }
functions
int ip6_output2(struct sk_buff *skb) { struct dst_entry *dst = skb->dst; struct net_device *dev = dst->dev; skb->protocol = htons(ETH_P_IPV6); skb->dev = dev; if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr)) { struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL; if (!(dev->flags & IFF_LOOPBACK) && ...
functions
int ip6_output(struct sk_buff *skb) { if (skb->len > dst_mtu(skb->dst) || dst_allfrag(skb->dst)) return ip6_fragment(skb, ip6_output2); else return ip6_output2(skb); }
functions
int ip6_route_me_harder(struct sk_buff *skb) { struct ipv6hdr *iph = skb->nh.ipv6h; struct dst_entry *dst; struct flowi fl = { .oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, .nl_u = { .ip6_u = { .daddr = iph->daddr, .saddr = iph->saddr, }
functions
int ip6_maybe_reroute(struct sk_buff *skb) { #ifdef CONFIG_NETFILTER if (skb->nfcache & NFC_ALTERED){ if (ip6_route_me_harder(skb) != 0){ kfree_skb(skb); return -EINVAL; }
functions
int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, struct ipv6_txoptions *opt, int ipfragok) { struct ipv6_pinfo *np = sk ? inet6_sk(sk) : NULL; struct in6_addr *first_hop = &fl->fl6_dst; struct dst_entry *dst = skb->dst; struct ipv6hdr *hdr; u8 proto = fl->proto; int seg_len = skb->len; ...
functions
int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev, struct in6_addr *saddr, struct in6_addr *daddr, int proto, int len) { struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *hdr; int totlen; skb->protocol = htons(ETH_P_IPV6); skb->dev = dev; totlen = len + sizeof(struc...
functions
int ip6_call_ra_chain(struct sk_buff *skb, int sel) { struct ip6_ra_chain *ra; struct sock *last = NULL; read_lock(&ip6_ra_lock); for (ra = ip6_ra_chain; ra; ra = ra->next) { struct sock *sk = ra->sk; if (sk && ra->sel == sel) { if (last) { struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); if (skb2...
functions
int ip6_forward_finish(struct sk_buff *skb) { return dst_output(skb); }
functions
int ip6_forward(struct sk_buff *skb) { struct dst_entry *dst = skb->dst; struct ipv6hdr *hdr = skb->nh.ipv6h; struct inet6_skb_parm *opt = IP6CB(skb); if (ipv6_devconf.forwarding == 0) goto error; if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { IP6_INC_STATS(IPSTATS_MIB_INDISCARDS); goto drop; }
functions
void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) { to->pkt_type = from->pkt_type; to->priority = from->priority; to->protocol = from->protocol; dst_release(to->dst); to->dst = dst_clone(from->dst); to->dev = from->dev; #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif #ifdef CONFIG_N...
functions
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) { u16 offset = sizeof(struct ipv6hdr); struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1); unsigned int packet_len = skb->tail - skb->nh.raw; int found_rhdr = 0; *nexthdr = &skb->nh.ipv6h->nexthdr; while (offset + 1 <= packet_len) { ...
functions
int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) { int err = 0; *dst = NULL; if (sk) { struct ipv6_pinfo *np = inet6_sk(sk); *dst = sk_dst_check(sk, np->dst_cookie); if (*dst) { struct rt6_info *rt = (struct rt6_info*)*dst; /* Yes, checking route validity in not connect...
functions
else if (np->cork.opt->tot_len < opt->tot_len) { printk(KERN_DEBUG "ip6_append_data: invalid option length\n"); return -EINVAL; }
functions
else if(i < MAX_SKB_FRAGS) { if (copy > PAGE_SIZE) copy = PAGE_SIZE; page = alloc_pages(sk->sk_allocation, 0); if (page == NULL) { err = -ENOMEM; goto error; }
functions
int ip6_push_pending_frames(struct sock *sk) { struct sk_buff *skb, *tmp_skb; struct sk_buff **tail_skb; struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *hdr; struct ipv6_txoptions *opt = np->cork.opt; struct ...
functions
void ip6_flush_pending_frames(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct sk_buff *skb; while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS); kfree_skb(skb); }
functions
void BoyerMooreCtxToNocase(BmCtx *bm_ctx, uint8_t *needle, uint16_t needle_len) { /* Store the content as lower case to make searching faster */ memcpy_tolower(needle, needle, needle_len); /* Prepare bad chars with nocase chars */ PreBmBcNocase(needle, needle_len, bm_ctx->bmBc); /* Prepare good Su...
functions
void BoyerMooreCtxDeInit(BmCtx *bmctx) { SCEnter(); if (bmctx == NULL) SCReturn; SCFree(bmctx); SCReturn; }
functions
void PreBmBc(const uint8_t *x, uint16_t m, uint16_t *bmBc) { int32_t i; for (i = 0; i < 256; ++i) { bmBc[i] = m; }
functions
void BoyerMooreSuffixes(const uint8_t *x, uint16_t m, uint16_t *suff) { int32_t f = 0, g, i; suff[m - 1] = m; g = m - 1; for (i = m - 2; i >= 0; --i) { if (i > g && suff[i + m - 1 - f] < i - g) suff[i] = suff[i + m - 1 - f]; else { if (i < g) g = i...
functions
int PreBmGs(const uint8_t *x, uint16_t m, uint16_t *bmGs) { int32_t i, j; uint16_t suff[m + 1]; BoyerMooreSuffixes(x, m, suff); for (i = 0; i < m; ++i) bmGs[i] = m; j = 0; for (i = m - 1; i >= -1; --i) if (i == -1 || suff[i] == i + 1) for (; j < m - 1 - i; ++j) ...
functions
void PreBmBcNocase(const uint8_t *x, uint16_t m, uint16_t *bmBc) { int32_t i; for (i = 0; i < 256; ++i) { bmBc[i] = m; }
functions
void BoyerMooreSuffixesNocase(const uint8_t *x, uint16_t m, uint16_t *suff) { int32_t f = 0, g, i; suff[m - 1] = m; g = m - 1; for (i = m - 2; i >= 0; --i) { if (i > g && suff[i + m - 1 - f] < i - g) { suff[i] = suff[i + m - 1 - f]; }
functions
void PreBmGsNocase(const uint8_t *x, uint16_t m, uint16_t *bmGs) { int32_t i, j; uint16_t suff[m + 1]; BoyerMooreSuffixesNocase(x, m, suff); for (i = 0; i < m; ++i) { bmGs[i] = m; }
functions
void BMDestroyCtx(SpmCtx *ctx) { if (ctx == NULL) { return; }
functions
void BMDestroyGlobalThreadCtx(SpmGlobalThreadCtx *global_thread_ctx) { if (global_thread_ctx == NULL) { return; }
functions
void BMDestroyThreadCtx(SpmThreadCtx *thread_ctx) { if (thread_ctx == NULL) { return; }
functions
void SpmBMRegister(void) { spm_table[SPM_BM].name = "bm"; spm_table[SPM_BM].InitGlobalThreadCtx = BMInitGlobalThreadCtx; spm_table[SPM_BM].DestroyGlobalThreadCtx = BMDestroyGlobalThreadCtx; spm_table[SPM_BM].MakeThreadCtx = BMMakeThreadCtx; spm_table[SPM_BM].DestroyThreadCtx = BMDestroyThreadCtx; ...
includes
#include <linux/module.h>
includes
#include <linux/types.h>
includes
#include <linux/slab.h>
includes
#include <linux/interrupt.h>
includes
#include <linux/spinlock.h>
includes
#include <linux/random.h>
includes
#include <linux/timer.h>
includes
#include <linux/time.h>
includes
#include <linux/kernel.h>
includes
#include <linux/mm.h>
includes
#include <linux/net.h>
includes
#include <net/ip.h>
includes
#include <net/inetpeer.h>
defines
#define node_height(x) x->avl_height
defines
#define peer_avl_empty (&peer_fake_node)
defines
#define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */
defines
#define lookup(daddr) \
defines
#define lookup_rightempty(start) \
defines
#define link_to_pool(n) \
functions
__init inet_initpeers(void) { struct sysinfo si; /* Use the straight interface to information about memory. */ si_meminfo(&si); /* The values below were suggested by Alexey Kuznetsov * <kuznet@ms2.inr.ac.ru>. I don't have any opinion about the values * myself. --SAW */ if (si.totalram <= (32768*1024)/PAGE...
functions
void unlink_from_unused(struct inet_peer *p) { spin_lock_bh(&inet_peer_unused_lock); if (p->unused_prevp != NULL) { /* On unused list. */ *p->unused_prevp = p->unused_next; if (p->unused_next != NULL) p->unused_next->unused_prevp = p->unused_prevp; else inet_peer_unused_tailp = p->unused_prevp; p->unu...
functions
void peer_avl_rebalance(struct inet_peer **stack[], struct inet_peer ***stackend) { struct inet_peer **nodep, *node, *l, *r; int lh, rh; while (stackend > stack) { nodep = *--stackend; node = *nodep; l = node->avl_left; r = node->avl_right; lh = node_height(l); rh = node_height(r); if (lh > rh + 1) ...
functions
else if (rh > lh + 1) { /* r: LH+2 */ struct inet_peer *rr, *rl, *rlr, *rll; int rlh; rr = r->avl_right; rl = r->avl_left; rlh = node_height(rl); if (rlh <= node_height(rr)) { /* rr: LH+1 */ node->avl_right = rl; /* rl: LH or LH+1 */ node->avl_left = l; /* l: LH */ node->avl_height = rlh +...
functions
void unlink_from_pool(struct inet_peer *p) { int do_free; do_free = 0; write_lock_bh(&peer_pool_lock); /* Check the reference counter. It was artificially incremented by 1 * in cleanup() function to prevent sudden disappearing. If the * reference count is still 1 then the node is referenced only as `p' * ...
functions
int cleanup_once(unsigned long ttl) { struct inet_peer *p; /* Remove the first entry from the list of unused nodes. */ spin_lock_bh(&inet_peer_unused_lock); p = inet_peer_unused_head; if (p != NULL) { __u32 delta = (__u32)jiffies - p->dtime; if (delta < ttl) { /* Do not prune fresh entries. */ spin_unlo...
functions
void peer_check_expire(unsigned long dummy) { unsigned long now = jiffies; int ttl; if (peer_total >= inet_peer_threshold) ttl = inet_peer_minttl; else ttl = inet_peer_maxttl - (inet_peer_maxttl - inet_peer_minttl) / HZ * peer_total / inet_peer_threshold * HZ; while (!cleanup_once(ttl)) { if (jiffi...
functions
void inet_putpeer(struct inet_peer *p) { spin_lock_bh(&inet_peer_unused_lock); if (atomic_dec_and_test(&p->refcnt)) { p->unused_prevp = inet_peer_unused_tailp; p->unused_next = NULL; *inet_peer_unused_tailp = p; inet_peer_unused_tailp = &p->unused_next; p->dtime = (__u32)jiffies; }
functions
int post_read_mst_fixup(NTFS_RECORD *b, const u32 size) { u16 usa_ofs, usa_count, usn; u16 *usa_pos, *data_pos; /* Setup the variables. */ usa_ofs = le16_to_cpu(b->usa_ofs); /* Decrement usa_count to get number of fixups. */ usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ if ( size ...
functions
int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) { u16 usa_ofs, usa_count, usn; u16 *usa_pos, *data_pos; /* Sanity check + only fixup if it makes sense. */ if (!b || ntfs_is_baad_record(b->magic) || ntfs_is_hole_record(b->magic)) return -EINVAL; /* Setup the variables. */ usa_ofs = le16_to_cpu(b->usa...
functions
void post_write_mst_fixup(NTFS_RECORD *b) { u16 *usa_pos, *data_pos; u16 usa_ofs = le16_to_cpu(b->usa_ofs); u16 usa_count = le16_to_cpu(b->usa_count) - 1; /* Position of usn in update sequence array. */ usa_pos = (u16*)b + usa_ofs/sizeof(u16); /* Position in protected data of first u16 that needs fixing up. */...
includes
#include <ibus.h>
includes
#include <stdlib.h>
includes
#include <locale.h>
includes
#include <chewing.h>
includes
#include <glib/gi18n.h>
defines
#define STRING_BUFFER_SIZE 100
functions
void ibus_disconnected_cb(IBusBus * bus, gpointer user_data) { g_debug("bus disconnected"); ibus_quit(); }
functions
void start_component(void) { IBUS_CHEWING_LOG(INFO, "start_component"); ibus_init(); bus = ibus_bus_new(); g_signal_connect(bus, "disconnected", G_CALLBACK(ibus_disconnected_cb), NULL); factory = ibus_factory_new(ibus_bus_get_connection(bus)); ibus_factory_add_engine(factory, "chewing",...
functions
void determine_locale() { #ifndef STRING_BUFFER_SIZE #endif gchar *localePtr = NULL; gchar localeStr[STRING_BUFFER_SIZE]; int i; for (i = 0; locale_env_strings[i] != NULL; i++) { if (getenv(locale_env_strings[i])) { localePtr = getenv(locale_env_strings[i]); break; }
main
int main(gint argc, gchar * argv[]) { GError *error = NULL; GOptionContext *context; gtk_init(&argc, &argv); /* Init i18n messages */ setlocale(LC_ALL, ""); bindtextdomain(QUOTE_ME(PROJECT_NAME), QUOTE_ME(DATA_DIR) "/locale"); textdomain(QUOTE_ME(PROJECT_NAME)); determine_locale(); ...
includes
#include <linux/module.h>
includes
#include <linux/fs.h>
includes
#include <linux/genhd.h>