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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  22 /*        All Rights Reserved   */
  23 
  24 
  25 /*
  26  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  27  *
  28  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  29  * Use is subject to license terms.
  30  */
  31 
  32 #ifndef _SYS_MNTTAB_H
  33 #define _SYS_MNTTAB_H
  34 
  35 #include <sys/types.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 #define MNTTAB  "/etc/mnttab"
  42 #define MNT_LINE_MAX    1024
  43 
  44 #define MNT_TOOLONG     1       /* entry exceeds MNT_LINE_MAX */
  45 #define MNT_TOOMANY     2       /* too many fields in line */
  46 #define MNT_TOOFEW      3       /* too few fields in line */
  47 
  48 #define mntnull(mp)\
  49         ((mp)->mnt_special = (mp)->mnt_mountp = \
  50             (mp)->mnt_fstype = (mp)->mnt_mntopts = \
  51             (mp)->mnt_time = NULL)
  52 
  53 #define putmntent(fd, mp)       (-1)
  54 
  55 /*
  56  * The fields in struct extmnttab should match those in struct mnttab until new
  57  * fields are encountered. This allows hasmntopt(), getmntent_common() and
  58  * mntioctl() to cast one type to the other safely.
  59  *
  60  * The fields in struct mnttab, struct extmnttab and struct mntentbuf must all
  61  * match those in the corresponding 32-bit versions defined in mntvnops.c.
  62  */
  63 struct mnttab {
  64         char    *mnt_special;
  65         char    *mnt_mountp;
  66         char    *mnt_fstype;
  67         char    *mnt_mntopts;
  68         char    *mnt_time;
  69 };
  70 
  71 struct extmnttab {
  72         char    *mnt_special;
  73         char    *mnt_mountp;
  74         char    *mnt_fstype;
  75         char    *mnt_mntopts;
  76         char    *mnt_time;
  77         uint_t  mnt_major;
  78         uint_t  mnt_minor;
  79 };
  80 
  81 struct mntentbuf {
  82         struct  extmnttab *mbuf_emp;
  83         size_t  mbuf_bufsize;
  84         char    *mbuf_buf;
  85 };
  86 
  87 #if !defined(_KERNEL)
  88 extern void     resetmnttab(FILE *);
  89 extern int      getmntent(FILE *, struct mnttab *);
  90 extern int      getextmntent(FILE *, struct extmnttab *, size_t);
  91 extern int      getmntany(FILE *, struct mnttab *, struct mnttab *);
  92 extern char     *hasmntopt(struct mnttab *, char *);
  93 extern char     *mntopt(char **);
  94 #endif
  95 
  96 #ifdef  __cplusplus
  97 }
  98 #endif
  99 
 100 #endif  /* _SYS_MNTTAB_H */