Skip to content

Commit 9c9823d

Browse files
committed
documentation improvements
Signed-off-by: Brian L. Troutwine <[email protected]>
1 parent 4dcc63b commit 9c9823d

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lading/src/bin/logrotate_fs.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ fn getattr_helper(
119119
ino: attr.inode as u64,
120120
size: attr.size,
121121
blocks: (attr.size + 511) / 512,
122-
// TODO these times should reflect those in the model, will need to
123-
// be translated from the tick to systemtime. Implies we'll need to
124-
// adjust up from start_time, knowing that a tick is one second
125-
// wide.
126122
atime,
127123
mtime,
128124
ctime,
@@ -233,6 +229,9 @@ impl Filesystem for LogrotateFS {
233229
// TODO building up a vec of entries here to handle offset really does
234230
// suggest that the model needs to be exposed in such a way that this
235231
// needn't be done.
232+
//
233+
// Ah, actually, the right buffer to push into is reply.add. There's no
234+
// need for `entries` at all.
236235
let mut entries = Vec::new();
237236

238237
// '.' and '..'
@@ -248,7 +247,7 @@ impl Filesystem for LogrotateFS {
248247
));
249248
}
250249

251-
// reaming children
250+
// remaining children
252251
if let Some(child_inodes) = state.readdir(ino as usize) {
253252
for child_ino in child_inodes {
254253
let file_type = state

lading/src/generator/file_gen/model.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Model the internal logic of a logrotate filesystem.
22
3-
//use lading_payload::block;
4-
53
use std::collections::{HashMap, HashSet};
64

75
use bytes::Bytes;
@@ -60,7 +58,7 @@ pub struct File {
6058

6159
/// The group ID of this File. So for instance all File instances that are
6260
/// called foo.log, foo.log.1 etc have the same group ID.
63-
group_id: u8,
61+
group_id: u16,
6462
}
6563

6664
impl File {
@@ -284,7 +282,7 @@ impl State {
284282
let mut names = Vec::new();
285283
names.push(base_name.clone()); // Ordinal 0
286284
for i in 1..=max_rotations {
287-
names.push(format!("{}.{}", base_name, i)); // Ordinal i
285+
names.push(format!("{base_name}.{i}")); // Ordinal i
288286
}
289287
state.group_names.push(names);
290288
}
@@ -349,7 +347,7 @@ impl State {
349347
new_inode
350348
}
351349
} else {
352-
panic!("current_inode {} is not a directory", current_inode);
350+
panic!("current_inode {current_inode} is not a directory");
353351
}
354352
};
355353

@@ -372,7 +370,7 @@ impl State {
372370
read_only: false,
373371
ordinal: 0,
374372
peer: None,
375-
group_id: group_id as u8,
373+
group_id,
376374
};
377375
state.nodes.insert(file_inode, Node::File { file });
378376

0 commit comments

Comments
 (0)