The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/puffs/puffs_sys.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: puffs_sys.h,v 1.11 2006/12/01 12:48:31 pooka Exp $     */
    2 
    3 /*
    4  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
    5  *
    6  * Development of this software was supported by the
    7  * Google Summer of Code program and the Ulla Tuominen Foundation.
    8  * The Google SoC project was mentored by Bill Studenmund.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. The name of the company nor the name of the author may be used to
   19  *    endorse or promote products derived from this software without specific
   20  *    prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   23  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   25  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  */
   34 
   35 #ifndef _PUFFS_SYS_H_
   36 #define _PUFFS_SYS_H_
   37 
   38 #include <sys/param.h>
   39 #include <sys/select.h>
   40 #include <sys/kauth.h>
   41 #include <sys/lock.h>
   42 #include <sys/queue.h>
   43 #include <sys/lock.h>
   44 #include <sys/pool.h>
   45 
   46 #include <fs/puffs/puffs_msgif.h>
   47 
   48 #include <miscfs/genfs/genfs_node.h>
   49 
   50 extern int (**puffs_vnodeop_p)(void *);
   51 extern int (**puffs_specop_p)(void *);
   52 extern int (**puffs_fifoop_p)(void *);
   53 
   54 extern const struct vnodeopv_desc puffs_vnodeop_opv_desc;
   55 extern const struct vnodeopv_desc puffs_specop_opv_desc;
   56 extern const struct vnodeopv_desc puffs_fifoop_opv_desc;
   57 extern const struct vnodeopv_desc puffs_msgop_opv_desc;
   58 
   59 extern struct pool puffs_pnpool;
   60 
   61 /*
   62  * While a request is going to userspace, park the caller within the
   63  * kernel.  This is the kernel counterpart of "struct puffs_req".
   64  */
   65 struct puffs_park {
   66         struct puffs_req park_preq;     /* the relevant preq            */
   67 
   68         void            *park_kernbuf;  /* kernel buffer address        */
   69         size_t          park_buflen;    /* buffer length                */
   70         size_t          park_copylen;   /* length to copy to userspace  */
   71 
   72         uint32_t        park_flags;
   73 
   74         TAILQ_ENTRY(puffs_park) park_entries;
   75 };
   76 #define park_id         park_preq.preq_id
   77 #define park_opclass    park_preq.preq_opclass
   78 #define park_optype     park_preq.preq_optype
   79 #define park_cookie     park_preq.preq_cookie
   80 #define park_rv         park_preq.preq_rv
   81 
   82 
   83 #define PUFFS_SIZEOPREQ_UIO_IN 1
   84 #define PUFFS_SIZEOPREQ_UIO_OUT 2
   85 #define PUFFS_SIZEOPREQ_BUF_IN 3
   86 #define PUFFS_SIZEOPREQ_BUF_OUT 4
   87 
   88 #define PUFFS_SIZEOP_UIO(a)     \
   89         (((a)==PUFFS_SIZEOPREQ_UIO_IN)||(a)==PUFFS_SIZEOPREQ_UIO_OUT)
   90 #define PUFFS_SIZEOP_BUF(a)     \
   91         (((a)==PUFFS_SIZEOPREQ_BUF_IN)||(a)==PUFFS_SIZEOPREQ_BUF_OUT)
   92 
   93 /* XXX: alignment-optimization */
   94 struct puffs_sizepark {
   95         uint64_t        pkso_reqid;
   96         uint8_t         pkso_reqtype;
   97 
   98         struct uio      *pkso_uio;
   99         void            *pkso_copybuf;
  100         size_t          pkso_bufsize;
  101 
  102         TAILQ_ENTRY(puffs_sizepark) pkso_entries;
  103 };
  104 
  105 #define DPRINTF(x)
  106 #define DPRINTF_VERBOSE(x)
  107 
  108 #define MPTOPUFFSMP(mp) ((struct puffs_mount *)((mp)->mnt_data))
  109 #define PMPTOMP(pmp) (pmp->pmp_mp)
  110 #define VPTOPP(vp) ((struct puffs_node *)(vp)->v_data)
  111 #define VPTOPNC(vp) (((struct puffs_node *)(vp)->v_data)->pn_cookie)
  112 #define VPTOPUFFSMP(vp) ((struct puffs_mount*)((struct puffs_node*)vp->v_data))
  113 #define FPTOPMP(fp) (((struct puffs_instance *)fp->f_data)->pi_pmp)
  114 #define FPTOPI(fp) ((struct puffs_instance *)fp->f_data)
  115 
  116 #define EXISTSOP(pmp, op) \
  117  (((pmp)->pmp_flags&PUFFS_KFLAG_ALLOPS) || ((pmp)->pmp_vnopmask[PUFFS_VN_##op]))
  118 
  119 TAILQ_HEAD(puffs_wq, puffs_park);
  120 struct puffs_mount {
  121         struct simplelock               pmp_lock;
  122 
  123         struct puffs_args               pmp_args;
  124 #define pmp_flags pmp_args.pa_flags
  125 #define pmp_vnopmask pmp_args.pa_vnopmask
  126 
  127         struct puffs_wq                 pmp_req_touser;
  128         size_t                          pmp_req_touser_waiters;
  129         size_t                          pmp_req_maxsize;
  130 
  131         struct puffs_wq                 pmp_req_replywait;
  132         TAILQ_HEAD(, puffs_sizepark)    pmp_req_sizepark;
  133 
  134         LIST_HEAD(, puffs_node)         pmp_pnodelist;
  135 
  136         struct mount                    *pmp_mp;
  137         struct vnode                    *pmp_root;
  138         void                            *pmp_rootcookie;
  139         struct selinfo                  *pmp_sel;       /* in puffs_instance */
  140 
  141         unsigned int                    pmp_nextreq;
  142         uint8_t                         pmp_status;
  143 };
  144 
  145 #define PUFFSTAT_BEFOREINIT     0
  146 #define PUFFSTAT_MOUNTING       1
  147 #define PUFFSTAT_RUNNING        2
  148 #define PUFFSTAT_DYING          3
  149 
  150 #define PNODE_INACTIVE  0x01
  151 #define PNODE_LOCKED    0x02
  152 #define PNODE_WANTED    0x04    
  153 struct puffs_node {
  154         struct genfs_node pn_gnode;     /* genfs glue                   */
  155 
  156         void            *pn_cookie;     /* userspace pnode cookie       */
  157         struct vnode    *pn_vp;         /* backpointer to vnode         */
  158         uint32_t        pn_stat;        /* node status                  */
  159 
  160         LIST_ENTRY(puffs_node) pn_entries;
  161 };
  162 
  163 int     puffs_start2(struct puffs_mount *, struct puffs_startreq *);
  164 
  165 int     puffs_vfstouser(struct puffs_mount *, int, void *, size_t);
  166 int     puffs_vntouser(struct puffs_mount *, int, void *, size_t, void *,
  167                        struct vnode *, struct vnode *);
  168 void    puffs_vntouser_faf(struct puffs_mount *, int, void *, size_t, void *);
  169 int     puffs_vntouser_req(struct puffs_mount *, int, void *, size_t,
  170                            void *, uint64_t, struct vnode *, struct vnode *);
  171 int     puffs_vntouser_adjbuf(struct puffs_mount *, int, void **, size_t *,
  172                               size_t, void *, struct vnode *, struct vnode *);
  173 
  174 int     puffs_getvnode(struct mount *, void *, enum vtype, voff_t, dev_t,
  175                        struct vnode **);
  176 int     puffs_newnode(struct mount *, struct vnode *, struct vnode **,
  177                       void *, struct componentname *, enum vtype, dev_t);
  178 void    puffs_putvnode(struct vnode *);
  179 struct vnode *puffs_pnode2vnode(struct puffs_mount *, void *);
  180 void    puffs_makecn(struct puffs_cn *, const struct componentname *);
  181 void    puffs_credcvt(struct puffs_cred *, kauth_cred_t);
  182 pid_t   puffs_lwp2pid(struct lwp *);
  183 
  184 void    puffs_updatenode(struct vnode *, int);
  185 #define PUFFS_UPDATEATIME       0x01
  186 #define PUFFS_UPDATECTIME       0x02
  187 #define PUFFS_UPDATEMTIME       0x04
  188 #define PUFFS_UPDATESIZE        0x08
  189 void    puffs_updatevpsize(struct vnode *);
  190 
  191 int     puffs_setpmp(pid_t, int, struct puffs_mount *);
  192 void    puffs_nukebypmp(struct puffs_mount *);
  193 
  194 uint64_t        puffs_getreqid(struct puffs_mount *);
  195 void            puffs_userdead(struct puffs_mount *);
  196 
  197 extern int (**puffs_vnodeop_p)(void *);
  198 
  199 MALLOC_DECLARE(M_PUFFS);
  200 
  201 #endif /* _PUFFS_SYS_H_ */

Cache object: 34bb65a917d67224680f1cd1246f3fef


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.