2 * cvfs.c -- completevfs() function for lsof library
7 * Copyright 1997 Purdue Research Foundation, West Lafayette, Indiana
8 * 47907. All rights reserved.
10 * Written by Victor A. Abell
12 * This software is not subject to any license of the American Telephone
13 * and Telegraph Company or the Regents of the University of California.
15 * Permission is granted to anyone to use this software for any purpose on
16 * any computer system, and to alter it and redistribute it freely, subject
17 * to the following restrictions:
19 * 1. Neither the authors nor Purdue University are responsible for any
20 * consequences of the use of this software.
22 * 2. The origin of this software must not be misrepresented, either by
23 * explicit claim or by omission. Credit to the authors and Purdue
24 * University must appear in documentation and sources.
26 * 3. Altered versions must be plainly marked as such, and must not be
27 * misrepresented as being the original software.
29 * 4. This notice may not be removed or altered.
34 * The caller must define CVFS_DEVSAVE to have the device number moved
35 * from the mounts entry to the local vfs structure.
37 * The caller must define CVFS_NLKSAVE to have the link count moved from
38 * the mounts entry to the local vfs structure.
40 * The caller must define CVFS_SZSAVE to have the size moved from the
41 * mounts entry to the local vfs structure.
45 #include "../machine.h"
47 #if defined(USE_LIB_COMPLETEVFS)
50 static char copyright[] =
51 "@(#) Copyright 1997 Purdue Research Foundation.\nAll rights reserved.\n";
52 static char *rcsid = "$Id: cvfs.c,v 1.6 2008/10/21 16:12:36 abe Exp $";
53 # endif /* !defined(lint) */
59 * completevfs() - complete local vfs structure
64 struct l_vfs *vfs; /* local vfs structure pointer */
65 dev_t *dev; /* device */
69 * If only Internet socket files are selected, don't bother completing the
70 * local vfs structure.
75 * Search for a match on device number.
77 for (mp = readmnt(); mp; mp = mp->next) {
78 if (mp->dev == *dev) {
80 # if defined(CVFS_DEVSAVE)
82 # endif /* defined(CVFS_DEVSAVE) */
84 # if defined(CVFS_NLKSAVE)
85 vfs->nlink = mp->nlink;
86 # endif /* defined(CVFS_NLKSAVE) */
88 # if defined(CVFS_SZSAVE)
90 # endif /* defined(CVFS_SZSAVE) */
93 vfs->fsname = mp->fsname;
95 # if defined(HASFSINO)
96 vfs->fs_ino = mp->inode;
97 # endif /* defined(HASFSINO) */
99 # if defined(HASMNTSTAT)
100 vfs->mnt_stat = mp->stat;
101 # endif /* defined(HASMNTSTAT) */
108 #else /* !defined(USE_LIB_COMPLETEVFS) */
109 char cvfs_d1[] = "d"; char *cvfs_d2 = cvfs_d1;
110 #endif /* defined(USE_LIB_COMPLETEVFS) */