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
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.
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]
24 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990, 1991, 1997 SMI */
28 /* All Rights Reserved */
34 #define LOCAL "/etc/default/fs"
35 #define REMOTE "/etc/dfs/fstypes"
38 * This is used to figure out the default file system type if "-F FStype"
39 * is not specified with the file system command and no entry in the
40 * /etc/vfstab matches the specified special.
41 * If the first character of the "special" is a "/" (eg, "/dev/dsk/c0d1s2"),
42 * returns the default local filesystem type.
43 * Otherwise (eg, "server:/path/name" or "resource"), returns the default
44 * remote filesystem type.
47 default_fstype(char *special
)
50 static char buf
[BUFSIZ
];
53 if (*special
== '/') {
54 if (defopen(LOCAL
) == 0) {
55 deffs
= defread("LOCAL=");
56 defopen(NULL
); /* close default file */
59 if ((fp
= fopen(REMOTE
, "r")) != NULL
) {
60 if (fgets(buf
, sizeof (buf
), fp
) != NULL
)
61 deffs
= strtok(buf
, " \t\n");
68 return (deffs
!= NULL
? deffs
: "ufs");