Module Name: src Committed By: manu Date: Fri Oct 31 13:56:04 UTC 2014
Modified Files: src/lib/libpuffs: dispatcher.c opdump.c puffs.c puffs.h puffs_ops.3 Log Message: libpuffs support for fallocate and fdiscard operations To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/lib/libpuffs/dispatcher.c cvs rdiff -u -r1.36 -r1.37 src/lib/libpuffs/opdump.c cvs rdiff -u -r1.117 -r1.118 src/lib/libpuffs/puffs.c cvs rdiff -u -r1.125 -r1.126 src/lib/libpuffs/puffs.h cvs rdiff -u -r1.39 -r1.40 src/lib/libpuffs/puffs_ops.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libpuffs/dispatcher.c diff -u src/lib/libpuffs/dispatcher.c:1.47 src/lib/libpuffs/dispatcher.c:1.48 --- src/lib/libpuffs/dispatcher.c:1.47 Sat Aug 16 16:25:44 2014 +++ src/lib/libpuffs/dispatcher.c Fri Oct 31 13:56:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $ */ +/* $NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $"); +__RCSID("$NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -1140,6 +1140,34 @@ dispatch(struct puffs_cc *pcc) break; } + case PUFFS_VN_FALLOCATE: + { + struct puffs_vnmsg_fallocate *auxt = auxbuf; + + if (pops->puffs_node_fallocate == NULL) { + error = EOPNOTSUPP; + break; + } + + error = pops->puffs_node_fallocate(pu, + opcookie, auxt->pvnr_off, auxt->pvnr_len); + break; + } + + case PUFFS_VN_FDISCARD: + { + struct puffs_vnmsg_fdiscard *auxt = auxbuf; + + if (pops->puffs_node_fdiscard == NULL) { + error = EOPNOTSUPP; + break; + } + + error = pops->puffs_node_fdiscard(pu, + opcookie, auxt->pvnr_off, auxt->pvnr_len); + break; + } + default: printf("inval op %d\n", preq->preq_optype); error = EINVAL; Index: src/lib/libpuffs/opdump.c diff -u src/lib/libpuffs/opdump.c:1.36 src/lib/libpuffs/opdump.c:1.37 --- src/lib/libpuffs/opdump.c:1.36 Thu Mar 15 02:02:21 2012 +++ src/lib/libpuffs/opdump.c Fri Oct 31 13:56:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $ */ +/* $NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $ */ /* * Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $"); +__RCSID("$NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -117,6 +117,8 @@ const char *puffsdump_vnop_revmap[] = { "PUFFS_VN_DELETEEXTATTR", "PUFFS_VN_SETEXTATTR", "PUFFS_VN_CLOSEEXTATTR", + "PUFFS_VN_FALLOCATE", + "PUFFS_VN_FDISCARD", }; size_t puffsdump_vnop_count = __arraycount(puffsdump_vnop_revmap); Index: src/lib/libpuffs/puffs.c diff -u src/lib/libpuffs/puffs.c:1.117 src/lib/libpuffs/puffs.c:1.118 --- src/lib/libpuffs/puffs.c:1.117 Mon Nov 14 01:27:42 2011 +++ src/lib/libpuffs/puffs.c Fri Oct 31 13:56:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $ */ +/* $NetBSD: puffs.c,v 1.118 2014/10/31 13:56:04 manu Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $"); +__RCSID("$NetBSD: puffs.c,v 1.118 2014/10/31 13:56:04 manu Exp $"); #endif /* !lint */ #include <sys/param.h> @@ -106,6 +106,8 @@ fillvnopmask(struct puffs_ops *pops, str FILLOP(setextattr, SETEXTATTR); FILLOP(listextattr, LISTEXTATTR); FILLOP(deleteextattr, DELETEEXTATTR); + FILLOP(fallocate, FALLOCATE); + FILLOP(fdiscard, FDISCARD); } #undef FILLOP Index: src/lib/libpuffs/puffs.h diff -u src/lib/libpuffs/puffs.h:1.125 src/lib/libpuffs/puffs.h:1.126 --- src/lib/libpuffs/puffs.h:1.125 Sat Aug 16 16:25:44 2014 +++ src/lib/libpuffs/puffs.h Fri Oct 31 13:56:04 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.h,v 1.125 2014/08/16 16:25:44 manu Exp $ */ +/* $NetBSD: puffs.h,v 1.126 2014/10/31 13:56:04 manu Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -252,8 +252,12 @@ struct puffs_ops { puffs_cookie_t, int); int (*puffs_node_open2)(struct puffs_usermount *, puffs_cookie_t, int, const struct puffs_cred *, int *); + int (*puffs_node_fallocate)(struct puffs_usermount *, + puffs_cookie_t, off_t, off_t); + int (*puffs_node_fdiscard)(struct puffs_usermount *, + puffs_cookie_t, off_t, off_t); - void *puffs_ops_spare[28]; + void *puffs_ops_spare[26]; }; typedef int (*pu_pathbuild_fn)(struct puffs_usermount *, @@ -414,7 +418,11 @@ enum { int fsname##_node_reclaim2(struct puffs_usermount *, \ puffs_cookie_t, int); \ int fsname##_node_open2(struct puffs_usermount *, \ - puffs_cookie_t, int, const struct puffs_cred *, int *); + puffs_cookie_t, int, const struct puffs_cred *, int *); \ + int fsname##_node_fallocate(struct puffs_usermount *, \ + puffs_cookie_t, int, off_t, off_t); \ + int fsname##_node_fdiscard(struct puffs_usermount *, \ + puffs_cookie_t, int, off_t, off_t); #define PUFFSOP_INIT(ops) \ Index: src/lib/libpuffs/puffs_ops.3 diff -u src/lib/libpuffs/puffs_ops.3:1.39 src/lib/libpuffs/puffs_ops.3:1.40 --- src/lib/libpuffs/puffs_ops.3:1.39 Sat Oct 18 08:33:23 2014 +++ src/lib/libpuffs/puffs_ops.3 Fri Oct 31 13:56:04 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: puffs_ops.3,v 1.39 2014/10/18 08:33:23 snj Exp $ +.\" $NetBSD: puffs_ops.3,v 1.40 2014/10/31 13:56:04 manu Exp $ .\" .\" Copyright (c) 2007 Antti Kantee. All rights reserved. .\" @@ -227,7 +227,17 @@ .Fa "const struct puffs_cred *pcr" .Fc .Ft int -.Fn puffs_node_print "struct puffs_usermount *pu" "puffs_cookie_t opc" +.Fo puffs_node_fallocate +.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len" +.Fc +.Ft int +.Fo puffs_node_fdiscard +.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len" +.Fc +.Ft int +.Fo puffs_node_print +.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" +.Fc .Ft int .Fo puffs_node_reclaim .Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" @@ -800,6 +810,20 @@ with an additional in which .Dv PUFFS_WRITE_FAF is set for Fire-And-Forget operations. +.It Fn puffs_node_fallocate "pu" "opc" "pos" "len" +Allocate +.Fa len +bytes of backing store at offset +.Fa pos +for the node referenced by the cookie +.Fa opc . +.It Fn puffs_node_fdiscard "pu" "opc" "pos" "len" +Free +.Fa len +bytes of backing store (creating a hole) at offset +.Fa pos +for the node referenced by the cookie +.Fa opc . .It Fn puffs_node_print "pu" "opc" Print information about node. This is used only for kernel-initiated diagnostic purposes.