[LTP] [PATCH 1/2] syscalls: new test writev07

Cyril Hrubis chrubis@suse.cz
Thu Oct 6 09:16:08 CEST 2016


Hi!
> > Hmm, we have tst_resm_hexd() in the old library exactly for this purpose
> > but it's not exported to the new library at this point. We should fix
> > that and make use of it here.
> > 
> > > +static void test_partially_valid_iovec(int initial_file_offset)
> > > +{
> > > +	int i, fd;
> > > +	unsigned char buffer[BUFSIZE], fpattern[BUFSIZE], tmp[BUFSIZE];
> > > +	long off_after;
> > > +	struct iovec wr_iovec[] = {
> > > +		{ buffer + CHUNK, CHUNK * 2 },
> > > +		{ bad_addr, CHUNK },
> > > +		{ buffer + CHUNK * 3, CHUNK },
> > > +		{ buffer + CHUNK * 2, CHUNK * 2 },
> > > +	};
> > 
> > Hmm, I fail to see the logic after the buffer and CHUNK here. Why don't
> > we start from the start of the buffer for the first iovec record?
> 
> We can, I picked random offset and lengths.
> 
> > 
> > Why is the BUFSIZE defined as CHUNK * 8 while the only CHUNK * 4 could
> > be reached here?
> 
> BUFSIZE should also be large enough to accomodate all writes combined,
> so in worst case (if bad_addr somehow worked) you need CHUNK * 6.
> I picked 8 to have some reserve. I can rework it just to CHUNK * 4 size.

Nah, just let it be. I was just wondering if there is a deeper meaning
behind these.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list