]>
Commit | Line | Data |
---|---|---|
ebe7e575 BB |
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 http://www.opensolaris.org/os/licensing. | |
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) 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). | |
25 | * LLNL-CODE-403049. | |
26 | * Rewritten for Linux by: | |
27 | * Rohan Puri <rohan.puri15@gmail.com> | |
28 | * Brian Behlendorf <behlendorf1@llnl.gov> | |
29 | */ | |
30 | ||
31 | #ifndef _ZFS_CTLDIR_H | |
32 | #define _ZFS_CTLDIR_H | |
33 | ||
34 | #include <sys/vnode.h> | |
278bee93 | 35 | #include <sys/pathname.h> |
ebe7e575 BB |
36 | #include <sys/zfs_vfsops.h> |
37 | #include <sys/zfs_znode.h> | |
38 | ||
39 | #define ZFS_CTLDIR_NAME ".zfs" | |
40 | #define ZFS_SNAPDIR_NAME "snapshot" | |
41 | #define ZFS_SHAREDIR_NAME "shares" | |
42 | ||
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)) | |
49 | ||
278bee93 | 50 | extern int zfs_expire_snapshot; |
ebe7e575 BB |
51 | |
52 | /* zfsctl generic functions */ | |
0037b49e BB |
53 | extern int zfsctl_create(zfsvfs_t *); |
54 | extern void zfsctl_destroy(zfsvfs_t *); | |
55 | extern struct inode *zfsctl_root(znode_t *); | |
278bee93 BB |
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); | |
ebe7e575 BB |
60 | extern int zfsctl_fid(struct inode *ip, fid_t *fidp); |
61 | ||
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, | |
65 | pathname_t *realpnp); | |
66 | ||
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, | |
70 | pathname_t *realpnp); | |
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, | |
74 | int flags); | |
75 | extern int zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap, | |
76 | struct inode **ipp, cred_t *cr, int flags); | |
278bee93 BB |
77 | extern int zfsctl_snapshot_mount(struct path *path, int flags); |
78 | extern int zfsctl_snapshot_unmount(char *snapname, int flags); | |
24ef51f6 CC |
79 | extern int zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid, |
80 | int delay); | |
9b77d1c9 CC |
81 | extern int zfsctl_snapdir_vget(struct super_block *sb, uint64_t objsetid, |
82 | int gen, struct inode **ipp); | |
ebe7e575 BB |
83 | |
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, | |
87 | pathname_t *realpnp); | |
88 | ||
ebe7e575 BB |
89 | /* |
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. | |
95 | */ | |
a3873583 RY |
96 | #define ZFSCTL_INO_ROOT 0x0000FFFFFFFFFFFFULL |
97 | #define ZFSCTL_INO_SHARES 0x0000FFFFFFFFFFFEULL | |
98 | #define ZFSCTL_INO_SNAPDIR 0x0000FFFFFFFFFFFDULL | |
99 | #define ZFSCTL_INO_SNAPDIRS 0x0000FFFFFFFFFFFCULL | |
ebe7e575 BB |
100 | |
101 | #define ZFSCTL_EXPIRE_SNAPSHOT 300 | |
102 | ||
103 | #endif /* _ZFS_CTLDIR_H */ |