GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/librpcsvc/nfs_prot.c Lines: 0 395 0.0 %
Date: 2017-11-13 Branches: 0 324 0.0 %

Line Branch Exec Source
1
/*
2
 * Please do not edit this file.
3
 * It was generated using rpcgen.
4
 */
5
6
#include "nfs_prot.h"
7
8
bool_t
9
xdr_nfsstat(XDR *xdrs, nfsstat *objp)
10
{
11
12
	if (!xdr_enum(xdrs, (enum_t *)objp))
13
		return (FALSE);
14
	return (TRUE);
15
}
16
17
bool_t
18
xdr_ftype(XDR *xdrs, ftype *objp)
19
{
20
21
	if (!xdr_enum(xdrs, (enum_t *)objp))
22
		return (FALSE);
23
	return (TRUE);
24
}
25
26
bool_t
27
xdr_nfs_fh(XDR *xdrs, nfs_fh *objp)
28
{
29
30
31
	if (!xdr_opaque(xdrs, objp->data, NFS_FHSIZE))
32
		return (FALSE);
33
	return (TRUE);
34
}
35
36
bool_t
37
xdr_nfstime(XDR *xdrs, nfstime *objp)
38
{
39
40
41
	if (!xdr_u_int(xdrs, &objp->seconds))
42
		return (FALSE);
43
	if (!xdr_u_int(xdrs, &objp->useconds))
44
		return (FALSE);
45
	return (TRUE);
46
}
47
48
bool_t
49
xdr_fattr(XDR *xdrs, fattr *objp)
50
{
51
52
	int32_t *buf;
53
54
	if (xdrs->x_op == XDR_ENCODE) {
55
		if (!xdr_ftype(xdrs, &objp->type))
56
			return (FALSE);
57
		buf = (int32_t *)XDR_INLINE(xdrs,
58
		    10 * BYTES_PER_XDR_UNIT);
59
		if (buf == NULL) {
60
			if (!xdr_u_int(xdrs, &objp->mode))
61
				return (FALSE);
62
			if (!xdr_u_int(xdrs, &objp->nlink))
63
				return (FALSE);
64
			if (!xdr_u_int(xdrs, &objp->uid))
65
				return (FALSE);
66
			if (!xdr_u_int(xdrs, &objp->gid))
67
				return (FALSE);
68
			if (!xdr_u_int(xdrs, &objp->size))
69
				return (FALSE);
70
			if (!xdr_u_int(xdrs, &objp->blocksize))
71
				return (FALSE);
72
			if (!xdr_u_int(xdrs, &objp->rdev))
73
				return (FALSE);
74
			if (!xdr_u_int(xdrs, &objp->blocks))
75
				return (FALSE);
76
			if (!xdr_u_int(xdrs, &objp->fsid))
77
				return (FALSE);
78
			if (!xdr_u_int(xdrs, &objp->fileid))
79
				return (FALSE);
80
		} else {
81
			IXDR_PUT_U_LONG(buf, objp->mode);
82
			IXDR_PUT_U_LONG(buf, objp->nlink);
83
			IXDR_PUT_U_LONG(buf, objp->uid);
84
			IXDR_PUT_U_LONG(buf, objp->gid);
85
			IXDR_PUT_U_LONG(buf, objp->size);
86
			IXDR_PUT_U_LONG(buf, objp->blocksize);
87
			IXDR_PUT_U_LONG(buf, objp->rdev);
88
			IXDR_PUT_U_LONG(buf, objp->blocks);
89
			IXDR_PUT_U_LONG(buf, objp->fsid);
90
			IXDR_PUT_U_LONG(buf, objp->fileid);
91
		}
92
		if (!xdr_nfstime(xdrs, &objp->atime))
93
			return (FALSE);
94
		if (!xdr_nfstime(xdrs, &objp->mtime))
95
			return (FALSE);
96
		if (!xdr_nfstime(xdrs, &objp->ctime))
97
			return (FALSE);
98
		return (TRUE);
99
	} else if (xdrs->x_op == XDR_DECODE) {
100
		if (!xdr_ftype(xdrs, &objp->type))
101
			return (FALSE);
102
		buf = (int32_t *)XDR_INLINE(xdrs,
103
		    10 * BYTES_PER_XDR_UNIT);
104
		if (buf == NULL) {
105
			if (!xdr_u_int(xdrs, &objp->mode))
106
				return (FALSE);
107
			if (!xdr_u_int(xdrs, &objp->nlink))
108
				return (FALSE);
109
			if (!xdr_u_int(xdrs, &objp->uid))
110
				return (FALSE);
111
			if (!xdr_u_int(xdrs, &objp->gid))
112
				return (FALSE);
113
			if (!xdr_u_int(xdrs, &objp->size))
114
				return (FALSE);
115
			if (!xdr_u_int(xdrs, &objp->blocksize))
116
				return (FALSE);
117
			if (!xdr_u_int(xdrs, &objp->rdev))
118
				return (FALSE);
119
			if (!xdr_u_int(xdrs, &objp->blocks))
120
				return (FALSE);
121
			if (!xdr_u_int(xdrs, &objp->fsid))
122
				return (FALSE);
123
			if (!xdr_u_int(xdrs, &objp->fileid))
124
				return (FALSE);
125
		} else {
126
			objp->mode = IXDR_GET_U_LONG(buf);
127
			objp->nlink = IXDR_GET_U_LONG(buf);
128
			objp->uid = IXDR_GET_U_LONG(buf);
129
			objp->gid = IXDR_GET_U_LONG(buf);
130
			objp->size = IXDR_GET_U_LONG(buf);
131
			objp->blocksize = IXDR_GET_U_LONG(buf);
132
			objp->rdev = IXDR_GET_U_LONG(buf);
133
			objp->blocks = IXDR_GET_U_LONG(buf);
134
			objp->fsid = IXDR_GET_U_LONG(buf);
135
			objp->fileid = IXDR_GET_U_LONG(buf);
136
		}
137
		if (!xdr_nfstime(xdrs, &objp->atime))
138
			return (FALSE);
139
		if (!xdr_nfstime(xdrs, &objp->mtime))
140
			return (FALSE);
141
		if (!xdr_nfstime(xdrs, &objp->ctime))
142
			return (FALSE);
143
		return (TRUE);
144
	}
145
146
	if (!xdr_ftype(xdrs, &objp->type))
147
		return (FALSE);
148
	if (!xdr_u_int(xdrs, &objp->mode))
149
		return (FALSE);
150
	if (!xdr_u_int(xdrs, &objp->nlink))
151
		return (FALSE);
152
	if (!xdr_u_int(xdrs, &objp->uid))
153
		return (FALSE);
154
	if (!xdr_u_int(xdrs, &objp->gid))
155
		return (FALSE);
156
	if (!xdr_u_int(xdrs, &objp->size))
157
		return (FALSE);
158
	if (!xdr_u_int(xdrs, &objp->blocksize))
159
		return (FALSE);
160
	if (!xdr_u_int(xdrs, &objp->rdev))
161
		return (FALSE);
162
	if (!xdr_u_int(xdrs, &objp->blocks))
163
		return (FALSE);
164
	if (!xdr_u_int(xdrs, &objp->fsid))
165
		return (FALSE);
166
	if (!xdr_u_int(xdrs, &objp->fileid))
167
		return (FALSE);
168
	if (!xdr_nfstime(xdrs, &objp->atime))
169
		return (FALSE);
170
	if (!xdr_nfstime(xdrs, &objp->mtime))
171
		return (FALSE);
172
	if (!xdr_nfstime(xdrs, &objp->ctime))
173
		return (FALSE);
174
	return (TRUE);
175
}
176
177
bool_t
178
xdr_sattr(XDR *xdrs, sattr *objp)
179
{
180
181
	int32_t *buf;
182
183
	if (xdrs->x_op == XDR_ENCODE) {
184
		buf = (int32_t *)XDR_INLINE(xdrs,
185
		    4 * BYTES_PER_XDR_UNIT);
186
		if (buf == NULL) {
187
			if (!xdr_u_int(xdrs, &objp->mode))
188
				return (FALSE);
189
			if (!xdr_u_int(xdrs, &objp->uid))
190
				return (FALSE);
191
			if (!xdr_u_int(xdrs, &objp->gid))
192
				return (FALSE);
193
			if (!xdr_u_int(xdrs, &objp->size))
194
				return (FALSE);
195
		} else {
196
			IXDR_PUT_U_LONG(buf, objp->mode);
197
			IXDR_PUT_U_LONG(buf, objp->uid);
198
			IXDR_PUT_U_LONG(buf, objp->gid);
199
			IXDR_PUT_U_LONG(buf, objp->size);
200
		}
201
		if (!xdr_nfstime(xdrs, &objp->atime))
202
			return (FALSE);
203
		if (!xdr_nfstime(xdrs, &objp->mtime))
204
			return (FALSE);
205
		return (TRUE);
206
	} else if (xdrs->x_op == XDR_DECODE) {
207
		buf = (int32_t *)XDR_INLINE(xdrs,
208
		    4 * BYTES_PER_XDR_UNIT);
209
		if (buf == NULL) {
210
			if (!xdr_u_int(xdrs, &objp->mode))
211
				return (FALSE);
212
			if (!xdr_u_int(xdrs, &objp->uid))
213
				return (FALSE);
214
			if (!xdr_u_int(xdrs, &objp->gid))
215
				return (FALSE);
216
			if (!xdr_u_int(xdrs, &objp->size))
217
				return (FALSE);
218
		} else {
219
			objp->mode = IXDR_GET_U_LONG(buf);
220
			objp->uid = IXDR_GET_U_LONG(buf);
221
			objp->gid = IXDR_GET_U_LONG(buf);
222
			objp->size = IXDR_GET_U_LONG(buf);
223
		}
224
		if (!xdr_nfstime(xdrs, &objp->atime))
225
			return (FALSE);
226
		if (!xdr_nfstime(xdrs, &objp->mtime))
227
			return (FALSE);
228
		return (TRUE);
229
	}
230
231
	if (!xdr_u_int(xdrs, &objp->mode))
232
		return (FALSE);
233
	if (!xdr_u_int(xdrs, &objp->uid))
234
		return (FALSE);
235
	if (!xdr_u_int(xdrs, &objp->gid))
236
		return (FALSE);
237
	if (!xdr_u_int(xdrs, &objp->size))
238
		return (FALSE);
239
	if (!xdr_nfstime(xdrs, &objp->atime))
240
		return (FALSE);
241
	if (!xdr_nfstime(xdrs, &objp->mtime))
242
		return (FALSE);
243
	return (TRUE);
244
}
245
246
bool_t
247
xdr_filename(XDR *xdrs, filename *objp)
248
{
249
250
	if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN))
251
		return (FALSE);
252
	return (TRUE);
253
}
254
255
bool_t
256
xdr_nfspath(XDR *xdrs, nfspath *objp)
257
{
258
259
	if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN))
260
		return (FALSE);
261
	return (TRUE);
262
}
263
264
bool_t
265
xdr_attrstat(XDR *xdrs, attrstat *objp)
266
{
267
268
	if (!xdr_nfsstat(xdrs, &objp->status))
269
		return (FALSE);
270
	switch (objp->status) {
271
	case NFS_OK:
272
		if (!xdr_fattr(xdrs, &objp->attrstat_u.attributes))
273
			return (FALSE);
274
		break;
275
	default:
276
		break;
277
	}
278
	return (TRUE);
279
}
280
281
bool_t
282
xdr_sattrargs(XDR *xdrs, sattrargs *objp)
283
{
284
285
286
	if (!xdr_nfs_fh(xdrs, &objp->file))
287
		return (FALSE);
288
	if (!xdr_sattr(xdrs, &objp->attributes))
289
		return (FALSE);
290
	return (TRUE);
291
}
292
293
bool_t
294
xdr_diropargs(XDR *xdrs, diropargs *objp)
295
{
296
297
298
	if (!xdr_nfs_fh(xdrs, &objp->dir))
299
		return (FALSE);
300
	if (!xdr_filename(xdrs, &objp->name))
301
		return (FALSE);
302
	return (TRUE);
303
}
304
305
bool_t
306
xdr_diropokres(XDR *xdrs, diropokres *objp)
307
{
308
309
310
	if (!xdr_nfs_fh(xdrs, &objp->file))
311
		return (FALSE);
312
	if (!xdr_fattr(xdrs, &objp->attributes))
313
		return (FALSE);
314
	return (TRUE);
315
}
316
317
bool_t
318
xdr_diropres(XDR *xdrs, diropres *objp)
319
{
320
321
	if (!xdr_nfsstat(xdrs, &objp->status))
322
		return (FALSE);
323
	switch (objp->status) {
324
	case NFS_OK:
325
		if (!xdr_diropokres(xdrs, &objp->diropres_u.diropres))
326
			return (FALSE);
327
		break;
328
	default:
329
		break;
330
	}
331
	return (TRUE);
332
}
333
334
bool_t
335
xdr_readlinkres(XDR *xdrs, readlinkres *objp)
336
{
337
338
	if (!xdr_nfsstat(xdrs, &objp->status))
339
		return (FALSE);
340
	switch (objp->status) {
341
	case NFS_OK:
342
		if (!xdr_nfspath(xdrs, &objp->readlinkres_u.data))
343
			return (FALSE);
344
		break;
345
	default:
346
		break;
347
	}
348
	return (TRUE);
349
}
350
351
bool_t
352
xdr_readargs(XDR *xdrs, readargs *objp)
353
{
354
355
356
	if (!xdr_nfs_fh(xdrs, &objp->file))
357
		return (FALSE);
358
	if (!xdr_u_int(xdrs, &objp->offset))
359
		return (FALSE);
360
	if (!xdr_u_int(xdrs, &objp->count))
361
		return (FALSE);
362
	if (!xdr_u_int(xdrs, &objp->totalcount))
363
		return (FALSE);
364
	return (TRUE);
365
}
366
367
bool_t
368
xdr_readokres(XDR *xdrs, readokres *objp)
369
{
370
371
372
	if (!xdr_fattr(xdrs, &objp->attributes))
373
		return (FALSE);
374
	if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
375
	    (u_int *)&objp->data.data_len,
376
	    NFS_MAXDATA))
377
		return (FALSE);
378
	return (TRUE);
379
}
380
381
bool_t
382
xdr_readres(XDR *xdrs, readres *objp)
383
{
384
385
	if (!xdr_nfsstat(xdrs, &objp->status))
386
		return (FALSE);
387
	switch (objp->status) {
388
	case NFS_OK:
389
		if (!xdr_readokres(xdrs, &objp->readres_u.reply))
390
			return (FALSE);
391
		break;
392
	default:
393
		break;
394
	}
395
	return (TRUE);
396
}
397
398
bool_t
399
xdr_writeargs(XDR *xdrs, writeargs *objp)
400
{
401
402
	int32_t *buf;
403
404
	if (xdrs->x_op == XDR_ENCODE) {
405
		if (!xdr_nfs_fh(xdrs, &objp->file))
406
			return (FALSE);
407
		buf = (int32_t *)XDR_INLINE(xdrs,
408
		    3 * BYTES_PER_XDR_UNIT);
409
		if (buf == NULL) {
410
			if (!xdr_u_int(xdrs, &objp->beginoffset))
411
				return (FALSE);
412
			if (!xdr_u_int(xdrs, &objp->offset))
413
				return (FALSE);
414
			if (!xdr_u_int(xdrs, &objp->totalcount))
415
				return (FALSE);
416
		} else {
417
			IXDR_PUT_U_LONG(buf, objp->beginoffset);
418
			IXDR_PUT_U_LONG(buf, objp->offset);
419
			IXDR_PUT_U_LONG(buf, objp->totalcount);
420
		}
421
		if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
422
	    (u_int *)&objp->data.data_len,
423
	    NFS_MAXDATA))
424
			return (FALSE);
425
		return (TRUE);
426
	} else if (xdrs->x_op == XDR_DECODE) {
427
		if (!xdr_nfs_fh(xdrs, &objp->file))
428
			return (FALSE);
429
		buf = (int32_t *)XDR_INLINE(xdrs,
430
		    3 * BYTES_PER_XDR_UNIT);
431
		if (buf == NULL) {
432
			if (!xdr_u_int(xdrs, &objp->beginoffset))
433
				return (FALSE);
434
			if (!xdr_u_int(xdrs, &objp->offset))
435
				return (FALSE);
436
			if (!xdr_u_int(xdrs, &objp->totalcount))
437
				return (FALSE);
438
		} else {
439
			objp->beginoffset = IXDR_GET_U_LONG(buf);
440
			objp->offset = IXDR_GET_U_LONG(buf);
441
			objp->totalcount = IXDR_GET_U_LONG(buf);
442
		}
443
		if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
444
	    (u_int *)&objp->data.data_len,
445
	    NFS_MAXDATA))
446
			return (FALSE);
447
		return (TRUE);
448
	}
449
450
	if (!xdr_nfs_fh(xdrs, &objp->file))
451
		return (FALSE);
452
	if (!xdr_u_int(xdrs, &objp->beginoffset))
453
		return (FALSE);
454
	if (!xdr_u_int(xdrs, &objp->offset))
455
		return (FALSE);
456
	if (!xdr_u_int(xdrs, &objp->totalcount))
457
		return (FALSE);
458
	if (!xdr_bytes(xdrs, (char **)&objp->data.data_val,
459
	    (u_int *)&objp->data.data_len,
460
	    NFS_MAXDATA))
461
		return (FALSE);
462
	return (TRUE);
463
}
464
465
bool_t
466
xdr_createargs(XDR *xdrs, createargs *objp)
467
{
468
469
470
	if (!xdr_diropargs(xdrs, &objp->where))
471
		return (FALSE);
472
	if (!xdr_sattr(xdrs, &objp->attributes))
473
		return (FALSE);
474
	return (TRUE);
475
}
476
477
bool_t
478
xdr_renameargs(XDR *xdrs, renameargs *objp)
479
{
480
481
482
	if (!xdr_diropargs(xdrs, &objp->from))
483
		return (FALSE);
484
	if (!xdr_diropargs(xdrs, &objp->to))
485
		return (FALSE);
486
	return (TRUE);
487
}
488
489
bool_t
490
xdr_linkargs(XDR *xdrs, linkargs *objp)
491
{
492
493
494
	if (!xdr_nfs_fh(xdrs, &objp->from))
495
		return (FALSE);
496
	if (!xdr_diropargs(xdrs, &objp->to))
497
		return (FALSE);
498
	return (TRUE);
499
}
500
501
bool_t
502
xdr_symlinkargs(XDR *xdrs, symlinkargs *objp)
503
{
504
505
506
	if (!xdr_diropargs(xdrs, &objp->from))
507
		return (FALSE);
508
	if (!xdr_nfspath(xdrs, &objp->to))
509
		return (FALSE);
510
	if (!xdr_sattr(xdrs, &objp->attributes))
511
		return (FALSE);
512
	return (TRUE);
513
}
514
515
bool_t
516
xdr_nfscookie(XDR *xdrs, nfscookie objp)
517
{
518
519
	if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE))
520
		return (FALSE);
521
	return (TRUE);
522
}
523
524
bool_t
525
xdr_readdirargs(XDR *xdrs, readdirargs *objp)
526
{
527
528
529
	if (!xdr_nfs_fh(xdrs, &objp->dir))
530
		return (FALSE);
531
	if (!xdr_nfscookie(xdrs, objp->cookie))
532
		return (FALSE);
533
	if (!xdr_u_int(xdrs, &objp->count))
534
		return (FALSE);
535
	return (TRUE);
536
}
537
538
bool_t
539
xdr_entry(XDR *xdrs, entry *objp)
540
{
541
542
543
	if (!xdr_u_int(xdrs, &objp->fileid))
544
		return (FALSE);
545
	if (!xdr_filename(xdrs, &objp->name))
546
		return (FALSE);
547
	if (!xdr_nfscookie(xdrs, objp->cookie))
548
		return (FALSE);
549
	if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry), (xdrproc_t)xdr_entry))
550
		return (FALSE);
551
	return (TRUE);
552
}
553
554
bool_t
555
xdr_dirlist(XDR *xdrs, dirlist *objp)
556
{
557
558
559
	if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entry), (xdrproc_t)xdr_entry))
560
		return (FALSE);
561
	if (!xdr_bool(xdrs, &objp->eof))
562
		return (FALSE);
563
	return (TRUE);
564
}
565
566
bool_t
567
xdr_readdirres(XDR *xdrs, readdirres *objp)
568
{
569
570
	if (!xdr_nfsstat(xdrs, &objp->status))
571
		return (FALSE);
572
	switch (objp->status) {
573
	case NFS_OK:
574
		if (!xdr_dirlist(xdrs, &objp->readdirres_u.reply))
575
			return (FALSE);
576
		break;
577
	default:
578
		break;
579
	}
580
	return (TRUE);
581
}
582
583
bool_t
584
xdr_statfsokres(XDR *xdrs, statfsokres *objp)
585
{
586
587
	int32_t *buf;
588
589
	if (xdrs->x_op == XDR_ENCODE) {
590
		buf = (int32_t *)XDR_INLINE(xdrs,
591
		    5 * BYTES_PER_XDR_UNIT);
592
		if (buf == NULL) {
593
			if (!xdr_u_int(xdrs, &objp->tsize))
594
				return (FALSE);
595
			if (!xdr_u_int(xdrs, &objp->bsize))
596
				return (FALSE);
597
			if (!xdr_u_int(xdrs, &objp->blocks))
598
				return (FALSE);
599
			if (!xdr_u_int(xdrs, &objp->bfree))
600
				return (FALSE);
601
			if (!xdr_u_int(xdrs, &objp->bavail))
602
				return (FALSE);
603
		} else {
604
			IXDR_PUT_U_LONG(buf, objp->tsize);
605
			IXDR_PUT_U_LONG(buf, objp->bsize);
606
			IXDR_PUT_U_LONG(buf, objp->blocks);
607
			IXDR_PUT_U_LONG(buf, objp->bfree);
608
			IXDR_PUT_U_LONG(buf, objp->bavail);
609
		}
610
		return (TRUE);
611
	} else if (xdrs->x_op == XDR_DECODE) {
612
		buf = (int32_t *)XDR_INLINE(xdrs,
613
		    5 * BYTES_PER_XDR_UNIT);
614
		if (buf == NULL) {
615
			if (!xdr_u_int(xdrs, &objp->tsize))
616
				return (FALSE);
617
			if (!xdr_u_int(xdrs, &objp->bsize))
618
				return (FALSE);
619
			if (!xdr_u_int(xdrs, &objp->blocks))
620
				return (FALSE);
621
			if (!xdr_u_int(xdrs, &objp->bfree))
622
				return (FALSE);
623
			if (!xdr_u_int(xdrs, &objp->bavail))
624
				return (FALSE);
625
		} else {
626
			objp->tsize = IXDR_GET_U_LONG(buf);
627
			objp->bsize = IXDR_GET_U_LONG(buf);
628
			objp->blocks = IXDR_GET_U_LONG(buf);
629
			objp->bfree = IXDR_GET_U_LONG(buf);
630
			objp->bavail = IXDR_GET_U_LONG(buf);
631
		}
632
		return (TRUE);
633
	}
634
635
	if (!xdr_u_int(xdrs, &objp->tsize))
636
		return (FALSE);
637
	if (!xdr_u_int(xdrs, &objp->bsize))
638
		return (FALSE);
639
	if (!xdr_u_int(xdrs, &objp->blocks))
640
		return (FALSE);
641
	if (!xdr_u_int(xdrs, &objp->bfree))
642
		return (FALSE);
643
	if (!xdr_u_int(xdrs, &objp->bavail))
644
		return (FALSE);
645
	return (TRUE);
646
}
647
648
bool_t
649
xdr_statfsres(XDR *xdrs, statfsres *objp)
650
{
651
652
	if (!xdr_nfsstat(xdrs, &objp->status))
653
		return (FALSE);
654
	switch (objp->status) {
655
	case NFS_OK:
656
		if (!xdr_statfsokres(xdrs, &objp->statfsres_u.reply))
657
			return (FALSE);
658
		break;
659
	default:
660
		break;
661
	}
662
	return (TRUE);
663
}