Re: autofs: make the autofsv5 packet file descriptor use a packetizedpipe

From: H. Peter Anvin
Date: Sun Apr 29 2012 - 20:29:17 EST


On 04/29/2012 05:25 PM, Linus Torvalds wrote:
> On Sun, Apr 29, 2012 at 5:15 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>>
>> I just looked at am-utils; am-utils *does* use autofs v5, and *will*
>> loop back and read more data on a short read.
>
> Can you point to the sources?
>
> If it's "short read" as in "I didn't get as much as I expected", that's fine.
>
> If it is "short read" as in "I don't even try to read 300 bytes, I
> read it in 8-byte chunks", we're screwed.
>

git://git.fsl.cs.sunysb.edu/am-utils-6.2.git
conf/autofs/autofs_linux.c

static ssize_t
autofs_get_pkt(int fd, void *buf, size_t bytes)
{
ssize_t i;

do {
i = read(fd, buf, bytes);

if (i <= 0)
break;

buf = (char *)buf + i;
bytes -= i;
} while (bytes);

return bytes;
}

...

#if AUTOFS_MAX_PROTO_VERSION >= 5
if (fh->version < 5) {
len = sizeof(p.pkt);
} else {
len = sizeof(p.pkt5);
}
#else
len = sizeof(p.pkt);
#endif /* AUTOFS_MAX_PROTO_VERSION >= 5 */

if (autofs_get_pkt(fh->fd, &p, len))
continue;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/