linux/arch/um/drivers/vde_kern.c
<<
n va632/spa 632/form 632a n va63 href="../linux+v33..3/arch/um/drivers/vde_kern.c">n va632img src="../.static/gfx/right.png" alt=">>">n 2/spa n 2spa class="lxr_search">n va ="+search" method="post" onsubmit="return do_search(this);">n va632input typ> hidden" nam> navtarget" tion> ">n va632input typ> text" nam> search" id search">n va632butt/optyp> submit">Searchn va63Prefs 632/a>n 2/spa va63 32/div va63 32form ac > ="ajax+*" method="post" onsubmit="return false;">n 2input typ> hidden" nam> ajax_lookup" id ajax_lookup" tion> ">nva63 32/form nva63 32div class="headingbott/m">
2div id file_contents"
 L1">3 312/a>2spa
 class="comment">/*2/spa
  
 L2">3 322/a>2spa
 class="comment"> * Copyright (C) 2007 Luca Bigliardi (shammash@artha.org).2/spa
  
 L3">3 332/a>2spa
 class="comment"> * Licensed under the GPL.2/spa
  
 L4">3 342/a>2spa
 class="comment"> *2/spa
  
 L5">3 352/a>2spa
 class="comment"> * Transport usage:2/spa
  
 L6">3 362/a>2spa
 class="comment"> *  ethN=vde,<vde_switch>,<mac addr>,<port>,<group>,<mode>,<descri	  >
>2/spa
  
 L7">3 372/a>2spa
 class="comment"> *2/spa
  
 L8">3 382/a>2spa
 class="comment"> */2/spa
  
 L9">3 392/a>n
 L10">3 10"
a>#include "2a href="include/linux/init.h" class="fref">linux/init.h"
a>"n
 L11">3 11"
a>#include <2a href="include/linux/netdevice.h" class="fref">linux/netdevice.h"
a>>n
 L12">3 12"
a>#include "2a href="include/net_kern.h" class="fref">net_kern.h"
a>"n
 L13">3 13"
a>#include "2a href="include/net_user.h" class="fref">net_user.h"
a>"n
 L14">3 14"
a>#include "2a href="arch/um/drivers/vde.h" class="fref">vde.h"
a>"n
 L15">3 152/a>n
 L16">3 162/a>static void32a href="+code=vde_init" class="sref">vde_init2/a>(struct32a href="+code=net_device" class="sref">net_device2/a> *2a href="+code=dev" class="sref">dev2/a>, void3*2a href="+code=data" class="sref">data2/a>)n
 L17">3 172/a>{n
 L18">3 182/a>        struct32a href="+code=vde_init" class="sref">vde_init2/a>3*2a href="+code=init" class="sref">init2/a>3=32a href="+code=data" class="sref">data2/a>;n
 L19">3 192/a>        struct32a href="+code=uml_net_private" class="sref">uml_net_private2/a>3*2a href="+code=pri" class="sref">pri2/a>;n
 L20">3 202/a>        struct32a href="+code=vde_data" class="sref">vde_data2/a>3*2a href="+code=vpri" class="sref">vpri2/a>;n
 L21">3 212/a>n
 L22">3 222/a>        2a href="+code=pri" class="sref">pri2/a>3=32a href="+code=netdev_priv" class="sref">netdev_priv2/a>(2a href="+code=dev" class="sref">dev2/a>);n
 L23">3 232/a>        2a href="+code=vpri" class="sref">vpri2/a>3=3(struct32a href="+code=vde_data" class="sref">vde_data2/a>3*) 2a href="+code=pri" class="sref">pri2/a>->2a href="+code=user" class="sref">user2/a>;n
 L24">3 242/a>n
 L25">3 252/a>        2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>3=32a href="+code=init" class="sref">init2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>;n
 L26">3 262/a>        2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=descr" class="sref">descr2/a>3=32a href="+code=init" class="sref">init2/a>->2a href="+code=descr" class="sref">descr2/a>3?32a href="+code=init" class="sref">init2/a>->2a href="+code=descr" class="sref">descr2/a>3: 2spa
 class="string">"UML vde_transport"2/spa
 ;n
 L27">3 272/a>        2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=args" class="sref">args2/a>3=32a href="+code=NULL" class="sref">NULL2/a>;n
 L28">3 282/a>        2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=conn" class="sref">conn2/a>3=32a href="+code=NULL" class="sref">NULL2/a>;n
 L29">3 292/a>        2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=dev" class="sref">dev2/a>3=32a href="+code=dev" class="sref">dev2/a>;n
 L30">3 302/a>n
 L31">3 312/a>        2a href="+code=printk" class="sref">printk2/a>(2spa
 class="string">"vde backend - %s, "2/spa
 , 2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>3?n
 L32">3 322/a>               2a href="+code=vpri" class="sref">vpri2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>3: 2spa
 class="string">"(default socket)"2/spa
 );n
 L33">3 332/a>n
 L34">3 342/a>        2a href="+code=vde_init_libstuff" class="sref">vde_init_libstuff2/a>(2a href="+code=vpri" class="sref">vpri2/a>, 2a href="+code=init" class="sref">init2/a>);n
 L35">3 352/a>n
 L36">3 362/a>        2a href="+code=printk" class="sref">printk2/a>(2spa
 class="string">"\n"2/spa
 );n
 L37">3 372/a>}n
 L38">3 382/a>n
 L39">3 392/a>static int 2a href="+code=vde_read" class="sref">vde_read2/a>(int 2a href="+code=fd" class="sref">fd2/a>, struct32a href="+code=sk_buff" class="sref">sk_buff2/a>3*2a href="+code=skb" class="sref">skb2/a>, struct32a href="+code=uml_net_private" class="sref">uml_net_private2/a>3*2a href="+code=lp" class="sref">lp2/a>)n
 L40">3 402/a>{n
 L41">3 412/a>        struct32a href="+code=vde_data" class="sref">vde_data2/a>3*2a href="+code=pri" class="sref">pri2/a>3=3(struct32a href="+code=vde_data" class="sref">vde_data2/a>3*) &2a href="+code=lp" class="sref">lp2/a>->2a href="+code=user" class="sref">user2/a>;n
 L42">3 422/a>n
 L43">3 432/a>        if (2a href="+code=pri" class="sref">pri2/a>->2a href="+code=conn" class="sref">conn2/a>3!=32a href="+code=NULL" class="sref">NULL2/a>)n
 L44">3 442/a>                return 2a href="+code=vde_user_read" class="sref">vde_user_read2/a>(2a href="+code=pri" class="sref">pri2/a>->2a href="+code=conn" class="sref">conn2/a>, 2a href="+code=skb_mac_header" class="sref">skb_mac_header2/a>(2a href="+code=skb" class="sref">skb2/a>),n
 L45">3 452/a>                                     2a href="+code=skb" class="sref">skb2/a>->2a href="+code=dev" class="sref">dev2/a>->2a href="+code=mtu" class="sref">mtu2/a> + 2a href="+code=ETH_HEADER_OTHER" class="sref">ETH_HEADER_OTHER2/a>);n
 L46">3 462/a>n
 L47">3 472/a>        2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_ERR" class="sref">KERN_ERR2/a> 2spa
 class="string">"vde_read - we have no VDECONN to read from"2/spa
 );n
 L48">3 482/a>        return -2a href="+code=EBADF" class="sref">EBADF2/a>;n
 L49">3 492/a>}n
 L50">3 502/a>n
 L51">3 512/a>static int 2a href="+code=vde_write" class="sref">vde_write2/a>(int 2a href="+code=fd" class="sref">fd2/a>, struct32a href="+code=sk_buff" class="sref">sk_buff2/a>3*2a href="+code=skb" class="sref">skb2/a>, struct32a href="+code=uml_net_private" class="sref">uml_net_private2/a>3*2a href="+code=lp" class="sref">lp2/a>)n
 L52">3 522/a>{n
 L53">3 532/a>        struct32a href="+code=vde_data" class="sref">vde_data2/a>3*2a href="+code=pri" class="sref">pri2/a>3=3(struct32a href="+code=vde_data" class="sref">vde_data2/a>3*) &2a href="+code=lp" class="sref">lp2/a>->2a href="+code=user" class="sref">user2/a>;n
 L54">3 542/a>n
 L55">3 552/a>        if (2a href="+code=pri" class="sref">pri2/a>->2a href="+code=conn" class="sref">conn2/a>3!=32a href="+code=NULL" class="sref">NULL2/a>)n
 L56">3 562/a>                return 2a href="+code=vde_user_write" class="sref">vde_user_write2/a>((void3*)2a href="+code=pri" class="sref">pri2/a>->2a href="+code=conn" class="sref">conn2/a>, 2a href="+code=skb" class="sref">skb2/a>->2a href="+code=data" class="sref">data2/a>,n
 L57">3 572/a>                                      2a href="+code=skb" class="sref">skb2/a>->2a href="+code=len" class="sref">len2/a>);n
 L58">3 582/a>n
 L59">3 592/a>        2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_ERR" class="sref">KERN_ERR2/a> 2spa
 class="string">"vde_write - we have no VDECONN to write to"2/spa
 );n
 L60">3 602/a>        return -2a href="+code=EBADF" class="sref">EBADF2/a>;n
 L61">3 612/a>}n
 L62">3 622/a>n
 L63">3 632/a>static const struct32a href="+code=net_kern_info" class="sref">net_kern_info2/a> 2a href="+code=vde_kern_info" class="sref">vde_kern_info2/a>3=3{n
 L64">3 642/a>        .2a href="+code=init" class="sref">init2/a>                   =32a href="+code=vde_init" class="sref">vde_init2/a>,n
 L65">3 652/a>        .2a href="+code=protocol" class="sref">protocol2/a>               =32a href="+code=eth_protocol" class="sref">eth_protocol2/a>,n
 L66">3 662/a>        .2a href="+code=read" class="sref">read2/a>                   =32a href="+code=vde_read" class="sref">vde_read2/a>,n
 L67">3 672/a>        .2a href="+code=write" class="sref">write2/a>                  =32a href="+code=vde_write" class="sref">vde_write2/a>,n
 L68">3 682/a>};n
 L69">3 692/a>n
 L70">3 702/a>static int 2a href="+code=vde_setup" class="sref">vde_setup2/a>(char3*2a href="+code=str" class="sref">str2/a>, char3**2a href="+code=mac_out" class="sref">mac_out2/a>, void3*2a href="+code=data" class="sref">data2/a>)n
 L71">3 712/a>{n
 L72">3 722/a>        struct32a href="+code=vde_init" class="sref">vde_init2/a>3*2a href="+code=init" class="sref">init2/a>3=32a href="+code=data" class="sref">data2/a>;n
 L73">3 732/a>        char3*2a href="+code=remain" class="sref">remain2/a>, *2a href="+code=port_str" class="sref">port_str2/a>3=32a href="+code=NULL" class="sref">NULL2/a>, *2a href="+code=mode_str" class="sref">mode_str2/a>3=32a href="+code=NULL" class="sref">NULL2/a>, *2a href="+code=last" class="sref">last2/a>;n
 L74">3 742/a>n
 L75">3 752/a>        *2a href="+code=init" class="sref">init2/a>3=3((struct32a href="+code=vde_init" class="sref">vde_init2/a>)n
 L76">3 762/a>                { .2a href="+code=vde_switch" class="sref">vde_switch2/a>3          =32a href="+code=NULL" class="sref">NULL2/a>,n
 L77">3 772/a>                  .2a href="+code=descr" class="sref">descr2/a>3               =32a href="+code=NULL" class="sref">NULL2/a>,n
 L78">3 782/a>                  .2a href="+code=port" class="sref">port2/a>                 = 0,n
 L79">3 792/a>                  .2a href="+code=group" class="sref">group2/a>3               =32a href="+code=NULL" class="sref">NULL2/a>,n
 L80">3 802/a>                  .2a href="+code=mode" class="sref">mode2/a>                 = 0 });n
 L81">3 812/a>n
 L82">3 822/a>        2a href="+code=remain" class="sref">remain2/a> =32a href="+code=split_if_spec" class="sref">split_if_spec2/a>(2a href="+code=str" class="sref">str2/a>, &2a href="+code=init" class="sref">init2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>, 2a href="+code=mac_out" class="sref">mac_out2/a>, &2a href="+code=port_str" class="sref">port_str2/a>,n
 L83">3 832/a>                                &2a href="+code=init" class="sref">init2/a>->2a href="+code=group" class="sref">group2/a>, &2a href="+code=mode_str" class="sref">mode_str2/a>, &2a href="+code=init" class="sref">init2/a>->2a href="+code=descr" class="sref">descr2/a>, 2a href="+code=NULL" class="sref">NULL2/a>);n
 L84">3 842/a>n
 L85">3 852/a>        if (2a href="+code=remain" class="sref">remain2/a> !=32a href="+code=NULL" class="sref">NULL2/a>)n
 L86">3 862/a>                2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_WARNING" class="sref">KERN_WARNING2/a> 2spa
 class="string">"vde_setup - Ignoring extra data :"2/spa
 n
 L87">3 872/a>                       2spa
 class="string">"'%s'\n"2/spa
 , 2a href="+code=remain" class="sref">remain2/a>);n
 L88">3 882/a>n
 L89">3 892/a>        if (2a href="+code=port_str" class="sref">port_str2/a>3!=32a href="+code=NULL" class="sref">NULL2/a>)3{n
 L90">3 902/a>                2a href="+code=init" class="sref">init2/a>->2a href="+code=port" class="sref">port2/a> =32a href="+code=simple_strtoul" class="sref">simple_strtoul2/a>(2a href="+code=port_str" class="sref">port_str2/a>, &2a href="+code=last" class="sref">last2/a>, 10);n
 L91">3 912/a>                if ((*2a href="+code=last" class="sref">last2/a>3!=32spa
 class="string">'\0'2/spa
 ) || (2a href="+code=last" class="sref">last2/a>3==32a href="+code=port_str" class="sref">port_str2/a>))3{n
 L92">3 922/a>                        2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_ERR" class="sref">KERN_ERR2/a> 2spa
 class="string">"vde_setup - Bad port : '%s'\n"2/spa
 ,n
 L93">3 932/a>                                                2a href="+code=port_str" class="sref">port_str2/a>);n
 L94">3 942/a>                        return 0;n
 L95">3 952/a>                }n
 L96">3 962/a>        }n
 L97">3 972/a>n
 L98">3 982/a>        if (2a href="+code=mode_str" class="sref">mode_str2/a>3!=32a href="+code=NULL" class="sref">NULL2/a>)3{n
 L99">3 992/a>                2a href="+code=init" class="sref">init2/a>->2a href="+code=mode" class="sref">mode2/a> =32a href="+code=simple_strtoul" class="sref">simple_strtoul2/a>(2a href="+code=mode_str" class="sref">mode_str2/a>, &2a href="+code=last" class="sref">last2/a>, 8);n
 L100">31002/a>                if ((*2a href="+code=last" class="sref">last2/a>3!=32spa
 class="string">'\0'2/spa
 ) || (2a href="+code=last" class="sref">last2/a>3==32a href="+code=mode_str" class="sref">mode_str2/a>))3{n
 L101">31012/a>                        2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_ERR" class="sref">KERN_ERR2/a> 2spa
 class="string">"vde_setup - Bad mode : '%s'\n"2/spa
 ,n
 L102">31022/a>                                                2a href="+code=mode_str" class="sref">mode_str2/a>);n
 L103">31032/a>                        return 0;n
 L104">31042/a>                }n
 L105">31052/a>        }n
 L106">31062/a>n
 L107">31072/a>        2a href="+code=printk" class="sref">printk2/a>(2a href="+code=KERN_INFO" class="sref">KERN_INFO2/a> 2spa
 class="string">"Configured vde device: %s\n"2/spa
 , 2a href="+code=init" class="sref">init2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>3?n
 L108">31082/a>               2a href="+code=init" class="sref">init2/a>->2a href="+code=vde_switch" class="sref">vde_switch2/a>3: 2spa
 class="string">"(default socket)"2/spa
 );n
 L109">31092/a>n
 L110">31102/a>        return 1;n
 L111">31112/a>}n
 L112">31122/a>n
 L113">31132/a>static struct32a href="+code=transport" class="sref">transport2/a> 2a href="+code=vde_transport" class="sref">vde_transport2/a> =3{n
 L114">31142/a>        .2a href="+code=list" class="sref">list2/a>           =32a href="+code=LIST_HEAD_INIT" class="sref">LIST_HEAD_INIT2/a>(2a href="+code=vde_transport" class="sref">vde_transport2/a>.2a href="+code=list" class="sref">list2/a>),n
 L115">31152/a>        .2a href="+code=nam>" class="sref">nam>2/a>           =32spa
 class="string">"vde"2/spa
 ,n
 L116">31162/a>        .2a href="+code=setup" class="sref">setup2/a>          =32a href="+code=vde_setup" class="sref">vde_setup2/a>,n
 L117">31172/a>        .2a href="+code=user" class="sref">user2/a>           =3&2a href="+code=vde_user_info" class="sref">vde_user_info2/a>,n
 L118">31182/a>        .2a href="+code=kern" class="sref">kern2/a>           =3&2a href="+code=vde_kern_info" class="sref">vde_kern_info2/a>,n
 L119">31192/a>        .2a href="+code=private_siz>" class="sref">private_siz>2/a>   = siz>of(struct32a href="+code=vde_data" class="sref">vde_data2/a>),n
 L120">31202/a>        .2a href="+code=setup_siz>" class="sref">setup_siz>2/a>     = siz>of(struct32a href="+code=vde_init" class="sref">vde_init2/a>),n
 L121">31212/a>};n
 L122">31222/a>n
 L123">31232/a>static int 2a href="+code=register_vde" class="sref">register_vde2/a>(void)n
 L124">31242/a>{n
 L125">31252/a>        2a href="+code=register_transport" class="sref">register_transport2/a>(&2a href="+code=vde_transport" class="sref">vde_transport2/a>);n
 L126">31262/a>        return 0;n
 L127">31272/a>}n
 L128">31282/a>n
 L129">31292/a>2a href="+code=late_initcall" class="sref">late_initcall2/a>(2a href="+code=register_vde" class="sref">register_vde2/a>);n
 L130">31302/a>
The original LXR software by the LXR community2/a>, this experimental verslxr@linux.no2/a>. 2/div 2div class="subfooter"> lxr.linux.no kindly hostedpby Redpill Linpro AS2/a>, provider of Linux consulting and opera > s services since 1995. 2/div 2/body 2/html