parsenfsfh.c (56896) | parsenfsfh.c (75118) |
---|---|
1/* 2 * parsenfsfh.c - portable parser for NFS file handles 3 * uses all sorts of heuristics 4 * 5 * Jeffrey C. Mogul 6 * Digital Equipment Corporation 7 * Western Research Laboratory 8 * | 1/* 2 * parsenfsfh.c - portable parser for NFS file handles 3 * uses all sorts of heuristics 4 * 5 * Jeffrey C. Mogul 6 * Digital Equipment Corporation 7 * Western Research Laboratory 8 * |
9 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 56896 2000-01-30 01:05:24Z fenner $ | 9 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 75118 2001-04-03 07:50:46Z fenner $ |
10 */ 11 12#ifndef lint 13static const char rcsid[] = | 10 */ 11 12#ifndef lint 13static const char rcsid[] = |
14 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.16 1999/11/21 09:36:47 fenner Exp $ (LBL)"; | 14 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.18 2000/07/01 03:39:00 assar Exp $ (LBL)"; |
15#endif 16 17#ifdef HAVE_CONFIG_H 18#include "config.h" 19#endif 20 21#include <sys/types.h> 22#include <sys/time.h> 23 24#include <ctype.h> | 15#endif 16 17#ifdef HAVE_CONFIG_H 18#include "config.h" 19#endif 20 21#include <sys/types.h> 22#include <sys/time.h> 23 24#include <ctype.h> |
25#ifdef HAVE_MEMORY_H 26#include <memory.h> 27#endif | |
28#include <stdio.h> 29#include <string.h> 30 31#include "interface.h" 32#include "nfsfh.h" 33 34/* 35 * This routine attempts to parse a file handle (in network byte order), --- 54 unchanged lines hidden (view full) --- 90ino_t *inop; 91char **osnamep; /* if non-NULL, return OS name here */ 92char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ 93int ourself; /* true if file handle was generated on this host */ 94{ 95 register unsigned char *fhp = (unsigned char *)fh; 96 u_int32_t temp; 97 int fhtype = FHT_UNKNOWN; | 25#include <stdio.h> 26#include <string.h> 27 28#include "interface.h" 29#include "nfsfh.h" 30 31/* 32 * This routine attempts to parse a file handle (in network byte order), --- 54 unchanged lines hidden (view full) --- 87ino_t *inop; 88char **osnamep; /* if non-NULL, return OS name here */ 89char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ 90int ourself; /* true if file handle was generated on this host */ 91{ 92 register unsigned char *fhp = (unsigned char *)fh; 93 u_int32_t temp; 94 int fhtype = FHT_UNKNOWN; |
95 int i; |
|
98 99 if (ourself) { 100 /* File handle generated on this host, no need for guessing */ 101#if defined(IRIX40) 102 fhtype = FHT_IRIX4; 103#endif 104#if defined(IRIX50) 105 fhtype = FHT_IRIX5; --- 261 unchanged lines hidden (view full) --- 367 *inop = temp; 368 369 if (osnamep) 370 *osnamep = "HPUX9"; 371 break; 372 373 case FHT_UNKNOWN: 374#ifdef DEBUG | 96 97 if (ourself) { 98 /* File handle generated on this host, no need for guessing */ 99#if defined(IRIX40) 100 fhtype = FHT_IRIX4; 101#endif 102#if defined(IRIX50) 103 fhtype = FHT_IRIX5; --- 261 unchanged lines hidden (view full) --- 365 *inop = temp; 366 367 if (osnamep) 368 *osnamep = "HPUX9"; 369 break; 370 371 case FHT_UNKNOWN: 372#ifdef DEBUG |
375 { 376 /* XXX debugging */ 377 int i; 378 for (i = 0; i < 32; i++) 379 (void)fprintf(stderr, "%x.", fhp[i]); 380 (void)fprintf(stderr, "\n"); 381 } | 373 /* XXX debugging */ 374 int i; 375 for (i = 0; i < 32; i++) 376 (void)fprintf(stderr, "%x.", fhp[i]); 377 (void)fprintf(stderr, "\n"); |
382#endif 383 /* XXX for now, give "bogus" values to aid debugging */ | 378#endif 379 /* XXX for now, give "bogus" values to aid debugging */ |
380 381 /* Save the actual handle, so it can be display with -u */ 382 for (i = 0; i < 32; i++) 383 (void)sprintf(&(fsidp->Opaque_Handle[i*2]), "%.2X", fhp[i]); 384 |
|
384 fsidp->fsid_code = 0; 385 fsidp->Fsid_dev.Minor = 257; 386 fsidp->Fsid_dev.Major = 257; 387 *inop = 1; 388 389 /* display will show this string instead of (257,257) */ 390 if (fsnamep) 391 *fsnamep = "Unknown"; --- 39 unchanged lines hidden --- | 385 fsidp->fsid_code = 0; 386 fsidp->Fsid_dev.Minor = 257; 387 fsidp->Fsid_dev.Major = 257; 388 *inop = 1; 389 390 /* display will show this string instead of (257,257) */ 391 if (fsnamep) 392 *fsnamep = "Unknown"; --- 39 unchanged lines hidden --- |