Skip to content

Commit 872359a

Browse files
author
rstade
committed
adapted for rustc 1.76.0-nightly (ba7c7a301 2023-11-13):
- updated box to Box syntax - feature "event" in nix crate
1 parent 69b33f9 commit 872359a

27 files changed

Lines changed: 58 additions & 72 deletions

File tree

framework/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "e2d2"
3-
version = "1.0.8"
3+
version = "1.0.9"
44
authors = ["Aurojit Panda <apanda@cs.berkeley.edu>", "Rainer Stademann"]
55
build = "build.rs"
66

@@ -20,7 +20,7 @@ regex = "*"
2020
lazy_static = "*"
2121
net2 = "*"
2222
# NIX restricts us to just unix for now, we can fix this if someone cares at a later point.
23-
nix = ">=0.10.0"
23+
nix = { version = ">=0.27.1", features =["event"] }
2424
toml = "0.6"
2525
# Hack for SHM
2626
uuid= { version = ">=0.7", features=["v4"] }
@@ -36,3 +36,4 @@ ipnet = ">=1.0"
3636
default = []
3737
performance = []
3838
packet_offset = []
39+

test/acl-fw/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(box_syntax)]
21
extern crate e2d2;
32
extern crate fnv;
43
extern crate getopts;

test/acl-fw/src/nf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ impl Acl {
3939
pub fn acl_match<T: 'static + Batch>(parent: T, acls: Vec<Acl>) -> CompositionBatch {
4040
let mut flow_cache = HashSet::<FiveTupleV4, FnvHash>::with_hasher(Default::default());
4141
parent
42-
.transform(box move |p| {
42+
.transform(Box::new(move |p| {
4343
p.headers_mut().mac_mut(0).swap_addresses();
44-
})
45-
.filter(box move |p| {
44+
}))
45+
.filter(Box::new(move |p| {
4646
let flow = p.headers().ip(1).flow().unwrap();
4747
for acl in &acls {
4848
if acl.matches(&flow, &flow_cache) {
@@ -53,6 +53,6 @@ pub fn acl_match<T: 'static + Batch>(parent: T, acls: Vec<Acl>) -> CompositionBa
5353
}
5454
}
5555
return false;
56-
})
56+
}))
5757
.compose()
5858
}

test/chain-test/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(box_syntax)]
2-
31
extern crate e2d2;
42
extern crate eui48;
53
extern crate fnv;

test/chain-test/src/nf.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ use e2d2::operators::*;
33
#[inline]
44
pub fn chain_nf<T: 'static + Batch>(parent: T) -> CompositionBatch {
55
let next = parent
6-
.transform(box move |pkt| {
6+
.transform(Box::new(move |pkt| {
77
let hdr = pkt.headers_mut().mac_mut(0);
88
hdr.swap_addresses();
9-
})
10-
.transform(box |pkt| {
9+
}))
10+
.transform(Box::new(|pkt| {
1111
let h = pkt.headers_mut().ip_mut(1);
1212
let ttl = h.ttl();
1313
h.set_ttl(ttl - 1);
14-
})
15-
.filter(box |pkt| {
14+
}))
15+
.filter(Box::new(|pkt| {
1616
let h = pkt.headers().ip(1);
1717
h.ttl() != 0
18-
});
18+
}));
1919
CompositionBatch::new(next)
2020
}
2121

@@ -26,10 +26,10 @@ pub fn chain<S: 'static + Batch>(parent: S, len: u32, pos: u32) -> CompositionBa
2626
chained = chain_nf(chained);
2727
}
2828
let next = if len % 2 == 0 || pos % 2 == 1 {
29-
CompositionBatch::new(chained.transform(box move |pkt| {
29+
CompositionBatch::new(chained.transform(Box::new(move |pkt| {
3030
let hdr = pkt.headers_mut().mac_mut(0);
3131
hdr.swap_addresses();
32-
}))
32+
})))
3333
} else {
3434
chained
3535
};

test/delay-test/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(box_syntax)]
21
extern crate e2d2;
32
extern crate fnv;
43
extern crate getopts;

test/delay-test/src/nf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ fn delay_loop(delay: u64) {
1818
}
1919

2020
pub fn delay<T: 'static + Batch>(parent: T, delay: u64) -> TransformBatch<T> {
21-
parent.transform(box move |pkt| {
21+
parent.transform(Box::new(move |pkt| {
2222
assert!(pkt.refcnt() == 1);
2323
let hdr = pkt.headers_mut().mac_mut(0);
2424
hdr.swap_addresses();
2525
delay_loop(delay);
26-
})
26+
}))
2727
}

test/framework/src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(box_syntax)]
21
extern crate e2d2;
32
extern crate getopts;
43
extern crate rand;
@@ -25,16 +24,16 @@ fn monitor<T: 'static + Batch>(
2524
mut monitoring_cache: MergeableStoreDP<isize>,
2625
) -> TransformBatch<TransformBatch<T>> {
2726
parent
28-
.transform(box |pkt| {
27+
.transform(Box::new(|pkt| {
2928
let hdr = pkt.headers_mut().mac_mut(0);
3029
hdr.swap_addresses();
31-
})
32-
.transform(box move |pkt| {
30+
}))
31+
.transform(Box::new(move |pkt| {
3332
let hdr = pkt.headers_mut().ip_mut(1);
3433
let ttl = hdr.ttl();
3534
hdr.set_ttl(ttl + 1);
3635
monitoring_cache.update(hdr.flow().unwrap(), 1);
37-
})
36+
}))
3837
}
3938

4039
fn recv_thread(ports: Vec<CacheAligned<PortQueue>>, core: i32, counter: MergeableStoreDP<isize>) {
@@ -45,7 +44,7 @@ fn recv_thread(ports: Vec<CacheAligned<PortQueue>>, core: i32, counter: Mergeabl
4544
.iter()
4645
.map(|port| {
4746
let ctr = counter.clone();
48-
box monitor(ReceiveBatch::new(port.clone()), ctr).send(port.clone()) as Box<dyn Batch>
47+
Box::new(monitor(ReceiveBatch::new(port.clone()), ctr).send(port.clone())) as Box<dyn Batch>
4948
})
5049
.collect();
5150
println!("Running {} pipelines", pipelines.len());

test/lpm/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(box_syntax)]
21
extern crate e2d2;
32
extern crate fnv;
43
extern crate getopts;

test/lpm/src/nf.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,21 +208,21 @@ pub fn lpm<T: 'static + Batch, S: Scheduler + Sized>(parent: T, s: &mut S) -> Co
208208
lpm_table.construct_table();
209209
let uuid = Uuid::new_v4();
210210
let mut groups = parent
211-
.transform(box |p| p.headers_mut().mac_mut(0).swap_addresses())
211+
.transform(Box::new(|p| p.headers_mut().mac_mut(0).swap_addresses()))
212212
.group_by(
213213
3,
214-
box move |pkt| {
214+
Box::new(move |pkt| {
215215
let hdr = pkt.headers().ip(1);
216216
lpm_table.lookup_entry(hdr.src()) as usize
217-
},
217+
}),
218218
s,
219219
"lpm_groups".to_string(),
220220
uuid,
221221
);
222222
let pipeline = merge_batches(vec![
223-
box groups.get_group(0).unwrap(),
224-
box groups.get_group(1).unwrap(),
225-
box groups.get_group(2).unwrap(),
223+
Box::new(groups.get_group(0).unwrap()),
224+
Box::new(groups.get_group(1).unwrap()),
225+
Box::new(groups.get_group(2).unwrap()),
226226
])
227227
.compose();
228228
pipeline

0 commit comments

Comments
 (0)