1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>xdr_truncate_encode</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Networking and Network Devices APIs"><link rel="up" href="ch01s05.html" title="SUN RPC subsystem"><link rel="prev" href="API-xdr-reserve-space.html" title="xdr_reserve_space"><link rel="next" href="API-xdr-restrict-buflen.html" title="xdr_restrict_buflen"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">xdr_truncate_encode</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-xdr-reserve-space.html">Prev</a> </td><th width="60%" align="center">SUN RPC subsystem</th><td width="20%" align="right"> <a accesskey="n" href="API-xdr-restrict-buflen.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-xdr-truncate-encode"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xdr_truncate_encode — 2 truncate an encode buffer 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">xdr_truncate_encode </b>(</code></td><td>struct xdr_stream * <var class="pdparam">xdr</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">len</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1096936372"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>xdr</code></em></span></dt><dd><p> 4 pointer to xdr_stream 5 </p></dd><dt><span class="term"><em class="parameter"><code>len</code></em></span></dt><dd><p> 6 new length of buffer 7 </p></dd></dl></div></div><div class="refsect1"><a name="idp1096938980"></a><h2>Description</h2><p> 8 Truncates the xdr stream, so that xdr->buf->len == len, 9 and xdr->p points at offset len from the start of the buffer, and 10 head, tail, and page lengths are adjusted to correspond. 11 </p><p> 12 13 If this means moving xdr->p to a different buffer, we assume that 14 that the end pointer should be set to the end of the current page, 15 except in the case of the head buffer when we assume the head 16 buffer's current length represents the end of the available buffer. 17 </p><p> 18 19 This is *not* safe to use on a buffer that already has inlined page 20 cache pages (as in a zero-copy server read reply), except for the 21 simple case of truncating from one position in the tail to another. 22</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-xdr-reserve-space.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s05.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-xdr-restrict-buflen.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">xdr_reserve_space</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">xdr_restrict_buflen</span></td></tr></table></div></body></html> 23