]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - zfs/include/sys/zfs_ctldir.h
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) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (C) 2011 Lawrence Livermore National Security, LLC.
24 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
26 * Rewritten for Linux by:
27 * Rohan Puri <rohan.puri15@gmail.com>
28 * Brian Behlendorf <behlendorf1@llnl.gov>
34 #include <sys/vnode.h>
35 #include <sys/pathname.h>
36 #include <sys/zfs_vfsops.h>
37 #include <sys/zfs_znode.h>
39 #define ZFS_CTLDIR_NAME ".zfs"
40 #define ZFS_SNAPDIR_NAME "snapshot"
41 #define ZFS_SHAREDIR_NAME "shares"
43 #define zfs_has_ctldir(zdp) \
44 ((zdp)->z_id == ZTOZSB(zdp)->z_root && \
45 (ZTOZSB(zdp)->z_ctldir != NULL))
46 #define zfs_show_ctldir(zdp) \
47 (zfs_has_ctldir(zdp) && \
48 (ZTOZSB(zdp)->z_show_ctldir))
50 extern int zfs_expire_snapshot
;
52 /* zfsctl generic functions */
53 extern int zfsctl_create(zfsvfs_t
*);
54 extern void zfsctl_destroy(zfsvfs_t
*);
55 extern struct inode
*zfsctl_root(znode_t
*);
56 extern void zfsctl_init(void);
57 extern void zfsctl_fini(void);
58 extern boolean_t
zfsctl_is_node(struct inode
*ip
);
59 extern boolean_t
zfsctl_is_snapdir(struct inode
*ip
);
60 extern int zfsctl_fid(struct inode
*ip
, fid_t
*fidp
);
62 /* zfsctl '.zfs' functions */
63 extern int zfsctl_root_lookup(struct inode
*dip
, char *name
,
64 struct inode
**ipp
, int flags
, cred_t
*cr
, int *direntflags
,
67 /* zfsctl '.zfs/snapshot' functions */
68 extern int zfsctl_snapdir_lookup(struct inode
*dip
, char *name
,
69 struct inode
**ipp
, int flags
, cred_t
*cr
, int *direntflags
,
71 extern int zfsctl_snapdir_rename(struct inode
*sdip
, char *sname
,
72 struct inode
*tdip
, char *tname
, cred_t
*cr
, int flags
);
73 extern int zfsctl_snapdir_remove(struct inode
*dip
, char *name
, cred_t
*cr
,
75 extern int zfsctl_snapdir_mkdir(struct inode
*dip
, char *dirname
, vattr_t
*vap
,
76 struct inode
**ipp
, cred_t
*cr
, int flags
);
77 extern int zfsctl_snapshot_mount(struct path
*path
, int flags
);
78 extern int zfsctl_snapshot_unmount(char *snapname
, int flags
);
79 extern int zfsctl_snapshot_unmount_delay(spa_t
*spa
, uint64_t objsetid
,
81 extern int zfsctl_snapdir_vget(struct super_block
*sb
, uint64_t objsetid
,
82 int gen
, struct inode
**ipp
);
84 /* zfsctl '.zfs/shares' functions */
85 extern int zfsctl_shares_lookup(struct inode
*dip
, char *name
,
86 struct inode
**ipp
, int flags
, cred_t
*cr
, int *direntflags
,
90 * These inodes numbers are reserved for the .zfs control directory.
91 * It is important that they be no larger that 48-bits because only
92 * 6 bytes are reserved in the NFS file handle for the object number.
93 * However, they should be as large as possible to avoid conflicts
94 * with the objects which are assigned monotonically by the dmu.
96 #define ZFSCTL_INO_ROOT 0x0000FFFFFFFFFFFFULL
97 #define ZFSCTL_INO_SHARES 0x0000FFFFFFFFFFFEULL
98 #define ZFSCTL_INO_SNAPDIR 0x0000FFFFFFFFFFFDULL
99 #define ZFSCTL_INO_SNAPDIRS 0x0000FFFFFFFFFFFCULL
101 #define ZFSCTL_EXPIRE_SNAPSHOT 300
103 #endif /* _ZFS_CTLDIR_H */