Skip to content

Commit

Permalink
logger_build_init_data() has same problem
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Jan 28, 2021
1 parent fc1f27c commit 08af344
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions selfdrive/loggerd/bootlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ int main(int argc, char** argv) {
assert(bzerror == BZ_OK);

// Write initdata
MessageBuilder init_msg;
logger_build_init_data(init_msg);
auto bytes = init_msg.toBytes();
kj::Array<capnp::word> init_msg = logger_build_init_data();
auto bytes = init_msg.asBytes();
BZ2_bzWrite(&bzerror, bz_file, bytes.begin(), bytes.size());
assert(bzerror == BZ_OK);

Expand Down
9 changes: 5 additions & 4 deletions selfdrive/loggerd/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ kj::Array<capnp::word> logger_build_boot() {
return capnp::messageToFlatArray(msg);
}

void logger_build_init_data(MessageBuilder &msg) {
kj::Array<capnp::word> logger_build_init_data() {
MessageBuilder msg;
auto init = msg.initEvent().initInitData();

if (util::file_exists("/EON")) {
Expand Down Expand Up @@ -134,12 +135,12 @@ void logger_build_init_data(MessageBuilder &msg) {
i++;
}
}
return capnp::messageToFlatArray(msg);
}

void log_init_data(LoggerState *s) {
MessageBuilder msg;
logger_build_init_data(msg);
auto bytes = msg.toBytes();
kj::Array<capnp::word> data = logger_build_init_data();
auto bytes = data.asBytes();
logger_log(s, bytes.begin(), bytes.size(), s->has_qlog);
}

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/loggerd/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct LoggerState {

int logger_mkpath(char* file_path);
kj::Array<capnp::word> logger_build_boot();
void logger_build_init_data(MessageBuilder &msg);
kj::Array<capnp::word> logger_build_init_data();
void logger_init(LoggerState *s, const char* log_name, bool has_qlog);
int logger_next(LoggerState *s, const char* root_path,
char* out_segment_path, size_t out_segment_path_len,
Expand Down

0 comments on commit 08af344

Please sign in to comment.