2012-08-16 13:25:43 +04:00
|
|
|
/* $NetBSD: puffs.h,v 1.124 2012/08/16 09:25:44 manu Exp $ */
|
2006-10-23 02:52:21 +04:00
|
|
|
|
|
|
|
/*
|
2007-05-01 19:58:00 +04:00
|
|
|
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
2006-10-23 02:52:21 +04:00
|
|
|
*
|
|
|
|
* Development of this software was supported by the
|
|
|
|
* Google Summer of Code program and the Ulla Tuominen Foundation.
|
|
|
|
* The Google SoC project was mentored by Bill Studenmund.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2006-12-07 13:53:21 +03:00
|
|
|
#ifndef _PUFFS_H_
|
|
|
|
#define _PUFFS_H_
|
2006-10-23 02:52:21 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
2007-02-15 15:51:45 +03:00
|
|
|
#include <sys/types.h>
|
2006-10-23 02:52:21 +04:00
|
|
|
#include <sys/mount.h>
|
2007-08-15 18:19:19 +04:00
|
|
|
#include <sys/namei.h>
|
2007-01-11 04:01:55 +03:00
|
|
|
#include <sys/stat.h>
|
2006-10-23 02:52:21 +04:00
|
|
|
#include <sys/statvfs.h>
|
2007-05-15 17:44:46 +04:00
|
|
|
#include <sys/time.h>
|
2006-10-23 02:52:21 +04:00
|
|
|
#include <sys/vnode.h>
|
|
|
|
|
|
|
|
#include <fs/puffs/puffs_msgif.h>
|
|
|
|
|
2007-01-06 21:22:09 +03:00
|
|
|
#include <mntopts.h>
|
2007-10-18 17:48:04 +04:00
|
|
|
#include <stdbool.h>
|
2006-12-29 18:28:11 +03:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* forwards */
|
|
|
|
struct puffs_cc;
|
|
|
|
|
|
|
|
struct puffs_getreq;
|
2007-07-01 19:30:15 +04:00
|
|
|
struct puffs_cred;
|
2007-07-01 22:39:39 +04:00
|
|
|
struct puffs_newinfo;
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
/* paths */
|
|
|
|
struct puffs_pathobj {
|
2007-05-01 19:58:00 +04:00
|
|
|
void *po_path;
|
|
|
|
size_t po_len;
|
|
|
|
uint32_t po_hash;
|
2007-01-15 03:39:02 +03:00
|
|
|
};
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
/* for prefix rename */
|
|
|
|
struct puffs_pathinfo {
|
|
|
|
struct puffs_pathobj *pi_old;
|
|
|
|
struct puffs_pathobj *pi_new;
|
|
|
|
};
|
|
|
|
|
2007-03-20 13:22:22 +03:00
|
|
|
/* describes one segment cached in the kernel */
|
|
|
|
struct puffs_kcache {
|
|
|
|
off_t pkc_start;
|
|
|
|
off_t pkc_end;
|
|
|
|
|
|
|
|
LIST_ENTRY(puffs_kcache) pkc_entries;
|
|
|
|
};
|
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
/* XXX: might disappear from here into a private header */
|
|
|
|
struct puffs_node {
|
|
|
|
off_t pn_size;
|
2007-06-24 21:55:07 +04:00
|
|
|
int pn_flags;
|
- Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.
We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.
- Fix lookup/reclaim race condition.
The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.
We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
2012-07-21 09:17:10 +04:00
|
|
|
int pn_nlookup;
|
2007-01-15 03:39:02 +03:00
|
|
|
struct vattr pn_va;
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
void *pn_data; /* private data */
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_pathobj pn_po; /* PUFFS_FLAG_BUILDPATH */
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_usermount *pn_mnt;
|
|
|
|
LIST_ENTRY(puffs_node) pn_entries;
|
2007-03-20 13:22:22 +03:00
|
|
|
|
|
|
|
LIST_HEAD(,puffs_kcache)pn_cacheinfo; /* PUFFS_KFLAG_CACHE */
|
2006-12-29 18:28:11 +03:00
|
|
|
};
|
2007-06-24 21:55:07 +04:00
|
|
|
#define PUFFS_NODE_REMOVED 0x01 /* not on entry list */
|
2006-12-29 18:28:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
struct puffs_usermount;
|
|
|
|
|
2006-10-23 02:52:21 +04:00
|
|
|
/*
|
|
|
|
* megaXXX: these are values from inside _KERNEL
|
|
|
|
* need to work on the translation for ALL the necessary values.
|
|
|
|
*/
|
|
|
|
#define PUFFS_VNOVAL (-1)
|
2007-07-09 13:28:48 +04:00
|
|
|
|
|
|
|
#define PUFFS_IO_APPEND 0x020
|
|
|
|
#define PUFFS_IO_NDELAY 0x100
|
|
|
|
|
2007-03-20 21:28:08 +03:00
|
|
|
#define PUFFS_VEXEC 01
|
|
|
|
#define PUFFS_VWRITE 02
|
|
|
|
#define PUFFS_VREAD 04
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2007-01-11 20:48:21 +03:00
|
|
|
#define PUFFS_FSYNC_DATAONLY 0x0002
|
|
|
|
#define PUFFS_FSYNC_CACHE 0x0100
|
|
|
|
|
2012-06-27 17:25:23 +04:00
|
|
|
/*
|
|
|
|
* xflags for setattr_ttl and write2
|
|
|
|
*/
|
|
|
|
#define PUFFS_SETATTR_FAF 0x1
|
|
|
|
#define PUFFS_WRITE_FAF 0x1
|
|
|
|
|
2011-07-04 12:07:29 +04:00
|
|
|
#define PUFFS_EXTATTR_LIST_LENPREFIX 1
|
2006-10-23 02:52:21 +04:00
|
|
|
/*
|
2006-12-29 18:28:11 +03:00
|
|
|
* Magic constants
|
2006-10-23 02:52:21 +04:00
|
|
|
*/
|
2007-10-26 17:51:14 +04:00
|
|
|
#define PUFFS_CC_STACKSHIFT_DEFAULT 18
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
struct puffs_cn {
|
|
|
|
struct puffs_kcn *pcn_pkcnp; /* kernel input */
|
2007-07-01 19:30:15 +04:00
|
|
|
struct puffs_cred *pcn_cred; /* cred used for lookup */
|
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_pathobj pcn_po_full; /* PUFFS_FLAG_BUILDPATH */
|
2006-10-23 02:52:21 +04:00
|
|
|
};
|
2006-12-29 18:28:11 +03:00
|
|
|
#define pcn_nameiop pcn_pkcnp->pkcn_nameiop
|
|
|
|
#define pcn_flags pcn_pkcnp->pkcn_flags
|
|
|
|
#define pcn_name pcn_pkcnp->pkcn_name
|
|
|
|
#define pcn_namelen pcn_pkcnp->pkcn_namelen
|
2007-07-02 14:24:17 +04:00
|
|
|
#define pcn_consume pcn_pkcnp->pkcn_consume
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2007-01-06 21:22:09 +03:00
|
|
|
/*
|
|
|
|
* Puffs options to mount
|
|
|
|
*/
|
|
|
|
/* kernel */
|
2007-06-25 02:18:38 +04:00
|
|
|
#define PUFFSMOPT_NAMECACHE { "namecache", 1, PUFFS_KFLAG_NOCACHE_NAME, 1 }
|
|
|
|
#define PUFFSMOPT_PAGECACHE { "pagecache", 1, PUFFS_KFLAG_NOCACHE_PAGE, 1 }
|
2010-05-21 15:29:42 +04:00
|
|
|
#define PUFFSMOPT_ATTRCACHE { "attrcache", 1, PUFFS_KFLAG_NOCACHE_ATTR, 1 }
|
2007-06-25 02:25:49 +04:00
|
|
|
#define PUFFSMOPT_CACHE { "cache", 1, PUFFS_KFLAG_NOCACHE, 1 }
|
2007-01-06 21:22:09 +03:00
|
|
|
#define PUFFSMOPT_ALLOPS { "allops", 0, PUFFS_KFLAG_ALLOPS, 1 }
|
|
|
|
|
|
|
|
/* libpuffs */
|
|
|
|
#define PUFFSMOPT_DUMP { "dump", 0, PUFFS_FLAG_OPDUMP, 1 }
|
|
|
|
|
|
|
|
#define PUFFSMOPT_STD \
|
2007-06-25 02:18:38 +04:00
|
|
|
PUFFSMOPT_NAMECACHE, \
|
|
|
|
PUFFSMOPT_PAGECACHE, \
|
2010-05-21 15:29:42 +04:00
|
|
|
PUFFSMOPT_ATTRCACHE, \
|
2007-06-25 02:25:49 +04:00
|
|
|
PUFFSMOPT_CACHE, \
|
2007-01-06 21:22:09 +03:00
|
|
|
PUFFSMOPT_ALLOPS, \
|
|
|
|
PUFFSMOPT_DUMP
|
|
|
|
|
|
|
|
extern const struct mntopt puffsmopts[]; /* puffs.c */
|
|
|
|
|
2006-10-23 02:52:21 +04:00
|
|
|
/* callbacks for operations */
|
2006-12-07 13:53:21 +03:00
|
|
|
struct puffs_ops {
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_fs_unmount)(struct puffs_usermount *, int);
|
|
|
|
int (*puffs_fs_statvfs)(struct puffs_usermount *, struct statvfs *);
|
|
|
|
int (*puffs_fs_sync)(struct puffs_usermount *, int,
|
2007-11-27 14:31:17 +03:00
|
|
|
const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_fs_fhtonode)(struct puffs_usermount *, void *, size_t,
|
2007-07-01 22:39:39 +04:00
|
|
|
struct puffs_newinfo *);
|
2008-08-12 23:44:39 +04:00
|
|
|
int (*puffs_fs_nodetofh)(struct puffs_usermount *, puffs_cookie_t,
|
2007-04-12 01:04:51 +04:00
|
|
|
void *, size_t *);
|
2010-05-21 14:50:52 +04:00
|
|
|
int (*puffs_fs_extattrctl)(struct puffs_usermount *, int,
|
|
|
|
puffs_cookie_t, int, int, const char *);
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_lookup)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_create)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
|
2007-07-01 22:39:39 +04:00
|
|
|
const struct vattr *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_mknod)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
|
2007-07-01 22:39:39 +04:00
|
|
|
const struct vattr *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_open)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_close)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_access)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_getattr)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_setattr)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct vattr *, const struct puffs_cred *);
|
|
|
|
int (*puffs_node_poll)(struct puffs_usermount *, puffs_cookie_t, int *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_mmap)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, vm_prot_t, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_fsync)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct puffs_cred *, int, off_t, off_t);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_seek)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, off_t, off_t, const struct puffs_cred *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_remove)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_link)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_rename)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *,
|
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_mkdir)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
|
2007-07-01 22:39:39 +04:00
|
|
|
const struct vattr *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_rmdir)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_symlink)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *,
|
2007-07-01 22:39:39 +04:00
|
|
|
const struct vattr *,
|
2006-10-23 02:52:21 +04:00
|
|
|
const char *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_readdir)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct dirent *, off_t *, size_t *,
|
2007-04-12 01:04:51 +04:00
|
|
|
const struct puffs_cred *, int *, off_t *, size_t *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_readlink)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct puffs_cred *, char *, size_t *);
|
|
|
|
int (*puffs_node_reclaim)(struct puffs_usermount *, puffs_cookie_t);
|
|
|
|
int (*puffs_node_inactive)(struct puffs_usermount *, puffs_cookie_t);
|
|
|
|
int (*puffs_node_print)(struct puffs_usermount *, puffs_cookie_t);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_pathconf)(struct puffs_usermount *,
|
2010-06-07 15:21:31 +04:00
|
|
|
puffs_cookie_t, int, register_t *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int (*puffs_node_advlock)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, void *, int, struct flock *, int);
|
|
|
|
int (*puffs_node_read)(struct puffs_usermount *, puffs_cookie_t,
|
2006-10-23 02:52:21 +04:00
|
|
|
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
|
2008-08-12 23:44:39 +04:00
|
|
|
int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t,
|
2006-10-23 02:52:21 +04:00
|
|
|
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
|
2009-10-18 03:19:52 +04:00
|
|
|
int (*puffs_node_abortop)(struct puffs_usermount *, puffs_cookie_t,
|
|
|
|
const struct puffs_cn *);
|
2010-05-21 14:50:52 +04:00
|
|
|
int (*puffs_node_getextattr)(struct puffs_usermount *, puffs_cookie_t,
|
|
|
|
int, const char *, size_t *, uint8_t *, size_t *,
|
|
|
|
const struct puffs_cred *);
|
|
|
|
int (*puffs_node_setextattr)(struct puffs_usermount *, puffs_cookie_t,
|
|
|
|
int, const char *, uint8_t *, size_t *, const struct puffs_cred *);
|
|
|
|
int (*puffs_node_listextattr)(struct puffs_usermount *, puffs_cookie_t,
|
2011-07-04 12:07:29 +04:00
|
|
|
int, size_t *, uint8_t *, size_t *, int, const struct puffs_cred *);
|
2010-05-21 14:50:52 +04:00
|
|
|
int (*puffs_node_deleteextattr)(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, int, const char *, const struct puffs_cred *);
|
2012-04-18 04:57:21 +04:00
|
|
|
int (*puffs_node_getattr_ttl)(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *,
|
|
|
|
struct timespec *);
|
|
|
|
int (*puffs_node_setattr_ttl)(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *,
|
2012-06-27 17:25:23 +04:00
|
|
|
struct timespec *, int);
|
|
|
|
int (*puffs_node_write2)(struct puffs_usermount *, puffs_cookie_t,
|
|
|
|
uint8_t *, off_t, size_t *, const struct puffs_cred *, int, int);
|
2012-08-16 13:25:43 +04:00
|
|
|
int (*puffs_node_reclaim2)(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, int);
|
2012-04-18 04:57:21 +04:00
|
|
|
|
2012-08-16 13:25:43 +04:00
|
|
|
void *puffs_ops_spare[28];
|
2006-10-23 02:52:21 +04:00
|
|
|
};
|
|
|
|
|
2007-02-15 15:51:45 +03:00
|
|
|
typedef int (*pu_pathbuild_fn)(struct puffs_usermount *,
|
|
|
|
const struct puffs_pathobj *,
|
|
|
|
const struct puffs_pathobj *, size_t,
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_pathobj *);
|
|
|
|
typedef int (*pu_pathtransform_fn)(struct puffs_usermount *,
|
2007-02-15 15:51:45 +03:00
|
|
|
const struct puffs_pathobj *,
|
2007-01-15 03:39:02 +03:00
|
|
|
const struct puffs_cn *,
|
|
|
|
struct puffs_pathobj *);
|
|
|
|
typedef int (*pu_pathcmp_fn)(struct puffs_usermount *, struct puffs_pathobj *,
|
2007-02-15 20:04:46 +03:00
|
|
|
struct puffs_pathobj *, size_t, int);
|
2007-01-15 03:39:02 +03:00
|
|
|
typedef void (*pu_pathfree_fn)(struct puffs_usermount *,
|
|
|
|
struct puffs_pathobj *);
|
|
|
|
typedef int (*pu_namemod_fn)(struct puffs_usermount *,
|
|
|
|
struct puffs_pathobj *, struct puffs_cn *);
|
|
|
|
|
2007-09-28 01:14:49 +04:00
|
|
|
typedef void (*pu_errnotify_fn)(struct puffs_usermount *,
|
2008-08-12 23:44:39 +04:00
|
|
|
uint8_t, int, const char *, puffs_cookie_t);
|
2007-09-28 01:14:49 +04:00
|
|
|
|
2007-11-30 22:02:28 +03:00
|
|
|
typedef void (*pu_prepost_fn)(struct puffs_usermount *);
|
2007-10-28 21:40:30 +03:00
|
|
|
|
2008-08-12 23:44:39 +04:00
|
|
|
typedef struct puffs_node *(*pu_cmap_fn)(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t);
|
2007-12-25 23:38:01 +03:00
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
enum {
|
2007-05-17 18:03:13 +04:00
|
|
|
PUFFS_STATE_BEFOREMOUNT, PUFFS_STATE_RUNNING,
|
2007-04-13 17:35:46 +04:00
|
|
|
PUFFS_STATE_UNMOUNTING, PUFFS_STATE_UNMOUNTED
|
2006-12-29 18:28:11 +03:00
|
|
|
};
|
|
|
|
|
2007-01-06 21:22:09 +03:00
|
|
|
#define PUFFS_FLAG_BUILDPATH 0x80000000 /* node paths in pnode */
|
|
|
|
#define PUFFS_FLAG_OPDUMP 0x40000000 /* dump all operations */
|
2007-05-01 19:58:00 +04:00
|
|
|
#define PUFFS_FLAG_HASHPATH 0x20000000 /* speedup: hash paths */
|
2012-08-16 13:25:43 +04:00
|
|
|
#define PUFFS_FLAG_PNCOOKIE 0x10000000 /* cookies are pnodes */
|
|
|
|
#define PUFFS_FLAG_MASK 0xf0000000
|
2007-04-22 22:02:44 +04:00
|
|
|
|
|
|
|
#define PUFFS_FLAG_KERN(a) ((a) & PUFFS_KFLAG_MASK)
|
|
|
|
#define PUFFS_FLAG_LIB(a) ((a) & PUFFS_FLAG_MASK)
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2006-11-30 08:37:48 +03:00
|
|
|
/* blocking mode argument */
|
2006-11-09 16:11:01 +03:00
|
|
|
#define PUFFSDEV_BLOCK 0
|
|
|
|
#define PUFFSDEV_NONBLOCK 1
|
|
|
|
|
2008-01-14 16:57:26 +03:00
|
|
|
#define PUFFS_STACKSIZE_DEFAULT (1<<PUFFS_CC_STACKSHIFT_DEFAULT)
|
|
|
|
#define PUFFS_STACKSIZE_MIN ((size_t)-1)
|
|
|
|
|
2006-10-23 02:52:21 +04:00
|
|
|
#define DENT_DOT 0
|
|
|
|
#define DENT_DOTDOT 1
|
|
|
|
#define DENT_ADJ(a) ((a)-2) /* nth request means dir's n-2th */
|
|
|
|
|
|
|
|
|
2006-12-08 02:15:20 +03:00
|
|
|
/*
|
2006-12-29 18:28:11 +03:00
|
|
|
* protos
|
2006-12-08 02:15:20 +03:00
|
|
|
*/
|
|
|
|
|
2006-12-07 13:53:21 +03:00
|
|
|
#define PUFFSOP_PROTOS(fsname) \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_fs_unmount(struct puffs_usermount *, int); \
|
|
|
|
int fsname##_fs_statvfs(struct puffs_usermount *, \
|
|
|
|
struct statvfs *); \
|
|
|
|
int fsname##_fs_sync(struct puffs_usermount *, int, \
|
2007-11-27 14:31:17 +03:00
|
|
|
const struct puffs_cred *cred); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_fs_fhtonode(struct puffs_usermount *, void *, \
|
|
|
|
size_t, struct puffs_newinfo *); \
|
2008-08-12 23:44:39 +04:00
|
|
|
int fsname##_fs_nodetofh(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, void *, size_t *); \
|
2010-05-21 14:50:52 +04:00
|
|
|
int fsname##_fs_extattrctl(struct puffs_usermount *, int, \
|
|
|
|
puffs_cookie_t, int, int, const char *); \
|
2006-12-07 13:53:21 +03:00
|
|
|
\
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_lookup(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, \
|
|
|
|
const struct puffs_cn *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_create(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, \
|
|
|
|
const struct puffs_cn *, const struct vattr *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_mknod(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, \
|
|
|
|
const struct puffs_cn *, const struct vattr *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_open(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_close(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_access(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, int, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_getattr(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_setattr(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct vattr *, \
|
|
|
|
const struct puffs_cred *); \
|
|
|
|
int fsname##_node_poll(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_mmap(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, vm_prot_t, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_fsync(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct puffs_cred *, int, \
|
|
|
|
off_t, off_t); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_seek(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, off_t, off_t, const struct puffs_cred *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_remove(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_link(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_rename(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *, \
|
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_mkdir(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, \
|
|
|
|
const struct puffs_cn *, const struct vattr *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_rmdir(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, puffs_cookie_t, const struct puffs_cn *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_symlink(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct puffs_newinfo *, \
|
|
|
|
const struct puffs_cn *, const struct vattr *, \
|
|
|
|
const char *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_readdir(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, struct dirent *, off_t *, size_t *, \
|
2007-04-12 01:04:51 +04:00
|
|
|
const struct puffs_cred *, int *, off_t *, size_t *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_readlink(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, const struct puffs_cred *, char *, \
|
|
|
|
size_t *); \
|
|
|
|
int fsname##_node_reclaim(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t); \
|
|
|
|
int fsname##_node_inactive(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_print(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_pathconf(struct puffs_usermount *, \
|
2010-06-07 15:21:31 +04:00
|
|
|
puffs_cookie_t, int, register_t *); \
|
2007-11-30 22:02:28 +03:00
|
|
|
int fsname##_node_advlock(struct puffs_usermount *, \
|
2008-08-12 23:44:39 +04:00
|
|
|
puffs_cookie_t, void *, int, struct flock *, int); \
|
|
|
|
int fsname##_node_read(struct puffs_usermount *, puffs_cookie_t,\
|
2006-10-23 02:52:21 +04:00
|
|
|
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);\
|
2008-08-12 23:44:39 +04:00
|
|
|
int fsname##_node_write(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, uint8_t *, off_t, size_t *, \
|
|
|
|
const struct puffs_cred *, int); \
|
2009-10-18 03:19:52 +04:00
|
|
|
int fsname##_node_abortop(struct puffs_usermount *, \
|
2010-05-21 14:50:52 +04:00
|
|
|
puffs_cookie_t, const struct puffs_cn *); \
|
|
|
|
int fsname##_node_getextattr(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int, const char *, size_t *, uint8_t *, \
|
|
|
|
size_t *, const struct puffs_cred *); \
|
|
|
|
int fsname##_node_setextattr(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int, const char *, uint8_t *, size_t *, \
|
|
|
|
const struct puffs_cred *); \
|
|
|
|
int fsname##_node_listextattr(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int, size_t *, uint8_t *, size_t *, \
|
2011-07-04 12:07:29 +04:00
|
|
|
int, const struct puffs_cred *); \
|
2010-05-21 14:50:52 +04:00
|
|
|
int fsname##_node_deleteextattr(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int, const char *, \
|
2012-04-18 04:57:21 +04:00
|
|
|
const struct puffs_cred *); \
|
|
|
|
int fsname##_node_getattr_ttl(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *, \
|
|
|
|
struct timespec *); \
|
|
|
|
int fsname##_node_setattr_ttl(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, struct vattr *, const struct puffs_cred *, \
|
2012-06-27 17:25:23 +04:00
|
|
|
struct timespec *, int); \
|
|
|
|
int fsname##_node_write2(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, uint8_t *, off_t, size_t *, \
|
2012-08-16 13:25:43 +04:00
|
|
|
const struct puffs_cred *, int, int); \
|
|
|
|
int fsname##_node_reclaim2(struct puffs_usermount *, \
|
|
|
|
puffs_cookie_t, int);
|
2012-04-18 04:57:21 +04:00
|
|
|
|
2006-10-23 02:52:21 +04:00
|
|
|
|
2006-12-07 13:53:21 +03:00
|
|
|
#define PUFFSOP_INIT(ops) \
|
2006-12-29 18:28:11 +03:00
|
|
|
ops = malloc(sizeof(struct puffs_ops)); \
|
2006-12-07 13:53:21 +03:00
|
|
|
memset(ops, 0, sizeof(struct puffs_ops))
|
|
|
|
#define PUFFSOP_SET(ops, fsname, fsornode, opname) \
|
|
|
|
(ops)->puffs_##fsornode##_##opname = fsname##_##fsornode##_##opname
|
|
|
|
#define PUFFSOP_SETFSNOP(ops, opname) \
|
|
|
|
(ops)->puffs_fs_##opname = puffs_fsnop_##opname
|
|
|
|
|
2007-06-24 22:42:25 +04:00
|
|
|
PUFFSOP_PROTOS(puffs_null) /* XXX */
|
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
#define PNPATH(pnode) ((pnode)->pn_po.po_path)
|
|
|
|
#define PNPLEN(pnode) ((pnode)->pn_po.po_len)
|
|
|
|
#define PCNPATH(pcnode) ((pcnode)->pcn_po_full.po_path)
|
|
|
|
#define PCNPLEN(pcnode) ((pcnode)->pcn_po_full.po_len)
|
2007-02-15 15:51:45 +03:00
|
|
|
#define PCNISDOTDOT(pcnode) \
|
|
|
|
((pcnode)->pcn_namelen == 2 && strcmp((pcnode)->pcn_name, "..") == 0)
|
2007-01-15 03:39:02 +03:00
|
|
|
|
2007-04-17 15:42:14 +04:00
|
|
|
#define PUFFS_STORE_DCOOKIE(cp, ncp, off) \
|
|
|
|
if (cp) { \
|
|
|
|
*((cp)++) = off; \
|
|
|
|
(*(ncp))++; \
|
|
|
|
}
|
|
|
|
|
2007-05-15 17:44:46 +04:00
|
|
|
/* mainloop */
|
|
|
|
typedef void (*puffs_ml_loop_fn)(struct puffs_usermount *);
|
|
|
|
|
2007-05-05 19:48:18 +04:00
|
|
|
/* framebuf stuff */
|
|
|
|
struct puffs_framebuf;
|
2007-05-15 17:44:46 +04:00
|
|
|
typedef int (*puffs_framev_readframe_fn)(struct puffs_usermount *,
|
2007-05-05 19:48:18 +04:00
|
|
|
struct puffs_framebuf *,
|
|
|
|
int, int *);
|
2007-05-15 17:44:46 +04:00
|
|
|
typedef int (*puffs_framev_writeframe_fn)(struct puffs_usermount *,
|
2007-05-05 19:48:18 +04:00
|
|
|
struct puffs_framebuf *,
|
|
|
|
int, int *);
|
2007-05-20 20:24:37 +04:00
|
|
|
typedef int (*puffs_framev_cmpframe_fn)(struct puffs_usermount *,
|
2007-05-05 19:48:18 +04:00
|
|
|
struct puffs_framebuf *,
|
2007-09-06 20:08:55 +04:00
|
|
|
struct puffs_framebuf *,
|
|
|
|
int *);
|
2007-05-15 17:44:46 +04:00
|
|
|
typedef void (*puffs_framev_fdnotify_fn)(struct puffs_usermount *, int, int);
|
2007-09-01 20:42:42 +04:00
|
|
|
typedef void (*puffs_framev_gotframe_fn)(struct puffs_usermount *,
|
|
|
|
struct puffs_framebuf *);
|
2007-05-15 17:44:46 +04:00
|
|
|
typedef void (*puffs_framev_cb)(struct puffs_usermount *,
|
|
|
|
struct puffs_framebuf *,
|
2007-05-16 14:04:08 +04:00
|
|
|
void *, int);
|
2007-07-08 01:13:41 +04:00
|
|
|
#define PUFFS_FBIO_READ 0x01
|
|
|
|
#define PUFFS_FBIO_WRITE 0x02
|
2007-07-20 17:14:55 +04:00
|
|
|
#define PUFFS_FBIO_ERROR 0x04
|
2007-07-08 01:13:41 +04:00
|
|
|
|
|
|
|
#define PUFFS_FBQUEUE_URGENT 0x01
|
2007-05-05 19:48:18 +04:00
|
|
|
|
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2009-10-18 23:09:20 +04:00
|
|
|
#define PUFFS_DEFER ((void *)-1)
|
2010-05-21 14:50:52 +04:00
|
|
|
struct puffs_usermount *puffs_init(struct puffs_ops *, const char *,
|
2007-07-17 15:34:51 +04:00
|
|
|
const char *, void *, uint32_t);
|
2007-05-17 18:03:13 +04:00
|
|
|
int puffs_mount(struct puffs_usermount *, const char *, int, void*);
|
2007-01-06 21:22:09 +03:00
|
|
|
int puffs_exit(struct puffs_usermount *, int);
|
2008-12-12 22:45:16 +03:00
|
|
|
void puffs_cancel(struct puffs_usermount *, int);
|
2007-11-05 20:48:17 +03:00
|
|
|
int puffs_mainloop(struct puffs_usermount *);
|
2007-11-16 21:35:10 +03:00
|
|
|
int puffs_daemon(struct puffs_usermount *, int, int);
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2010-01-12 21:42:38 +03:00
|
|
|
int puffs_unmountonsignal(int, bool);
|
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
|
|
|
|
int puffs_getselectable(struct puffs_usermount *);
|
|
|
|
int puffs_setblockingmode(struct puffs_usermount *, int);
|
|
|
|
int puffs_getstate(struct puffs_usermount *);
|
|
|
|
void puffs_setstacksize(struct puffs_usermount *, size_t);
|
|
|
|
|
2007-05-15 17:44:46 +04:00
|
|
|
void puffs_ml_setloopfn(struct puffs_usermount *, puffs_ml_loop_fn);
|
|
|
|
void puffs_ml_settimeout(struct puffs_usermount *, struct timespec *);
|
|
|
|
|
2007-04-12 19:09:00 +04:00
|
|
|
void puffs_setroot(struct puffs_usermount *,
|
|
|
|
struct puffs_node *);
|
|
|
|
struct puffs_node *puffs_getroot(struct puffs_usermount *);
|
2007-05-17 18:03:13 +04:00
|
|
|
void puffs_setrootinfo(struct puffs_usermount *,
|
|
|
|
enum vtype, vsize_t, dev_t);
|
|
|
|
|
2007-04-12 19:09:00 +04:00
|
|
|
void *puffs_getspecific(struct puffs_usermount *);
|
2008-12-12 21:59:53 +03:00
|
|
|
void puffs_setspecific(struct puffs_usermount *, void *);
|
2007-04-16 12:28:55 +04:00
|
|
|
void puffs_setmaxreqlen(struct puffs_usermount *, size_t);
|
2007-04-12 19:09:00 +04:00
|
|
|
size_t puffs_getmaxreqlen(struct puffs_usermount *);
|
2007-04-16 17:04:49 +04:00
|
|
|
void puffs_setfhsize(struct puffs_usermount *, size_t, int);
|
2009-10-18 23:09:20 +04:00
|
|
|
void puffs_setmntinfo(struct puffs_usermount *,
|
|
|
|
const char *, const char *);
|
2007-04-16 12:28:55 +04:00
|
|
|
|
|
|
|
void puffs_setncookiehash(struct puffs_usermount *, int);
|
2007-04-12 19:09:00 +04:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_pathobj *puffs_getrootpathobj(struct puffs_usermount *);
|
|
|
|
|
2007-05-07 21:16:07 +04:00
|
|
|
void puffs_setback(struct puffs_cc *, int);
|
|
|
|
|
2007-01-11 04:01:55 +03:00
|
|
|
struct puffs_node *puffs_pn_new(struct puffs_usermount *, void *);
|
2007-06-24 21:55:07 +04:00
|
|
|
void puffs_pn_remove(struct puffs_node *);
|
2006-12-29 18:28:11 +03:00
|
|
|
void puffs_pn_put(struct puffs_node *);
|
2007-08-17 21:25:31 +04:00
|
|
|
struct vattr *puffs_pn_getvap(struct puffs_node *);
|
|
|
|
void * puffs_pn_getpriv(struct puffs_node *);
|
|
|
|
void puffs_pn_setpriv(struct puffs_node *, void *);
|
|
|
|
struct puffs_pathobj *puffs_pn_getpo(struct puffs_node *);
|
|
|
|
struct puffs_usermount *puffs_pn_getmnt(struct puffs_node *);
|
Add PUFFS_KFLAG_CACHE_FS_TTL flag to puffs_init(3) to use name and
attribute cache with filesystem provided TTL.
lookup, create, mknod, mkdir, symlink, getattr and setattr messages
have been extended so that attributes and their TTL can be provided
by the filesytem. lookup, create, mknod, mkdir, and symlink messages
are also extended so that the filesystem can provide name TTL.
The filesystem updates attributes and TTL using
puffs_pn_getvap(3), puffs_pn_getvattl(3), and puffs_pn_getcnttl(3)
2012-04-08 19:07:45 +04:00
|
|
|
struct timespec *puffs_pn_getvattl(struct puffs_node *);
|
|
|
|
struct timespec *puffs_pn_getcnttl(struct puffs_node *);
|
2007-01-15 03:39:02 +03:00
|
|
|
|
2008-08-12 23:44:39 +04:00
|
|
|
void puffs_newinfo_setcookie(struct puffs_newinfo *, puffs_cookie_t);
|
2007-07-01 22:39:39 +04:00
|
|
|
void puffs_newinfo_setvtype(struct puffs_newinfo *, enum vtype);
|
|
|
|
void puffs_newinfo_setsize(struct puffs_newinfo *, voff_t);
|
|
|
|
void puffs_newinfo_setrdev(struct puffs_newinfo *, dev_t);
|
2012-04-18 04:57:21 +04:00
|
|
|
void puffs_newinfo_setva(struct puffs_newinfo *, struct vattr *);
|
|
|
|
void puffs_newinfo_setvattl(struct puffs_newinfo *, struct timespec *);
|
|
|
|
void puffs_newinfo_setcnttl(struct puffs_newinfo *, struct timespec *);
|
2007-07-01 22:39:39 +04:00
|
|
|
|
2007-04-12 19:09:00 +04:00
|
|
|
void *puffs_pn_getmntspecific(struct puffs_node *);
|
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
typedef void * (*puffs_nodewalk_fn)(struct puffs_usermount *,
|
|
|
|
struct puffs_node *, void *);
|
|
|
|
void *puffs_pn_nodewalk(struct puffs_usermount *,
|
|
|
|
puffs_nodewalk_fn, void *);
|
2007-01-11 04:01:55 +03:00
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
void puffs_setvattr(struct vattr *, const struct vattr *);
|
|
|
|
void puffs_vattr_null(struct vattr *);
|
|
|
|
|
2007-06-24 22:42:25 +04:00
|
|
|
void puffs_null_setops(struct puffs_ops *);
|
|
|
|
|
2008-01-28 21:35:49 +03:00
|
|
|
int puffs_dispatch_create(struct puffs_usermount *,
|
|
|
|
struct puffs_framebuf *,
|
|
|
|
struct puffs_cc **);
|
|
|
|
int puffs_dispatch_exec(struct puffs_cc *,
|
|
|
|
struct puffs_framebuf **);
|
2007-12-16 23:02:57 +03:00
|
|
|
|
2007-02-15 15:51:45 +03:00
|
|
|
/*
|
|
|
|
* generic/dummy routines applicable for some file systems
|
|
|
|
*/
|
2007-11-30 22:02:28 +03:00
|
|
|
int puffs_fsnop_unmount(struct puffs_usermount *, int);
|
|
|
|
int puffs_fsnop_statvfs(struct puffs_usermount *, struct statvfs *);
|
2007-02-15 15:51:45 +03:00
|
|
|
void puffs_zerostatvfs(struct statvfs *);
|
2007-11-30 22:02:28 +03:00
|
|
|
int puffs_fsnop_sync(struct puffs_usermount *, int waitfor,
|
2007-11-27 14:31:17 +03:00
|
|
|
const struct puffs_cred *);
|
2007-12-19 17:01:16 +03:00
|
|
|
|
2008-08-12 23:44:39 +04:00
|
|
|
int puffs_genfs_node_getattr(struct puffs_usermount *, puffs_cookie_t,
|
2007-12-19 17:01:16 +03:00
|
|
|
struct vattr *, const struct puffs_cred *);
|
2008-08-12 23:44:39 +04:00
|
|
|
int puffs_genfs_node_reclaim(struct puffs_usermount *, puffs_cookie_t);
|
2007-02-15 15:51:45 +03:00
|
|
|
|
2007-01-11 04:01:55 +03:00
|
|
|
/*
|
|
|
|
* Subroutine stuff
|
|
|
|
*/
|
|
|
|
|
|
|
|
int puffs_gendotdent(struct dirent **, ino_t, int, size_t *);
|
|
|
|
int puffs_nextdent(struct dirent **, const char *, ino_t,
|
|
|
|
uint8_t, size_t *);
|
|
|
|
int puffs_vtype2dt(enum vtype);
|
|
|
|
enum vtype puffs_mode2vt(mode_t);
|
|
|
|
void puffs_stat2vattr(struct vattr *va, const struct stat *);
|
2007-03-16 11:14:49 +03:00
|
|
|
mode_t puffs_addvtype2mode(mode_t, enum vtype);
|
2007-03-21 22:55:55 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* credentials & permissions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Credential fetch */
|
2007-07-01 21:22:13 +04:00
|
|
|
int puffs_cred_getuid(const struct puffs_cred *, uid_t *);
|
|
|
|
int puffs_cred_getgid(const struct puffs_cred *, gid_t *);
|
|
|
|
int puffs_cred_getgroups(const struct puffs_cred *, gid_t *, short *);
|
2007-03-21 22:55:55 +03:00
|
|
|
|
|
|
|
/* Credential check */
|
2007-10-18 17:48:04 +04:00
|
|
|
bool puffs_cred_isuid(const struct puffs_cred *, uid_t);
|
|
|
|
bool puffs_cred_hasgroup(const struct puffs_cred *, gid_t);
|
|
|
|
bool puffs_cred_isregular(const struct puffs_cred *);
|
|
|
|
bool puffs_cred_iskernel(const struct puffs_cred *);
|
|
|
|
bool puffs_cred_isfs(const struct puffs_cred *);
|
|
|
|
bool puffs_cred_isjuggernaut(const struct puffs_cred *);
|
2007-03-21 22:55:55 +03:00
|
|
|
|
|
|
|
/* misc */
|
|
|
|
int puffs_access(enum vtype, mode_t, uid_t, gid_t, mode_t,
|
|
|
|
const struct puffs_cred *);
|
2007-03-22 19:57:27 +03:00
|
|
|
int puffs_access_chown(uid_t, gid_t, uid_t, gid_t,
|
|
|
|
const struct puffs_cred *);
|
|
|
|
int puffs_access_chmod(uid_t, gid_t, enum vtype, mode_t,
|
|
|
|
const struct puffs_cred *);
|
|
|
|
int puffs_access_times(uid_t, gid_t, mode_t, int,
|
|
|
|
const struct puffs_cred *);
|
2007-03-21 22:55:55 +03:00
|
|
|
|
2007-01-11 04:01:55 +03:00
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
/*
|
|
|
|
* Call Context interfaces relevant for user.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void puffs_cc_yield(struct puffs_cc *);
|
|
|
|
void puffs_cc_continue(struct puffs_cc *);
|
2007-10-21 23:25:58 +04:00
|
|
|
void puffs_cc_schedule(struct puffs_cc *);
|
2007-10-21 18:28:05 +04:00
|
|
|
int puffs_cc_getcaller(struct puffs_cc *,pid_t *,lwpid_t *);
|
2007-11-29 20:47:54 +03:00
|
|
|
struct puffs_cc *puffs_cc_getcc(struct puffs_usermount *);
|
2006-12-29 18:28:11 +03:00
|
|
|
|
2007-01-09 21:15:08 +03:00
|
|
|
/*
|
|
|
|
* Flushing / invalidation routines
|
|
|
|
*/
|
|
|
|
|
2008-08-12 23:44:39 +04:00
|
|
|
int puffs_inval_namecache_dir(struct puffs_usermount *, puffs_cookie_t);
|
2007-01-09 21:19:01 +03:00
|
|
|
int puffs_inval_namecache_all(struct puffs_usermount *);
|
2007-01-09 21:15:08 +03:00
|
|
|
|
2008-08-12 23:44:39 +04:00
|
|
|
int puffs_inval_pagecache_node(struct puffs_usermount *, puffs_cookie_t);
|
|
|
|
int puffs_inval_pagecache_node_range(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, off_t, off_t);
|
|
|
|
int puffs_flush_pagecache_node(struct puffs_usermount *, puffs_cookie_t);
|
|
|
|
int puffs_flush_pagecache_node_range(struct puffs_usermount *,
|
|
|
|
puffs_cookie_t, off_t, off_t);
|
2007-03-20 13:22:22 +03:00
|
|
|
|
2007-01-15 03:39:02 +03:00
|
|
|
/*
|
|
|
|
* Path constructicons
|
|
|
|
*/
|
|
|
|
|
2007-02-15 20:04:46 +03:00
|
|
|
int puffs_stdpath_buildpath(struct puffs_usermount *,
|
2007-02-15 15:51:45 +03:00
|
|
|
const struct puffs_pathobj *,
|
|
|
|
const struct puffs_pathobj *, size_t,
|
2007-01-15 03:39:02 +03:00
|
|
|
struct puffs_pathobj *);
|
2007-02-15 20:04:46 +03:00
|
|
|
int puffs_stdpath_cmppath(struct puffs_usermount *, struct puffs_pathobj *,
|
|
|
|
struct puffs_pathobj *, size_t, int);
|
|
|
|
void puffs_stdpath_freepath(struct puffs_usermount *,struct puffs_pathobj *);
|
2007-01-15 03:39:02 +03:00
|
|
|
|
2007-02-15 20:04:46 +03:00
|
|
|
void *puffs_path_walkcmp(struct puffs_usermount *,
|
|
|
|
struct puffs_node *, void *);
|
2007-01-15 03:39:02 +03:00
|
|
|
void *puffs_path_prefixadj(struct puffs_usermount *,
|
|
|
|
struct puffs_node *, void *);
|
|
|
|
int puffs_path_pcnbuild(struct puffs_usermount *,
|
|
|
|
struct puffs_cn *, void *);
|
2007-05-01 19:58:00 +04:00
|
|
|
void puffs_path_buildhash(struct puffs_usermount *, struct puffs_pathobj *);
|
2007-12-05 00:24:10 +03:00
|
|
|
void puffs_set_pathbuild(struct puffs_usermount *, pu_pathbuild_fn); void puffs_set_pathtransform(struct puffs_usermount *, pu_pathtransform_fn);
|
2007-01-15 03:39:02 +03:00
|
|
|
void puffs_set_pathcmp(struct puffs_usermount *, pu_pathcmp_fn);
|
|
|
|
void puffs_set_pathfree(struct puffs_usermount *, pu_pathfree_fn);
|
|
|
|
void puffs_set_namemod(struct puffs_usermount *, pu_namemod_fn);
|
|
|
|
|
2007-09-28 01:14:49 +04:00
|
|
|
void puffs_set_errnotify(struct puffs_usermount *, pu_errnotify_fn);
|
2009-12-05 23:54:10 +03:00
|
|
|
void puffs_kernerr_log(struct puffs_usermount *, uint8_t, int,
|
|
|
|
const char *, puffs_cookie_t);
|
2011-08-30 00:41:06 +04:00
|
|
|
__dead void puffs_kernerr_abort(struct puffs_usermount *, uint8_t, int,
|
2009-12-05 23:54:10 +03:00
|
|
|
const char *, puffs_cookie_t);
|
2007-10-28 21:40:30 +03:00
|
|
|
void puffs_set_prepost(struct puffs_usermount *,
|
|
|
|
pu_prepost_fn, pu_prepost_fn);
|
2007-12-25 23:38:01 +03:00
|
|
|
void puffs_set_cmap(struct puffs_usermount *, pu_cmap_fn);
|
2007-09-28 01:14:49 +04:00
|
|
|
|
2007-01-27 02:00:33 +03:00
|
|
|
/*
|
|
|
|
* Suspension
|
|
|
|
*/
|
|
|
|
|
|
|
|
int puffs_fs_suspend(struct puffs_usermount *);
|
|
|
|
|
2007-05-05 19:48:18 +04:00
|
|
|
/*
|
|
|
|
* Frame buffering
|
|
|
|
*/
|
|
|
|
|
2007-05-15 17:44:46 +04:00
|
|
|
void puffs_framev_init(struct puffs_usermount *,
|
|
|
|
puffs_framev_readframe_fn,
|
|
|
|
puffs_framev_writeframe_fn,
|
2007-05-20 20:24:37 +04:00
|
|
|
puffs_framev_cmpframe_fn,
|
2007-09-01 20:42:42 +04:00
|
|
|
puffs_framev_gotframe_fn,
|
2007-05-15 17:44:46 +04:00
|
|
|
puffs_framev_fdnotify_fn);
|
2007-05-12 01:27:13 +04:00
|
|
|
|
2007-05-05 19:48:18 +04:00
|
|
|
struct puffs_framebuf *puffs_framebuf_make(void);
|
|
|
|
void puffs_framebuf_destroy(struct puffs_framebuf *);
|
2007-12-05 00:24:10 +03:00
|
|
|
int puffs_framebuf_dup(struct puffs_framebuf *,
|
|
|
|
struct puffs_framebuf **);
|
2007-05-05 19:48:18 +04:00
|
|
|
void puffs_framebuf_recycle(struct puffs_framebuf *);
|
|
|
|
int puffs_framebuf_reserve_space(struct puffs_framebuf *,
|
|
|
|
size_t);
|
|
|
|
|
|
|
|
int puffs_framebuf_putdata(struct puffs_framebuf *, const void *, size_t);
|
|
|
|
int puffs_framebuf_putdata_atoff(struct puffs_framebuf *, size_t,
|
|
|
|
const void *, size_t);
|
|
|
|
int puffs_framebuf_getdata(struct puffs_framebuf *, void *, size_t);
|
|
|
|
int puffs_framebuf_getdata_atoff(struct puffs_framebuf *, size_t,
|
|
|
|
void *, size_t);
|
|
|
|
|
|
|
|
size_t puffs_framebuf_telloff(struct puffs_framebuf *);
|
|
|
|
size_t puffs_framebuf_tellsize(struct puffs_framebuf *);
|
|
|
|
size_t puffs_framebuf_remaining(struct puffs_framebuf *);
|
|
|
|
int puffs_framebuf_seekset(struct puffs_framebuf *, size_t);
|
|
|
|
int puffs_framebuf_getwindow(struct puffs_framebuf *, size_t,
|
|
|
|
void **, size_t *);
|
|
|
|
|
2007-05-15 17:44:46 +04:00
|
|
|
int puffs_framev_enqueue_cc(struct puffs_cc *, int,
|
2007-07-08 01:13:41 +04:00
|
|
|
struct puffs_framebuf *, int);
|
2007-05-15 17:44:46 +04:00
|
|
|
int puffs_framev_enqueue_cb(struct puffs_usermount *, int,
|
|
|
|
struct puffs_framebuf *,
|
2007-07-08 01:13:41 +04:00
|
|
|
puffs_framev_cb, void *, int);
|
2007-05-15 17:44:46 +04:00
|
|
|
int puffs_framev_enqueue_justsend(struct puffs_usermount *, int,
|
2007-07-08 01:13:41 +04:00
|
|
|
struct puffs_framebuf *, int, int);
|
|
|
|
int puffs_framev_enqueue_directreceive(struct puffs_cc *, int,
|
|
|
|
struct puffs_framebuf *, int);
|
|
|
|
int puffs_framev_enqueue_directsend(struct puffs_cc *, int,
|
|
|
|
struct puffs_framebuf *, int);
|
2007-07-20 17:14:55 +04:00
|
|
|
int puffs_framev_enqueue_waitevent(struct puffs_cc *, int, int *);
|
2007-05-20 23:56:56 +04:00
|
|
|
int puffs_framev_framebuf_ccpromote(struct puffs_framebuf *,
|
|
|
|
struct puffs_cc *);
|
2007-05-15 17:44:46 +04:00
|
|
|
|
2007-07-08 01:13:41 +04:00
|
|
|
int puffs_framev_addfd(struct puffs_usermount *, int, int);
|
|
|
|
int puffs_framev_enablefd(struct puffs_usermount *, int, int);
|
|
|
|
int puffs_framev_disablefd(struct puffs_usermount *, int, int);
|
|
|
|
int puffs_framev_removefd(struct puffs_usermount *, int, int);
|
2007-07-08 15:24:58 +04:00
|
|
|
void puffs_framev_removeonclose(struct puffs_usermount *, int, int);
|
2007-07-08 01:13:41 +04:00
|
|
|
void puffs_framev_unmountonclose(struct puffs_usermount *, int, int);
|
2007-05-11 20:22:38 +04:00
|
|
|
|
2006-12-29 18:28:11 +03:00
|
|
|
__END_DECLS
|
|
|
|
|
2006-12-07 13:53:21 +03:00
|
|
|
#endif /* _PUFFS_H_ */
|