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 2011 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  25  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26  * Copyright 2017 RackTop Systems.
  27  */
  28 
  29 #ifndef _SYS_ZFS_CONTEXT_H
  30 #define _SYS_ZFS_CONTEXT_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #define _SYNCH_H
  37 
  38 #define _SYS_VNODE_H
  39 #define _SYS_VFS_H
  40 #define _SYS_CALLB_H
  41 
  42 #include <stdio.h>
  43 #include <stdlib.h>
  44 #include <stddef.h>
  45 #include <stdarg.h>
 
 228         size_t          vsa_aclentsz;   /* ACE size in bytes of vsa_aclentp */
 229 } vsecattr_t;
 230 
 231 #define AT_TYPE         0x00001
 232 #define AT_MODE         0x00002
 233 #define AT_UID          0x00004
 234 #define AT_GID          0x00008
 235 #define AT_FSID         0x00010
 236 #define AT_NODEID       0x00020
 237 #define AT_NLINK        0x00040
 238 #define AT_SIZE         0x00080
 239 #define AT_ATIME        0x00100
 240 #define AT_MTIME        0x00200
 241 #define AT_CTIME        0x00400
 242 #define AT_RDEV         0x00800
 243 #define AT_BLKSIZE      0x01000
 244 #define AT_NBLOCKS      0x02000
 245 #define AT_SEQ          0x08000
 246 #define AT_XVATTR       0x10000
 247 
 248 #define CRCREAT         0
 249 
 250 extern int fop_getattr(vnode_t *vp, vattr_t *vap);
 251 
 252 #define VOP_CLOSE(vp, f, c, o, cr, ct)  0
 253 #define VOP_PUTPAGE(vp, of, sz, fl, cr, ct)     0
 254 #define VOP_GETATTR(vp, vap, fl, cr, ct)  fop_getattr((vp), (vap));
 255 
 256 #define VOP_FSYNC(vp, f, cr, ct)        fsync((vp)->v_fd)
 257 
 258 #define VN_RELE(vp)     vn_close(vp)
 259 
 260 extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
 261     int x2, int x3);
 262 extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
 263     int x2, int x3, vnode_t *vp, int fd);
 264 extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
 265     offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp);
 266 extern void vn_close(vnode_t *vp);
 267 
 268 #define vn_remove(path, x1, x2)         remove(path)
 269 #define vn_rename(from, to, seg)        rename((from), (to))
 270 #define vn_is_readonly(vp)              B_FALSE
 271 
 272 extern vnode_t *rootdir;
 273 
 274 #include <sys/file.h>             /* for FREAD, FWRITE, etc */
 275 #include <sys/sunddi.h>           /* for ddi_strtoul, ddi_strtoull, etc */
 276 #include <sys/cyclic.h>           /* for cyclic_add, cyclic remove, etc */
 
 
 300 
 301 #define CALLB_CPR_INIT(cp, lockp, func, name)   {               \
 302         (cp)->cc_lockp = lockp;                                      \
 303 }
 304 
 305 #define CALLB_CPR_SAFE_BEGIN(cp) {                              \
 306         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 307 }
 308 
 309 #define CALLB_CPR_SAFE_END(cp, lockp) {                         \
 310         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 311 }
 312 
 313 #define CALLB_CPR_EXIT(cp) {                                    \
 314         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 315         mutex_exit((cp)->cc_lockp);                          \
 316 }
 317 
 318 #define zone_dataset_visible(x, y)      (1)
 319 #define INGLOBALZONE(z)                 (1)
 320 extern uint32_t zone_get_hostid(void *zonep);
 321 
 322 extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
 323 extern int zfs_secpolicy_rename_perms(const char *from, const char *to,
 324     cred_t *cr);
 325 extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
 326 
 327 #define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) \
 328         sysevent_post_event(_c, _d, _b, "libzpool", _e, _f)
 329 
 330 #ifdef  __cplusplus
 331 }
 332 #endif
 333 
 334 #endif  /* _SYS_ZFS_CONTEXT_H */
 | 
 
 
   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) 2012, 2016 by Delphix. All rights reserved.
  24  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  25  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright 2017 RackTop Systems.
  27  */
  28 
  29 #ifndef _SYS_ZFS_CONTEXT_H
  30 #define _SYS_ZFS_CONTEXT_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #define _SYNCH_H
  37 
  38 #define _SYS_VNODE_H
  39 #define _SYS_VFS_H
  40 #define _SYS_CALLB_H
  41 
  42 #include <stdio.h>
  43 #include <stdlib.h>
  44 #include <stddef.h>
  45 #include <stdarg.h>
 
 228         size_t          vsa_aclentsz;   /* ACE size in bytes of vsa_aclentp */
 229 } vsecattr_t;
 230 
 231 #define AT_TYPE         0x00001
 232 #define AT_MODE         0x00002
 233 #define AT_UID          0x00004
 234 #define AT_GID          0x00008
 235 #define AT_FSID         0x00010
 236 #define AT_NODEID       0x00020
 237 #define AT_NLINK        0x00040
 238 #define AT_SIZE         0x00080
 239 #define AT_ATIME        0x00100
 240 #define AT_MTIME        0x00200
 241 #define AT_CTIME        0x00400
 242 #define AT_RDEV         0x00800
 243 #define AT_BLKSIZE      0x01000
 244 #define AT_NBLOCKS      0x02000
 245 #define AT_SEQ          0x08000
 246 #define AT_XVATTR       0x10000
 247 
 248 typedef struct caller_context {
 249         pid_t           cc_pid;         /* Process ID of the caller */
 250         int             cc_sysid;       /* System ID, used for remote calls */
 251         u_longlong_t    cc_caller_id;   /* Identifier for (set of) caller(s) */
 252         ulong_t         cc_flags;
 253 } caller_context_t;
 254 
 255 #define CRCREAT         0
 256 
 257 extern int fop_getattr(vnode_t *vp, vattr_t *vap);
 258 
 259 #define VOP_CLOSE(vp, f, c, o, cr, ct)  0
 260 #define VOP_PUTPAGE(vp, of, sz, fl, cr, ct)     0
 261 #define VOP_GETATTR(vp, vap, fl, cr, ct)  fop_getattr((vp), (vap));
 262 
 263 #define VOP_FSYNC(vp, f, cr, ct)        fsync((vp)->v_fd)
 264 #define VOP_SPACE(vp, cmd, flck, fl, off, cr, ct) \
 265         fcntl((vp)->v_fd, cmd, (flck), sizeof (*(flck)))
 266 
 267 #define VN_RELE(vp)     vn_close(vp)
 268 
 269 extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
 270     int x2, int x3);
 271 extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
 272     int x2, int x3, vnode_t *vp, int fd);
 273 extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
 274     offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp);
 275 extern void vn_close(vnode_t *vp);
 276 
 277 #define vn_remove(path, x1, x2)         remove(path)
 278 #define vn_rename(from, to, seg)        rename((from), (to))
 279 #define vn_is_readonly(vp)              B_FALSE
 280 
 281 extern vnode_t *rootdir;
 282 
 283 #include <sys/file.h>             /* for FREAD, FWRITE, etc */
 284 #include <sys/sunddi.h>           /* for ddi_strtoul, ddi_strtoull, etc */
 285 #include <sys/cyclic.h>           /* for cyclic_add, cyclic remove, etc */
 
 309 
 310 #define CALLB_CPR_INIT(cp, lockp, func, name)   {               \
 311         (cp)->cc_lockp = lockp;                                      \
 312 }
 313 
 314 #define CALLB_CPR_SAFE_BEGIN(cp) {                              \
 315         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 316 }
 317 
 318 #define CALLB_CPR_SAFE_END(cp, lockp) {                         \
 319         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 320 }
 321 
 322 #define CALLB_CPR_EXIT(cp) {                                    \
 323         ASSERT(MUTEX_HELD((cp)->cc_lockp));                  \
 324         mutex_exit((cp)->cc_lockp);                          \
 325 }
 326 
 327 #define zone_dataset_visible(x, y)      (1)
 328 #define INGLOBALZONE(z)                 (1)
 329 
 330 extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
 331 extern int zfs_secpolicy_rename_perms(const char *from, const char *to,
 332     cred_t *cr);
 333 extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
 334 
 335 #define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) \
 336         sysevent_post_event(_c, _d, _b, "libzpool", _e, _f)
 337 
 338 #ifdef  __cplusplus
 339 }
 340 #endif
 341 
 342 #endif  /* _SYS_ZFS_CONTEXT_H */
 |