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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
22 * Copyright (c) 2011, Lawrence Livermore National Security, LLC.
28 #include <sys/mntent.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/file_compat.h>
35 #include <linux/parser.h>
36 #include <linux/task_io_accounting_ops.h>
37 #include <linux/vfs_compat.h>
38 #include <linux/writeback.h>
39 #include <linux/xattr_compat.h>
42 extern void zpl_vap_init(vattr_t
*vap
, struct inode
*dir
,
43 zpl_umode_t mode
, cred_t
*cr
);
45 extern const struct inode_operations zpl_inode_operations
;
46 extern const struct inode_operations zpl_dir_inode_operations
;
47 extern const struct inode_operations zpl_symlink_inode_operations
;
48 extern const struct inode_operations zpl_special_inode_operations
;
49 extern dentry_operations_t zpl_dentry_operations
;
52 extern ssize_t
zpl_read_common(struct inode
*ip
, const char *buf
,
53 size_t len
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
55 extern ssize_t
zpl_write_common(struct inode
*ip
, const char *buf
,
56 size_t len
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
58 #if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE)
59 extern long zpl_fallocate_common(struct inode
*ip
, int mode
,
60 loff_t offset
, loff_t len
);
61 #endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */
63 extern const struct address_space_operations zpl_address_space_operations
;
64 extern const struct file_operations zpl_file_operations
;
65 extern const struct file_operations zpl_dir_file_operations
;
68 extern void zpl_prune_sb(int64_t nr_to_scan
, void *arg
);
70 extern const struct super_operations zpl_super_operations
;
71 extern const struct export_operations zpl_export_operations
;
72 extern struct file_system_type zpl_fs_type
;
75 extern ssize_t
zpl_xattr_list(struct dentry
*dentry
, char *buf
, size_t size
);
76 extern int zpl_xattr_security_init(struct inode
*ip
, struct inode
*dip
,
77 const struct qstr
*qstr
);
78 #if defined(CONFIG_FS_POSIX_ACL)
79 extern int zpl_set_acl(struct inode
*ip
, int type
, struct posix_acl
*acl
);
80 extern struct posix_acl
*zpl_get_acl(struct inode
*ip
, int type
);
81 #if !defined(HAVE_GET_ACL)
82 #if defined(HAVE_CHECK_ACL_WITH_FLAGS)
83 extern int zpl_check_acl(struct inode
*inode
, int mask
, unsigned int flags
);
84 #elif defined(HAVE_CHECK_ACL)
85 extern int zpl_check_acl(struct inode
*inode
, int mask
);
86 #elif defined(HAVE_PERMISSION_WITH_NAMEIDATA)
87 extern int zpl_permission(struct inode
*ip
, int mask
, struct nameidata
*nd
);
88 #elif defined(HAVE_PERMISSION)
89 extern int zpl_permission(struct inode
*ip
, int mask
);
90 #endif /* HAVE_CHECK_ACL | HAVE_PERMISSION */
91 #endif /* HAVE_GET_ACL */
93 extern int zpl_init_acl(struct inode
*ip
, struct inode
*dir
);
94 extern int zpl_chmod_acl(struct inode
*ip
);
97 zpl_init_acl(struct inode
*ip
, struct inode
*dir
)
103 zpl_chmod_acl(struct inode
*ip
)
107 #endif /* CONFIG_FS_POSIX_ACL */
109 extern xattr_handler_t
*zpl_xattr_handlers
[];
112 extern const struct file_operations zpl_fops_root
;
113 extern const struct inode_operations zpl_ops_root
;
115 extern const struct file_operations zpl_fops_snapdir
;
116 extern const struct inode_operations zpl_ops_snapdir
;
117 #ifdef HAVE_AUTOMOUNT
118 extern const struct dentry_operations zpl_dops_snapdirs
;
120 extern const struct inode_operations zpl_ops_snapdirs
;
121 #endif /* HAVE_AUTOMOUNT */
123 extern const struct file_operations zpl_fops_shares
;
124 extern const struct inode_operations zpl_ops_shares
;
126 #if defined(HAVE_VFS_ITERATE) || defined(HAVE_VFS_ITERATE_SHARED)
128 #define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
135 typedef struct dir_context
{
137 const filldir_t actor
;
141 #define DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
148 dir_emit(struct dir_context
*ctx
, const char *name
, int namelen
,
149 uint64_t ino
, unsigned type
)
151 return (ctx
->actor(ctx
->dirent
, name
, namelen
, ctx
->pos
, ino
, type
)
156 dir_emit_dot(struct file
*file
, struct dir_context
*ctx
)
158 return (ctx
->actor(ctx
->dirent
, ".", 1, ctx
->pos
,
159 file
->f_path
.dentry
->d_inode
->i_ino
, DT_DIR
) == 0);
163 dir_emit_dotdot(struct file
*file
, struct dir_context
*ctx
)
165 return (ctx
->actor(ctx
->dirent
, "..", 2, ctx
->pos
,
166 parent_ino(file
->f_path
.dentry
), DT_DIR
) == 0);
170 dir_emit_dots(struct file
*file
, struct dir_context
*ctx
)
173 if (!dir_emit_dot(file
, ctx
))
178 if (!dir_emit_dotdot(file
, ctx
))
184 #endif /* HAVE_VFS_ITERATE */
186 #endif /* _SYS_ZPL_H */