2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Dump memory to NFS swap file after a panic.
28 * We have no timeouts, context switches, etc.
29 */
30
31 #include <rpc/types.h>
32 #include <sys/param.h>
33 #include <sys/errno.h>
34 #include <sys/vnode.h>
35 #include <sys/bootconf.h>
36 #include <nfs/nfs.h>
37 #include <rpc/auth.h>
38 #include <rpc/xdr.h>
39 #include <rpc/rpc_msg.h>
40 #include <rpc/clnt.h>
41 #include <netinet/in.h>
352 nd_get_reply(TIUSER *tiptr, XDR *xdrp, uint32_t call_xid, int *badmsg)
353 {
354 static struct rpc_msg reply_msg;
355 static struct rpc_err rpc_err;
356 static struct nfsattrstat na;
357 static struct WRITE3res wres;
358 static struct t_kunitdata rudata;
359 int uderr;
360 int type;
361 int error;
362
363 *badmsg = 0;
364
365 rudata.addr.maxlen = 0;
366 rudata.opt.maxlen = 0;
367 rudata.udata.udata_mp = (mblk_t *)NULL;
368
369 nd_log("nfs_dump: calling t_krcvudata\n");
370
371 if (error = t_krcvudata(tiptr, &rudata, &type, &uderr)) {
372 nfs_perror(error, "\nnfs_dump: t_krcvudata failed: %m\n");
373 return (EIO);
374 }
375 if (type != T_DATA) {
376 cmn_err(CE_WARN, "\tnfs_dump: received type %d", type);
377 *badmsg = 1;
378 return (0);
379 }
380 if (!rudata.udata.udata_mp) {
381 cmn_err(CE_WARN, "\tnfs_dump: null receive");
382 *badmsg = 1;
383 return (0);
384 }
385
386 /*
387 * Decode results.
388 */
389 xdrmblk_init(xdrp, rudata.udata.udata_mp, XDR_DECODE, 0);
390
391 reply_msg.acpted_rply.ar_verf = _null_auth;
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Gary Mills
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Dump memory to NFS swap file after a panic.
29 * We have no timeouts, context switches, etc.
30 */
31
32 #include <rpc/types.h>
33 #include <sys/param.h>
34 #include <sys/errno.h>
35 #include <sys/vnode.h>
36 #include <sys/bootconf.h>
37 #include <nfs/nfs.h>
38 #include <rpc/auth.h>
39 #include <rpc/xdr.h>
40 #include <rpc/rpc_msg.h>
41 #include <rpc/clnt.h>
42 #include <netinet/in.h>
353 nd_get_reply(TIUSER *tiptr, XDR *xdrp, uint32_t call_xid, int *badmsg)
354 {
355 static struct rpc_msg reply_msg;
356 static struct rpc_err rpc_err;
357 static struct nfsattrstat na;
358 static struct WRITE3res wres;
359 static struct t_kunitdata rudata;
360 int uderr;
361 int type;
362 int error;
363
364 *badmsg = 0;
365
366 rudata.addr.maxlen = 0;
367 rudata.opt.maxlen = 0;
368 rudata.udata.udata_mp = (mblk_t *)NULL;
369
370 nd_log("nfs_dump: calling t_krcvudata\n");
371
372 if (error = t_krcvudata(tiptr, &rudata, &type, &uderr)) {
373 if (error == EBADMSG) {
374 cmn_err(CE_WARN, "\tnfs_dump: received EBADMSG");
375 *badmsg = 1;
376 return (0);
377 }
378 nfs_perror(error, "\nnfs_dump: t_krcvudata failed: %m\n");
379 return (EIO);
380 }
381 if (type != T_DATA) {
382 cmn_err(CE_WARN, "\tnfs_dump: received type %d", type);
383 *badmsg = 1;
384 return (0);
385 }
386 if (!rudata.udata.udata_mp) {
387 cmn_err(CE_WARN, "\tnfs_dump: null receive");
388 *badmsg = 1;
389 return (0);
390 }
391
392 /*
393 * Decode results.
394 */
395 xdrmblk_init(xdrp, rudata.udata.udata_mp, XDR_DECODE, 0);
396
397 reply_msg.acpted_rply.ar_verf = _null_auth;
|