I merged that to a new git repo: https://github.com/ecashin/vblade/ ... but noticed along the way that you're using atoi. Because you're supporting 64-bit numbers, would you mind sending a patch that uses strtoll or doing it in git and sending a pull request? On May 11, 2014, at 2:10 PM, Christoph Biedl <sourceforge.bnwi@xxxxxxxxxxxxxxxxxx> wrote: > Ed Cashin wrote... > >> That sounds like a natural complement to your first patch, yes. If >> you've got the momentum to whip together the second patch, I could >> merge them both at once. > > Here you are. The patch below is to replace the original one, so uses > vlong for the offset, and implements a lenght limit of the export. > > That version ran here for a few hours in production, everything was > doing as expected. > > Christoph > > diff --git a/aoe.c b/aoe.c > index 0ab0b99..ef590ae 100644 > --- a/aoe.c > +++ b/aoe.c > @@ -462,11 +462,13 @@ int > main(int argc, char **argv) > { > int ch, omode = 0, readonly = 0; > + vlong length = 0; > > bufcnt = Bufcount; > + offset = 0; > setbuf(stdin, NULL); > progname = *argv; > - while ((ch = getopt(argc, argv, "b:dsrm:")) != -1) { > + while ((ch = getopt(argc, argv, "b:dsrm:o:l:")) != -1) { > switch (ch) { > case 'b': > bufcnt = atoi(optarg); > @@ -485,6 +487,12 @@ main(int argc, char **argv) > case 'm': > setmask(optarg); > break; > + case 'o': > + offset = atoi(optarg); > + break; > + case 'l': > + length = atoi(optarg); > + break; > case '?': > default: > usage(); > @@ -505,6 +513,18 @@ main(int argc, char **argv) > setserial(argv[3], shelf, slot); > size = getsize(bfd); > size /= 512; > + if (size < offset) { > + fprintf(stderr, "Offset %llu too big - remaining size is negative!\n", offset); > + exit(1); > + } > + size -= offset; > + if (length) { > + if (length > size) { > + fprintf(stderr, "Length %llu too big - exceeds size of file!\n", offset); > + exit(1); > + } > + size = length; > + } > ifname = argv[2]; > sfd = dial(ifname, bufcnt); > getea(sfd, ifname, mac); > diff --git a/ata.c b/ata.c > index 4854f34..7c53b46 100644 > --- a/ata.c > +++ b/ata.c > @@ -155,12 +155,12 @@ atacmd(Ataregs *p, uchar *dp, int ndp, int payload) // do the ata cmd > return 0; > } > if (p->cmd == 0x20 || p->cmd == 0x24) > - n = getsec(bfd, dp, lba, p->sectors); > + n = getsec(bfd, dp, lba+offset, p->sectors); > else { > // packet should be big enough to contain the data > if (payload < 512 * p->sectors) > return -1; > - n = putsec(bfd, dp, lba, p->sectors); > + n = putsec(bfd, dp, lba+offset, p->sectors); > } > n /= 512; > if (n != p->sectors) { > diff --git a/dat.h b/dat.h > index 064ab1e..9b7ec46 100644 > --- a/dat.h > +++ b/dat.h > @@ -169,6 +169,7 @@ uchar mac[6]; > int bfd; // block file descriptor > int sfd; // socket file descriptor > vlong size; // size of vblade > +vlong offset; > char *progname; > char serial[Nserial+1]; > > diff --git a/vblade.8 b/vblade.8 > index 2cd2b2c..175baa0 100644 > --- a/vblade.8 > +++ b/vblade.8 > @@ -55,6 +55,14 @@ The -r flag restricts the export of the device to be read-only. > The -m flag takes an argument, a comma separated list of MAC addresses > permitted access to the vblade. A MAC address can be specified in upper > or lower case, with or without colons. > +.TP > +\fB-o\fP > +The -o flag takes an argument, the number of sectors that should be > +skipped at the beginning of filename. > +.TP > +\fB-l\fP > +The -l flag takes an argument, the number of sectors to exports. > +Defaults to the end of file. > .SH EXAMPLE > In this example, the root user on a host named > .I nai > > ------------------------------------------------------------------------------ > Is your legacy SCM system holding you back? Join Perforce May 7 to find out: > • 3 signs your SCM is hindering your productivity > • Requirements for releasing software faster > • Expert tips and advice for migrating your SCM now > http://p.sf.net/sfu/perforce > _______________________________________________ > Aoetools-discuss mailing list > Aoetools-discuss@xxxxxxxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/aoetools-discuss ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Aoetools-discuss mailing list Aoetools-discuss@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/aoetools-discuss