Fix some style issues
This commit is contained in:
parent
b1071b6b92
commit
425cc2d1cf
|
|
@ -138,13 +138,17 @@ impl FileIo for OpenBlockFile {
|
||||||
|
|
||||||
fn ioctl(&self, raw_ioctl: RawIoctl) -> Result<i32> {
|
fn ioctl(&self, raw_ioctl: RawIoctl) -> Result<i32> {
|
||||||
use ioctl_defs::*;
|
use ioctl_defs::*;
|
||||||
|
|
||||||
dispatch_ioctl!(match raw_ioctl {
|
dispatch_ioctl!(match raw_ioctl {
|
||||||
cmd @ BlkGetSize64 => {
|
cmd @ BlkGetSize64 => {
|
||||||
let size = (self.0.metadata().nr_sectors * SECTOR_SIZE) as u64;
|
let size = (self.0.metadata().nr_sectors * SECTOR_SIZE) as u64;
|
||||||
cmd.write(&size)?;
|
cmd.write(&size)?;
|
||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
_ => return_errno_with_message!(Errno::ENOTTY, "unsupported ioctl on block device"),
|
_ => return_errno_with_message!(
|
||||||
|
Errno::ENOTTY,
|
||||||
|
"the ioctl command is not supported by block devices"
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ pub fn sys_prlimit64(
|
||||||
old_rlim_addr: Vaddr,
|
old_rlim_addr: Vaddr,
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
) -> Result<SyscallReturn> {
|
) -> Result<SyscallReturn> {
|
||||||
let userspace = ctx.user_space();
|
let user_space = ctx.user_space();
|
||||||
|
|
||||||
let new_raw = if new_rlim_addr == 0 {
|
let new_raw = if new_rlim_addr == 0 {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(userspace.read_val(new_rlim_addr)?)
|
Some(user_space.read_val(new_rlim_addr)?)
|
||||||
};
|
};
|
||||||
|
|
||||||
let old_raw = if pid == 0 || pid == ctx.process.pid() {
|
let old_raw = if pid == 0 || pid == ctx.process.pid() {
|
||||||
|
|
@ -53,7 +53,7 @@ pub fn sys_prlimit64(
|
||||||
};
|
};
|
||||||
|
|
||||||
if old_rlim_addr != 0 {
|
if old_rlim_addr != 0 {
|
||||||
userspace.write_val(old_rlim_addr, &old_raw)?;
|
user_space.write_val(old_rlim_addr, &old_raw)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(SyscallReturn::Return(0))
|
Ok(SyscallReturn::Return(0))
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ const SIZE_OF_PART: usize = size_of::<Part>();
|
||||||
const CPUS_IN_PART: usize = SIZE_OF_PART * 8;
|
const CPUS_IN_PART: usize = SIZE_OF_PART * 8;
|
||||||
|
|
||||||
fn read_cpu_set_from(
|
fn read_cpu_set_from(
|
||||||
uspace: CurrentUserSpace,
|
user_space: CurrentUserSpace,
|
||||||
cpuset_size: usize,
|
cpuset_size: usize,
|
||||||
cpu_set_ptr: Vaddr,
|
cpu_set_ptr: Vaddr,
|
||||||
) -> Result<CpuSet> {
|
) -> Result<CpuSet> {
|
||||||
|
|
@ -81,7 +81,7 @@ fn read_cpu_set_from(
|
||||||
|
|
||||||
let nr_parts_to_read = cmp::min(cpuset_size / SIZE_OF_PART, num_cpus.div_ceil(CPUS_IN_PART));
|
let nr_parts_to_read = cmp::min(cpuset_size / SIZE_OF_PART, num_cpus.div_ceil(CPUS_IN_PART));
|
||||||
for part_id in 0..nr_parts_to_read {
|
for part_id in 0..nr_parts_to_read {
|
||||||
let user_part: Part = uspace.read_val(cpu_set_ptr + part_id * SIZE_OF_PART)?;
|
let user_part: Part = user_space.read_val(cpu_set_ptr + part_id * SIZE_OF_PART)?;
|
||||||
for bit_id in 0..CPUS_IN_PART {
|
for bit_id in 0..CPUS_IN_PART {
|
||||||
if user_part & (1 << bit_id) != 0 {
|
if user_part & (1 << bit_id) != 0 {
|
||||||
// If the CPU ID is invalid, just ignore it.
|
// If the CPU ID is invalid, just ignore it.
|
||||||
|
|
@ -102,7 +102,7 @@ fn read_cpu_set_from(
|
||||||
|
|
||||||
// Returns the number of bytes written.
|
// Returns the number of bytes written.
|
||||||
fn write_cpu_set_to(
|
fn write_cpu_set_to(
|
||||||
uspace: CurrentUserSpace,
|
user_space: CurrentUserSpace,
|
||||||
cpu_set: &CpuSet,
|
cpu_set: &CpuSet,
|
||||||
cpuset_size: usize,
|
cpuset_size: usize,
|
||||||
cpu_set_ptr: Vaddr,
|
cpu_set_ptr: Vaddr,
|
||||||
|
|
@ -119,7 +119,7 @@ fn write_cpu_set_to(
|
||||||
for cpu_id in cpu_set.iter() {
|
for cpu_id in cpu_set.iter() {
|
||||||
let id = cpu_id.as_usize();
|
let id = cpu_id.as_usize();
|
||||||
while part_idx < cmp::min(id / CPUS_IN_PART, nr_parts_to_write) {
|
while part_idx < cmp::min(id / CPUS_IN_PART, nr_parts_to_write) {
|
||||||
uspace.write_val(cpu_set_ptr + part_idx * SIZE_OF_PART, &user_part)?;
|
user_space.write_val(cpu_set_ptr + part_idx * SIZE_OF_PART, &user_part)?;
|
||||||
user_part = 0;
|
user_part = 0;
|
||||||
part_idx += 1;
|
part_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ fn write_cpu_set_to(
|
||||||
}
|
}
|
||||||
|
|
||||||
while part_idx < nr_parts_to_write {
|
while part_idx < nr_parts_to_write {
|
||||||
uspace.write_val(cpu_set_ptr + part_idx * SIZE_OF_PART, &user_part)?;
|
user_space.write_val(cpu_set_ptr + part_idx * SIZE_OF_PART, &user_part)?;
|
||||||
user_part = 0;
|
user_part = 0;
|
||||||
part_idx += 1;
|
part_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue