3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SYS_FS_CACHEFS_DLOG_H
28 #define _SYS_FS_CACHEFS_DLOG_H
29
30 #pragma ident "%Z%%M% %I% %E% SMI"
31
32 #include <sys/vfs.h>
33 #include <sys/acl.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40 * Version number of log file format.
41 * Put in an int at the start of the file.
42 * Large Files: Increment VER by 1.
43 */
44 #define CFS_DLOG_VERSION 1001
45
46 /* valid types of dlog records */
47 enum cfs_dlog_op {
48 CFS_DLOG_CREATE = 0x100,
49 CFS_DLOG_REMOVE,
50 CFS_DLOG_LINK,
51 CFS_DLOG_RENAME,
262
263 /*
264 * XXXX the maxsize calculation below will give wrong answer if
265 * the total size of struct cfs_dlog_setsecattr + max aclsize is less than
266 * the size of the union above. This is currently true, but to be on the safe
267 * side, use struct size plus acl size (minus trailer because it's not
268 * not counted in the length field).
269 */
270 #define CFS_DLOG_SECATTR_MAXSIZE (sizeof (struct cfs_dlog_setsecattr) + \
271 (sizeof (aclent_t) * MAX_ACL_ENTRIES))
272
273 #ifndef MAX
274 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
275 #endif /* MAX */
276
277 #define CFS_DLOG_ENTRY_MAXSIZE \
278 MAX(offsetof(struct cfs_dlog_entry, dl_trailer), \
279 offsetof(struct cfs_dlog_entry, dl_u.dl_setsecattr) + \
280 CFS_DLOG_SECATTR_MAXSIZE)
281
282 #if defined(_KERNEL) && defined(__STDC__)
283 int cachefs_dlog_setup(fscache_t *fscp, int createfile);
284 void cachefs_dlog_teardown(fscache_t *fscp);
285 int cachefs_dlog_commit(fscache_t *fscp, off_t offset, int error);
286 int cachefs_dlog_cidmap(fscache_t *fscp);
287 off_t cachefs_dlog_setattr(fscache_t *fscp, struct vattr *vap, int flags,
288 cnode_t *cp, cred_t *cr);
289 off_t
290 cachefs_dlog_setsecattr(fscache_t *fscp, vsecattr_t *vsec, int flags,
291 cnode_t *cp, cred_t *cr);
292 off_t cachefs_dlog_create(fscache_t *fscp, cnode_t *pcp, char *nm,
293 vattr_t *vap, int excl, int mode, cnode_t *cp, int exists, cred_t *cr);
294 off_t cachefs_dlog_remove(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
295 cred_t *cr);
296 off_t cachefs_dlog_link(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
297 cred_t *cr);
298 off_t cachefs_dlog_rename(fscache_t *fscp, cnode_t *odcp, char *onm,
299 cnode_t *ndcp, char *nnm, cred_t *cr, cnode_t *cp, cnode_t *delcp);
300 off_t cachefs_dlog_mkdir(fscache_t *fscp, cnode_t *pcp, cnode_t *cp, char *nm,
301 vattr_t *vap, cred_t *cr);
302 off_t cachefs_dlog_rmdir(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 *
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
27 */
28
29 #ifndef _SYS_FS_CACHEFS_DLOG_H
30 #define _SYS_FS_CACHEFS_DLOG_H
31
32 #include <sys/vfs.h>
33 #include <sys/acl.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40 * Version number of log file format.
41 * Put in an int at the start of the file.
42 * Large Files: Increment VER by 1.
43 */
44 #define CFS_DLOG_VERSION 1001
45
46 /* valid types of dlog records */
47 enum cfs_dlog_op {
48 CFS_DLOG_CREATE = 0x100,
49 CFS_DLOG_REMOVE,
50 CFS_DLOG_LINK,
51 CFS_DLOG_RENAME,
262
263 /*
264 * XXXX the maxsize calculation below will give wrong answer if
265 * the total size of struct cfs_dlog_setsecattr + max aclsize is less than
266 * the size of the union above. This is currently true, but to be on the safe
267 * side, use struct size plus acl size (minus trailer because it's not
268 * not counted in the length field).
269 */
270 #define CFS_DLOG_SECATTR_MAXSIZE (sizeof (struct cfs_dlog_setsecattr) + \
271 (sizeof (aclent_t) * MAX_ACL_ENTRIES))
272
273 #ifndef MAX
274 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
275 #endif /* MAX */
276
277 #define CFS_DLOG_ENTRY_MAXSIZE \
278 MAX(offsetof(struct cfs_dlog_entry, dl_trailer), \
279 offsetof(struct cfs_dlog_entry, dl_u.dl_setsecattr) + \
280 CFS_DLOG_SECATTR_MAXSIZE)
281
282 #if defined(_KERNEL)
283 int cachefs_dlog_setup(fscache_t *fscp, int createfile);
284 void cachefs_dlog_teardown(fscache_t *fscp);
285 int cachefs_dlog_commit(fscache_t *fscp, off_t offset, int error);
286 int cachefs_dlog_cidmap(fscache_t *fscp);
287 off_t cachefs_dlog_setattr(fscache_t *fscp, struct vattr *vap, int flags,
288 cnode_t *cp, cred_t *cr);
289 off_t
290 cachefs_dlog_setsecattr(fscache_t *fscp, vsecattr_t *vsec, int flags,
291 cnode_t *cp, cred_t *cr);
292 off_t cachefs_dlog_create(fscache_t *fscp, cnode_t *pcp, char *nm,
293 vattr_t *vap, int excl, int mode, cnode_t *cp, int exists, cred_t *cr);
294 off_t cachefs_dlog_remove(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
295 cred_t *cr);
296 off_t cachefs_dlog_link(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
297 cred_t *cr);
298 off_t cachefs_dlog_rename(fscache_t *fscp, cnode_t *odcp, char *onm,
299 cnode_t *ndcp, char *nnm, cred_t *cr, cnode_t *cp, cnode_t *delcp);
300 off_t cachefs_dlog_mkdir(fscache_t *fscp, cnode_t *pcp, cnode_t *cp, char *nm,
301 vattr_t *vap, cred_t *cr);
302 off_t cachefs_dlog_rmdir(fscache_t *fscp, cnode_t *pcp, char *nm, cnode_t *cp,
|