Re: [PATCH 1/5] tty: Add a function to insert a string of characters with the same flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Was it really the 17th I sent the second set out - apparently so - so
ignore the first email, this is the correct patch set.

> > +int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
> > +		const unsigned char *chars, char flag, size_t size)
> >  {
> >  	int copied = 0;
> >  	do {
> > +		int goal = min(size - copied, TTY_BUFFER_PAGE);
> 
> This variable isn't used in this function.
> 
> >  		int space = tty_buffer_request_room(tty, goal);

Its used here. The logic basically is

goal =  {	I want a buffer to hold "size - copied" 
	{	I want it to fit in one page

space = 	what I get back

we copy space and move on based on what we get back, so it looks correct
to me.

> >  		memcpy(tb->char_buf_ptr + tb->used, chars, space);
> > -		memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space);
> > +		memset(tb->flag_buf_ptr + tb->used, flag, space);
> 
> Should you have "goal" here instead of "space"?

No because we could ask for say 500 and get 250 back, we then want to
copy 250.


Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux