optr.c (71750) | optr.c (71787) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94"; 37#endif 38static const char rcsid[] = | 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 --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/sbin/dump/optr.c 71750 2001-01-28 21:21:37Z phk $"; | 39 "$FreeBSD: head/sbin/dump/optr.c 71787 2001-01-29 09:45:51Z phk $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> | 40#endif /* not lint */ 41 42#include <sys/param.h> |
43#include <sys/queue.h> |
|
43#include <sys/wait.h> 44#include <sys/time.h> 45 46#include <errno.h> 47#include <fstab.h> 48#include <grp.h> 49#include <stdio.h> 50#include <stdlib.h> --- 345 unchanged lines hidden (view full) --- 396 (new->fs_spec = strdup(fs->fs_spec)) == NULL) 397 quit("%s\n", strerror(errno)); 398 new->fs_passno = fs->fs_passno; 399 new->fs_freq = fs->fs_freq; 400 return (new); 401} 402 403struct pfstab { | 44#include <sys/wait.h> 45#include <sys/time.h> 46 47#include <errno.h> 48#include <fstab.h> 49#include <grp.h> 50#include <stdio.h> 51#include <stdlib.h> --- 345 unchanged lines hidden (view full) --- 397 (new->fs_spec = strdup(fs->fs_spec)) == NULL) 398 quit("%s\n", strerror(errno)); 399 new->fs_passno = fs->fs_passno; 400 new->fs_freq = fs->fs_freq; 401 return (new); 402} 403 404struct pfstab { |
404 struct pfstab *pf_next; | 405 SLIST_ENTRY(pfstab) pf_list; |
405 struct fstab *pf_fstab; 406}; 407 | 406 struct fstab *pf_fstab; 407}; 408 |
408static struct pfstab *table; | 409static SLIST_HEAD(, pfstab) table; |
409 410void 411getfstab() 412{ 413 register struct fstab *fs; 414 register struct pfstab *pf; 415 416 if (setfsent() == 0) { --- 5 unchanged lines hidden (view full) --- 422 if (strcmp(fs->fs_type, FSTAB_RW) && 423 strcmp(fs->fs_type, FSTAB_RO) && 424 strcmp(fs->fs_type, FSTAB_RQ)) 425 continue; 426 fs = allocfsent(fs); 427 if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL) 428 quit("%s\n", strerror(errno)); 429 pf->pf_fstab = fs; | 410 411void 412getfstab() 413{ 414 register struct fstab *fs; 415 register struct pfstab *pf; 416 417 if (setfsent() == 0) { --- 5 unchanged lines hidden (view full) --- 423 if (strcmp(fs->fs_type, FSTAB_RW) && 424 strcmp(fs->fs_type, FSTAB_RO) && 425 strcmp(fs->fs_type, FSTAB_RQ)) 426 continue; 427 fs = allocfsent(fs); 428 if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL) 429 quit("%s\n", strerror(errno)); 430 pf->pf_fstab = fs; |
430 pf->pf_next = table; 431 table = pf; | 431 SLIST_INSERT_HEAD(&table, pf, pf_list); |
432 } 433 (void) endfsent(); 434} 435 436/* 437 * Search in the fstab for a file name. 438 * This file name can be either the special or the path file name. 439 * 440 * The file name can omit the leading '/'. 441 */ 442struct fstab * 443fstabsearch(key) 444 char *key; 445{ 446 register struct pfstab *pf; 447 register struct fstab *fs; 448 char *rn; 449 | 432 } 433 (void) endfsent(); 434} 435 436/* 437 * Search in the fstab for a file name. 438 * This file name can be either the special or the path file name. 439 * 440 * The file name can omit the leading '/'. 441 */ 442struct fstab * 443fstabsearch(key) 444 char *key; 445{ 446 register struct pfstab *pf; 447 register struct fstab *fs; 448 char *rn; 449 |
450 for (pf = table; pf != NULL; pf = pf->pf_next) { | 450 SLIST_FOREACH(pf, &table, pf_list) { |
451 fs = pf->pf_fstab; 452 if (strcmp(fs->fs_file, key) == 0 || 453 strcmp(fs->fs_spec, key) == 0) 454 return (fs); 455 rn = rawname(fs->fs_spec); 456 if (rn != NULL && strcmp(rn, key) == 0) 457 return (fs); 458 if (key[0] != '/') { --- 75 unchanged lines hidden --- | 451 fs = pf->pf_fstab; 452 if (strcmp(fs->fs_file, key) == 0 || 453 strcmp(fs->fs_spec, key) == 0) 454 return (fs); 455 rn = rawname(fs->fs_spec); 456 if (rn != NULL && strcmp(rn, key) == 0) 457 return (fs); 458 if (key[0] != '/') { --- 75 unchanged lines hidden --- |