Skip to content

Commit 741896f

Browse files
committed
enable alternative log and install path
Signed-off-by: Tianhao Wang <[email protected]>
1 parent 33cd87e commit 741896f

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

qvisor/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ lazy_static! {
169169
);
170170
}
171171

172-
pub const LOG_FILE: &'static str = "/var/log/quark/quark.log";
173-
174172
pub fn InitSingleton() {
175173
self::qlib::InitSingleton();
176174
}

qvisor/src/print.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ pub fn SetSyncPrint(syncPrint: bool) {
4343
LOG.SetSyncPrint(syncPrint);
4444
}
4545

46-
pub const LOG_FILE_DEFAULT: &str = "/var/log/quark/quark.log";
47-
pub const RAWLOG_FILE_DEFAULT: &str = "/var/log/quark/raw.log";
48-
pub const LOG_FILE_FORMAT: &str = "/var/log/quark/{}.log";
46+
47+
pub const LOG_DIR: &str = match option_env!("QLOG_DIR") {
48+
Some(s) => s,
49+
None => "/var/log/quark"
50+
};
51+
pub const LOG_FILE_DEFAULT: &str = concatcp!(LOG_DIR, "/quark.log");
52+
pub const RAWLOG_FILE_DEFAULT: &str = concatcp!(LOG_DIR, "/raw.log");
53+
pub const LOG_FILE_FORMAT: &str = concatcp!(LOG_DIR, "/{}.log");
4954
pub const TIME_FORMAT: &str = "%H:%M:%S%.3f";
5055

5156
pub const MEMORY_LEAK_LOG: bool = false;

qvisor/src/runc/runtime/vm.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ impl VirtualMachine {
166166
);
167167
}
168168

169+
pub const QUARK_BIN_DIR: &'static str = match option_env!("QBIN_DIR") {
170+
Some(s) => s,
171+
None => "/usr/local/bin"
172+
};
173+
pub const VDSO_PATH: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/vdso.so");
169174
#[cfg(debug_assertions)]
170-
pub const KERNEL_IMAGE: &'static str = "/usr/local/bin/qkernel_d.bin";
171-
175+
pub const KERNEL_IMAGE: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/qkernel_d.bin");
172176
#[cfg(not(debug_assertions))]
173-
pub const KERNEL_IMAGE: &'static str = "/usr/local/bin/qkernel.bin";
174-
175-
pub const VDSO_PATH: &'static str = "/usr/local/bin/vdso.so";
177+
pub const KERNEL_IMAGE: &'static str = concatcp!(VirtualMachine::QUARK_BIN_DIR, "/qkernel.bin");
176178

177179
pub fn InitShareSpace(
178180
cpuCount: usize,

0 commit comments

Comments
 (0)