source: rtems/cpukit/libnetworking/sys/mount.h @ 5f7d9d0e

4.104.114.84.95
Last change on this file since 5f7d9d0e was c834daa, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/18/05 at 03:42:36

2005-04-18 Ralf Corsepius <ralf.corsepius@…>

  • libnetworking/sys/mount.h: More updates from FreeBSD. Remove ufs, mfs, dosfs, isofs.
  • Property mode set to 100644
File size: 11.4 KB
Line 
1/*
2 * Copyright (c) 1989, 1991, 1993
3 *      The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 *    may be used to endorse or promote products derived from this software
15 *    without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 *      @(#)mount.h     8.21 (Berkeley) 5/20/95
30 * $FreeBSD: src/sys/sys/mount.h,v 1.195 2005/03/24 07:29:23 jeff Exp $
31 */
32
33/*
34 * $Id$
35 */
36 
37#ifndef _SYS_MOUNT_H_
38#define _SYS_MOUNT_H_
39
40#ifndef _KERNEL
41#include <sys/ucred.h>
42#endif
43#include <sys/queue.h>
44
45typedef struct fsid { int32_t val[2]; } fsid_t; /* filesystem id type */
46
47/*
48 * File identifier.
49 * These are unique per filesystem on a single machine.
50 */
51#define MAXFIDSZ        16
52
53struct fid {
54        u_short         fid_len;                /* length of data in bytes */
55        u_short         fid_reserved;           /* force longword alignment */
56        char            fid_data[MAXFIDSZ];     /* data (variable length) */
57};
58
59/*
60 * filesystem statistics
61 */
62
63#define MNAMELEN 90     /* length of buffer for returned name */
64
65struct statfs {
66        long    f_spare2;               /* placeholder */
67        long    f_bsize;                /* fundamental filesystem block size */
68        long    f_iosize;               /* optimal transfer block size */
69        long    f_blocks;               /* total data blocks in filesystem */
70        long    f_bfree;                /* free blocks in fs */
71        long    f_bavail;               /* free blocks avail to non-superuser */
72        long    f_files;                /* total file nodes in filesystem */
73        long    f_ffree;                /* free file nodes in fs */
74        fsid_t  f_fsid;                 /* filesystem id */
75        uid_t   f_owner;                /* user that mounted the filesystem */
76        int     f_type;                 /* type of filesystem (see below) */
77        int     f_flags;                /* copy of mount flags */
78        long    f_spare[6];             /* spare for later */
79        char    f_mntonname[MNAMELEN];  /* directory on which mounted */
80        char    f_mntfromname[MNAMELEN];/* mounted filesystem */
81};
82
83/*
84 * Structure per mounted filesystem.  Each mounted filesystem has an
85 * array of operations and an instance record.  The filesystems are
86 * put on a doubly linked list.
87 *
88 */
89LIST_HEAD(vnodelst, vnode);
90
91struct mount {
92        CIRCLEQ_ENTRY(mount) mnt_list;          /* mount list */
93        struct vfsops   *mnt_op;                /* operations on fs */
94        struct vfsconf  *mnt_vfc;               /* configuration info */
95        struct vnode    *mnt_vnodecovered;      /* vnode we mounted on */
96        struct vnodelst mnt_vnodelist;          /* list of vnodes this mount */
97        int             mnt_flag;               /* flags */
98        int             mnt_maxsymlinklen;      /* max size of short symlink */
99        struct statfs   mnt_stat;               /* cache of filesystem stats */
100        void *          mnt_data;               /* private data */
101        time_t          mnt_time;               /* last time written*/
102};
103
104/*
105 * Mount flags.
106 *
107 * Unmount uses MNT_FORCE flag.
108 */
109#define MNT_RDONLY      0x00000001      /* read only filesystem */
110#define MNT_SYNCHRONOUS 0x00000002      /* filesystem written synchronously */
111#define MNT_NOEXEC      0x00000004      /* can't exec from filesystem */
112#define MNT_NOSUID      0x00000008      /* don't honor setuid bits on fs */
113#define MNT_NODEV       0x00000010      /* don't interpret special files */
114#define MNT_UNION       0x00000020      /* union with underlying filesystem */
115#define MNT_ASYNC       0x00000040      /* filesystem written asynchronously */
116#define MNT_NOATIME     0x10000000      /* Disable update of file access times */
117
118/*
119 * exported mount flags.
120 */
121#define MNT_EXRDONLY    0x00000080      /* exported read only */
122#define MNT_EXPORTED    0x00000100      /* filesystem is exported */
123#define MNT_DEFEXPORTED 0x00000200      /* exported to the world */
124#define MNT_EXPORTANON  0x00000400      /* use anon uid mapping for everyone */
125#define MNT_EXKERB      0x00000800      /* exported with Kerberos uid mapping */
126#define MNT_EXPUBLIC    0x20000000      /* public export (WebNFS) */
127
128/*
129 * Flags set by internal operations.
130 */
131#define MNT_LOCAL       0x00001000      /* filesystem is stored locally */
132#define MNT_QUOTA       0x00002000      /* quotas are enabled on filesystem */
133#define MNT_ROOTFS      0x00004000      /* identifies the root filesystem */
134#define MNT_USER        0x00008000      /* mounted by a user */
135#define MNT_IGNORE      0x00800000      /* do not show entry in df */
136
137/*
138 * Mask of flags that are visible to statfs()
139 */
140#define MNT_VISFLAGMASK (MNT_RDONLY|MNT_SYNCHRONOUS|MNT_NOEXEC|MNT_NOSUID| \
141                         MNT_NODEV|MNT_UNION|MNT_ASYNC|MNT_EXRDONLY|MNT_EXPORTED| \
142                         MNT_DEFEXPORTED|MNT_EXPORTANON|MNT_EXKERB|MNT_LOCAL| \
143                         MNT_QUOTA|MNT_ROOTFS|MNT_USER|MNT_NOATIME)
144
145/*
146 * filesystem control flags.
147 *
148 * MNT_MLOCK lock the mount entry so that name lookup cannot proceed
149 * past the mount point.  This keeps the subtree stable during mounts
150 * and unmounts.
151 */
152#define MNT_UPDATE      0x00010000      /* not a real mount, just an update */
153#define MNT_DELEXPORT   0x00020000      /* delete export host lists */
154#define MNT_RELOAD      0x00040000      /* reload filesystem data */
155#define MNT_FORCE       0x00080000      /* force unmount or readonly change */
156#define MNT_MLOCK       0x00100000      /* lock so that subtree is stable */
157#define MNT_MWAIT       0x00200000      /* someone is waiting for lock */
158#define MNT_MPBUSY      0x00400000      /* scan of mount point in progress */
159#define MNT_MPWANT      0x00800000      /* waiting for mount point */
160#define MNT_UNMOUNT     0x01000000      /* unmount in progress */
161#define MNT_WANTRDWR    0x02000000      /* want upgrade to read/write */
162
163/*
164 * used to get configured filesystems information
165 */
166#define VFS_MAXNAMELEN 32
167struct vfsconf {
168        void *vfc_vfsops;
169        char vfc_name[VFS_MAXNAMELEN];
170        int vfc_index;
171        int vfc_refcount;
172        int vfc_flags;
173};
174
175/*
176 * Operations supported on mounted filesystem.
177 */
178#ifdef _KERNEL
179
180extern  int     doforce;        /* Flag to permit forcible unmounting. */
181extern struct vfsconf void_vfsconf;
182extern struct vfsconf *vfsconf[];
183
184#ifdef __STDC__
185struct nameidata;
186struct mbuf;
187#endif
188
189struct vfsops {
190        int     (*vfs_mount)    __P((struct mount *mp, char *path, caddr_t data,
191                                    struct nameidata *ndp, struct proc *p));
192        int     (*vfs_start)    __P((struct mount *mp, int flags,
193                                    struct proc *p));
194        int     (*vfs_unmount)  __P((struct mount *mp, int mntflags,
195                                    struct proc *p));
196        int     (*vfs_root)     __P((struct mount *mp, struct vnode **vpp));
197        int     (*vfs_quotactl) __P((struct mount *mp, int cmds, uid_t uid,
198                                    caddr_t arg, struct proc *p));
199        int     (*vfs_statfs)   __P((struct mount *mp, struct statfs *sbp,
200                                    struct proc *p));
201        int     (*vfs_sync)     __P((struct mount *mp, int waitfor,
202                                    struct ucred *cred, struct proc *p));
203        int     (*vfs_vget)     __P((struct mount *mp, ino_t ino,
204                                    struct vnode **vpp));
205        int     (*vfs_fhtovp)   __P((struct mount *mp, struct fid *fhp,
206                                    struct mbuf *nam, struct vnode **vpp,
207                                    int *exflagsp, struct ucred **credanonp));
208        int     (*vfs_vptofh)   __P((struct vnode *vp, struct fid *fhp));
209        int     (*vfs_init)     __P((void));
210};
211
212#define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
213        (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
214#define VFS_START(MP, FLAGS, P)   (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
215#define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
216#define VFS_ROOT(MP, VPP)         (*(MP)->mnt_op->vfs_root)(MP, VPP)
217#define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
218#define VFS_STATFS(MP, SBP, P)    (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
219#define VFS_SYNC(MP, WAIT, C, P)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
220#define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
221#define VFS_FHTOVP(MP, FIDP, NAM, VPP, EXFLG, CRED) \
222        (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, NAM, VPP, EXFLG, CRED)
223#define VFS_VPTOFH(VP, FIDP)      (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
224
225#endif /* _KERNEL */
226
227/*
228 * Flags for various system call interfaces.
229 *
230 * waitfor flags to vfs_sync() and getfsstat()
231 */
232#define MNT_WAIT        1
233#define MNT_NOWAIT      2
234
235/*
236 * Generic file handle
237 */
238struct fhandle {
239        fsid_t  fh_fsid;        /* Filesystem id of mount point */
240        struct  fid fh_fid;     /* Filesys specific id */
241};
242typedef struct fhandle  fhandle_t;
243
244#ifdef _KERNEL
245#include <net/radix.h>
246#include <sys/socket.h>         /* XXX for AF_MAX */
247
248/*
249 * Network address lookup element
250 */
251struct netcred {
252        struct  radix_node netc_rnodes[2];
253        int     netc_exflags;
254        struct  ucred netc_anon;
255};
256
257/*
258 * Network export information
259 */
260struct netexport {
261        struct  netcred ne_defexported;               /* Default export */
262        struct  radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */
263};
264#endif /* _KERNEL */
265
266/*
267 * Export arguments for local filesystem mount calls.
268 */
269struct export_args {
270        int     ex_flags;               /* export related flags */
271        uid_t   ex_root;                /* mapping for root uid */
272        struct  ucred ex_anon;          /* mapping for anonymous user */
273        struct  sockaddr *ex_addr;      /* net address to which exported */
274        int     ex_addrlen;             /* and the net address length */
275        struct  sockaddr *ex_mask;      /* mask of valid bits in saddr */
276        int     ex_masklen;             /* and the smask length */
277};
278
279#ifdef _KERNEL
280extern  int (*mountroot) __P((void *));
281extern  struct vfsops   *mountrootvfsops;
282
283/*
284 * exported vnode operations
285 */
286int     dounmount __P((struct mount *, int, struct proc *));
287struct  mount *getvfs __P((fsid_t *));      /* return vfs given fsid */
288void    getnewfsid __P((struct mount *, int));
289int     vflush __P((struct mount *, struct vnode *, int));
290int     vfs_export                          /* process mount export info */
291          __P((struct mount *, struct netexport *, struct export_args *));
292struct  netcred *vfs_export_lookup          /* lookup host in fs export list */
293          __P((struct mount *, struct netexport *, struct mbuf *));
294int     vfs_lock __P((struct mount *));         /* lock a vfs */
295int     vfs_mountedon __P((struct vnode *));    /* is a vfs mounted on vp */
296int     vfs_mountroot __P((void *));            /* XXX goes away? */
297void    vfs_msync __P((struct mount *, int));
298void    vfs_unlock __P((struct mount *));       /* unlock a vfs */
299void    vfs_unmountall __P((void));
300int     vfs_busy __P((struct mount *));         /* mark a vfs  busy */
301void    vfs_unbusy __P((struct mount *));       /* mark a vfs not busy */
302extern  CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
303extern  struct vfsops *vfssw[];                 /* filesystem type table */
304
305#else /* _KERNEL */
306
307#include <sys/cdefs.h>
308
309__BEGIN_DECLS
310int     fstatfs __P((int, struct statfs *));
311int     getfh __P((const char *, fhandle_t *));
312int     getfsstat __P((struct statfs *, long, int));
313int     getmntinfo __P((struct statfs **, int));
314int     mount __P((int, const char *, int, void *));
315int     statfs __P((const char *, struct statfs *));
316int     unmount __P((const char *, int));
317
318/* C library stuff */
319struct  vfsconf *getvfsbyname __P((const char *));
320struct  vfsconf *getvfsbytype __P((int));
321struct  vfsconf *getvfsent __P((void));
322void    setvfsent __P((int));
323void    endvfsent __P((void));
324int     vfsisloadable __P((const char *));
325int     vfsload __P((const char *));
326__END_DECLS
327
328#endif /* _KERNEL */
329
330#endif /* !_SYS_MOUNT_H_ */
Note: See TracBrowser for help on using the repository browser.