Re: [patch -v2 06/23] s390/vmcp: use simple_read_from_buffer

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

 



Am Montag, 2. Juni 2008 schrieb akinobu.mita@xxxxxxxxx:

> -	tocopy = min(session->resp_size - (size_t) (*ppos), count);
> -	tocopy = min(tocopy, session->bufsize - (size_t) (*ppos));
> +	ret = simple_read_from_buffer(buff, count, ppos,
> +				session->response, session->resp_size);
> 

Its not that simple. The z/VM Diagnose 8 has a quite interesting return value.

- session->bufsize is the size of the buffer as we allocated and know 
- session->resp_size is the size of the data - no matter if the buffer was 
large enough. z/VM is smart enough to not go beyond the buffer, but it tells 
us how many bytes it skipped. resp_size contains bufsize + skipped_bytes.

Unfortunately there is no end of string delimiter and we have to use the 
response size.

There are two cases:
1. The buffer was large enough, so we can use session->resp_size
2. The buffer was not large enough and output was truncated. we must now use 
session->bufsize

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux