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 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _LX_MOUNT_H 27 #define _LX_MOUNT_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #include <rpc/rpc.h> 36 #include <nfs/nfs.h> 37 38 /* 39 * mount() is significantly different between Linux and Solaris. The main 40 * difference is between the set of flags. Some flags on Linux can be 41 * translated to a Solaris equivalent, some are converted to a 42 * filesystem-specific option, while others have no equivalent whatsoever. 43 */ 44 #define LX_MS_MGC_VAL 0xC0ED0000 45 #define LX_MS_RDONLY 0x00000001 46 #define LX_MS_NOSUID 0x00000002 47 #define LX_MS_NODEV 0x00000004 48 #define LX_MS_NOEXEC 0x00000008 49 #define LX_MS_SYNCHRONOUS 0x00000010 50 #define LX_MS_REMOUNT 0x00000020 51 #define LX_MS_MANDLOCK 0x00000040 52 #define LX_MS_NOATIME 0x00000400 53 #define LX_MS_NODIRATIME 0x00000800 54 #define LX_MS_BIND 0x00001000 55 #define LX_MS_SUPPORTED (LX_MS_MGC_VAL | \ 56 LX_MS_RDONLY | LX_MS_NOSUID | \ 57 LX_MS_NODEV | LX_MS_NOEXEC | \ 58 LX_MS_REMOUNT | LX_MS_NOATIME | \ 59 LX_MS_BIND) 60 61 /* 62 * support for nfs mounts 63 */ 64 #define LX_NMD_MAXHOSTNAMELEN 256 65 66 #define LX_NFS_MOUNT_SOFT 0x00000001 67 #define LX_NFS_MOUNT_INTR 0x00000002 68 #define LX_NFS_MOUNT_SECURE 0x00000004 69 #define LX_NFS_MOUNT_POSIX 0x00000008 70 #define LX_NFS_MOUNT_NOCTO 0x00000010 71 #define LX_NFS_MOUNT_NOAC 0x00000020 72 #define LX_NFS_MOUNT_TCP 0x00000040 73 #define LX_NFS_MOUNT_VER3 0x00000080 74 #define LX_NFS_MOUNT_KERBEROS 0x00000100 75 #define LX_NFS_MOUNT_NONLM 0x00000200 76 #define LX_NFS_MOUNT_BROKEN_SUID 0x00000400 77 #define LX_NFS_MOUNT_SUPPORTED (LX_NFS_MOUNT_SOFT | \ 78 LX_NFS_MOUNT_INTR | \ 79 LX_NFS_MOUNT_POSIX | \ 80 LX_NFS_MOUNT_NOCTO | \ 81 LX_NFS_MOUNT_NOAC | \ 82 LX_NFS_MOUNT_TCP | \ 83 LX_NFS_MOUNT_VER3 | \ 84 LX_NFS_MOUNT_NONLM) 85 86 #define LX_NMD_DEFAULT_RSIZE 0 87 #define LX_NMD_DEFAULT_WSIZE 0 88 89 /* 90 * the nfs v3 file handle structure definitions are _almost_ the same 91 * on linux and solaris. the key difference are: 92 * 93 * 1) on linux fh3_length is an unsigned short where as on solaris it's 94 * an int. 95 * 96 * 2) on linux the file handle data doesn't 32 bit members, so the structure 97 * is not 32 bit aligned. (where as on solaris it is.) 98 * 99 * so rather than defining a structure that would allow us to intrepret 100 * all the contents of the nfs v3 file handle here, we decide to treate 101 * the file handle as an array of chars. this works just fine since it 102 * avoids the alignment issues and the actual file handle handle contects 103 * are defined by the nfs specification so they are common across solaris 104 * and linux. we do the same thing for nfs v2 file handles. 105 */ 106 struct lx_nfs_fh2 { 107 unsigned char lx_fh_data[NFS_FHSIZE]; 108 } lx_nfs_fh2; 109 110 struct lx_nfs_fh3 { 111 unsigned short lx_fh3_length; 112 unsigned char lx_fh3_data[NFS3_FHSIZE]; 113 } lx_nfs_fh3; 114 115 typedef struct lx_nfs_mount_data { 116 int nmd_version; 117 int nmd_fd; 118 struct lx_nfs_fh2 nmd_old_root; 119 int nmd_flags; 120 int nmd_rsize; 121 int nmd_wsize; 122 int nmd_timeo; 123 int nmd_retrans; 124 int nmd_acregmin; 125 int nmd_acregmax; 126 int nmd_acdirmin; 127 int nmd_acdirmax; 128 struct sockaddr_in nmd_addr; 129 char nmd_hostname[LX_NMD_MAXHOSTNAMELEN]; 130 int nmd_namlen; 131 uint_t nmd_bsize; 132 struct lx_nfs_fh3 nmd_root; 133 } lx_nfs_mount_data_t; 134 135 #ifdef __cplusplus 136 } 137 #endif 138 139 #endif /* _LX_MOUNT_H */