@@ -22,7 +22,6 @@ use oxide_vpc::api::AddRouterEntryReq;
2222use oxide_vpc:: api:: CreateXdeReq ;
2323use oxide_vpc:: api:: DeleteXdeReq ;
2424use oxide_vpc:: api:: FirewallRule ;
25- use oxide_vpc:: api:: ListPortsReq ;
2625use oxide_vpc:: api:: ListPortsResp ;
2726use oxide_vpc:: api:: RemFwRuleReq ;
2827use oxide_vpc:: api:: SetFwRulesReq ;
@@ -58,8 +57,7 @@ impl OpteAdm {
5857 let xde_devname = name. into ( ) ;
5958 let cmd = OpteCmd :: CreateXde ;
6059 let req = CreateXdeReq { xde_devname, linkid, cfg, passthrough } ;
61-
62- let res = run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req) ;
60+ let res = run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) ) ;
6361
6462 if res. is_err ( ) {
6563 let _ = link:: delete_link_id ( linkid, libnet:: LinkFlags :: Active ) ;
@@ -73,7 +71,7 @@ impl OpteAdm {
7371 let link_id = libnet:: LinkHandle :: Name ( name. into ( ) ) . id ( ) ?;
7472 let req = DeleteXdeReq { xde_devname : name. into ( ) } ;
7573 let cmd = OpteCmd :: DeleteXde ;
76- let resp = run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req) ?;
74+ let resp = run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) ) ?;
7775 libnet:: link:: delete_link_id ( link_id, libnet:: LinkFlags :: Active ) ?;
7876 Ok ( resp)
7977 }
@@ -86,7 +84,7 @@ impl OpteAdm {
8684 ) -> Result < NoResp , Error > {
8785 let req = SetXdeUnderlayReq { u1 : u1. into ( ) , u2 : u2. into ( ) } ;
8886 let cmd = OpteCmd :: SetXdeUnderlay ;
89- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req)
87+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
9088 }
9189
9290 /// Add a firewall rule
@@ -100,7 +98,7 @@ impl OpteAdm {
10098 port_name : port_name. to_string ( ) ,
10199 rule : rule. clone ( ) ,
102100 } ;
103- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req)
101+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
104102 }
105103
106104 pub fn set_firewall_rules (
@@ -111,7 +109,7 @@ impl OpteAdm {
111109 let cmd = OpteCmd :: SetFwRules ;
112110 let req =
113111 SetFwRulesReq { port_name : port_name. to_string ( ) , rules : rules } ;
114- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req)
112+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
115113 }
116114
117115 /// Return the contents of an OPTE layer.
@@ -125,21 +123,12 @@ impl OpteAdm {
125123 port_name : port_name. to_string ( ) ,
126124 name : name. to_string ( ) ,
127125 } ;
128- run_cmd_ioctl :: < api:: DumpLayerResp , _ > (
129- self . device . as_raw_fd ( ) ,
130- cmd,
131- & req,
132- )
126+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
133127 }
134128
135129 /// List all the ports.
136130 pub fn list_ports ( & self ) -> Result < ListPortsResp , Error > {
137- let cmd = OpteCmd :: ListPorts ;
138- run_cmd_ioctl :: < ListPortsResp , _ > (
139- self . device . as_raw_fd ( ) ,
140- cmd,
141- & ListPortsReq { unused : ( ) } ,
142- )
131+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , OpteCmd :: ListPorts , None :: < & ( ) > )
143132 }
144133
145134 pub fn list_layers (
@@ -150,7 +139,7 @@ impl OpteAdm {
150139 run_cmd_ioctl :: < api:: ListLayersResp , _ > (
151140 self . device . as_raw_fd ( ) ,
152141 cmd,
153- & api:: ListLayersReq { port_name : port. to_string ( ) } ,
142+ Some ( & api:: ListLayersReq { port_name : port. to_string ( ) } ) ,
154143 )
155144 }
156145
@@ -167,7 +156,7 @@ impl OpteAdm {
167156 req : & RemFwRuleReq ,
168157 ) -> Result < NoResp , Error > {
169158 let cmd = OpteCmd :: RemFwRule ;
170- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, req)
159+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( req) )
171160 }
172161
173162 /// Return the TCP flows.
@@ -179,7 +168,7 @@ impl OpteAdm {
179168 run_cmd_ioctl :: < api:: DumpTcpFlowsResp , _ > (
180169 self . device . as_raw_fd ( ) ,
181170 cmd,
182- & api:: DumpTcpFlowsReq { port_name : port_name. to_string ( ) } ,
171+ Some ( & api:: DumpTcpFlowsReq { port_name : port_name. to_string ( ) } ) ,
183172 )
184173 }
185174
@@ -189,7 +178,7 @@ impl OpteAdm {
189178 run_cmd_ioctl (
190179 self . device . as_raw_fd ( ) ,
191180 cmd,
192- & api:: ClearUftReq { port_name : port_name. to_string ( ) } ,
181+ Some ( & api:: ClearUftReq { port_name : port_name. to_string ( ) } ) ,
193182 )
194183 }
195184
@@ -199,22 +188,22 @@ impl OpteAdm {
199188 run_cmd_ioctl :: < api:: DumpUftResp , _ > (
200189 self . device . as_raw_fd ( ) ,
201190 cmd,
202- & api:: DumpUftReq { port_name : port_name. to_string ( ) } ,
191+ Some ( & api:: DumpUftReq { port_name : port_name. to_string ( ) } ) ,
203192 )
204193 }
205194
206195 pub fn set_v2p ( & self , req : & SetVirt2PhysReq ) -> Result < NoResp , Error > {
207196 let cmd = OpteCmd :: SetVirt2Phys ;
208- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req)
197+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
209198 }
210199
211200 /// Dump the Virtual-to-Physical mappings.
212201 pub fn dump_v2p ( & self ) -> Result < overlay:: DumpVirt2PhysResp , Error > {
213202 let cmd = OpteCmd :: DumpVirt2Phys ;
214- run_cmd_ioctl :: < overlay :: DumpVirt2PhysResp , _ > (
203+ run_cmd_ioctl (
215204 self . device . as_raw_fd ( ) ,
216205 cmd,
217- & overlay:: DumpVirt2PhysReq { unused : 99 } ,
206+ Some ( & overlay:: DumpVirt2PhysReq { unused : 99 } ) ,
218207 )
219208 }
220209
@@ -223,6 +212,6 @@ impl OpteAdm {
223212 req : & AddRouterEntryReq ,
224213 ) -> Result < NoResp , Error > {
225214 let cmd = OpteCmd :: AddRouterEntry ;
226- run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, & req)
215+ run_cmd_ioctl ( self . device . as_raw_fd ( ) , cmd, Some ( & req) )
227216 }
228217}
0 commit comments