xref: /titanic_52/usr/src/cmd/fs.d/autofs/auto_mnttab.c (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	auto_mnttab.c
24  *
25  *	Copyright (c) 1988-1999 Sun Microsystems Inc
26  *	All Rights Reserved.
27  */
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <stdio.h>
32 #include <sys/mnttab.h>
33 #include <sys/mkdev.h>
34 #include "automount.h"
35 
36 static mutex_t mnttab_lock = DEFAULTMUTEX;
37 
38 /*
39  * XXX - Serialize calls to fsgetmntlist, so that threads can get consistent
40  * snapshots of the in-kernel mnttab.  This function should be removed
41  * once getextmntent is made MT-safe and callers can invoke fsgetmntlist
42  * directly.
43  */
44 struct mntlist *
45 getmntlist()
46 {
47 	struct mntlist *mntl;
48 
49 	(void) mutex_lock(&mnttab_lock);
50 	mntl = fsgetmntlist();
51 	(void) mutex_unlock(&mnttab_lock);
52 	return (mntl);
53 }
54 
55 /*
56  * Return device number from extmnttab struct
57  */
58 dev_t
59 get_devid(mnt)
60 	struct extmnttab *mnt;
61 {
62 	return (makedev(mnt->mnt_major, mnt->mnt_minor));
63 }
64