Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16


   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 /*
  23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 




  27 #ifndef _SHAREFS_SHAREFS_H
  28 #define _SHAREFS_SHAREFS_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 /*
  33  * This header provides service for the sharefs module.
  34  */
  35 
  36 #include <sys/modctl.h>
  37 #include <sys/vfs.h>
  38 #include <sys/vnode.h>
  39 #include <sys/gfs.h>
  40 #include <sharefs/share.h>
  41 #include <sharefs/sharetab.h>
  42 
  43 #ifdef __cplusplus
  44 extern "C" {
  45 #endif
  46 
  47 #define SHAREFS_ROOT    "/etc/dfs"
  48 #define SHAREFS_BASE    "sharetab"
  49 
  50 /*
  51  * Lengths of strings.
  52  */
  53 typedef struct sharefs_lens {
  54         int     shl_path;
  55         int     shl_res;
  56         int     shl_fstype;
  57         int     shl_opts;
  58         int     shl_descr;
  59 } sharefs_lens_t;
  60 
  61 /*
  62  * VFS data object
  63  */
  64 typedef struct sharefs_vfs {
  65         vnode_t *sharefs_vfs_root;
  66 } sharefs_vfs_t;
  67 
  68 #define SHAREFS_NAME_MAX        MAXNAMELEN
  69 
  70 /*

  71  * The lock ordering whenever sharefs_lock and sharetab_lock both
  72  * need to be held is: sharefs_lock and then sharetab_lock.
  73  */
  74 extern krwlock_t        sharefs_lock;   /* lock for the vnode ops */
  75 extern sharetab_t       *sharefs_sharetab;      /* The sharetab. */
  76 
  77 extern uint_t           sharetab_count; /* How many shares? */
  78 extern krwlock_t        sharetab_lock;  /* lock for the cached sharetab */
  79 extern size_t           sharetab_size;  /* How big is the sharetab file? */
  80 
  81 extern timestruc_t      sharetab_mtime; /* Last mod to sharetab */
  82 extern timestruc_t      sharetab_snap_time;     /* Last snap */
  83 extern uint_t           sharetab_generation;    /* Which copy is it? */

  84 
  85 #define SHAREFS_INO_FILE        0x80
  86 
  87 extern vnode_t *sharefs_create_root_file(vfs_t *);

  88 
  89 /*
  90  * Sharetab file
  91  *
  92  * Note that even though the sharetab code does not explictly
  93  * use 'sharefs_file', it is required by GFS that the first
  94  * field of the private data be a gfs_file_t.
  95  */
  96 typedef struct shnode_t {
  97         gfs_file_t      sharefs_file;           /* gfs file */
  98         char            *sharefs_snap;          /* snapshot of the share */
  99         size_t          sharefs_size;           /* size of the snapshot */
 100         uint_t          sharefs_count;          /* number of shares */
 101         uint_t          sharefs_refs;           /* reference count */
 102         uint_t          sharefs_real_vp;        /* Are we a real or snap */
 103         uint_t          sharefs_generation;     /* Which copy are we? */
 104         timestruc_t     sharefs_snap_time;      /* When were we modded? */
 105 } shnode_t;
 106 
 107 /*


   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 /*
  23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2018 Nexenta Systems, Inc.
  29  */
  30 
  31 #ifndef _SHAREFS_SHAREFS_H
  32 #define _SHAREFS_SHAREFS_H
  33 


  34 /*
  35  * This header provides service for the sharefs module.
  36  */
  37 
  38 #include <sys/modctl.h>
  39 #include <sys/vfs.h>
  40 #include <sys/vnode.h>
  41 #include <sys/gfs.h>
  42 #include <sharefs/share.h>
  43 #include <sharefs/sharetab.h>
  44 
  45 #ifdef __cplusplus
  46 extern "C" {
  47 #endif
  48 
  49 #define SHAREFS_ROOT    "/etc/dfs"
  50 #define SHAREFS_BASE    "sharetab"
  51 
  52 /*
  53  * Lengths of strings.
  54  */
  55 typedef struct sharefs_lens {
  56         int     shl_path;
  57         int     shl_res;
  58         int     shl_fstype;
  59         int     shl_opts;
  60         int     shl_descr;
  61 } sharefs_lens_t;
  62 
  63 /*
  64  * VFS data object
  65  */
  66 typedef struct sharefs_vfs {
  67         vnode_t *sharefs_vfs_root;
  68 } sharefs_vfs_t;
  69 
  70 #define SHAREFS_NAME_MAX        MAXNAMELEN
  71 
  72 typedef struct sharetab_globals {
  73         /*
  74          * The lock ordering whenever sharefs_lock and sharetab_lock both
  75          * need to be held is: sharefs_lock and then sharetab_lock.
  76          */
  77         krwlock_t       sharefs_lock;   /* lock for the vnode ops */
  78         sharetab_t      *sharefs_sharetab;      /* The sharetab. */
  79 
  80         uint_t          sharetab_count; /* How many shares? */
  81         krwlock_t       sharetab_lock;  /* lock for the cached sharetab */
  82         size_t          sharetab_size;  /* How big is the sharetab file? */
  83 
  84         timestruc_t     sharetab_mtime; /* Last mod to sharetab */
  85         timestruc_t     sharetab_snap_time;     /* Last snap */
  86         uint_t          sharetab_generation;    /* Which copy is it? */
  87 } sharetab_globals_t;
  88 
  89 #define SHAREFS_INO_FILE        0x80
  90 
  91 extern vnode_t *sharefs_create_root_file(vfs_t *);
  92 extern sharetab_globals_t *sharetab_get_globals(zone_t *zone);
  93 
  94 /*
  95  * Sharetab file
  96  *
  97  * Note that even though the sharetab code does not explictly
  98  * use 'sharefs_file', it is required by GFS that the first
  99  * field of the private data be a gfs_file_t.
 100  */
 101 typedef struct shnode_t {
 102         gfs_file_t      sharefs_file;           /* gfs file */
 103         char            *sharefs_snap;          /* snapshot of the share */
 104         size_t          sharefs_size;           /* size of the snapshot */
 105         uint_t          sharefs_count;          /* number of shares */
 106         uint_t          sharefs_refs;           /* reference count */
 107         uint_t          sharefs_real_vp;        /* Are we a real or snap */
 108         uint_t          sharefs_generation;     /* Which copy are we? */
 109         timestruc_t     sharefs_snap_time;      /* When were we modded? */
 110 } shnode_t;
 111 
 112 /*