'\" te .\" Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH GETVFSENT 3C "Nov 26, 2017" .SH NAME getvfsent, getvfsfile, getvfsspec, getvfsany \- get vfstab file entry .SH SYNOPSIS .LP .nf #include <stdio.h> #include <sys/vfstab.h> \fBint\fR \fBgetvfsent\fR(\fBFILE *\fR\fIfp\fR, \fBstruct vfstab *\fR\fIvp\fR); .fi .LP .nf \fBint\fR \fBgetvfsfile\fR(\fBFILE *\fR\fIfp\fR, \fBstruct vfstab *\fR\fIvp\fR, \fBchar *\fR\fIfile\fR); .fi .LP .nf \fBint\fR \fBgetvfsspec\fR(\fBFILE *\fR, \fBstruct vfstab *\fR\fIvp\fR, \fBchar *\fR\fIspec\fR); .fi .LP .nf \fBint\fR \fBgetvfsany\fR(\fBFILE *\fR, \fBstruct vfstab *\fR\fIvp\fR, \fBstruct vfstab *\fR\fIvref\fR); .fi .SH DESCRIPTION .LP The \fBgetvfsent()\fR, \fBgetvfsfile()\fR, \fBgetvfsspec()\fR, and \fBgetvfsany()\fR functions each fill in the structure pointed to by \fIvp\fR with the broken-out fields of a line in the \fB/etc/vfstab\fR file. Each line in the file contains a \fBvfstab\fR structure, declared in the <\fBsys/vfstab.h\fR> header, whose following members are described on the \fBvfstab\fR(4) manual page: .sp .in +2 .nf \fB char *vfs_special; char *vfs_fsckdev; char *vfs_mountp; char *vfs_fstype; char *vfs_fsckpass; char *vfs_automnt; char *vfs_mntopts;\fR .fi .in -2 .sp .LP The \fBgetvfsent()\fR function returns a pointer to the next \fBvfstab\fR structure in the file; so successive calls can be used to search the entire file. .sp .LP The \fBgetvfsfile()\fR function searches the file referenced by \fIfp\fR until a mount point matching \fBfile\fR is found and fills \fIvp\fR with the fields from the line in the file. .sp .LP The \fBgetvfsspec()\fR function searches the file referenced by \fIfp\fR until a special device matching \fIspec\fR is found and fills \fIvp\fR with the fields from the line in the file. The \fIspec\fR argument will try to match on device type (block or character special) and major and minor device numbers. If it cannot match in this manner, then it compares the strings. .sp .LP The \fBgetvfsany()\fR function searches the file referenced by \fIfp\fR until a match is found between a line in the file and \fIvref\fR. A match occurs if all non-null entries in \fIvref\fR match the corresponding fields in the file. .sp .LP Note that these functions do not open, close, or rewind the file. .SH RETURN VALUES .LP If the next entry is successfully read by \fBgetvfsent()\fR or a match is found with \fBgetvfsfile()\fR, \fBgetvfsspec()\fR, or \fBgetvfsany()\fR, \fB0\fR is returned. If an end-of-file is encountered on reading, these functions return \fB\(mi1\fR\&. If an error is encountered, a value greater than 0 is returned. The possible error values are: .sp .ne 2 .na \fB\fBVFS_TOOLONG\fR\fR .ad .RS 15n A line in the file exceeded the internal buffer size of \fBVFS_LINE_MAX\fR. .RE .sp .ne 2 .na \fB\fBVFS_TOOMANY\fR\fR .ad .RS 15n A line in the file contains too many fields. .RE .sp .ne 2 .na \fB\fBVFS_TOOFEW\fR\fR .ad .RS 15n A line in the file contains too few fields. .RE .SH FILES .LP \fB/etc/vfstab\fR .SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ MT-Level Safe .TE .SH SEE ALSO .LP \fBvfstab\fR(4), \fBattributes\fR(5) .SH NOTES .LP The members of the \fBvfstab\fR structure point to information contained in a static area, so it must be copied if it is to be saved.