1*3957Sth199096 /* 2*3957Sth199096 * CDDL HEADER START 3*3957Sth199096 * 4*3957Sth199096 * The contents of this file are subject to the terms of the 5*3957Sth199096 * Common Development and Distribution License (the "License"). 6*3957Sth199096 * You may not use this file except in compliance with the License. 7*3957Sth199096 * 8*3957Sth199096 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*3957Sth199096 * or http://www.opensolaris.org/os/licensing. 10*3957Sth199096 * See the License for the specific language governing permissions 11*3957Sth199096 * and limitations under the License. 12*3957Sth199096 * 13*3957Sth199096 * When distributing Covered Code, include this CDDL HEADER in each 14*3957Sth199096 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*3957Sth199096 * If applicable, add the following below this CDDL HEADER, with the 16*3957Sth199096 * fields enclosed by brackets "[]" replaced with your own identifying 17*3957Sth199096 * information: Portions Copyright [yyyy] [name of copyright owner] 18*3957Sth199096 * 19*3957Sth199096 * CDDL HEADER END 20*3957Sth199096 */ 21*3957Sth199096 22*3957Sth199096 /* 23*3957Sth199096 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*3957Sth199096 * Use is subject to license terms. 25*3957Sth199096 */ 26*3957Sth199096 27*3957Sth199096 #ifndef _SHAREFS_SHAREFS_H 28*3957Sth199096 #define _SHAREFS_SHAREFS_H 29*3957Sth199096 30*3957Sth199096 #pragma ident "%Z%%M% %I% %E% SMI" 31*3957Sth199096 32*3957Sth199096 /* 33*3957Sth199096 * This header provides service for the sharefs module. 34*3957Sth199096 */ 35*3957Sth199096 36*3957Sth199096 #include <sys/modctl.h> 37*3957Sth199096 #include <sys/vfs.h> 38*3957Sth199096 #include <sys/vnode.h> 39*3957Sth199096 #include <sys/gfs.h> 40*3957Sth199096 #include <sharefs/share.h> 41*3957Sth199096 #include <sharefs/sharetab.h> 42*3957Sth199096 43*3957Sth199096 #ifdef __cplusplus 44*3957Sth199096 extern "C" { 45*3957Sth199096 #endif 46*3957Sth199096 47*3957Sth199096 #define SHAREFS_ROOT "/etc/dfs" 48*3957Sth199096 #define SHAREFS_BASE "sharetab" 49*3957Sth199096 50*3957Sth199096 /* 51*3957Sth199096 * Lengths of strings. 52*3957Sth199096 */ 53*3957Sth199096 typedef struct sharefs_lens { 54*3957Sth199096 int shl_path; 55*3957Sth199096 int shl_res; 56*3957Sth199096 int shl_fstype; 57*3957Sth199096 int shl_opts; 58*3957Sth199096 int shl_descr; 59*3957Sth199096 } sharefs_lens_t; 60*3957Sth199096 61*3957Sth199096 /* 62*3957Sth199096 * VFS data object 63*3957Sth199096 */ 64*3957Sth199096 typedef struct sharefs_vfs { 65*3957Sth199096 vnode_t *sharefs_vfs_root; 66*3957Sth199096 } sharefs_vfs_t; 67*3957Sth199096 68*3957Sth199096 #define SHAREFS_NAME_MAX MAXNAMELEN 69*3957Sth199096 70*3957Sth199096 /* 71*3957Sth199096 * The lock ordering whenever sharefs_lock and sharetab_lock both 72*3957Sth199096 * need to be held is: sharefs_lock and then sharetab_lock. 73*3957Sth199096 */ 74*3957Sth199096 extern krwlock_t sharefs_lock; /* lock for the vnode ops */ 75*3957Sth199096 extern sharetab_t *sharefs_sharetab; /* The sharetab. */ 76*3957Sth199096 77*3957Sth199096 extern uint_t sharetab_count; /* How many shares? */ 78*3957Sth199096 extern krwlock_t sharetab_lock; /* lock for the cached sharetab */ 79*3957Sth199096 extern size_t sharetab_size; /* How big is the sharetab file? */ 80*3957Sth199096 81*3957Sth199096 extern timestruc_t sharetab_mtime; /* Last mod to sharetab */ 82*3957Sth199096 extern timestruc_t sharetab_snap_time; /* Last snap */ 83*3957Sth199096 extern uint_t sharetab_generation; /* Which copy is it? */ 84*3957Sth199096 85*3957Sth199096 #define SHAREFS_INO_FILE 0x80 86*3957Sth199096 87*3957Sth199096 extern vnode_t *sharefs_create_root_file(vfs_t *); 88*3957Sth199096 89*3957Sth199096 /* 90*3957Sth199096 * Sharetab file 91*3957Sth199096 * 92*3957Sth199096 * Note that even though the sharetab code does not explictly 93*3957Sth199096 * use 'sharefs_file', it is required by GFS that the first 94*3957Sth199096 * field of the private data be a gfs_file_t. 95*3957Sth199096 */ 96*3957Sth199096 typedef struct shnode_t { 97*3957Sth199096 gfs_file_t sharefs_file; /* gfs file */ 98*3957Sth199096 char *sharefs_snap; /* snapshot of the share */ 99*3957Sth199096 size_t sharefs_size; /* size of the snapshot */ 100*3957Sth199096 uint_t sharefs_count; /* number of shares */ 101*3957Sth199096 uint_t sharefs_refs; /* reference count */ 102*3957Sth199096 uint_t sharefs_real_vp; /* Are we a real or snap */ 103*3957Sth199096 uint_t sharefs_generation; /* Which copy are we? */ 104*3957Sth199096 timestruc_t sharefs_snap_time; /* When were we modded? */ 105*3957Sth199096 } shnode_t; 106*3957Sth199096 107*3957Sth199096 /* 108*3957Sth199096 * Some conversion macros: 109*3957Sth199096 */ 110*3957Sth199096 #define VTOSH(vp) ((shnode_t *)((vp)->v_data)) 111*3957Sth199096 112*3957Sth199096 extern const fs_operation_def_t sharefs_tops_data[]; 113*3957Sth199096 extern vnodeops_t *sharefs_ops_data; 114*3957Sth199096 115*3957Sth199096 extern void sharefs_data_init(void); 116*3957Sth199096 117*3957Sth199096 extern void sharefs_sharetab_init(void); 118*3957Sth199096 119*3957Sth199096 #ifdef __cplusplus 120*3957Sth199096 } 121*3957Sth199096 #endif 122*3957Sth199096 123*3957Sth199096 #endif /* !_SHAREFS_SHAREFS_H */ 124