]> git.saurik.com Git - apple/xnu.git/blame - bsd/isofs/cd9660/cd9660_util.c
xnu-517.tar.gz
[apple/xnu.git] / bsd / isofs / cd9660 / cd9660_util.c
CommitLineData
1c79356b 1/*
55e303ae 2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/* $NetBSD: cd9660_util.c,v 1.8 1994/12/13 22:33:25 mycroft Exp $ */
26
27/*-
28 * Copyright (c) 1994
29 * The Regents of the University of California. All rights reserved.
30 *
31 * This code is derived from software contributed to Berkeley
32 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
33 * Support code is derived from software contributed to Berkeley
34 * by Atsushi Murai (amurai@spec.co.jp).
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)cd9660_util.c 8.3 (Berkeley) 12/5/94
65 *
66 * HISTORY
67 * 7-Dec-98 Add ATTR_VOL_MOUNTFLAGS attribute support - djb
68 * 18-Nov-98 Add support for volfs - djb
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>
73#include <sys/vnode.h>
74#include <sys/mount.h>
75#include <sys/namei.h>
76#include <sys/resourcevar.h>
77#include <sys/kernel.h>
78#include <sys/file.h>
79#include <sys/stat.h>
80#include <sys/buf.h>
81#include <sys/proc.h>
82#include <sys/conf.h>
83#include <sys/utfconv.h>
84#include <miscfs/specfs/specdev.h> /* XXX */
85#include <miscfs/fifofs/fifo.h> /* XXX */
86#include <sys/malloc.h>
87#include <sys/dir.h>
88#include <sys/attr.h>
89#include <kern/assert.h>
90#include <architecture/byte_order.h>
91
92#include <isofs/cd9660/iso.h>
93#include <isofs/cd9660/cd9660_node.h>
94#include <isofs/cd9660/iso_rrip.h>
95
96/*
97 * translate and compare a filename
98 * Note: Version number plus ';' may be omitted.
99 */
100int
101isofncmp(fn, fnlen, isofn, isolen)
102 u_char *fn, *isofn;
103 int fnlen, isolen;
104{
105 int i, j;
106 char c;
107
108 while (--fnlen >= 0) {
109 if (--isolen < 0)
110 return *fn;
111 if ((c = *isofn++) == ';') {
112 switch (*fn++) {
113 default:
114 return *--fn;
115 case 0:
116 return 0;
117 case ';':
118 break;
119 }
120 for (i = 0; --fnlen >= 0; i = i * 10 + *fn++ - '0') {
121 if (*fn < '0' || *fn > '9') {
122 return -1;
123 }
124 }
125 for (j = 0; --isolen >= 0; j = j * 10 + *isofn++ - '0');
126 return i - j;
127 }
128 /* if raw comparison fails, check if char was mapped */
129 if (c != *fn) {
130 if (c >= 'A' && c <= 'Z') {
131 if (c + ('a' - 'A') != *fn) {
132 if (*fn >= 'a' && *fn <= 'z')
133 return *fn - ('a' - 'A') - c;
134 else
135 return *fn - c;
136 }
137 } else if (c == '/') {
138 if (*fn != ':')
139 return *fn - c;
140 } else if (c > 0 || *fn != '_')
141 return *fn - c;
142 }
143 fn++;
144 }
145 if (isolen > 0) {
146 switch (*isofn) {
147 default:
148 return -1;
149 case '.':
150 if (isofn[1] != ';')
151 return -1;
152 case ';':
153 return 0;
154 }
155 }
156 return 0;
157}
158
159
160/*
161 * translate and compare a UCS-2 filename
162 * Note: Version number plus ';' may be omitted.
163 */
164
165int
166ucsfncmp(fn, fnlen, ucsfn, ucslen)
167 u_int16_t *fn;
168 int fnlen;
169 u_int16_t *ucsfn;
170 int ucslen;
171{
172 int i, j;
173 u_int16_t c;
174
175 /* convert byte count to char count */
176 ucslen /= 2;
177 fnlen /= 2;
178
179 while (--fnlen >= 0) {
180 if (--ucslen < 0)
181 return *fn;
182 if ((c = *ucsfn++) == UCS_SEPARATOR2) {
183 switch (*fn++) {
184 default:
185 return *--fn;
186 case 0:
187 return 0;
188 case UCS_SEPARATOR2:
189 break;
190 }
191 for (i = 0; --fnlen >= 0; i = i * 10 + *fn++ - '0') {
192 if (*fn < '0' || *fn > '9') {
193 return -1;
194 }
195 }
196 for (j = 0; --ucslen >= 0; j = j * 10 + *ucsfn++ - '0');
197 return i - j;
198 }
199 if (c != *fn)
200 return *fn - c;
201 fn++;
202 }
203 if (ucslen > 0) {
204 switch (*ucsfn) {
205 default:
206 return -1;
207 case UCS_SEPARATOR1:
208 if (ucsfn[1] != UCS_SEPARATOR2)
209 return -1;
210 case UCS_SEPARATOR2:
211 return 0;
212 }
213 }
214 return 0;
215}
216
217
218/*
219 * translate a filename
220 */
221void
55e303ae 222isofntrans(infn, infnlen, outfn, outfnlen, original, assoc)
1c79356b
A
223 u_char *infn, *outfn;
224 int infnlen;
225 u_short *outfnlen;
226 int original;
55e303ae 227 int assoc;
1c79356b
A
228{
229 int fnidx = 0;
230
55e303ae
A
231 /*
232 * Add a "._" prefix for associated files
233 */
234 if (assoc) {
235 *outfn++ = ASSOCCHAR1;
236 *outfn++ = ASSOCCHAR2;
237 fnidx += 2;
238 infnlen +=2;
239 }
1c79356b
A
240 for (; fnidx < infnlen; fnidx++) {
241 char c = *infn++;
242
243 /*
244 * Some ISO 9600 CD names contain 8-bit chars.
245 * These chars are mapped to '_' because there
246 * is no context for mapping them to UTF-8.
247 * In addition '/' is mapped to ':'.
248 *
249 * isofncmp accounts for these mappings.
250 */
251 if (!original) {
252 if (c < 0)
253 c = '_';
254 else if (c == '/')
255 c = ':';
256 else if (c == '.' && *infn == ';')
257 break;
258 else if (c == ';')
259 break;
260 }
261 *outfn++ = c;
262 }
263 *outfnlen = fnidx;
264}
265
266
267
268/*
269 * translate a UCS-2 filename to UTF-8
270 */
271void
55e303ae 272ucsfntrans(infn, infnlen, outfn, outfnlen, dir, assoc)
1c79356b
A
273 u_int16_t *infn;
274 int infnlen;
275 u_char *outfn;
276 u_short *outfnlen;
277 int dir;
55e303ae 278 int assoc;
1c79356b
A
279{
280 if (infnlen == 1) {
281 strcpy(outfn, "..");
282
283 if (*(u_char*)infn == 0)
284 *outfnlen = 1;
285 else if (*(u_char*)infn == 1)
286 *outfnlen = 2;
287 } else {
288 int fnidx;
289 size_t outbytes;
290 int flags;
291
292 fnidx = infnlen/2;
293 flags = 0;
294
55e303ae
A
295 /*
296 * Add a "._" prefix for associated files
297 */
298 if (assoc) {
299 *outfn++ = ASSOCCHAR1;
300 *outfn++ = ASSOCCHAR2;
301 }
1c79356b
A
302 if (!dir) {
303 /* strip file version number */
304 for (fnidx--; fnidx > 0; fnidx--) {
305 /* stop when ';' is found */
306 if (infn[fnidx] == UCS_SEPARATOR2) {
307 /* drop dangling dot */
308 if (fnidx > 0 && infn[fnidx-1] == UCS_SEPARATOR1)
309 fnidx--;
310 break;
311 }
312 }
313 if (fnidx <= 0)
314 fnidx = infnlen/2;
315 }
316
0b4e3aa0 317 flags = UTF_NO_NULL_TERM | UTF_DECOMPOSED;
1c79356b
A
318 if (BYTE_ORDER != BIG_ENDIAN)
319 flags |= UTF_REVERSE_ENDIAN;
320
321 (void) utf8_encodestr(infn, fnidx * 2, outfn, &outbytes, ISO_JOLIET_NAMEMAX, 0, flags);
55e303ae 322 *outfnlen = assoc ? outbytes + 2 : outbytes;
1c79356b
A
323 }
324}
325
326
327/*
328 * count the number of children by enumerating the directory
329 */
330static int
331isochildcount(vdp, dircnt, filcnt)
332 struct vnode *vdp;
333 int *dircnt;
334 int *filcnt;
335{
336 struct iso_node *dp;
337 struct buf *bp = NULL;
55e303ae 338 struct iso_mnt *imp;
1c79356b
A
339 struct iso_directory_record *ep;
340 u_long bmask;
341 int error = 0;
342 int reclen;
343 int dirs, files;
344 int blkoffset;
345 int logblksize;
346 long diroffset;
347
348 dp = VTOI(vdp);
55e303ae
A
349 imp = dp->i_mnt;
350 bmask = imp->im_sector_size - 1;
351 logblksize = imp->im_sector_size;
1c79356b
A
352 blkoffset = diroffset = 0;
353 dirs = files = 0;
354
355 while (diroffset < dp->i_size) {
356 /*
357 * If offset is on a block boundary, read the next
358 * directory block. Release previous if it exists.
359 */
360 if ((diroffset & bmask) == 0) {
361 if (bp != NULL)
362 brelse(bp);
55e303ae 363 if ( (error = VOP_BLKATOFF(vdp, SECTOFF(imp, diroffset), NULL, &bp)) )
1c79356b
A
364 break;
365 blkoffset = 0;
366 }
367
368 ep = (struct iso_directory_record *)
369 ((char *)bp->b_data + blkoffset);
370
371 reclen = isonum_711(ep->length);
372 if (reclen == 0) {
373 /* skip to next block, if any */
374 diroffset =
375 (diroffset & ~bmask) + logblksize;
376 continue;
377 }
378
379 if ((reclen < ISO_DIRECTORY_RECORD_SIZE) ||
380 (blkoffset + reclen > logblksize) ||
381 (reclen < ISO_DIRECTORY_RECORD_SIZE + isonum_711(ep->name_len))){
382 /* illegal, so give up */
383 break;
384 }
385
55e303ae
A
386 /*
387 * Some poorly mastered discs have an incorrect directory
388 * file size. If the '.' entry has a better size (bigger)
389 * then use that instead.
390 */
391 if ((diroffset == 0) && (isonum_733(ep->size) > dp->i_size)) {
392 dp->i_size = isonum_733(ep->size);
393 }
394
1c79356b
A
395 if ( isonum_711(ep->flags) & directoryBit )
396 dirs++;
397 else if ((isonum_711(ep->flags) & associatedBit) == 0)
398 files++;
399
400 diroffset += reclen;
401 blkoffset += reclen;
402 }
403
404 if (bp)
405 brelse (bp);
406
407 *dircnt = dirs;
408 *filcnt = files;
409
410 return (error);
411}
412
413
414/*
415 * There are two ways to qualify for ownership rights on an object:
416 *
417 * 1. Your UID matches the UID of the vnode
418 * 2. You are root
419 *
420 */
421static int cd9660_owner_rights(uid_t owner, struct iso_mnt *imp, struct ucred *cred, struct proc *p, int invokesuperuserstatus) {
422 return ((cred->cr_uid == owner) || /* [1] */
423 (invokesuperuserstatus && (suser(cred, &p->p_acflag) == 0))) ? 0 : EPERM; /* [2] */
424}
425
426
427
428static unsigned long DerivePermissionSummary(uid_t owner, gid_t group, mode_t obj_mode, struct iso_mnt *imp, struct ucred *cred, struct proc *p) {
429 register gid_t *gp;
430 unsigned long permissions;
431 int i;
432
433 /* User id 0 (root) always gets access. */
434 if (cred->cr_uid == 0) {
435 permissions = R_OK | X_OK;
436 goto Exit;
437 };
438
439 /* Otherwise, check the owner. */
440 if (cd9660_owner_rights(owner, imp, cred, p, 0) == 0) {
441 permissions = ((unsigned long)obj_mode & S_IRWXU) >> 6;
442 goto Exit;
443 }
444
445 /* Otherwise, check the groups. */
446 for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) {
447 if (group == *gp) {
448 permissions = ((unsigned long)obj_mode & S_IRWXG) >> 3;
449 goto Exit;
450 }
451 };
452
453 /* Otherwise, settle for 'others' access. */
454 permissions = (unsigned long)obj_mode & S_IRWXO;
455
456Exit:
457 return permissions & ~W_OK; /* Write access is always impossible */
458}
459
460
461int
462attrcalcsize(struct attrlist *attrlist)
463{
464 int size;
465 attrgroup_t a;
466
467#if ((ATTR_CMN_NAME | ATTR_CMN_DEVID | ATTR_CMN_FSID | ATTR_CMN_OBJTYPE | \
468 ATTR_CMN_OBJTAG | ATTR_CMN_OBJID | ATTR_CMN_OBJPERMANENTID | ATTR_CMN_PAROBJID | \
469 ATTR_CMN_SCRIPT | ATTR_CMN_CRTIME | ATTR_CMN_MODTIME | ATTR_CMN_CHGTIME | \
470 ATTR_CMN_ACCTIME | ATTR_CMN_BKUPTIME | ATTR_CMN_FNDRINFO | ATTR_CMN_OWNERID | \
471 ATTR_CMN_GRPID | ATTR_CMN_ACCESSMASK | ATTR_CMN_NAMEDATTRCOUNT | ATTR_CMN_NAMEDATTRLIST| \
472 ATTR_CMN_FLAGS | ATTR_CMN_USERACCESS) != ATTR_CMN_VALIDMASK)
473#error AttributeBlockSize: Missing bits in common mask computation!
474#endif
475 assert((attrlist->commonattr & ~ATTR_CMN_VALIDMASK) == 0);
476
477#if ((ATTR_VOL_FSTYPE | ATTR_VOL_SIGNATURE | ATTR_VOL_SIZE | ATTR_VOL_SPACEFREE | \
478 ATTR_VOL_SPACEAVAIL | ATTR_VOL_MINALLOCATION | ATTR_VOL_ALLOCATIONCLUMP | ATTR_VOL_IOBLOCKSIZE | \
479 ATTR_VOL_OBJCOUNT | ATTR_VOL_FILECOUNT | ATTR_VOL_DIRCOUNT | ATTR_VOL_MAXOBJCOUNT | \
480 ATTR_VOL_MOUNTPOINT | ATTR_VOL_NAME | ATTR_VOL_MOUNTFLAGS | ATTR_VOL_INFO | \
481 ATTR_VOL_MOUNTEDDEVICE| ATTR_VOL_ENCODINGSUSED | ATTR_VOL_CAPABILITIES | ATTR_VOL_ATTRIBUTES) != ATTR_VOL_VALIDMASK)
482#error AttributeBlockSize: Missing bits in volume mask computation!
483#endif
484 assert((attrlist->volattr & ~ATTR_VOL_VALIDMASK) == 0);
485
486#if ((ATTR_DIR_LINKCOUNT | ATTR_DIR_ENTRYCOUNT | ATTR_DIR_MOUNTSTATUS) != ATTR_DIR_VALIDMASK)
487#error AttributeBlockSize: Missing bits in directory mask computation!
488#endif
489 assert((attrlist->dirattr & ~ATTR_DIR_VALIDMASK) == 0);
490#if ((ATTR_FILE_LINKCOUNT | ATTR_FILE_TOTALSIZE | ATTR_FILE_ALLOCSIZE | ATTR_FILE_IOBLOCKSIZE | \
491 ATTR_FILE_CLUMPSIZE | ATTR_FILE_DEVTYPE | ATTR_FILE_FILETYPE | ATTR_FILE_FORKCOUNT | \
492 ATTR_FILE_FORKLIST | ATTR_FILE_DATALENGTH | ATTR_FILE_DATAALLOCSIZE | ATTR_FILE_DATAEXTENTS | \
493 ATTR_FILE_RSRCLENGTH | ATTR_FILE_RSRCALLOCSIZE | ATTR_FILE_RSRCEXTENTS) != ATTR_FILE_VALIDMASK)
494#error AttributeBlockSize: Missing bits in file mask computation!
495#endif
496 assert((attrlist->fileattr & ~ATTR_FILE_VALIDMASK) == 0);
497
498#if ((ATTR_FORK_TOTALSIZE | ATTR_FORK_ALLOCSIZE) != ATTR_FORK_VALIDMASK)
499#error AttributeBlockSize: Missing bits in fork mask computation!
500#endif
501 assert((attrlist->forkattr & ~ATTR_FORK_VALIDMASK) == 0);
502
503 size = 0;
504
505 if ((a = attrlist->commonattr) != 0) {
506 if (a & ATTR_CMN_NAME) size += sizeof(struct attrreference);
507 if (a & ATTR_CMN_DEVID) size += sizeof(dev_t);
508 if (a & ATTR_CMN_FSID) size += sizeof(fsid_t);
509 if (a & ATTR_CMN_OBJTYPE) size += sizeof(fsobj_type_t);
510 if (a & ATTR_CMN_OBJTAG) size += sizeof(fsobj_tag_t);
511 if (a & ATTR_CMN_OBJID) size += sizeof(fsobj_id_t);
512 if (a & ATTR_CMN_OBJPERMANENTID) size += sizeof(fsobj_id_t);
513 if (a & ATTR_CMN_PAROBJID) size += sizeof(fsobj_id_t);
514 if (a & ATTR_CMN_SCRIPT) size += sizeof(text_encoding_t);
515 if (a & ATTR_CMN_CRTIME) size += sizeof(struct timespec);
516 if (a & ATTR_CMN_MODTIME) size += sizeof(struct timespec);
517 if (a & ATTR_CMN_CHGTIME) size += sizeof(struct timespec);
518 if (a & ATTR_CMN_ACCTIME) size += sizeof(struct timespec);
519 if (a & ATTR_CMN_BKUPTIME) size += sizeof(struct timespec);
520 if (a & ATTR_CMN_FNDRINFO) size += 32 * sizeof(u_int8_t);
521 if (a & ATTR_CMN_OWNERID) size += sizeof(uid_t);
522 if (a & ATTR_CMN_GRPID) size += sizeof(gid_t);
523 if (a & ATTR_CMN_ACCESSMASK) size += sizeof(u_long);
524 if (a & ATTR_CMN_NAMEDATTRCOUNT) size += sizeof(u_long);
525 if (a & ATTR_CMN_NAMEDATTRLIST) size += sizeof(struct attrreference);
526 if (a & ATTR_CMN_FLAGS) size += sizeof(u_long);
527 if (a & ATTR_CMN_USERACCESS) size += sizeof(u_long);
528 };
529 if ((a = attrlist->volattr) != 0) {
530 if (a & ATTR_VOL_FSTYPE) size += sizeof(u_long);
531 if (a & ATTR_VOL_SIGNATURE) size += sizeof(u_long);
532 if (a & ATTR_VOL_SIZE) size += sizeof(off_t);
533 if (a & ATTR_VOL_SPACEFREE) size += sizeof(off_t);
534 if (a & ATTR_VOL_SPACEAVAIL) size += sizeof(off_t);
535 if (a & ATTR_VOL_MINALLOCATION) size += sizeof(off_t);
536 if (a & ATTR_VOL_ALLOCATIONCLUMP) size += sizeof(off_t);
537 if (a & ATTR_VOL_IOBLOCKSIZE) size += sizeof(size_t);
538 if (a & ATTR_VOL_OBJCOUNT) size += sizeof(u_long);
539 if (a & ATTR_VOL_FILECOUNT) size += sizeof(u_long);
540 if (a & ATTR_VOL_DIRCOUNT) size += sizeof(u_long);
541 if (a & ATTR_VOL_MAXOBJCOUNT) size += sizeof(u_long);
542 if (a & ATTR_VOL_MOUNTPOINT) size += sizeof(struct attrreference);
543 if (a & ATTR_VOL_NAME) size += sizeof(struct attrreference);
544 if (a & ATTR_VOL_MOUNTFLAGS) size += sizeof(u_long);
545 if (a & ATTR_VOL_MOUNTEDDEVICE) size += sizeof(struct attrreference);
546 if (a & ATTR_VOL_ENCODINGSUSED) size += sizeof(unsigned long long);
547 if (a & ATTR_VOL_CAPABILITIES) size += sizeof(vol_capabilities_attr_t);
548 if (a & ATTR_VOL_ATTRIBUTES) size += sizeof(vol_attributes_attr_t);
549 };
550 if ((a = attrlist->dirattr) != 0) {
551 if (a & ATTR_DIR_LINKCOUNT) size += sizeof(u_long);
552 if (a & ATTR_DIR_ENTRYCOUNT) size += sizeof(u_long);
553 if (a & ATTR_DIR_MOUNTSTATUS) size += sizeof(u_long);
554 };
555 if ((a = attrlist->fileattr) != 0) {
556 if (a & ATTR_FILE_LINKCOUNT) size += sizeof(u_long);
557 if (a & ATTR_FILE_TOTALSIZE) size += sizeof(off_t);
558 if (a & ATTR_FILE_ALLOCSIZE) size += sizeof(off_t);
559 if (a & ATTR_FILE_IOBLOCKSIZE) size += sizeof(size_t);
560 if (a & ATTR_FILE_CLUMPSIZE) size += sizeof(off_t);
561 if (a & ATTR_FILE_DEVTYPE) size += sizeof(u_long);
562 if (a & ATTR_FILE_FILETYPE) size += sizeof(u_long);
563 if (a & ATTR_FILE_FORKCOUNT) size += sizeof(u_long);
564 if (a & ATTR_FILE_FORKLIST) size += sizeof(struct attrreference);
565 if (a & ATTR_FILE_DATALENGTH) size += sizeof(off_t);
566 if (a & ATTR_FILE_DATAALLOCSIZE) size += sizeof(off_t);
567 if (a & ATTR_FILE_DATAEXTENTS) size += sizeof(extentrecord);
568 if (a & ATTR_FILE_RSRCLENGTH) size += sizeof(off_t);
569 if (a & ATTR_FILE_RSRCALLOCSIZE) size += sizeof(off_t);
570 if (a & ATTR_FILE_RSRCEXTENTS) size += sizeof(extentrecord);
571 };
572 if ((a = attrlist->forkattr) != 0) {
573 if (a & ATTR_FORK_TOTALSIZE) size += sizeof(off_t);
574 if (a & ATTR_FORK_ALLOCSIZE) size += sizeof(off_t);
575 };
576
577 return size;
578}
579
580
581
582void
583packvolattr (struct attrlist *alist,
584 struct iso_node *ip, /* ip for root directory */
585 void **attrbufptrptr,
586 void **varbufptrptr)
587{
588 void *attrbufptr;
589 void *varbufptr;
590 struct iso_mnt *imp;
591 struct mount *mp;
592 attrgroup_t a;
593 u_long attrlength;
594
595 attrbufptr = *attrbufptrptr;
596 varbufptr = *varbufptrptr;
597 imp = ip->i_mnt;
598 mp = imp->im_mountp;
599
600 if ((a = alist->commonattr) != 0) {
601 if (a & ATTR_CMN_NAME) {
602 attrlength = strlen( imp->volume_id ) + 1;
603 ((struct attrreference *)attrbufptr)->attr_dataoffset = (u_int8_t *)varbufptr - (u_int8_t *)attrbufptr;
604 ((struct attrreference *)attrbufptr)->attr_length = attrlength;
605 (void) strncpy((unsigned char *)varbufptr, imp->volume_id, attrlength);
606
607 /* Advance beyond the space just allocated and round up to the next 4-byte boundary: */
608 (u_int8_t *)varbufptr += attrlength + ((4 - (attrlength & 3)) & 3);
609 ++((struct attrreference *)attrbufptr);
610 };
611 if (a & ATTR_CMN_DEVID) *((dev_t *)attrbufptr)++ = imp->im_devvp->v_rdev;
612 if (a & ATTR_CMN_FSID) *((fsid_t *)attrbufptr)++ = ITOV(ip)->v_mount->mnt_stat.f_fsid;
613 if (a & ATTR_CMN_OBJTYPE) *((fsobj_type_t *)attrbufptr)++ = 0;
614 if (a & ATTR_CMN_OBJTAG) *((fsobj_tag_t *)attrbufptr)++ = VT_ISOFS;
615 if (a & ATTR_CMN_OBJID) {
616 ((fsobj_id_t *)attrbufptr)->fid_objno = 0;
617 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
618 ++((fsobj_id_t *)attrbufptr);
619 };
620 if (a & ATTR_CMN_OBJPERMANENTID) {
621 ((fsobj_id_t *)attrbufptr)->fid_objno = 0;
622 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
623 ++((fsobj_id_t *)attrbufptr);
624 };
625 if (a & ATTR_CMN_PAROBJID) {
626 ((fsobj_id_t *)attrbufptr)->fid_objno = 0;
627 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
628 ++((fsobj_id_t *)attrbufptr);
629 };
630 if (a & ATTR_CMN_SCRIPT) *((text_encoding_t *)attrbufptr)++ = 0;
631 if (a & ATTR_CMN_CRTIME) *((struct timespec *)attrbufptr)++ = imp->creation_date;
632 if (a & ATTR_CMN_MODTIME) *((struct timespec *)attrbufptr)++ = imp->modification_date;
633 if (a & ATTR_CMN_CHGTIME) *((struct timespec *)attrbufptr)++ = imp->modification_date;
634 if (a & ATTR_CMN_ACCTIME) *((struct timespec *)attrbufptr)++ = imp->modification_date;
635 if (a & ATTR_CMN_BKUPTIME) {
636 ((struct timespec *)attrbufptr)->tv_sec = 0;
637 ((struct timespec *)attrbufptr)->tv_nsec = 0;
638 ++((struct timespec *)attrbufptr);
639 };
640 if (a & ATTR_CMN_FNDRINFO) {
641 bzero (attrbufptr, 32 * sizeof(u_int8_t));
642 (u_int8_t *)attrbufptr += 32 * sizeof(u_int8_t);
643 };
644 if (a & ATTR_CMN_OWNERID) *((uid_t *)attrbufptr)++ = ip->inode.iso_uid;
645 if (a & ATTR_CMN_GRPID) *((gid_t *)attrbufptr)++ = ip->inode.iso_gid;
646 if (a & ATTR_CMN_ACCESSMASK) *((u_long *)attrbufptr)++ = (u_long)ip->inode.iso_mode;
647 if (a & ATTR_CMN_FLAGS) *((u_long *)attrbufptr)++ = 0;
648 if (a & ATTR_CMN_USERACCESS) {
649 *((u_long *)attrbufptr)++ =
650 DerivePermissionSummary(ip->inode.iso_uid,
651 ip->inode.iso_gid,
652 ip->inode.iso_mode,
653 imp,
654 current_proc()->p_ucred,
655 current_proc());
656 };
657 };
658
659 if ((a = alist->volattr) != 0) {
660 off_t blocksize = (off_t)imp->logical_block_size;
661
662 if (a & ATTR_VOL_FSTYPE) *((u_long *)attrbufptr)++ = (u_long)imp->im_mountp->mnt_vfc->vfc_typenum;
663 if (a & ATTR_VOL_SIGNATURE) *((u_long *)attrbufptr)++ = (u_long)ISO9660SIGNATURE;
664 if (a & ATTR_VOL_SIZE) *((off_t *)attrbufptr)++ = (off_t)imp->volume_space_size * blocksize;
665 if (a & ATTR_VOL_SPACEFREE) *((off_t *)attrbufptr)++ = 0;
666 if (a & ATTR_VOL_SPACEAVAIL) *((off_t *)attrbufptr)++ = 0;
667 if (a & ATTR_VOL_MINALLOCATION) *((off_t *)attrbufptr)++ = blocksize;
668 if (a & ATTR_VOL_ALLOCATIONCLUMP) *((off_t *)attrbufptr)++ = blocksize;
669 if (a & ATTR_VOL_IOBLOCKSIZE) *((size_t *)attrbufptr)++ = blocksize;
670 if (a & ATTR_VOL_OBJCOUNT) *((u_long *)attrbufptr)++ = 0;
671 if (a & ATTR_VOL_FILECOUNT) *((u_long *)attrbufptr)++ = 0;
672 if (a & ATTR_VOL_DIRCOUNT) *((u_long *)attrbufptr)++ = 0;
673 if (a & ATTR_VOL_MAXOBJCOUNT) *((u_long *)attrbufptr)++ = 0xFFFFFFFF;
674 if (a & ATTR_VOL_NAME) {
675 attrlength = strlen( imp->volume_id ) + 1;
676 ((struct attrreference *)attrbufptr)->attr_dataoffset = (u_int8_t *)varbufptr - (u_int8_t *)attrbufptr;
677 ((struct attrreference *)attrbufptr)->attr_length = attrlength;
678 (void) strncpy((unsigned char *)varbufptr, imp->volume_id, attrlength);
679
680 /* Advance beyond the space just allocated and round up to the next 4-byte boundary: */
681 (u_int8_t *)varbufptr += attrlength + ((4 - (attrlength & 3)) & 3);
682 ++((struct attrreference *)attrbufptr);
683 };
684 if (a & ATTR_VOL_MOUNTFLAGS) *((u_long *)attrbufptr)++ = (u_long)imp->im_mountp->mnt_flag;
685 if (a & ATTR_VOL_MOUNTEDDEVICE) {
686 ((struct attrreference *)attrbufptr)->attr_dataoffset = (u_int8_t *)varbufptr - (u_int8_t *)attrbufptr;
687 ((struct attrreference *)attrbufptr)->attr_length = strlen(mp->mnt_stat.f_mntfromname) + 1;
688 attrlength = ((struct attrreference *)attrbufptr)->attr_length;
689 attrlength = attrlength + ((4 - (attrlength & 3)) & 3); /* round up to the next 4-byte boundary: */
690 (void) bcopy(mp->mnt_stat.f_mntfromname, varbufptr, attrlength);
691
692 /* Advance beyond the space just allocated: */
693 (u_int8_t *)varbufptr += attrlength;
694 ++((struct attrreference *)attrbufptr);
695 };
696 if (a & ATTR_VOL_ENCODINGSUSED) *((unsigned long long *)attrbufptr)++ = (unsigned long long)0;
697 if (a & ATTR_VOL_CAPABILITIES) {
55e303ae
A
698 ((vol_capabilities_attr_t *)attrbufptr)->capabilities[VOL_CAPABILITIES_FORMAT] =
699 (imp->iso_ftype == ISO_FTYPE_RRIP ? VOL_CAP_FMT_SYMBOLICLINKS : 0) |
700 (imp->iso_ftype == ISO_FTYPE_RRIP ? VOL_CAP_FMT_HARDLINKS : 0) |
701 (imp->iso_ftype == ISO_FTYPE_RRIP || imp->iso_ftype == ISO_FTYPE_JOLIET
702 ? VOL_CAP_FMT_CASE_SENSITIVE : 0) |
703 VOL_CAP_FMT_CASE_PRESERVING |
704 VOL_CAP_FMT_FAST_STATFS;
1c79356b 705 ((vol_capabilities_attr_t *)attrbufptr)->capabilities[VOL_CAPABILITIES_INTERFACES] =
55e303ae
A
706 VOL_CAP_INT_ATTRLIST |
707 VOL_CAP_INT_NFSEXPORT;
1c79356b
A
708 ((vol_capabilities_attr_t *)attrbufptr)->capabilities[VOL_CAPABILITIES_RESERVED1] = 0;
709 ((vol_capabilities_attr_t *)attrbufptr)->capabilities[VOL_CAPABILITIES_RESERVED2] = 0;
710
711 ((vol_capabilities_attr_t *)attrbufptr)->valid[VOL_CAPABILITIES_FORMAT] =
55e303ae
A
712 VOL_CAP_FMT_PERSISTENTOBJECTIDS |
713 VOL_CAP_FMT_SYMBOLICLINKS |
714 VOL_CAP_FMT_HARDLINKS |
715 VOL_CAP_FMT_JOURNAL |
716 VOL_CAP_FMT_JOURNAL_ACTIVE |
717 VOL_CAP_FMT_NO_ROOT_TIMES |
718 VOL_CAP_FMT_SPARSE_FILES |
719 VOL_CAP_FMT_ZERO_RUNS |
720 VOL_CAP_FMT_CASE_SENSITIVE |
721 VOL_CAP_FMT_CASE_PRESERVING |
722 VOL_CAP_FMT_FAST_STATFS;
1c79356b 723 ((vol_capabilities_attr_t *)attrbufptr)->valid[VOL_CAPABILITIES_INTERFACES] =
55e303ae
A
724 VOL_CAP_INT_SEARCHFS |
725 VOL_CAP_INT_ATTRLIST |
726 VOL_CAP_INT_NFSEXPORT |
727 VOL_CAP_INT_READDIRATTR |
728 VOL_CAP_INT_EXCHANGEDATA |
729 VOL_CAP_INT_COPYFILE |
730 VOL_CAP_INT_ALLOCATE |
731 VOL_CAP_INT_VOL_RENAME |
732 VOL_CAP_INT_ADVLOCK |
733 VOL_CAP_INT_FLOCK;
1c79356b
A
734 ((vol_capabilities_attr_t *)attrbufptr)->valid[VOL_CAPABILITIES_RESERVED1] = 0;
735 ((vol_capabilities_attr_t *)attrbufptr)->valid[VOL_CAPABILITIES_RESERVED2] = 0;
736
737 ++((vol_capabilities_attr_t *)attrbufptr);
738 };
739 if (a & ATTR_VOL_ATTRIBUTES) {
740 ((vol_attributes_attr_t *)attrbufptr)->validattr.commonattr = ATTR_CMN_VALIDMASK;
741 ((vol_attributes_attr_t *)attrbufptr)->validattr.volattr = ATTR_VOL_VALIDMASK;
742 ((vol_attributes_attr_t *)attrbufptr)->validattr.dirattr = ATTR_DIR_VALIDMASK;
743 ((vol_attributes_attr_t *)attrbufptr)->validattr.fileattr = ATTR_FILE_VALIDMASK;
744 ((vol_attributes_attr_t *)attrbufptr)->validattr.forkattr = ATTR_FORK_VALIDMASK;
745
746 ((vol_attributes_attr_t *)attrbufptr)->nativeattr.commonattr = ATTR_CMN_VALIDMASK;
747 ((vol_attributes_attr_t *)attrbufptr)->nativeattr.volattr = ATTR_VOL_VALIDMASK;
748 ((vol_attributes_attr_t *)attrbufptr)->nativeattr.dirattr = ATTR_DIR_VALIDMASK;
749 ((vol_attributes_attr_t *)attrbufptr)->nativeattr.fileattr = ATTR_FILE_VALIDMASK;
750 ((vol_attributes_attr_t *)attrbufptr)->nativeattr.forkattr = ATTR_FORK_VALIDMASK;
751
752 ++((vol_attributes_attr_t *)attrbufptr);
753 };
754 };
755
756 *attrbufptrptr = attrbufptr;
757 *varbufptrptr = varbufptr;
758}
759
760
761void
762packcommonattr (struct attrlist *alist,
763 struct iso_node *ip,
764 void **attrbufptrptr,
765 void **varbufptrptr)
766{
767 void *attrbufptr;
768 void *varbufptr;
769 attrgroup_t a;
770 u_long attrlength;
771
772 attrbufptr = *attrbufptrptr;
773 varbufptr = *varbufptrptr;
774
775 if ((a = alist->commonattr) != 0) {
776 struct iso_mnt *imp = ip->i_mnt;
777
778 if (a & ATTR_CMN_NAME) {
779 /* special case root since we know how to get it's name */
780 if (ITOV(ip)->v_flag & VROOT) {
781 attrlength = strlen( imp->volume_id ) + 1;
782 (void) strncpy((unsigned char *)varbufptr, imp->volume_id, attrlength);
783 } else {
784 attrlength = strlen(ip->i_namep) + 1;
785 (void) strncpy((unsigned char *)varbufptr, ip->i_namep, attrlength);
786 }
787
788 ((struct attrreference *)attrbufptr)->attr_dataoffset = (u_int8_t *)varbufptr - (u_int8_t *)attrbufptr;
789 ((struct attrreference *)attrbufptr)->attr_length = attrlength;
790 /* Advance beyond the space just allocated and round up to the next 4-byte boundary: */
791 (u_int8_t *)varbufptr += attrlength + ((4 - (attrlength & 3)) & 3);
792 ++((struct attrreference *)attrbufptr);
793 };
794 if (a & ATTR_CMN_DEVID) *((dev_t *)attrbufptr)++ = ip->i_dev;
795 if (a & ATTR_CMN_FSID) *((fsid_t *)attrbufptr)++ = ITOV(ip)->v_mount->mnt_stat.f_fsid;
796 if (a & ATTR_CMN_OBJTYPE) *((fsobj_type_t *)attrbufptr)++ = ITOV(ip)->v_type;
797 if (a & ATTR_CMN_OBJTAG) *((fsobj_tag_t *)attrbufptr)++ = ITOV(ip)->v_tag;
798 if (a & ATTR_CMN_OBJID) {
799 if (ITOV(ip)->v_flag & VROOT)
800 ((fsobj_id_t *)attrbufptr)->fid_objno = 2; /* force root to be 2 */
801 else
802 ((fsobj_id_t *)attrbufptr)->fid_objno = ip->i_number;
803 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
804 ++((fsobj_id_t *)attrbufptr);
805 };
806 if (a & ATTR_CMN_OBJPERMANENTID) {
807 if (ITOV(ip)->v_flag & VROOT)
808 ((fsobj_id_t *)attrbufptr)->fid_objno = 2; /* force root to be 2 */
809 else
810 ((fsobj_id_t *)attrbufptr)->fid_objno = ip->i_number;
811 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
812 ++((fsobj_id_t *)attrbufptr);
813 };
814 if (a & ATTR_CMN_PAROBJID) {
815 struct iso_directory_record *dp = (struct iso_directory_record *)imp->root;
816 ino_t rootino = isodirino(dp, imp);
817
818 if (ip->i_number == rootino)
819 ((fsobj_id_t *)attrbufptr)->fid_objno = 1; /* force root parent to be 1 */
820 else if (ip->i_parent == rootino)
821 ((fsobj_id_t *)attrbufptr)->fid_objno = 2; /* force root to be 2 */
822 else
823 ((fsobj_id_t *)attrbufptr)->fid_objno = ip->i_parent;
824 ((fsobj_id_t *)attrbufptr)->fid_generation = 0;
825 ++((fsobj_id_t *)attrbufptr);
826 };
827 if (a & ATTR_CMN_SCRIPT) *((text_encoding_t *)attrbufptr)++ = 0;
828 if (a & ATTR_CMN_CRTIME) *((struct timespec *)attrbufptr)++ = ip->inode.iso_mtime;
829 if (a & ATTR_CMN_MODTIME) *((struct timespec *)attrbufptr)++ = ip->inode.iso_mtime;
830 if (a & ATTR_CMN_CHGTIME) *((struct timespec *)attrbufptr)++ = ip->inode.iso_ctime;
831 if (a & ATTR_CMN_ACCTIME) *((struct timespec *)attrbufptr)++ = ip->inode.iso_atime;
832 if (a & ATTR_CMN_BKUPTIME) {
833 ((struct timespec *)attrbufptr)->tv_sec = 0;
834 ((struct timespec *)attrbufptr)->tv_nsec = 0;
835 ++((struct timespec *)attrbufptr);
836 };
837 if (a & ATTR_CMN_FNDRINFO) {
838 struct finder_info finfo = {0};
839
840 finfo.fdFlags = ip->i_FinderFlags;
0b4e3aa0
A
841 finfo.fdLocation.v = -1;
842 finfo.fdLocation.h = -1;
1c79356b
A
843 if (ITOV(ip)->v_type == VREG) {
844 finfo.fdType = ip->i_FileType;
845 finfo.fdCreator = ip->i_Creator;
846 }
847 bcopy (&finfo, attrbufptr, sizeof(finfo));
848 (u_int8_t *)attrbufptr += sizeof(finfo);
849 bzero (attrbufptr, EXTFNDRINFOSIZE);
850 (u_int8_t *)attrbufptr += EXTFNDRINFOSIZE;
851 };
852 if (a & ATTR_CMN_OWNERID) *((uid_t *)attrbufptr)++ = ip->inode.iso_uid;
853 if (a & ATTR_CMN_GRPID) *((gid_t *)attrbufptr)++ = ip->inode.iso_gid;
854 if (a & ATTR_CMN_ACCESSMASK) *((u_long *)attrbufptr)++ = (u_long)ip->inode.iso_mode;
855 if (a & ATTR_CMN_FLAGS) *((u_long *)attrbufptr)++ = 0; /* could also use ip->i_flag */
856 if (a & ATTR_CMN_USERACCESS) {
857 *((u_long *)attrbufptr)++ =
858 DerivePermissionSummary(ip->inode.iso_uid,
859 ip->inode.iso_gid,
860 ip->inode.iso_mode,
861 imp,
862 current_proc()->p_ucred,
863 current_proc());
864 };
865 };
866
867 *attrbufptrptr = attrbufptr;
868 *varbufptrptr = varbufptr;
869}
870
871
872void
873packdirattr(struct attrlist *alist,
874 struct iso_node *ip,
875 void **attrbufptrptr,
876 void **varbufptrptr)
877{
878 void *attrbufptr;
879 attrgroup_t a;
880 int filcnt, dircnt;
881
882 attrbufptr = *attrbufptrptr;
883 filcnt = dircnt = 0;
884
885 a = alist->dirattr;
886 if ((ITOV(ip)->v_type == VDIR) && (a != 0)) {
887 /*
888 * if we haven't counted our children yet, do it now...
889 */
890 if ((ip->i_entries == 0) &&
891 (a & (ATTR_DIR_LINKCOUNT | ATTR_DIR_ENTRYCOUNT))) {
892 (void) isochildcount(ITOV(ip), &dircnt, &filcnt);
893
894 if ((ip->inode.iso_links == 1) && (dircnt != 0))
895 ip->inode.iso_links = dircnt;
896 if ((filcnt + dircnt) > 0)
897 ip->i_entries = dircnt + filcnt;
898 }
899
900 if (a & ATTR_DIR_LINKCOUNT) {
901 *((u_long *)attrbufptr)++ = ip->inode.iso_links;
902 }
903 if (a & ATTR_DIR_ENTRYCOUNT) {
904 /* exclude '.' and '..' from total caount */
905 *((u_long *)attrbufptr)++ = ((ip->i_entries <= 2) ? 0 : (ip->i_entries - 2));
906 }
907 if (a & ATTR_DIR_MOUNTSTATUS) {
908 if (ITOV(ip)->v_mountedhere) {
909 *((u_long *)attrbufptr)++ = DIR_MNTSTATUS_MNTPOINT;
910 } else {
911 *((u_long *)attrbufptr)++ = 0;
912 };
913 };
914 };
915
916 *attrbufptrptr = attrbufptr;
917}
918
919
920void
921packfileattr(struct attrlist *alist,
922 struct iso_node *ip,
923 void **attrbufptrptr,
924 void **varbufptrptr)
925{
926 void *attrbufptr = *attrbufptrptr;
927 void *varbufptr = *varbufptrptr;
928 attrgroup_t a = alist->fileattr;
929
930 if ((ITOV(ip)->v_type == VREG) && (a != 0)) {
931 if (a & ATTR_FILE_LINKCOUNT)
932 *((u_long *)attrbufptr)++ = ip->inode.iso_links;
933 if (a & ATTR_FILE_TOTALSIZE)
934 *((off_t *)attrbufptr)++ = (off_t)ip->i_size;
935 if (a & ATTR_FILE_ALLOCSIZE)
936 *((off_t *)attrbufptr)++ = (off_t)ip->i_size;
937 if (a & ATTR_FILE_IOBLOCKSIZE)
938 *((u_long *)attrbufptr)++ = ip->i_mnt->logical_block_size;
939 if (a & ATTR_FILE_CLUMPSIZE)
940 *((u_long *)attrbufptr)++ = ip->i_mnt->logical_block_size;
941 if (a & ATTR_FILE_DEVTYPE)
942 *((u_long *)attrbufptr)++ = (u_long)ip->inode.iso_rdev;
943 if (a & ATTR_FILE_DATALENGTH)
944 *((off_t *)attrbufptr)++ = (off_t)ip->i_size;
945 if (a & ATTR_FILE_DATAALLOCSIZE)
946 *((off_t *)attrbufptr)++ = (off_t)ip->i_size;
947 if (a & ATTR_FILE_RSRCLENGTH)
948 *((off_t *)attrbufptr)++ = (off_t)ip->i_rsrcsize;
949 if (a & ATTR_FILE_RSRCALLOCSIZE)
950 *((off_t *)attrbufptr)++ = (off_t)ip->i_rsrcsize;
951 }
952
953 *attrbufptrptr = attrbufptr;
954 *varbufptrptr = varbufptr;
955}
956
957
958void
959packattrblk(struct attrlist *alist,
960 struct vnode *vp,
961 void **attrbufptrptr,
962 void **varbufptrptr)
963{
964 struct iso_node *ip = VTOI(vp);
965
966 if (alist->volattr != 0) {
967 packvolattr(alist, ip, attrbufptrptr, varbufptrptr);
968 } else {
969 packcommonattr(alist, ip, attrbufptrptr, varbufptrptr);
970
971 switch (ITOV(ip)->v_type) {
972 case VDIR:
973 packdirattr(alist, ip, attrbufptrptr, varbufptrptr);
974 break;
975
976 case VREG:
977 packfileattr(alist, ip, attrbufptrptr, varbufptrptr);
978 break;
979
980 /* Without this the compiler complains about VNON,VBLK,VCHR,VLNK,VSOCK,VFIFO,VBAD and VSTR
981 not being handled...
982 */
983 default:
984 break;
985 };
986 };
987};