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/contrib/openzfs/include/os/linux/zfs/sys/zpl.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 /*
    2  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License (the "License").
    6  * You may not use this file except in compliance with the License.
    7  *
    8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    9  * or https://opensource.org/licenses/CDDL-1.0.
   10  * See the License for the specific language governing permissions
   11  * and limitations under the License.
   12  *
   13  * When distributing Covered Code, include this CDDL HEADER in each
   14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   15  * If applicable, add the following below this CDDL HEADER, with the
   16  * fields enclosed by brackets "[]" replaced with your own identifying
   17  * information: Portions Copyright [yyyy] [name of copyright owner]
   18  *
   19  * CDDL HEADER END
   20  */
   21 /*
   22  * Copyright (c) 2011, Lawrence Livermore National Security, LLC.
   23  */
   24 
   25 #ifndef _SYS_ZPL_H
   26 #define _SYS_ZPL_H
   27 
   28 #include <sys/mntent.h>
   29 #include <sys/vfs.h>
   30 #include <linux/aio.h>
   31 #include <linux/dcache_compat.h>
   32 #include <linux/exportfs.h>
   33 #include <linux/falloc.h>
   34 #include <linux/parser.h>
   35 #include <linux/task_io_accounting_ops.h>
   36 #include <linux/vfs_compat.h>
   37 #include <linux/writeback.h>
   38 #include <linux/xattr_compat.h>
   39 
   40 /* zpl_inode.c */
   41 extern void zpl_vap_init(vattr_t *vap, struct inode *dir,
   42     umode_t mode, cred_t *cr, zuserns_t *mnt_ns);
   43 
   44 extern const struct inode_operations zpl_inode_operations;
   45 #ifdef HAVE_RENAME2_OPERATIONS_WRAPPER
   46 extern const struct inode_operations_wrapper zpl_dir_inode_operations;
   47 #else
   48 extern const struct inode_operations zpl_dir_inode_operations;
   49 #endif
   50 extern const struct inode_operations zpl_symlink_inode_operations;
   51 extern const struct inode_operations zpl_special_inode_operations;
   52 
   53 /* zpl_file.c */
   54 extern const struct address_space_operations zpl_address_space_operations;
   55 extern const struct file_operations zpl_file_operations;
   56 extern const struct file_operations zpl_dir_file_operations;
   57 
   58 /* zpl_super.c */
   59 extern void zpl_prune_sb(int64_t nr_to_scan, void *arg);
   60 
   61 extern const struct super_operations zpl_super_operations;
   62 extern const struct export_operations zpl_export_operations;
   63 extern struct file_system_type zpl_fs_type;
   64 
   65 /* zpl_xattr.c */
   66 extern ssize_t zpl_xattr_list(struct dentry *dentry, char *buf, size_t size);
   67 extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
   68     const struct qstr *qstr);
   69 #if defined(CONFIG_FS_POSIX_ACL)
   70 #if defined(HAVE_SET_ACL)
   71 #if defined(HAVE_SET_ACL_USERNS)
   72 extern int zpl_set_acl(struct user_namespace *userns, struct inode *ip,
   73     struct posix_acl *acl, int type);
   74 #elif defined(HAVE_SET_ACL_USERNS_DENTRY_ARG2)
   75 extern int zpl_set_acl(struct user_namespace *userns, struct dentry *dentry,
   76     struct posix_acl *acl, int type);
   77 #else
   78 extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
   79 #endif /* HAVE_SET_ACL_USERNS */
   80 #endif /* HAVE_SET_ACL */
   81 #if defined(HAVE_GET_ACL_RCU) || defined(HAVE_GET_INODE_ACL)
   82 extern struct posix_acl *zpl_get_acl(struct inode *ip, int type, bool rcu);
   83 #elif defined(HAVE_GET_ACL)
   84 extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
   85 #endif
   86 extern int zpl_init_acl(struct inode *ip, struct inode *dir);
   87 extern int zpl_chmod_acl(struct inode *ip);
   88 #else
   89 static inline int
   90 zpl_init_acl(struct inode *ip, struct inode *dir)
   91 {
   92         return (0);
   93 }
   94 
   95 static inline int
   96 zpl_chmod_acl(struct inode *ip)
   97 {
   98         return (0);
   99 }
  100 #endif /* CONFIG_FS_POSIX_ACL */
  101 
  102 extern xattr_handler_t *zpl_xattr_handlers[];
  103 
  104 /* zpl_ctldir.c */
  105 extern const struct file_operations zpl_fops_root;
  106 extern const struct inode_operations zpl_ops_root;
  107 
  108 extern const struct file_operations zpl_fops_snapdir;
  109 extern const struct inode_operations zpl_ops_snapdir;
  110 
  111 extern const struct file_operations zpl_fops_shares;
  112 extern const struct inode_operations zpl_ops_shares;
  113 
  114 #if defined(HAVE_VFS_ITERATE) || defined(HAVE_VFS_ITERATE_SHARED)
  115 
  116 #define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) {   \
  117         .actor = _actor,                                \
  118         .pos = _pos,                                    \
  119 }
  120 
  121 typedef struct dir_context zpl_dir_context_t;
  122 
  123 #define zpl_dir_emit            dir_emit
  124 #define zpl_dir_emit_dot        dir_emit_dot
  125 #define zpl_dir_emit_dotdot     dir_emit_dotdot
  126 #define zpl_dir_emit_dots       dir_emit_dots
  127 
  128 #else
  129 
  130 typedef struct zpl_dir_context {
  131         void *dirent;
  132         const filldir_t actor;
  133         loff_t pos;
  134 } zpl_dir_context_t;
  135 
  136 #define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) {   \
  137         .dirent = _dirent,                              \
  138         .actor = _actor,                                \
  139         .pos = _pos,                                    \
  140 }
  141 
  142 static inline bool
  143 zpl_dir_emit(zpl_dir_context_t *ctx, const char *name, int namelen,
  144     uint64_t ino, unsigned type)
  145 {
  146         return (!ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type));
  147 }
  148 
  149 static inline bool
  150 zpl_dir_emit_dot(struct file *file, zpl_dir_context_t *ctx)
  151 {
  152         return (ctx->actor(ctx->dirent, ".", 1, ctx->pos,
  153             file_inode(file)->i_ino, DT_DIR) == 0);
  154 }
  155 
  156 static inline bool
  157 zpl_dir_emit_dotdot(struct file *file, zpl_dir_context_t *ctx)
  158 {
  159         return (ctx->actor(ctx->dirent, "..", 2, ctx->pos,
  160             parent_ino(file_dentry(file)), DT_DIR) == 0);
  161 }
  162 
  163 static inline bool
  164 zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
  165 {
  166         if (ctx->pos == 0) {
  167                 if (!zpl_dir_emit_dot(file, ctx))
  168                         return (false);
  169                 ctx->pos = 1;
  170         }
  171         if (ctx->pos == 1) {
  172                 if (!zpl_dir_emit_dotdot(file, ctx))
  173                         return (false);
  174                 ctx->pos = 2;
  175         }
  176         return (true);
  177 }
  178 #endif /* HAVE_VFS_ITERATE */
  179 
  180 #if defined(HAVE_INODE_TIMESTAMP_TRUNCATE)
  181 #define zpl_inode_timestamp_truncate(ts, ip)    timestamp_truncate(ts, ip)
  182 #elif defined(HAVE_INODE_TIMESPEC64_TIMES)
  183 #define zpl_inode_timestamp_truncate(ts, ip)    \
  184         timespec64_trunc(ts, (ip)->i_sb->s_time_gran)
  185 #else
  186 #define zpl_inode_timestamp_truncate(ts, ip)    \
  187         timespec_trunc(ts, (ip)->i_sb->s_time_gran)
  188 #endif
  189 
  190 #if defined(HAVE_INODE_OWNER_OR_CAPABLE)
  191 #define zpl_inode_owner_or_capable(ns, ip)      inode_owner_or_capable(ip)
  192 #elif defined(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED)
  193 #define zpl_inode_owner_or_capable(ns, ip)      inode_owner_or_capable(ns, ip)
  194 #else
  195 #error "Unsupported kernel"
  196 #endif
  197 
  198 #ifdef HAVE_SETATTR_PREPARE_USERNS
  199 #define zpl_setattr_prepare(ns, dentry, ia)     setattr_prepare(ns, dentry, ia)
  200 #else
  201 /*
  202  * Use kernel-provided version, or our own from
  203  * linux/vfs_compat.h
  204  */
  205 #define zpl_setattr_prepare(ns, dentry, ia)     setattr_prepare(dentry, ia)
  206 #endif
  207 
  208 #endif  /* _SYS_ZPL_H */

Cache object: c8877eadcfcf37fc526bc633bb1c4938


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