tape: page-align BlockHeader so that we can use it with SG_IO
This commit is contained in:
parent
6f63c29306
commit
11f5d59396
@ -288,9 +288,12 @@ impl BlockHeader {
|
|||||||
pub fn new() -> Box<Self> {
|
pub fn new() -> Box<Self> {
|
||||||
use std::alloc::{alloc_zeroed, Layout};
|
use std::alloc::{alloc_zeroed, Layout};
|
||||||
|
|
||||||
|
// align to PAGESIZE, so that we can use it with SG_IO
|
||||||
|
let page_size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) } as usize;
|
||||||
|
|
||||||
let mut buffer = unsafe {
|
let mut buffer = unsafe {
|
||||||
let ptr = alloc_zeroed(
|
let ptr = alloc_zeroed(
|
||||||
Layout::from_size_align(Self::SIZE, std::mem::align_of::<u64>())
|
Layout::from_size_align(Self::SIZE, page_size)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
Box::from_raw(
|
Box::from_raw(
|
||||||
|
Loading…
Reference in New Issue
Block a user