Fix pioctl input and output handling

Pioctl input and output handling was being handled in an adhoc
manner, with little or no detection of input and output buffer
overflow. Whilst overflow is difficult to provoke on a real system,
due to the size of the buffers being allocated for output, the code
was difficult to read, and fragile to maintain.

This patch adds an XDR like abstraction for marshalling and
unmarshalling pioctl data. Whilst the real XDR can't be used and
maintain backwards compatibility, this gives a similar elegance.

Input and output pointers are replaced with instances of
struct afs_pdata, which store both a pointer to the current position
in the data stream, and a note of where the stream ends.

All access to a data stream is now performed through a set of helper
functions, which handle the reading and writing of integers, strings,
and arbitrary blocks of bytes. An 'inline' function is provided for
those cases where direct access to the stream is required.

Change-Id: I6ed2e8e80cebde2abc6a517f4dbef09042b47037
Reviewed-on: http://gerrit.openafs.org/1223
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Simon Wilkinson 2010-02-03 00:31:32 +00:00 committed by Derrick Brashear
parent a1fd212bc6
commit 718f85a8b6

File diff suppressed because it is too large Load Diff