Skip to content

Commit

Permalink
Make kproplog handle underfull iprop logs
Browse files Browse the repository at this point in the history
kproplog currently assumes that an iprop log is full once it has
circled--which is true right now but will need to change for
hierarchical slaves.  Avoid this assumption by using the correct
index modulus in print_update whether or not the log is full.

Based on a patch from Richard Basch <basch@alum.mit.edu>.
  • Loading branch information
greghudson committed Jan 26, 2013
1 parent 74bee54 commit 2743fde
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/slave/kproplog.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ print_attr(kdbe_val_t *val, int vverbose)
* Print the update entry information
*/
static void
print_update(kdb_hlog_t *ulog, uint32_t entry, unsigned int verbose)
print_update(kdb_hlog_t *ulog, uint32_t entry, uint32_t ulogentries,
unsigned int verbose)
{
XDR xdrs;
uint32_t start_sno, i, j, indx;
Expand All @@ -414,7 +415,7 @@ print_update(kdb_hlog_t *ulog, uint32_t entry, unsigned int verbose)
start_sno = ulog->kdb_first_sno - 1;

for (i = start_sno; i < ulog->kdb_last_sno; i++) {
indx = i % ulog->kdb_num;
indx = i % ulogentries;

indx_log = (kdb_ent_header_t *)INDEX(ulog, indx);

Expand Down Expand Up @@ -621,7 +622,7 @@ main(int argc, char **argv)
}

if ((!headeronly) && ulog->kdb_num) {
print_update(ulog, entry, verbose);
print_update(ulog, entry, params.iprop_ulogsize, verbose);
}

(void) printf("\n");
Expand Down

0 comments on commit 2743fde

Please sign in to comment.