Skip to content

Commit 24a1022

Browse files
committed
Fix build
1 parent 74d952b commit 24a1022

8 files changed

Lines changed: 21 additions & 16 deletions

File tree

build-container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ RUN apt-get -yq update && apt-get -yq install libssl-dev \
1212
RUN mkdir -p ~/.ssh && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
1313
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
1414
ENV PATH /root/.cargo/bin:$PATH
15-
RUN cargo install rustfmt
15+
RUN cargo install rustfmt-nightly || true
1616
CMD [/bin/bash]

framework/src/control/linux/epoll.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ impl PollHandle {
1717
}
1818

1919
pub fn schedule_read_rawfd(&self, fd: RawFd, token: Token) {
20-
let mut event = EpollEvent::new(EPOLLIN | EPOLLET | EPOLLONESHOT, token);
20+
let mut event = EpollEvent::new(
21+
EpollFlags::EPOLLIN | EpollFlags::EPOLLET | EpollFlags::EPOLLONESHOT,
22+
token,
23+
);
2124
epoll_ctl(self.epoll_fd, EpollOp::EpollCtlMod, fd, &mut event).unwrap();
2225
}
2326

@@ -26,7 +29,10 @@ impl PollHandle {
2629
}
2730

2831
pub fn schedule_write_rawfd(&self, fd: RawFd, token: Token) {
29-
let mut event = EpollEvent::new(EPOLLOUT | EPOLLET | EPOLLONESHOT, token);
32+
let mut event = EpollEvent::new(
33+
EpollFlags::EPOLLOUT | EpollFlags::EPOLLET | EpollFlags::EPOLLONESHOT,
34+
token,
35+
);
3036
epoll_ctl(self.epoll_fd, EpollOp::EpollCtlMod, fd, &mut event).unwrap();
3137
}
3238

@@ -36,7 +42,7 @@ impl PollHandle {
3642
}
3743

3844
pub fn new_io_fd(&self, fd: RawFd, token: Token) {
39-
let mut event = EpollEvent::new(EPOLLET | EPOLLONESHOT, token);
45+
let mut event = EpollEvent::new(EpollFlags::EPOLLET | EpollFlags::EPOLLONESHOT, token);
4046
epoll_ctl(self.epoll_fd, EpollOp::EpollCtlAdd, fd, &mut event).unwrap();
4147
}
4248
}
@@ -71,13 +77,13 @@ impl PollScheduler {
7177
#[inline]
7278
fn epoll_kind_to_available(&self, kind: &EpollFlags) -> Available {
7379
let mut available = NONE;
74-
if kind.contains(EPOLLIN) {
80+
if kind.contains(EpollFlags::EPOLLIN) {
7581
available |= READ
7682
};
77-
if kind.contains(EPOLLOUT) {
83+
if kind.contains(EpollFlags::EPOLLOUT) {
7884
available |= WRITE
7985
};
80-
if kind.contains(EPOLLHUP) || kind.contains(EPOLLERR) {
86+
if kind.contains(EpollFlags::EPOLLHUP) || kind.contains(EpollFlags::EPOLLERR) {
8187
available |= HUP
8288
};
8389
available

framework/src/headers/ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl IpHeader {
185185
pub fn fragment_offset(&self) -> u16 {
186186
let id_flag_fragment = self.id_to_foffset;
187187
let flag_fragment = (id_flag_fragment & 0xffff) as u16;
188-
u16::from_be(((flag_fragment & !0xe) >> 3))
188+
u16::from_be((flag_fragment & !0xe) >> 3)
189189
}
190190

191191
#[inline]

framework/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#![feature(heap_api)]
1010
#![feature(unique)]
1111
#![feature(const_fn)]
12+
// FIXME: Figure out if this is really the right thing here.
13+
#![feature(ptr_internals)]
1214
// Used for cache alignment.
1315
#![feature(allocator_api)]
1416
#![allow(unused_features)]

framework/src/native/libnuma.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ impl Eq for Bitmask {}
104104
impl Bitmask {
105105
pub unsafe fn allocate_node_mask() -> Bitmask {
106106
Bitmask {
107-
bitmask: wrapped::numa_bitmask_clearall(wrapped::numa_bitmask_alloc(numa_num_possible_nodes()
108-
as u32)),
107+
bitmask: wrapped::numa_bitmask_clearall(wrapped::numa_bitmask_alloc(numa_num_possible_nodes() as u32)),
109108
}
110109
}
111110

framework/src/operators/packet_batch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl PacketBatch {
144144
let len = self.scratch.len();
145145
// No need to offset here since self.scratch is tight.
146146
let array_ptr = self.scratch.as_mut_ptr();
147-
let ret = mbuf_free_bulk(array_ptr, (len as i32));
147+
let ret = mbuf_free_bulk(array_ptr, len as i32);
148148
self.scratch.clear();
149149
if ret == 0 {
150150
Some(len)

framework/src/utils/flow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn crc_hash<T: Sized>(to_hash: &T, iv: u32) -> u32 {
125125

126126
fn flow_as_u8(flow: &Flow) -> &[u8] {
127127
let size = mem::size_of::<Flow>();
128-
unsafe { slice::from_raw_parts(((flow as *const Flow) as *const u8), size) }
128+
unsafe { slice::from_raw_parts((flow as *const Flow) as *const u8, size) }
129129
}
130130

131131
#[inline]

framework/tests/tcp_window.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,9 @@ fn test_overlapping_write() {
473473
let read = r0.read_data(&mut read_buf[..]);
474474
let read_str = str::from_utf8(&read_buf[..read]).unwrap();
475475
assert_eq!(
476-
read_str,
477-
"hello world",
476+
read_str, "hello world",
478477
"Read value {} expected {}",
479-
read_str,
480-
"hello world"
478+
read_str, "hello world"
481479
);
482480

483481
if let InsertionResult::Inserted { written, .. } = r0.add_data(base_seq, data0.as_bytes()) {

0 commit comments

Comments
 (0)