parsenfsfh.c (75118) | parsenfsfh.c (98527) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation, 3 * Western Research Laboratory. All rights reserved. 4 * Copyright (c) 2001 Compaq Computer Corporation. All rights reserved. 5 * 6 * Permission to use, copy, and modify this software and its 7 * documentation is hereby granted only under the following terms and 8 * conditions. Both the above copyright notice and this permission 9 * notice must appear in all copies of the software, derivative works 10 * or modified versions, and any portions thereof, and both notices 11 * must appear in supporting documentation. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions 15 * are met: 16 * 1. Redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer. 18 * 2. Redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in 20 * the documentation and/or other materials provided with the 21 * distribution. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS" AND COMPAQ COMPUTER CORPORATION 24 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 25 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO 26 * EVENT SHALL COMPAQ COMPUTER CORPORATION BE LIABLE FOR ANY 27 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 28 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 29 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 30 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 31 * SOFTWARE. 32 */ 33 34/* |
|
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 * | 35 * parsenfsfh.c - portable parser for NFS file handles 36 * uses all sorts of heuristics 37 * 38 * Jeffrey C. Mogul 39 * Digital Equipment Corporation 40 * Western Research Laboratory 41 * |
9 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 75118 2001-04-03 07:50:46Z fenner $ | 42 * $FreeBSD: head/contrib/tcpdump/parsenfsfh.c 98527 2002-06-21 00:49:02Z fenner $ |
10 */ 11 12#ifndef lint 13static const char rcsid[] = | 43 */ 44 45#ifndef lint 46static const char rcsid[] = |
14 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.18 2000/07/01 03:39:00 assar Exp $ (LBL)"; | 47 "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001/09/17 21:57:53 fenner 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> --- 57 unchanged lines hidden (view full) --- 80static int is_UCX(unsigned char *); 81 82void 83Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself) 84register caddr_t *fh; 85int len; 86my_fsid *fsidp; 87ino_t *inop; | 48#endif 49 50#ifdef HAVE_CONFIG_H 51#include "config.h" 52#endif 53 54#include <sys/types.h> 55#include <sys/time.h> --- 57 unchanged lines hidden (view full) --- 113static int is_UCX(unsigned char *); 114 115void 116Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself) 117register caddr_t *fh; 118int len; 119my_fsid *fsidp; 120ino_t *inop; |
88char **osnamep; /* if non-NULL, return OS name here */ 89char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */ | 121const char **osnamep; /* if non-NULL, return OS name here */ 122const char **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; 96 97 if (ourself) { --- 268 unchanged lines hidden (view full) --- 366 367 if (osnamep) 368 *osnamep = "HPUX9"; 369 break; 370 371 case FHT_UNKNOWN: 372#ifdef DEBUG 373 /* XXX debugging */ | 123int ourself; /* true if file handle was generated on this host */ 124{ 125 register unsigned char *fhp = (unsigned char *)fh; 126 u_int32_t temp; 127 int fhtype = FHT_UNKNOWN; 128 int i; 129 130 if (ourself) { --- 268 unchanged lines hidden (view full) --- 399 400 if (osnamep) 401 *osnamep = "HPUX9"; 402 break; 403 404 case FHT_UNKNOWN: 405#ifdef DEBUG 406 /* XXX debugging */ |
374 int i; | |
375 for (i = 0; i < 32; i++) 376 (void)fprintf(stderr, "%x.", fhp[i]); 377 (void)fprintf(stderr, "\n"); 378#endif | 407 for (i = 0; i < 32; i++) 408 (void)fprintf(stderr, "%x.", fhp[i]); 409 (void)fprintf(stderr, "\n"); 410#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++) | 411 /* Save the actual handle, so it can be display with -u */ 412 for (i = 0; i < 32; i++) |
383 (void)sprintf(&(fsidp->Opaque_Handle[i*2]), "%.2X", fhp[i]); | 413 (void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X", fhp[i]); |
384 | 414 |
415 /* XXX for now, give "bogus" values to aid debugging */ |
|
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 --- | 416 fsidp->fsid_code = 0; 417 fsidp->Fsid_dev.Minor = 257; 418 fsidp->Fsid_dev.Major = 257; 419 *inop = 1; 420 421 /* display will show this string instead of (257,257) */ 422 if (fsnamep) 423 *fsnamep = "Unknown"; --- 39 unchanged lines hidden --- |