Skip to content

Commit 03c913f

Browse files
committed
Remove non-prefixed printing macros
As suggested by Greg, it is simpler if we match the C side since people will jump back and forth between C and Rust. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 1fa10de commit 03c913f

File tree

17 files changed

+98
-409
lines changed

17 files changed

+98
-409
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -216,45 +216,27 @@ jobs:
216216
grep '] rust_minimal: Rust minimal sample (exit)$' qemu-stdout.log
217217
218218
- run: |
219-
grep '] rust_print: Rust printing macros sample (init)$' qemu-stdout.log
220-
221-
grep '] rust_print: Emergency message (level 0) with newline w/o args$' qemu-stdout.log
222-
grep '] rust_print: Alert message (level 1) with newline w/o args$' qemu-stdout.log
223-
grep '] rust_print: Critical message (level 2) with newline w/o args$' qemu-stdout.log
224-
grep '] rust_print: Error message (level 3) with newline w/o args$' qemu-stdout.log
225-
grep '] rust_print: Warning message (level 4) with newline w/o args$' qemu-stdout.log
226-
grep '] rust_print: Notice message (level 5) with newline w/o args$' qemu-stdout.log
227-
grep '] rust_print: Info message (level 6) with newline w/o args$' qemu-stdout.log
228-
grep '] rust_print: A line that is continued with newline w/o args$' qemu-stdout.log
229-
230-
grep '] rust_print: Emergency message (level 0) w/o newline w/o args$' qemu-stdout.log
231-
grep '] rust_print: Alert message (level 1) w/o newline w/o args$' qemu-stdout.log
232-
grep '] rust_print: Critical message (level 2) w/o newline w/o args$' qemu-stdout.log
233-
grep '] rust_print: Error message (level 3) w/o newline w/o args$' qemu-stdout.log
234-
grep '] rust_print: Warning message (level 4) w/o newline w/o args$' qemu-stdout.log
235-
grep '] rust_print: Notice message (level 5) w/o newline w/o args$' qemu-stdout.log
236-
grep '] rust_print: Info message (level 6) w/o newline w/o args$' qemu-stdout.log
237-
grep '] rust_print: A line that is continued w/o newline w/o args$' qemu-stdout.log
238-
239-
grep '] rust_print: Emergency message (level 0) with newline with args$' qemu-stdout.log
240-
grep '] rust_print: Alert message (level 1) with newline with args$' qemu-stdout.log
241-
grep '] rust_print: Critical message (level 2) with newline with args$' qemu-stdout.log
242-
grep '] rust_print: Error message (level 3) with newline with args$' qemu-stdout.log
243-
grep '] rust_print: Warning message (level 4) with newline with args$' qemu-stdout.log
244-
grep '] rust_print: Notice message (level 5) with newline with args$' qemu-stdout.log
245-
grep '] rust_print: Info message (level 6) with newline with args$' qemu-stdout.log
246-
grep '] rust_print: A line that is continued with newline with args$' qemu-stdout.log
247-
248-
grep '] rust_print: Emergency message (level 0) w/o newline with args$' qemu-stdout.log
249-
grep '] rust_print: Alert message (level 1) w/o newline with args$' qemu-stdout.log
250-
grep '] rust_print: Critical message (level 2) w/o newline with args$' qemu-stdout.log
251-
grep '] rust_print: Error message (level 3) w/o newline with args$' qemu-stdout.log
252-
grep '] rust_print: Warning message (level 4) w/o newline with args$' qemu-stdout.log
253-
grep '] rust_print: Notice message (level 5) w/o newline with args$' qemu-stdout.log
254-
grep '] rust_print: Info message (level 6) w/o newline with args$' qemu-stdout.log
255-
grep '] rust_print: A line that is continued w/o newline with args$' qemu-stdout.log
256-
257-
grep '] rust_print: Rust printing macros sample (exit)$' qemu-stdout.log
219+
grep '] rust_print: Rust printing macros sample (init)$' qemu-stdout.log
220+
221+
grep '] rust_print: Emergency message (level 0) without args$' qemu-stdout.log
222+
grep '] rust_print: Alert message (level 1) without args$' qemu-stdout.log
223+
grep '] rust_print: Critical message (level 2) without args$' qemu-stdout.log
224+
grep '] rust_print: Error message (level 3) without args$' qemu-stdout.log
225+
grep '] rust_print: Warning message (level 4) without args$' qemu-stdout.log
226+
grep '] rust_print: Notice message (level 5) without args$' qemu-stdout.log
227+
grep '] rust_print: Info message (level 6) without args$' qemu-stdout.log
228+
grep '] rust_print: A line that is continued without args$' qemu-stdout.log
229+
230+
grep '] rust_print: Emergency message (level 0) with args$' qemu-stdout.log
231+
grep '] rust_print: Alert message (level 1) with args$' qemu-stdout.log
232+
grep '] rust_print: Critical message (level 2) with args$' qemu-stdout.log
233+
grep '] rust_print: Error message (level 3) with args$' qemu-stdout.log
234+
grep '] rust_print: Warning message (level 4) with args$' qemu-stdout.log
235+
grep '] rust_print: Notice message (level 5) with args$' qemu-stdout.log
236+
grep '] rust_print: Info message (level 6) with args$' qemu-stdout.log
237+
grep '] rust_print: A line that is continued with args$' qemu-stdout.log
238+
239+
grep '] rust_print: Rust printing macros sample (exit)$' qemu-stdout.log
258240
259241
- run: |
260242
grep '] rust_module_parameters: Rust module parameters sample (init)$' qemu-stdout.log

drivers/android/allocation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl Drop for Allocation<'_> {
151151
let view = AllocationView::new(self, info.offsets.start);
152152
for i in info.offsets.clone().step_by(size_of::<usize>()) {
153153
if self.cleanup_object(i, &view).is_err() {
154-
warn!("Error cleaning up object at offset {}", i)
154+
pr_warn!("Error cleaning up object at offset {}\n", i)
155155
}
156156
}
157157
}

drivers/android/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl Process {
557557
.reservation_abort(ptr - mapping.address)
558558
.is_err()
559559
{
560-
warn!("Offset {} failed to free", ptr - mapping.address);
560+
pr_warn!("Offset {} failed to free\n", ptr - mapping.address);
561561
}
562562
}
563563
}
@@ -566,7 +566,7 @@ impl Process {
566566
let mut inner = self.inner.lock();
567567
if let Some(ref mut mapping) = &mut inner.mapping {
568568
if mapping.alloc.reservation_commit(offset, data).is_err() {
569-
warn!("Offset {} failed to be marked freeable", offset);
569+
pr_warn!("Offset {} failed to be marked freeable\n", offset);
570570
}
571571
}
572572
}

drivers/android/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl Thread {
398398
self.process.get_node_from_handle(handle, strong)
399399
})?;
400400
}
401-
_ => warn!("Unsupported binder object type: {:x}", header.type_),
401+
_ => pr_warn!("Unsupported binder object type: {:x}\n", header.type_),
402402
}
403403
Ok(())
404404
}

rust/kernel/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'a> Drop for KParamGuard<'a> {
140140
///
141141
/// fn test() {
142142
/// // This prints `8`.
143-
/// info!("{}", offset_of!(Test, b));
143+
/// pr_info!("{}\n", offset_of!(Test, b));
144144
/// }
145145
/// ```
146146
#[macro_export]
@@ -181,7 +181,7 @@ macro_rules! offset_of {
181181
/// let b_ptr = &test.b;
182182
/// let test_alias = unsafe { container_of!(b_ptr, Test, b) };
183183
/// // This prints `true`.
184-
/// info!("{}", core::ptr::eq(&test, test_alias));
184+
/// pr_info!("{}\n", core::ptr::eq(&test, test_alias));
185185
/// }
186186
/// ```
187187
#[macro_export]

rust/kernel/prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub use alloc::{borrow::ToOwned, string::String};
1515

1616
pub use module::module;
1717

18-
pub use super::{alert, cont, crit, emerg, err, info, notice, warn};
1918
pub use super::{pr_alert, pr_cont, pr_crit, pr_emerg, pr_err, pr_info, pr_notice, pr_warn};
2019

2120
pub use super::static_assert;

0 commit comments

Comments
 (0)