Message ID | 20190704081133.7818-4-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Improve istep command usability | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (6a4185ca278930693a6edb6d003267f74df3d2e8) |
snowpatch_ozlabs/build-multiarch | success | Test build-multiarch on branch master |
Better than my shell script :-) Reviewed-by: Alistair Popple <alistair@popple.id.au> On Thursday, 4 July 2019 6:11:33 PM AEST Amitay Isaacs wrote: > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > src/istep.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/src/istep.c b/src/istep.c > index a141a31..a04c45d 100644 > --- a/src/istep.c > +++ b/src/istep.c > @@ -36,6 +36,7 @@ static int istep(uint32_t major, uint32_t minor) > { > struct pdbg_target *sbefifo; > int count = 0, i, rc; > + int first = minor, last = minor; > > for_each_path_target_class("sbefifo", sbefifo) { > if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED) > @@ -56,6 +57,12 @@ static int istep(uint32_t major, uint32_t minor) > if (istep_data[i].major != major) > continue; > > + if (minor == 0) { > + first = istep_data[i].minor_first; > + last = istep_data[i].minor_last; > + break; > + } > + > if (minor < istep_data[i].minor_first || > minor > istep_data[i].minor_last) { > fprintf(stderr, "Istep %d minor should be %d to %d\n", > @@ -66,10 +73,15 @@ static int istep(uint32_t major, uint32_t minor) > } > } > > - rc = sbe_istep(sbefifo, major, minor); > - if (!rc) > - count++; > + for (i = first; i <= last ; i++) { > + printf("Running istep %d.%d\n", major, i); > + rc = sbe_istep(sbefifo, major, i); > + if (rc) > + goto fail; > + } > + count++; > > +fail: > return count; > } > OPTCMD_DEFINE_CMD_WITH_ARGS(istep, istep, (DATA32, DATA32));
diff --git a/src/istep.c b/src/istep.c index a141a31..a04c45d 100644 --- a/src/istep.c +++ b/src/istep.c @@ -36,6 +36,7 @@ static int istep(uint32_t major, uint32_t minor) { struct pdbg_target *sbefifo; int count = 0, i, rc; + int first = minor, last = minor; for_each_path_target_class("sbefifo", sbefifo) { if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED) @@ -56,6 +57,12 @@ static int istep(uint32_t major, uint32_t minor) if (istep_data[i].major != major) continue; + if (minor == 0) { + first = istep_data[i].minor_first; + last = istep_data[i].minor_last; + break; + } + if (minor < istep_data[i].minor_first || minor > istep_data[i].minor_last) { fprintf(stderr, "Istep %d minor should be %d to %d\n", @@ -66,10 +73,15 @@ static int istep(uint32_t major, uint32_t minor) } } - rc = sbe_istep(sbefifo, major, minor); - if (!rc) - count++; + for (i = first; i <= last ; i++) { + printf("Running istep %d.%d\n", major, i); + rc = sbe_istep(sbefifo, major, i); + if (rc) + goto fail; + } + count++; +fail: return count; } OPTCMD_DEFINE_CMD_WITH_ARGS(istep, istep, (DATA32, DATA32));
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/istep.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)