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/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>
41 extern void zpl_vap_init(vattr_t
*vap
, struct inode
*dir
,
42 umode_t mode
, cred_t
*cr
);
44 extern const struct inode_operations zpl_inode_operations
;
45 extern const struct inode_operations zpl_dir_inode_operations
;
46 extern const struct inode_operations zpl_symlink_inode_operations
;
47 extern const struct inode_operations zpl_special_inode_operations
;
48 extern dentry_operations_t zpl_dentry_operations
;
51 extern ssize_t
zpl_read_common(struct inode
*ip
, const char *buf
,
52 size_t len
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
54 extern ssize_t
zpl_write_common(struct inode
*ip
, const char *buf
,
55 size_t len
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
58 extern const struct address_space_operations zpl_address_space_operations
;
59 extern const struct file_operations zpl_file_operations
;
60 extern const struct file_operations zpl_dir_file_operations
;
63 extern void zpl_prune_sb(int64_t nr_to_scan
, void *arg
);
65 extern const struct super_operations zpl_super_operations
;
66 extern const struct export_operations zpl_export_operations
;
67 extern struct file_system_type zpl_fs_type
;
70 extern ssize_t
zpl_xattr_list(struct dentry
*dentry
, char *buf
, size_t size
);
71 extern int zpl_xattr_security_init(struct inode
*ip
, struct inode
*dip
,
72 const struct qstr
*qstr
);
73 #if defined(CONFIG_FS_POSIX_ACL)
74 #if defined(HAVE_SET_ACL)
75 extern int zpl_set_acl(struct inode
*ip
, struct posix_acl
*acl
, int type
);
76 #endif /* HAVE_SET_ACL */
77 extern struct posix_acl
*zpl_get_acl(struct inode
*ip
, int type
);
78 extern int zpl_init_acl(struct inode
*ip
, struct inode
*dir
);
79 extern int zpl_chmod_acl(struct inode
*ip
);
82 zpl_init_acl(struct inode
*ip
, struct inode
*dir
)
88 zpl_chmod_acl(struct inode
*ip
)
92 #endif /* CONFIG_FS_POSIX_ACL */
94 extern xattr_handler_t
*zpl_xattr_handlers
[];
97 extern const struct file_operations zpl_fops_root
;
98 extern const struct inode_operations zpl_ops_root
;
100 extern const struct file_operations zpl_fops_snapdir
;
101 extern const struct inode_operations zpl_ops_snapdir
;
102 extern const struct dentry_operations zpl_dops_snapdirs
;
104 extern const struct file_operations zpl_fops_shares
;
105 extern const struct inode_operations zpl_ops_shares
;
107 #if defined(HAVE_VFS_ITERATE) || defined(HAVE_VFS_ITERATE_SHARED)
109 #define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
114 typedef struct dir_context zpl_dir_context_t
;
116 #define zpl_dir_emit dir_emit
117 #define zpl_dir_emit_dot dir_emit_dot
118 #define zpl_dir_emit_dotdot dir_emit_dotdot
119 #define zpl_dir_emit_dots dir_emit_dots
123 typedef struct zpl_dir_context
{
125 const filldir_t actor
;
129 #define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
136 zpl_dir_emit(zpl_dir_context_t
*ctx
, const char *name
, int namelen
,
137 uint64_t ino
, unsigned type
)
139 return (!ctx
->actor(ctx
->dirent
, name
, namelen
, ctx
->pos
, ino
, type
));
143 zpl_dir_emit_dot(struct file
*file
, zpl_dir_context_t
*ctx
)
145 return (ctx
->actor(ctx
->dirent
, ".", 1, ctx
->pos
,
146 file_inode(file
)->i_ino
, DT_DIR
) == 0);
150 zpl_dir_emit_dotdot(struct file
*file
, zpl_dir_context_t
*ctx
)
152 return (ctx
->actor(ctx
->dirent
, "..", 2, ctx
->pos
,
153 parent_ino(file_dentry(file
)), DT_DIR
) == 0);
157 zpl_dir_emit_dots(struct file
*file
, zpl_dir_context_t
*ctx
)
160 if (!zpl_dir_emit_dot(file
, ctx
))
165 if (!zpl_dir_emit_dotdot(file
, ctx
))
171 #endif /* HAVE_VFS_ITERATE */
174 * Linux 4.18, inode times converted from timespec to timespec64.
176 #if defined(HAVE_INODE_TIMESPEC64_TIMES)
177 #define zpl_inode_timespec_trunc(ts, gran) timespec64_trunc(ts, gran)
179 #define zpl_inode_timespec_trunc(ts, gran) timespec_trunc(ts, gran)
182 #endif /* _SYS_ZPL_H */