From f8a246b9791d1450cf4945cc7b38f651a3a456ee Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 7 Jan 2008 20:05:19 +0000 Subject: Make ftruncate a 'struct file' operation rather than a vnode operation. This makes it possible to support ftruncate() on non-vnode file types in the future. - 'struct fileops' grows a 'fo_truncate' method to handle an ftruncate() on a given file descriptor. - ftruncate() moves to kern/sys_generic.c and now just fetches a file object and invokes fo_truncate(). - The vnode-specific portions of ftruncate() move to vn_truncate() in vfs_vnops.c which implements fo_truncate() for vnode file types. - Non-vnode file types return EINVAL in their fo_truncate() method. Submitted by: rwatson --- sys/dev/streams/streams.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/dev/streams') diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 55df9e5..5b97f85 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -90,6 +90,7 @@ static struct cdev *dt_ptm, *dt_arp, *dt_icmp, *dt_ip, *dt_tcp, *dt_udp, static struct fileops svr4_netops = { .fo_read = soo_read, .fo_write = soo_write, + .fo_truncate = soo_truncate, .fo_ioctl = soo_ioctl, .fo_poll = soo_poll, .fo_kqfilter = soo_kqfilter, -- cgit v1.1