Skip to content

Commit adc3323

Browse files
ordovicialevex
authored andcommitted
Replace '/*' style comments with '//' style, which is recommended officially
1 parent ffd4cd7 commit adc3323

File tree

13 files changed

+39
-35
lines changed

13 files changed

+39
-35
lines changed

src/blkio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl Controller for BlkIoController {
268268
}
269269

270270
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
271-
/* get the resources that apply to this controller */
271+
// get the resources that apply to this controller
272272
let res: &BlkIoResources = &res.blkio;
273273

274274
if res.update_values {

src/cgroup.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ impl<'b> Cgroup<'b> {
121121
{
122122
for i in &self.subsystems {
123123
if i.to_controller().control_type() == T::controller_type() {
124-
/*
125-
* N.B.:
126-
* https://play.rust-lang.org/?gist=978b2846bacebdaa00be62374f4f4334&version=stable&mode=debug&edition=2015
127-
*/
124+
// N.B.:
125+
// https://play.rust-lang.org/?gist=978b2846bacebdaa00be62374f4f4334&version=stable&mode=debug&edition=2015
128126
return Some(i.into());
129127
}
130128
}
@@ -149,7 +147,7 @@ impl<'b> Cgroup<'b> {
149147
/// Returns an Iterator that can be used to iterate over the tasks that are currently in the
150148
/// control group.
151149
pub fn tasks(&self) -> Vec<CgroupPid> {
152-
/* Collect the tasks from all subsystems */
150+
// Collect the tasks from all subsystems
153151
let mut v = self
154152
.subsystems()
155153
.iter()

src/cpu.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,41 @@ impl Controller for CpuController {
3535
fn control_type(&self) -> Controllers {
3636
Controllers::Cpu
3737
}
38+
3839
fn get_path(&self) -> &PathBuf {
3940
&self.path
4041
}
42+
4143
fn get_path_mut(&mut self) -> &mut PathBuf {
4244
&mut self.path
4345
}
46+
4447
fn get_base(&self) -> &PathBuf {
4548
&self.base
4649
}
4750

4851
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
49-
/* get the resources that apply to this controller */
52+
// get the resources that apply to this controller
5053
let res: &CpuResources = &res.cpu;
5154

5255
if res.update_values {
53-
/* apply pid_max */
56+
// apply pid_max
5457
let _ = self.set_shares(res.shares);
5558
if self.shares() != Ok(res.shares as u64) {
5659
return Err(CgroupError::Unknown);
5760
}
61+
5862
let _ = self.set_cfs_period(res.period);
5963
if self.cfs_period() != Ok(res.period as u64) {
6064
return Err(CgroupError::Unknown);
6165
}
66+
6267
let _ = self.set_cfs_quota(res.quota as u64);
6368
if self.cfs_quota() != Ok(res.quota as u64) {
6469
return Err(CgroupError::Unknown);
6570
}
66-
/* TODO: rt properties (CONFIG_RT_GROUP_SCHED) are not yet supported */
71+
72+
// TODO: rt properties (CONFIG_RT_GROUP_SCHED) are not yet supported
6773
}
6874

6975
Ok(())

src/cpuset.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Controller for CpuSetController {
9292
}
9393

9494
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
95-
/* get the resources that apply to this controller */
95+
// get the resources that apply to this controller
9696
let res: &CpuResources = &res.cpu;
9797

9898
if res.update_values {
@@ -148,12 +148,12 @@ fn parse_range(s: String) -> Result<Vec<(u64, u64)>, CgroupError> {
148148
return Ok(fin);
149149
}
150150

151-
/* first split by commas */
151+
// first split by commas
152152
let comma_split = s.split(",");
153153

154154
for sp in comma_split {
155155
if sp.contains("-") {
156-
/* this is a true range */
156+
// this is a true range
157157
let dash_split = sp.split("-").collect::<Vec<_>>();
158158
if dash_split.len() != 2 {
159159
return Err(CgroupError::ParseError);
@@ -165,7 +165,7 @@ fn parse_range(s: String) -> Result<Vec<(u64, u64)>, CgroupError> {
165165
}
166166
fin.push((first.unwrap(), second.unwrap()));
167167
} else {
168-
/* this is just a single number */
168+
// this is just a single number
169169
let num = sp.parse::<u64>();
170170
if num.is_err() {
171171
return Err(CgroupError::ParseError);

src/devices.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl Controller for DevicesController {
143143
}
144144

145145
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
146-
/* get the resources that apply to this controller */
146+
// get the resources that apply to this controller
147147
let res: &DeviceResources = &res.devices;
148148

149149
if res.update_values {

src/hierarchies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ impl V1 {
109109
}
110110

111111
fn find_v1_mount() -> Option<String> {
112-
/* Open mountinfo so we can get a parseable mount list */
112+
// Open mountinfo so we can get a parseable mount list
113113
let mountinfo_path = Path::new("/proc/self/mountinfo");
114114

115-
/* If /proc isn't mounted, or something else happens, then bail out */
115+
// If /proc isn't mounted, or something else happens, then bail out
116116
if mountinfo_path.exists() == false {
117117
return None;
118118
}

src/hugetlb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Controller for HugeTlbController {
3737
}
3838

3939
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
40-
/* get the resources that apply to this controller */
40+
// get the resources that apply to this controller
4141
let res: &HugePageResources = &res.hugepages;
4242

4343
if res.update_values {
@@ -93,7 +93,7 @@ impl HugeTlbController {
9393

9494
/// Whether the system supports `hugetlb_size` hugepages.
9595
pub fn size_supported(&self, _hugetlb_size: String) -> bool {
96-
/* TODO */
96+
// TODO
9797
true
9898
}
9999

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub trait Controller {
143143
/// kernel the information.
144144
fn apply(&self, res: &Resources) -> Result<(), CgroupError>;
145145

146-
/* meta stuff */
146+
// meta stuff
147147
#[doc(hidden)]
148148
fn control_type(&self) -> Controllers;
149149
#[doc(hidden)]
@@ -302,14 +302,14 @@ pub struct PidResources {
302302
pub struct CpuResources {
303303
/// Whether values should be applied to the controller.
304304
pub update_values: bool,
305-
/* cpuset */
305+
// cpuset
306306
/// A comma-separated list of CPU IDs where the task in the control group can run. Dashes
307307
/// between numbers indicate ranges.
308308
pub cpus: String,
309309
/// Same syntax as the `cpus` field of this structure, but applies to memory nodes instead of
310310
/// processors.
311311
pub mems: String,
312-
/* cpu */
312+
// cpu
313313
/// Weight of how much of the total CPU time should this control group get. Note that this is
314314
/// hierarchical, so this is weighted against the siblings of this control group.
315315
pub shares: u64,

src/memory.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ pub struct Memory {
325325
pub max_usage_in_bytes: u64,
326326
/// Whether moving charges at immigrate is allowed.
327327
pub move_charge_at_immigrate: u64,
328-
/* TODO: parse this */
328+
// TODO: parse this
329329
/// Contains various statistics about the NUMA locality of the control group's tasks.
330330
///
331331
/// The format of this field (as lifted from the kernel sources):
@@ -342,7 +342,7 @@ pub struct Memory {
342342
/// Allows setting a limit to memory usage which is enforced when the system (note, _not_ the
343343
/// control group) detects memory pressure.
344344
pub soft_limit_in_bytes: u64,
345-
/* TODO: parse this */
345+
// TODO: parse this
346346
/// Contains a wide array of statistics about the memory usage of the tasks in the control
347347
/// group.
348348
pub stat: MemoryStat,
@@ -406,7 +406,7 @@ impl Controller for MemController {
406406
}
407407

408408
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
409-
/* get the resources that apply to this controller */
409+
// get the resources that apply to this controller
410410
let memres: &MemoryResources = &res.memory;
411411

412412
if memres.update_values {

src/net_cls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Controller for NetClsController {
3838
}
3939

4040
fn apply(&self, res: &Resources) -> Result<(), CgroupError> {
41-
/* get the resources that apply to this controller */
41+
// get the resources that apply to this controller
4242
let res: &NetworkResources = &res.network;
4343

4444
if res.update_values {

0 commit comments

Comments
 (0)