fstab.c (84768) | fstab.c (90045) |
---|---|
1/* 2 * Copyright (c) 1980, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) | 1/* 2 * Copyright (c) 1980, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) |
35#if 0 | |
36static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; | 35static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; |
37#else 38static char rcsid[] = 39 "$FreeBSD: head/lib/libc/gen/fstab.c 84768 2001-10-10 17:48:44Z bde $"; 40#endif | |
41#endif /* LIBC_SCCS and not lint */ | 36#endif /* LIBC_SCCS and not lint */ |
37#include <sys/cdefs.h> 38__FBSDID("$FreeBSD: head/lib/libc/gen/fstab.c 90045 2002-02-01 01:32:19Z obrien $"); |
|
42 43#include "namespace.h" 44#include <sys/param.h> 45#include <sys/mount.h> 46#include <sys/stat.h> 47 48#include <errno.h> 49#include <fstab.h> 50#include <paths.h> 51#include <stdio.h> 52#include <stdlib.h> 53#include <string.h> 54#include <unistd.h> 55#include "un-namespace.h" 56 57static FILE *_fs_fp; 58static struct fstab _fs_fstab; 59static int LineNo = 0; 60 | 39 40#include "namespace.h" 41#include <sys/param.h> 42#include <sys/mount.h> 43#include <sys/stat.h> 44 45#include <errno.h> 46#include <fstab.h> 47#include <paths.h> 48#include <stdio.h> 49#include <stdlib.h> 50#include <string.h> 51#include <unistd.h> 52#include "un-namespace.h" 53 54static FILE *_fs_fp; 55static struct fstab _fs_fstab; 56static int LineNo = 0; 57 |
61static void error __P((int)); 62static void fixfsfile __P((void)); 63static int fstabscan __P((void)); | 58static void error(int); 59static void fixfsfile(void); 60static int fstabscan(void); |
64 65static void 66fixfsfile() 67{ 68 static char buf[sizeof(_PATH_DEV) + MNAMELEN]; 69 struct stat sb; 70 struct statfs sf; 71 --- 124 unchanged lines hidden (view full) --- 196{ 197 if ((!_fs_fp && !setfsent()) || !fstabscan()) 198 return((struct fstab *)NULL); 199 return(&_fs_fstab); 200} 201 202struct fstab * 203getfsspec(name) | 61 62static void 63fixfsfile() 64{ 65 static char buf[sizeof(_PATH_DEV) + MNAMELEN]; 66 struct stat sb; 67 struct statfs sf; 68 --- 124 unchanged lines hidden (view full) --- 193{ 194 if ((!_fs_fp && !setfsent()) || !fstabscan()) 195 return((struct fstab *)NULL); 196 return(&_fs_fstab); 197} 198 199struct fstab * 200getfsspec(name) |
204 register const char *name; | 201 const char *name; |
205{ 206 if (setfsent()) 207 while (fstabscan()) 208 if (!strcmp(_fs_fstab.fs_spec, name)) 209 return(&_fs_fstab); 210 return((struct fstab *)NULL); 211} 212 213struct fstab * 214getfsfile(name) | 202{ 203 if (setfsent()) 204 while (fstabscan()) 205 if (!strcmp(_fs_fstab.fs_spec, name)) 206 return(&_fs_fstab); 207 return((struct fstab *)NULL); 208} 209 210struct fstab * 211getfsfile(name) |
215 register const char *name; | 212 const char *name; |
216{ 217 if (setfsent()) 218 while (fstabscan()) 219 if (!strcmp(_fs_fstab.fs_file, name)) 220 return(&_fs_fstab); 221 return((struct fstab *)NULL); 222} 223 --- 41 unchanged lines hidden --- | 213{ 214 if (setfsent()) 215 while (fstabscan()) 216 if (!strcmp(_fs_fstab.fs_file, name)) 217 return(&_fs_fstab); 218 return((struct fstab *)NULL); 219} 220 --- 41 unchanged lines hidden --- |