-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log_fcb walk back #3295
log_fcb walk back #3295
Conversation
1eacd5f
to
e790f32
Compare
} | ||
} | ||
|
||
if (cache->cache_data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could use some comment:
elem_size is converted to host, but other params (ix, offset) are used as is
also elem_size is (32bit size?) int but it is stored into cache_data which is uint16
If cache is kept in host order, maybe this function should get all params in host order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inconsistent endianness removed.
function argument change to uint16_t to match calling argument
Option -s allows to skip number of logs from the start Usage: log [-n <number>] [-s <skip_number> ] i.e.: log -s 100 -n 10 will print at most 10 entries from each log skipping first 100 entries Signed-off-by: Jerzy Kasenberg <[email protected]>
e790f32
to
36015a0
Compare
This extends fcb_entry structure with field that can change direction of the walk. fcb_getnext() function can now walk in backward direction. Signed-off-by: Jerzy Kasenberg <[email protected]>
Previously fcb sequence to write FCB entry was: fcb_append(fcb, len, loc) flash_area_write(fa,...) fcb_finish(fcb, loc) This adds function fcb_write() that should be used instead of direct call to flash_area_write to make it more consistent. Signed-off-by: Jerzy Kasenberg <[email protected]>
This adds field to log_offset that allows to specify log walk back direction. For now only log_fcb/fcb use implement walking back. Signed-off-by: Jerzy Kasenberg <[email protected]>
fcb_walk initialize only certain fields of fcb_entry before walking. This could lead to unpredictable behaviour if additional fields were utilized. Signed-off-by: Jerzy Kasenberg <[email protected]>
Variable cnt and len were reused leading to some inconsistencies. 1. cnt was number of bytes needed to store len but it was later changed to store number of bytes in flash to store len (that can be larger when flash alignment restrictions are applied). Later it was used to actually write len filed to flash, however if alignment was not 1 or 2 some random data would be written to flash (starting from tmp_str but extending to other values on stack). No there is separate variable to keep track how many bytes in flash are needed. 2. calculating whether entry will fit in current sector, fcb_disk_area was not aligned correctly that could lead to problems for flash that has alignment that is higher then 8. 3. append_loc was partially updated but fe_data_len was never filled leaving structure in inconsistent state. 4. active->fe_data_len could have incorrect value (rounded up to alignment) This was small inconsistency that probably would not result in any problem Signed-off-by: Jerzy Kasenberg <[email protected]>
36015a0
to
14213b4
Compare
This adds functionality to walk back in fcb and in log_fcb
Additional options to
log
cmd-s <n>
skips n logs before prints are started-r
start printing from the latest logs (work only for FCB based logs)will print 10 latest logs from reboot log
will print logs skipping first 1000 from reboot_log
Signed-off-by: Jerzy Kasenberg [email protected]