Ticket #4033: vmount.h

File vmount.h, 10.7 KB (added by dp, 5 years ago)
Line 
1/* IBM_PROLOG_BEGIN_TAG                                                   */
2/* This is an automatically generated prolog.                             */
3/*                                                                        */
4/* bos720 src/bos/kernel/sys/vmount.h 1.58.2.3                            */
5/*                                                                        */
6/* Licensed Materials - Property of IBM                                   */
7/*                                                                        */
8/* COPYRIGHT International Business Machines Corp. 1985,2015              */
9/* All Rights Reserved                                                    */
10/*                                                                        */
11/* US Government Users Restricted Rights - Use, duplication or            */
12/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
13/*                                                                        */
14/* IBM_PROLOG_END_TAG                                                     */
15/* @(#)95       1.58.2.3  src/bos/kernel/sys/vmount.h, syslfs, bos720, 1510A_720 2/23/15 09:55:54  */
16#ifndef _H_VMOUNT
17#define _H_VMOUNT
18
19/*
20 * COMPONENT_NAME: SYSLFS - Logical File System
21 *
22 * FUNCTIONS:
23 *
24 * ORIGINS: 27
25 *
26 */
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/*
33 * Types of file systems for the vmount system call
34 *      NOTE -  When implementing new file system types, ensure
35 *              that the vfs numbers do not conflict.
36 *
37 *  NFS NOTE -  When adding a new version of NFS, checking for the new
38 *              NFS type is needed to the following functions/files:
39 *                   openpnp / open.c
40 *                   insflck and common_reclock / lockctl.c
41 *                   jfs_do_cr / lsfs.c
42 *              In addition, kdb should be aware of the new type.
43 */
44
45
46#define MNT_AIX         0       /* Same as MNT_J2                 */
47#define MNT_J2          0       /* AIX physical fs "jfs2"         */
48#define MNT_NAMEFS      1       /* AIX pseudo fs "namefs"         */
49#define MNT_NFS         2       /* SUN Network File System "nfs"  */
50#define MNT_JFS         3       /* AIX R3 physical fs "jfs"       */
51#define MNT_CDROM       5       /* CDROM File System "cdrom"      */
52#define MNT_PROCFS      6       /* PROCFS File System "proc"      */
53
54#define MNT_USRVFS      8       /* first 8 (0 - 7) reserved for IBM use */
55
56/* User file systems use MNT_USRVFS to MNT_USRLAST.               */
57#define MNT_SFS        16       /* AIX Special FS (STREAM mounts) */
58#define MNT_CACHEFS    17       /* Cachefs file system            */
59#define MNT_NFS3       18       /* NFSv3 file system              */
60#define MNT_AUTOFS     19       /* Automount file system          */
61#define MNT_POOLFS     20       /* Pool file system               */
62
63#define MNT_USRLAST    31       /* last valid user file system    */
64
65/* vfs numbers above MNT_USRLAST reserved for IBM use only        */
66#define MNT_VXFS       32       /* THRPGIO File System "vxfs"     */
67#define MNT_VXODM      33       /* For Veritas File System        */
68#define MNT_UDF        34       /* UDFS file system               */
69#define MNT_NFS4       35       /* NFSv4 file system              */
70#define MNT_RFS4       36       /* NFSv4 Pseudo file system       */
71#define MNT_CIFS       37       /* AIX SMBFS (CIFS client)        */
72#define MNT_PMEMFS     38       /* MCR Async Mobility pseudo file system */
73
74#define MNT_AHAFS      39       /* AHAFS File System "aha"        */
75
76#define MNT_STNFS      40       /* Short-Term NFS                 */
77#define MNT_ASMFS      41       /* Oracle ASM FS                  */
78
79#define MNT_AIXLAST    47       /* last valid vfs number          */
80
81#define MNT_BADVFS     -1       /* always illegal vfs type        */
82
83
84/*
85 * Definitions for bits in the vfs_flag field.
86 *
87 * Some of these are renamed and used as mount flags
88 */
89
90/* VFS flags */
91
92#define VFS_READONLY    0x00000001      /* rdonly access to vfs         */
93#define VFS_REMOVABLE   0x00000002      /* removable (diskette) media   */
94#define VFS_DEVMOUNT    0x00000004      /* physical device mount        */
95#define VFS_REMOTE      0x00000008      /* file system is on network    */
96#define VFS_SYSV_MOUNT  0x00000010      /* System V style mount         */
97#define VFS_UNMOUNTING  0x00000020      /* originated by unmount()      */
98#define VFS_NOSUID      0x00000040      /* don't maintain suid-ness     */
99                                        /* across this mount            */
100#define VFS_NODEV       0x00000080      /* don't allow device access    */
101                                        /* across this mount            */
102#define VFS_NOINTEG     0x00000100      /* no integrity mount option    */
103#define VFS_NOMANAGER   0x00000200      /* mount managed fs w/o manager */
104#define VFS_NOCASE      0x00000400      /* do not map dir names         */
105#define VFS_UPCASE      0x00000800      /* map dir names to uppercase   */
106#define VFS_NBC         0x00001000      /* NBC cached file in this vfs  */
107#define VFS_MIND        0x00002000      /* multi-segment .indirect      */
108#define VFS_RBR         0x00004000      /* Release-behind when reading  */
109#define VFS_RBW         0x00008000      /* Release-behind when writing  */
110#define VFS_DISCONNECTED 0x00010000     /* file mount not in use        */
111#define VFS_SHUTDOWN    0x00020000      /* forced unmount for shutdown  */
112#define VFS_VMOUNTOK    0x00040000      /* dir/file mnt permission flag */
113#define VFS_SUSER       0x00080000      /* client-side suser perm. flag */
114#define VFS_SOFT_MOUNT  0x00100000      /* file-over-file or directory  */
115                                        /* over directory "soft" mount  */
116#define VFS_UNMOUNTED   0x00200000      /* unmount completed, stale     */
117                                        /* vnodes are left in the vfs   */
118#define VFS_DEADMOUNT   0x00400000      /* softmount vfs should be      */
119                                        /* disconnected at last vnode   */
120                                        /* free                         */
121#define VFS_SNAPSHOT    0x00800000      /* snapshot mount               */
122#define VFS_VCM_ON      0x01000000      /* VCM is currently active      */
123#define VFS_VCM_MONITOR 0x02000000      /* VCM monitoring is active     */
124#define VFS_ATIMEOFF    0x04000000      /* no atime updates during i/o  */
125#define VFS_READMOSTLY  0x10000000      /* ROFS allows open for write   */
126#define VFS_CIOR        0x20000000      /* O_CIOR mount                 */
127#define VFS_CIO         0x40000000      /* O_CIO mount                  */
128#define VFS_DIO         0x80000000      /* O_DIRECT mount               */
129
130
131/* Mount flags */
132#define MNT_READONLY    VFS_READONLY
133#define MNT_REMOVABLE   VFS_REMOVABLE
134#define MNT_DEVICE      VFS_DEVMOUNT
135#define MNT_REMOTE      VFS_REMOTE
136#define MNT_SYSV_MOUNT  VFS_SYSV_MOUNT
137#define MNT_UNMOUNTING  VFS_UNMOUNTING 
138#define MNT_NOSUID      VFS_NOSUID
139#define MNT_NODEV       VFS_NODEV
140#define MNT_NOINTEG     VFS_NOINTEG
141#define MNT_NOMANAGER   VFS_NOMANAGER
142#define MNT_NOCASE      VFS_NOCASE
143#define MNT_UPCASE      VFS_UPCASE
144#define MNT_VFS_NBC     VFS_NBC
145#define MNT_MIND        VFS_MIND
146#define MNT_RBR         VFS_RBR
147#define MNT_RBW         VFS_RBW
148#define MNT_DIO         VFS_DIO
149#define MNT_SNAPSHOT    VFS_SNAPSHOT
150#define MNT_CIO         VFS_CIO
151#define MNT_CIOR        VFS_CIOR
152#define MNT_READMOSTLY  VFS_READMOSTLY
153#define MNT_ATIMEOFF    VFS_ATIMEOFF
154
155
156
157
158/*
159 * The following may be used as flags for mount(2) and vmount(2) calls. 
160 * MNT_DEVICE, MNT_REMOTE are output only -- ignored as input, set by vmount
161 */
162#define VMOUNT_MASK     \
163        (MNT_READONLY | MNT_REMOVABLE | MNT_SYSV_MOUNT | MNT_NOSUID | \
164         MNT_NODEV | MNT_NOINTEG | MNT_NOMANAGER | MNT_NOCASE | MNT_UPCASE | \
165         MNT_MIND | MNT_RBR | MNT_RBW | MNT_DIO | MNT_SNAPSHOT | \
166         MNT_CIO | MNT_CIOR | MNT_READMOSTLY | MNT_ATIMEOFF)
167
168
169/*
170 * The variable length data descriptors are an array of offsets
171 * (from beginning of struct vmount) and sizes.
172 * NOTES:
173 * If a particular area has no data, offset and size should be 0.
174 * The size must always be filled in, even if the data is a NULL
175 * terminated printable text string.
176 */
177#define VMT_OBJECT      0       /* I index of object name               */
178#define VMT_STUB        1       /* I index of mounted over stub name    */
179#define VMT_HOST        2       /* I index of (short) hostname          */
180#define VMT_HOSTNAME    3       /* I index of (long) hostname           */
181#define VMT_INFO        4       /* I index of binary vfs specific info  */
182                                /*   includes network address, opts, etc*/
183#define VMT_ARGS        5       /* I index of text of vfs specific args */
184#define VMT_LASTINDEX   5       /* I the last in the array of structs   */
185
186/*
187 * Vmount system call argument, also a mntctl return structure.
188 * This structure has a fixed size of data and offsets, and then
189 * has the data for the fs pointed to by "vmount ptr + offset".
190 * If a particular area has no data, the offset and size should be 0.
191 * Input parameters are indicated by "I", output only parameters
192 * are indicated by "O" (input parameters are also output).
193 */
194struct vmount {
195        uint    vmt_revision;   /* I revision level, currently 1        */
196        uint    vmt_length;     /* I total length of structure and data */
197#if !defined(_KERNEL) && defined(__64BIT__)
198        fsid64_t  vmt_fsid;     /* O id of file system                  */
199#else
200        fsid_t  vmt_fsid;       /* O id of file system                  */
201#endif
202        int     vmt_vfsnumber;  /* O unique mount id of file system     */
203        uint    vmt_time;       /* O time of mount                      */
204        uint    vmt_timepad;    /* O (in future, time is 2 longs)       */
205        int     vmt_flags;      /* I general mount flags                */
206                                /* O MNT_REMOTE is output only          */
207        int     vmt_gfstype;    /* I type of gfs, see MNT_XXX above     */
208        struct vmt_data {
209                short vmt_off;  /* I offset of data, word aligned       */
210                short vmt_size; /* I actual size of data in bytes       */
211        } vmt_data[VMT_LASTINDEX + 1];
212        /*
213         * the variable length data goes here, starting at word (32 bit)
214         * boundaries.
215         */
216};
217
218#define VMT_DATAPAD     512     /* extra space for remount with added options */
219#define VMT_REVISION    1       /* current version of struct vmount     */
220
221/*
222 * macros to easily get ptr and size of variable length info
223 * given ptr to vmount structure and index to object
224 */
225#define vmt2dataptr(vmt, idx)   ((caddr_t)(((long)(vmt)) + \
226                                ((vmt)->vmt_data[(idx)].vmt_off)))
227#define vmt2datasize(vmt, idx)  ((vmt)->vmt_data[(idx)].vmt_size)
228
229/*
230 * mntctl operations and arguments.
231 *      mntctl(cmd, size, buf)
232 * cmd - one of the command defines below (MCTL_????)
233 * size - size of the area that buf points to
234 * buf - pointer to an argument/results area
235 */
236#define MCTL_QUERY      2       /* (new style) query what is mounted
237                                 * buf points to array of vmount structures
238                                 * (which are variable length)
239                                 * returns: 0 = look in first word of buf
240                                 *      for needed size,
241                                 * -1 = error,
242                                 * >0 = number of vmount structs in buf
243                                 */
244#define MCTL_QUERY_MY_MNTS 8    /* query which mounts have been issued
245                                 * from within a WPAR.
246                                 */
247#define MCTL_REMNT    0x0013    /* change the mount options of mounted
248                                 * mounted file system. This request is
249                                 * passed to underlying file system through
250                                 * VFS_CNTL.
251                                 */
252#define MCTL_GET_MNTDOVER_INO 0x0014 /* query the mntdover ino number */
253#define MCTL_QUERY_MNT_FROZEN         0x0015
254       
255struct mctl_mntdover_ino {
256        ino64_t mctl_mntdover_ino;      /* O ino for mntdover vnode */
257        char    *mctl_mntdover_path;    /* I path for mntdover vnode */
258};
259
260/*
261 * flags for the uvmount(2) system call
262 * int uvmount(vfsnumber, flags)
263 *      int     vfsnumber; number from vmount structure, or statfs
264 */
265#define UVMNT_FORCE     0x0001  /* force the unmount, regardless! */
266
267/* Function prototypes */
268int vmount(struct vmount *, int);
269int uvmount(int, int);
270int mntctl(int, size_t, char *);
271int fscntl(int, int, caddr_t, size_t);
272
273#ifdef __cplusplus
274}
275#endif
276
277#endif /* _H_VMOUNT */