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/xfs/xfs_locl.h

Version: -  FREEBSD  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
    3  * (Royal Institute of Technology, Stockholm, Sweden).
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  *
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  *
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  *
   17  * 3. Neither the name of the Institute nor the names of its contributors
   18  *    may be used to endorse or promote products derived from this software
   19  *    without specific prior written permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
   25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  */
   33 
   34 /* $arla: xfs_locl.h,v 1.72 2003/02/15 16:40:00 lha Exp $ */
   35 
   36 #ifdef HAVE_CONFIG_H
   37 #include <config.h>
   38 #else
   39 #include <xfs/xfs_config.h>
   40 #endif
   41 
   42 #ifndef RCSID
   43 #define RCSID(x)
   44 #endif
   45 
   46 #ifdef __osf__
   47 
   48 #ifdef __GNUC__
   49 #define asm __foo_asm
   50 #endif
   51 #include <sys/types.h>
   52 #include <sys/errno.h>
   53 #include <sys/uio.h>
   54 #include <machine/cpu.h>
   55 #include <sys/conf.h>
   56 #include <sys/sysconfig.h>
   57 #include <sys/file.h>
   58 #include <sys/malloc.h>
   59 #include <sys/poll.h>
   60 #include <sys/ioctl.h>
   61 #include <sys/fcntl.h>
   62 #include <sys/vfs_proto.h>
   63 #include <io/common/devdriver.h>
   64 #include <vm/vm_page.h>
   65 #include <vm/vm_vppage.h>
   66 #include <vm/vm_ubc.h>
   67 
   68 typedef short int16_t;
   69 typedef unsigned short uint16_t;
   70 typedef int int32_t;
   71 typedef unsigned int uint32_t;
   72 
   73 #define VT_AFS VT_ADDON
   74 #define MOUNT_NNPFS MOUNT_PC
   75 
   76 typedef struct nameidata xfs_componentname;
   77 
   78 /* XXX this is gross, but makes the code considerably more readable */
   79 #if 0
   80 #define componentname   nameidata
   81 #endif
   82 
   83 #define cn_nameptr      ni_ptr
   84 #define cn_namelen      ni_namelen
   85 #define cn_hash         ni_hash
   86 #define cn_cred         ni_cred
   87 #define cn_nameiop      ni_nameiop
   88 #define cn_flags        ni_flags
   89 
   90 #define mnt_stat m_stat
   91 #define mnt_flag m_flag
   92 
   93 #define NDINIT(ndp, op, flags, segflg, namep, p)        \
   94         (ndp)->ni_nameiop = (op) | (flags);             \
   95         (ndp)->ni_segflg = segflg;                      \
   96         (ndp)->ni_dirp = namep;
   97 
   98 #define LOCKLEAF 0
   99 
  100 #define FFLAGS(mode) ((mode) - FOPEN)
  101 
  102 /* 4.4BSD vput does VOP_UNLOCK + vrele, but it seems as if we only
  103    should do a vrele here */
  104 #define vput(VP) vrele(VP)
  105 
  106 #define xfs_uio_to_proc(uiop) (u.u_procp)
  107 #define xfs_cnp_to_proc(cnp) (u.u_procp)
  108 #define xfs_proc_to_cred(p) ((p)->p_rcred)
  109 #define xfs_proc_to_euid(p) ((p)->p_rcred->cr_uid)
  110 
  111 #define xfs_curproc() (u.u_procp)
  112 
  113 #define xfs_vop_read VOP_READ
  114 #define xfs_vop_write VOP_WRITE
  115 #define xfs_vop_getattr(t, attr, cred, proc, error) VOP_GETATTR((t), (attr), (cred), (error))
  116 #define xfs_vop_access(dvp, mode, cred, proc, error) VOP_ACCESS((dvp), (mode), (cred), (error))
  117 
  118 struct vop_generic_args;
  119 
  120 typedef u_long va_size_t;
  121 
  122 #else /* !__osf__ */
  123 
  124 typedef struct componentname xfs_componentname;
  125 
  126 #include <sys/types.h>
  127 #include <sys/param.h>
  128 #include <sys/time.h>
  129 #include <sys/proc.h>
  130 #include <sys/filedesc.h>
  131 #include <sys/kernel.h>
  132 #ifdef HAVE_SYS_MODULE_H
  133 #include <sys/module.h>
  134 #endif
  135 #include <sys/systm.h>
  136 #include <sys/fcntl.h>
  137 #ifdef HAVE_SYS_SYSPROTO_H
  138 #include <sys/sysproto.h>
  139 #endif
  140 #include <sys/conf.h>
  141 #include <sys/mount.h>
  142 #include <sys/exec.h>
  143 #ifdef HAVE_SYS_SYSENT_H
  144 #include <sys/sysent.h>
  145 #endif
  146 #ifdef HAVE_SYS_LKM_H
  147 #include <sys/lkm.h>
  148 #endif
  149 #ifdef HAVE_SYS_LOCK_H
  150 #include <sys/lock.h>
  151 #endif
  152 #ifdef HAVE_SYS_MUTEX_H
  153 #include <sys/mutex.h>
  154 #endif
  155 #include <sys/vnode.h>
  156 #include <sys/errno.h>
  157 #include <sys/file.h>
  158 #include <sys/namei.h>
  159 #include <sys/dirent.h>
  160 #include <sys/ucred.h>
  161 #include <sys/selinfo.h>
  162 #include <sys/uio.h>
  163 #ifdef HAVE_SYS_POLL_H
  164 #include <sys/poll.h>
  165 #endif
  166 #ifdef HAVE_SYS_SIGNALVAR_H
  167 #include <sys/signalvar.h>
  168 #endif
  169 #ifdef HAVE_SYS_INTTYPES_H
  170 #include <sys/inttypes.h>
  171 #endif
  172 #include <sys/syscall.h>
  173 #include <sys/queue.h>
  174 #include <sys/malloc.h>
  175 #ifdef HAVE_SYS_SYSCALLARGS_H
  176 #include <sys/syscallargs.h>
  177 #endif
  178 #ifdef HAVE_SYS_ATTR_H
  179 #include <sys/attr.h>
  180 #endif
  181 
  182 #ifdef HAVE_MISCFS_GENFS_GENFS_H
  183 #include <miscfs/genfs/genfs.h>
  184 #endif
  185 #ifdef HAVE_MISCFS_SYNCFS_SYNCFS_H
  186 #include <miscfs/syncfs/syncfs.h>
  187 #endif
  188 #ifndef HAVE_KERNEL_UVM_ONLY
  189 #ifdef HAVE_VM_VM_H
  190 #include <vm/vm.h>
  191 #endif
  192 #ifdef HAVE_VM_VM_EXTERN_H
  193 #include <vm/vm_extern.h>
  194 #endif
  195 #ifdef HAVE_VM_VM_ZONE_H
  196 #include <vm/vm_zone.h>
  197 #endif
  198 #ifdef HAVE_VM_VM_OBJECT_H
  199 #include <vm/vm_object.h>
  200 #endif
  201 #endif
  202 #ifdef HAVE_UVM_UVM_EXTERN_H
  203 #include <uvm/uvm_extern.h>
  204 #endif
  205 #ifdef HAVE_VM_UMA_H
  206 #include <vm/uma.h>
  207 #endif
  208 
  209 #if defined(__APPLE__)
  210 #include <machine/machine_routines.h>
  211 #include <mach/machine/vm_types.h>
  212 #include <sys/ubc.h>
  213 void cache_purge(struct vnode *);
  214 int cache_lookup(struct vnode *, struct vnode **, struct componentname *);
  215 void cache_enter(struct vnode *, struct vnode *, struct componentname *);
  216 void cache_purgevfs(struct mount *);
  217 #endif
  218 
  219 #define xfs_vop_read(t, uio, ioflag, cred, error) (error) = VOP_READ((t), (uio), (ioflag), (cred))
  220 #define xfs_vop_write(t, uio, ioflag, cred, error) (error) = VOP_WRITE((t), (uio), (ioflag), (cred))
  221 #define xfs_vop_getattr(t, attr, cred, proc, error) (error) = VOP_GETATTR((t), (attr), (cred), (proc))
  222 #define xfs_vop_access(dvp, mode, cred, proc, error) (error) = VOP_ACCESS((dvp), (mode), (cred), (proc))
  223 
  224 typedef u_quad_t va_size_t;
  225 
  226 #endif /* !__osf__ */
  227 
  228 #ifdef __FreeBSD_version
  229 #if __FreeBSD_version < 400000
  230 # error This version is unsupported
  231 #elif __FreeBSD_version < 440001 || (__FreeBSD_version >= 500000 && __FreeBSD_version < 500023)
  232 typedef struct proc d_thread_t;
  233 #elif __FreeBSD_version == 500023
  234 #   define HAVE_FREEBSD_THREAD
  235 typedef struct thread d_thread_t;
  236 #elif __FreeBSD_version >= 500024
  237 #   define HAVE_FREEBSD_THREAD
  238 #endif
  239 typedef d_thread_t syscall_d_thread_t;
  240 #define syscall_thread_to_thread(x) (x)
  241 #else /* !__FreeBSD_version */
  242 #if defined(__NetBSD__) && __NetBSD_Version__ >= 106130000
  243 typedef struct lwp syscall_d_thread_t;
  244 #define syscall_thread_to_thread(x) ((x)->l_proc)
  245 #else
  246 typedef struct proc syscall_d_thread_t;
  247 #define syscall_thread_to_thread(x) (x)
  248 #endif
  249 typedef struct proc d_thread_t;
  250 #endif /* !__FreeBSD_version */
  251 
  252 #ifdef VV_ROOT
  253 #define NNPFS_MAKE_VROOT(v) ((v)->v_vflag |= VV_ROOT) /* FreeBSD 5 */
  254 #else
  255 #define NNPFS_MAKE_VROOT(v) ((v)->v_flag |= VROOT)
  256 #endif
  257 
  258 #if defined(__NetBSD__) && __NetBSD_Version__ >= 105280000
  259 #include <miscfs/genfs/genfs.h>
  260 #include <miscfs/genfs/genfs_node.h>
  261 
  262 struct genfs_ops xfs_genfsops;
  263 #endif
  264 
  265 
  266 #if defined(HAVE_FREEBSD_THREAD)
  267 #define xfs_uio_to_thread(uiop) ((uiop)->uio_td)
  268 #define xfs_cnp_to_thread(cnp) ((cnp)->cn_thread)
  269 #define xfs_thread_to_cred(td) ((td)->td_proc->p_ucred)
  270 #define xfs_thread_to_euid(td) ((td)->td_proc->p_ucred->cr_uid)
  271 #else
  272 #define xfs_uio_to_proc(uiop) ((uiop)->uio_procp)
  273 #define xfs_cnp_to_proc(cnp) ((cnp)->cn_proc)
  274 #define xfs_proc_to_cred(p) ((p)->p_ucred)
  275 #define xfs_proc_to_euid(p) ((p)->p_ucred->cr_uid)
  276 #endif
  277 
  278 #if defined(__FreeBSD_version) && __FreeBSD_version >= 500043
  279 extern const char *VT_AFS;
  280 #endif
  281 
  282 #if defined(__FreeBSD__)
  283 typedef void * xfs_malloc_type;
  284 #elif defined(__NetBSD__) && __NetBSD_Version__ >= 106140000 /* 1.6N */
  285 typedef struct malloc_type * xfs_malloc_type;
  286 #else
  287 typedef int xfs_malloc_type;
  288 #endif
  289 
  290 #ifdef __APPLE__
  291 #define xfs_curproc() (current_proc())
  292 #else
  293 #if defined(HAVE_FREEBSD_THREAD)
  294 #define xfs_curthread() (curthread)
  295 #else
  296 #define xfs_curproc() (curproc)
  297 #endif
  298 #endif
  299 
  300 #ifdef __osf__
  301 #define xfs_pushdirty(vp, cred, p)
  302 #else
  303 void    xfs_pushdirty(struct vnode *, struct ucred *, d_thread_t *);
  304 #endif
  305 
  306 
  307 #if defined(HAVE_UINTPTR_T) /* c99 enviroment */
  308 #define xfs_uintptr_t           uintptr_t
  309 #else
  310 #if defined(_LP64) || defined(alpha) || defined(__alpha__) || defined(__sparc64__) || defined(__sparcv9__)
  311 #define xfs_uintptr_t           unsigned long long
  312 #else /* !LP64 */
  313 #define xfs_uintptr_t           unsigned long
  314 #endif /* LP64 */
  315 #endif
  316 
  317 /*
  318  * XXX
  319  */
  320 
  321 #ifndef SCARG
  322 #if defined(__FreeBSD_version) && __FreeBSD_version >  500042
  323 #define SCARG(a, b) ((a)->b)
  324 #define syscallarg(x)   x
  325 #else
  326 #define SCARG(a, b) ((a)->b.datum)
  327 #define syscallarg(x)   union { x datum; register_t pad; }
  328 #endif /* __FreeBSD_version */
  329 #endif /* SCARG */
  330 
  331 #ifndef syscallarg
  332 #define syscallarg(x)   x
  333 #endif
  334 
  335 #ifndef HAVE_REGISTER_T
  336 typedef int register_t;
  337 #endif
  338 
  339 /* malloc(9) waits by default, freebsd post 5.0 choose to remove the flag */
  340 #ifndef M_WAITOK
  341 #define M_WAITOK 0
  342 #endif
  343 
  344 #if defined(HAVE_DEF_STRUCT_SETGROUPS_ARGS)
  345 #define xfs_setgroups_args setgroups_args
  346 #elif defined(HAVE_DEF_STRUCT_SYS_SETGROUPS_ARGS)
  347 #define xfs_setgroups_args sys_setgroups_args
  348 #elif __osf__
  349 struct xfs_setgroups_args {
  350     syscallarg(int) gidsetsize;
  351     syscallarg(gid_t) *gidset;
  352 };
  353 #elif defined(__APPLE__)
  354 struct xfs_setgroups_args{
  355         syscallarg(u_int)   gidsetsize;
  356         syscallarg(gid_t)   *gidset;
  357 };
  358 #else
  359 #error what is you setgroups named ?
  360 #endif
  361 
  362 
  363 #ifdef HAVE_KERNEL_VFS_GETVFS
  364 #define xfs_vfs_getvfs vfs_getvfs
  365 #else
  366 #define xfs_vfs_getvfs getvfs
  367 #endif
  368 
  369 #ifdef HAVE_FOUR_ARGUMENT_VFS_OBJECT_CREATE
  370 #define xfs_vfs_object_create(vp,proc,ucred) vfs_object_create(vp,proc,ucred,TRUE)
  371 #else
  372 #define xfs_vfs_object_create(vp,proc,ucred) vfs_object_create(vp,proc,ucred)
  373 #endif
  374 
  375 #if  defined(UVM) || (defined(__NetBSD__) && __NetBSD_Version__ >= 105280000)
  376 #define xfs_set_vp_size(vp, sz) uvm_vnp_setsize(vp, sz)
  377 #elif HAVE_KERNEL_VNODE_PAGER_SETSIZE
  378 #define xfs_set_vp_size(vp, sz) vnode_pager_setsize(vp, sz)
  379 #elif defined(__APPLE__)
  380 #define xfs_set_vp_size(vp, sz) ubc_setsize(vp, sz)
  381 #else
  382 #define xfs_set_vp_size(vp, sz)
  383 #endif
  384 
  385 /* namei flag */
  386 #ifdef LOCKLEAF
  387 #define NNPFS_LOCKLEAF LOCKLEAF
  388 #else
  389 #define NNPFS_LOCKLEAF 0
  390 #endif
  391 
  392 #ifdef NEED_VGONEL_PROTO
  393 void    vgonel (struct vnode *vp, d_thread_t *p);
  394 #endif
  395 
  396 #ifdef NEED_ISSIGNAL_PROTO
  397 int     issignal (d_thread_t *);
  398 #endif
  399 
  400 #ifdef NEED_STRNCMP_PROTO
  401 int     strncmp (const char *, const char *, size_t);
  402 #endif
  403 
  404 #ifdef NEED_VN_WRITECHK_PROTO
  405 int     vn_writechk (struct vnode *);
  406 #endif
  407 
  408 #ifdef NEED_UBC_PUSHDIRTY_PROTO
  409 int     ubc_pushdirty (struct vnode *);
  410 #endif
  411 
  412 #include <xfs/xfs_syscalls.h>
  413 
  414 /* 
  415  *  The VOP table
  416  *
  417  *    What VOPs do we have today ? 
  418  */
  419 
  420 #define NNPFS_VOP_DEF(n)        \
  421         struct vop_##n##_args; \
  422         int xfs_##n(struct vop_##n##_args *);
  423 
  424 #include "xfs/xfs_vopdefs.h"

Cache object: bb6913187db9cb0098a8784cf05b46e2


[ 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.