-
Notifications
You must be signed in to change notification settings - Fork 3
/
listing10.html
executable file
·1785 lines (1533 loc) · 73 KB
/
listing10.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<!-- BEGIN META TAG INFO -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="home" href="http://developer.apple.com/">
<link rel="find" href="http://developer.apple.com/search/">
<link rel="stylesheet" type="text/css" href="../../documentation/css/adcstyle.css" title="fonts">
<script language="JavaScript" src="../../documentation/js/adc.js" type="text/javascript"></script>
<!-- END META TAG INFO -->
<!-- BEGIN TITLE -->
<title>FSMegaInfo - /FileManager.c</title>
<!-- END TITLE -->
<script language="JavaScript">
function JumpToNewPage() {
window.location=document.scpopupmenu.gotop.value;
return true;
}
</script>
</head>
<!-- BEGIN BODY OPEN -->
<body>
<!--END BODY OPEN -->
<!-- START CENTER OPEN -->
<center>
<!-- END CENTER OPEN -->
<!-- BEGIN LOGO AND SEARCH -->
<!--#include virtual="/includes/adcnavbar"-->
<!-- END LOGO AND SEARCH -->
<!-- START BREADCRUMB -->
<div id="breadcrumb">
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr>
<td scope="row"><img width="340" height="10" src="images/1dot.gif" alt=""></td>
<td><img width="340" height="10" src="images/1dot.gif" alt=""></td>
</tr>
<tr valign="middle">
<td align="left" colspan="2">
<a href="http://developer.apple.com/">ADC Home</a> > <a href="../../referencelibrary/index.html">Reference Library</a> > <a href="../../samplecode/index.html">Sample Code</a> > <a href="../../samplecode/Darwin/index.html">Darwin</a> > <a href="../../samplecode/Darwin/idxFileManagement-date.html">File Management</a> > <A HREF="javascript:location.replace('index.html');">FSMegaInfo</A> >
</td>
</tr>
<tr>
<td colspan="2" scope="row"><img width="680" height="35" src="images/1dot.gif" alt=""></td>
</tr>
</table>
</div>
<!-- END BREADCRUMB -->
<!-- START MAIN CONTENT -->
<!-- START TITLE GRAPHIC AND INTRO-->
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td><h1><div id="pagehead">FSMegaInfo</div></h1></td>
</tr>
</table>
<!-- END TITLE GRAPHIC AND INTRO -->
<!-- START WIDE COLUMN -->
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td id="scdetails">
<h2>/FileManager.c</h2>
<form name="scpopupmenu" onSubmit="return false;" method=post>
<p><strong>View Source Code:</strong>
<select name="gotop" onChange="JumpToNewPage();" style="width:340px"><option selected value="ingnore">Select File</option>
<option value="listing1.html">/AliasManager.c</option>
<option value="listing2.html">/BSD.c</option>
<option value="listing3.html">/BSD.h</option>
<option value="listing4.html">/BSDAttrList.c</option>
<option value="listing5.html">/Command.c</option>
<option value="listing6.html">/Command.h</option>
<option value="listing7.html">/DiskArb.c</option>
<option value="listing8.html">/FieldPrinter.c</option>
<option value="listing9.html">/FieldPrinter.h</option>
<option value="listing10.html">/FileManager.c</option>
<option value="listing11.html">/FolderManager.c</option>
<option value="listing12.html">/FSMegaInfo.c</option>
<option value="listing13.html">/Read Me About FSMegaInfo.txt</option>
<option value="listing14.html">/Tests/ten-five-intel.txt</option>
<option value="listing15.html">/Tests/ten-five-one-ppc64.txt</option>
<option value="listing16.html">/Tests/ten-five-ppc.txt</option>
<option value="listing17.html">/Tests/ten-four-eleven-intel.txt</option>
<option value="listing18.html">/Tests/ten-four-eleven-ppc.txt</option></select>
</p>
</form>
<p><strong><a href="FSMegaInfo.zip">Download Sample</a></strong> (“FSMegaInfo.zip”, 522.7K)<BR>
<strong><a href="FSMegaInfo.dmg">Download Sample</a></strong> (“FSMegaInfo.dmg”, 920.2K)</p>
<!--
<p><strong><a href="#">Download Sample</a></strong> (“filename.sit”, 500K)</p>
-->
</td>
</tr>
<tr>
<td scope="row"><img width="680" height="10" src="images/1dot.gif" alt=""><br>
<img height="1" width="680" src="images/1dot_919699.gif" alt=""><br>
<img width="680" height="20" src="images/1dot.gif" alt=""></td>
</tr>
<tr>
<td scope="row">
<!--googleon: index -->
<pre class="sourcecodebox">/*
File: FileManager.c
Contains: File Manager command processing.
Written by: DTS
Copyright: Copyright (c) 2008 Apple Inc. All Rights Reserved.
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of
these terms. If you do not agree with these terms, please do
not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following
terms, and subject to these terms, Apple grants you a personal,
non-exclusive license, under Apple's copyrights in this
original Apple software (the "Apple Software"), to use,
reproduce, modify and redistribute the Apple Software, with or
without modifications, in source and/or binary forms; provided
that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the
following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks
or logos of Apple Inc. may be used to endorse or promote
products derived from the Apple Software without specific prior
written permission from Apple. Except as expressly stated in
this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or
by other works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis.
APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING
THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY
OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include <netinet/in.h>
#include <netdb.h>
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
#include "FieldPrinter.h"
#include "Command.h"
#include "BSD.h" // for kTextEncodingEnums
/////////////////////////////////////////////////////////////////
#pragma mark ***** Utilities Routines
static void FPAFPString(
const char * fieldName,
size_t fieldSize,
const void * fieldPtr,
uint32_t indent,
size_t nameWidth,
uint32_t verbose,
const void * info
)
// Prints an AFP-style Pascal string field, where the field holds
// the offset from the start of the record to the Pascal string data.
// info supplies the offset from fieldPtr to the base of the record.
// The string is assumed to be MacRoman (not my favourite design
// decision, but offset is already being used and it was too painful
// to add an extra parameter, or break it out into a record).
//
// See definition of FPPrinter for a parameter description.
{
short fieldValue;
const UInt8 * pstrPtr;
char * strBuf;
#pragma unused(fieldSize)
#pragma unused(verbose)
assert( FPStandardPreCondition() );
fieldValue = *((const short *) fieldPtr);
pstrPtr = ((const UInt8 *) fieldPtr) - ((size_t) info) + fieldValue;
strBuf = FPPStringToUTFCString(pstrPtr, kCFStringEncodingMacRoman);
assert(strBuf != NULL);
if (strBuf != NULL) {
fprintf(stdout, "%*s%-*s = %hd ('%s')\n", (int) indent, "", (int) nameWidth, fieldName, fieldValue, strBuf);
}
free(strBuf);
}
static void FPFSFileSecurityRef(
const char * fieldName,
size_t fieldSize,
const void * fieldPtr,
uint32_t indent,
size_t nameWidth,
uint32_t verbose,
const void * info
)
{
#pragma unused(fieldSize)
#pragma unused(info)
OSStatus err;
int junk;
FSFileSecurityRef fileSec;
CFUUIDBytes uuid;
UInt32 id;
UInt16 mode;
assert( FPStandardPreCondition() );
assert(fieldSize == sizeof(FSFileSecurityRef));
fileSec = *((FSFileSecurityRef *) fieldPtr);
if (fileSec == NULL) {
fprintf(stdout, "%*s%-*s = NULL\n", (int) indent, "", (int) nameWidth, fieldName);
} else {
acl_t acl;
void * aclBuf;
size_t aclBufSize;
ssize_t aclActualSize;
aclBufSize = 0; // quieten warning
aclActualSize = 0; // quieten warning
acl = NULL;
aclBuf = NULL;
fprintf(stdout, "%*s%s:\n", (int) indent, "", fieldName);
err = FSFileSecurityGetOwnerUUID(fileSec, &uuid);
if (err == noErr) {
FPGUID("owner UUID", sizeof(uuid), &uuid, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
err = FSFileSecurityGetOwner(fileSec, &id);
if (err == noErr) {
FPUID("owner UID", sizeof(id), &id, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
err = FSFileSecurityGetGroupUUID(fileSec, &uuid);
if (err == noErr) {
FPGUID("group UUID", sizeof(uuid), &uuid, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
err = FSFileSecurityGetGroup(fileSec, &id);
if (err == noErr) {
FPGID("owning GID", sizeof(id), &id, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
err = FSFileSecurityGetMode(fileSec, &mode);
if (err == noErr) {
FPModeT("mode", sizeof(mode), &mode, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
err = FSFileSecurityCopyAccessControlList(fileSec, &acl);
if (err == noErr) {
aclBufSize = acl_size(acl);
aclBuf = malloc(aclBufSize);
if (aclBuf == NULL) {
err = memFullErr;
}
}
if (err == noErr) {
aclActualSize = acl_copy_ext_native(aclBuf, acl, aclBufSize);
if (aclActualSize < 0) {
err = errno;
} else {
assert( ((size_t) aclActualSize) <= aclBufSize );
}
}
if (err == noErr) {
FPKauthFileSec("acl", aclActualSize, aclBuf, indent + kStdIndent, strlen("owner UUID"), verbose, NULL);
}
free(aclBuf);
if (acl != NULL) {
junk = acl_free(acl);
assert(junk == 0);
}
}
}
#pragma mark * FSGetVolumeInfo
// FSVolumeInfoBitmap
static const FPFlagDesc kFSGetVolumeInfoOptions[] = {
{kFSVolInfoCreateDate, "kFSVolInfoCreateDate"},
{kFSVolInfoModDate, "kFSVolInfoModDate"},
{kFSVolInfoBackupDate, "kFSVolInfoBackupDate"},
{kFSVolInfoCheckedDate, "kFSVolInfoCheckedDate"},
{kFSVolInfoFileCount, "kFSVolInfoFileCount"},
{kFSVolInfoDirCount, "kFSVolInfoDirCount"},
{kFSVolInfoSizes, "kFSVolInfoSizes"},
{kFSVolInfoBlocks, "kFSVolInfoBlocks"},
{kFSVolInfoNextAlloc, "kFSVolInfoNextAlloc"},
{kFSVolInfoRsrcClump, "kFSVolInfoRsrcClump"},
{kFSVolInfoDataClump, "kFSVolInfoDataClump"},
{kFSVolInfoNextID, "kFSVolInfoNextID"},
{kFSVolInfoFinderInfo, "kFSVolInfoFinderInfo"},
{kFSVolInfoFlags, "kFSVolInfoFlags"},
{kFSVolInfoFSInfo, "kFSVolInfoFSInfo"},
{kFSVolInfoDriveInfo, "kFSVolInfoDriveInfo"},
{0, NULL}
};
// Flags in the flags field of FSVolumeInfo.
static const FPFlagDesc kVolAttrFlags[] = {
{kFSVolFlagDefaultVolumeMask, "kFSVolFlagDefaultVolumeMask" },
{kFSVolFlagFilesOpenMask, "kFSVolFlagFilesOpenMask" },
{kFSVolFlagHardwareLockedMask, "kFSVolFlagHardwareLockedMask" },
{kFSVolFlagJournalingActiveMask, "kFSVolFlagJournalingActiveMask"},
{kFSVolFlagSoftwareLockedMask, "kFSVolFlagSoftwareLockedMask" },
{0, NULL}
};
// Size multipliers for fields in the FSVolumeInfo structure. See
// FPSize for a description of what this is about.
static const FPSizeMultiplier kFSGetVolumeInfoTotalBlocksMultiplier = {
offsetof(FSVolumeInfo, blockSize) - offsetof(FSVolumeInfo, totalBlocks),
sizeof(UInt32)
};
static const FPSizeMultiplier kFSGetVolumeInfoFreeBlocksMultiplier = {
offsetof(FSVolumeInfo, blockSize) - offsetof(FSVolumeInfo, freeBlocks),
sizeof(UInt32)
};
static void PrintVolumeInfo(
const HFSUniStr255 * volName,
FSVolumeInfoBitmap options,
const FSVolumeInfo * volInfo,
uint32_t indent,
uint32_t verbose
)
// The core of the FSGetVolumeInfo command.
{
const size_t kNameSpacer = strlen("nextAllocation");
assert(volName != NULL);
assert(volInfo != NULL);
HFSUniStr255FieldPrinter("volumeName", sizeof(*volName), volName, indent, kNameSpacer, verbose, NULL);
if (options & kFSVolInfoCreateDate) {
FPUTCDateTime("createDate", sizeof(volInfo->createDate), &volInfo->createDate, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoModDate) {
FPUTCDateTime("modifyDate", sizeof(volInfo->modifyDate), &volInfo->modifyDate, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoBackupDate) {
FPUTCDateTime("backupDate", sizeof(volInfo->backupDate), &volInfo->backupDate, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoCheckedDate) {
FPUTCDateTime("checkedDate", sizeof(volInfo->checkedDate), &volInfo->checkedDate, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoFileCount) {
FPUDec("fileCount", sizeof(volInfo->fileCount), &volInfo->fileCount, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoDirCount) {
FPUDec("folderCount", sizeof(volInfo->folderCount), &volInfo->folderCount, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoSizes) {
FPSize("totalBytes", sizeof(volInfo->totalBytes), &volInfo->totalBytes, indent, kNameSpacer, verbose, NULL);
FPSize("freeBytes", sizeof(volInfo->freeBytes), &volInfo->freeBytes, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoBlocks) {
FPSize("blockSize", sizeof(volInfo->blockSize), &volInfo->blockSize, indent, kNameSpacer, verbose, NULL);
FPSize("totalBlocks", sizeof(volInfo->totalBlocks), &volInfo->totalBlocks, indent, kNameSpacer, verbose, &kFSGetVolumeInfoTotalBlocksMultiplier);
FPSize("freeBlocks", sizeof(volInfo->freeBlocks), &volInfo->freeBlocks, indent, kNameSpacer, verbose, &kFSGetVolumeInfoFreeBlocksMultiplier);
}
if (options & kFSVolInfoNextAlloc) {
FPUDec("nextAllocation", sizeof(volInfo->nextAllocation), &volInfo->nextAllocation, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoRsrcClump) {
FPSize("rsrcClumpSize", sizeof(volInfo->rsrcClumpSize), &volInfo->rsrcClumpSize, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoDataClump) {
FPSize("dataClumpSize", sizeof(volInfo->dataClumpSize), &volInfo->dataClumpSize, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoNextID) {
FPUDec("nextCatalogID", sizeof(volInfo->nextCatalogID), &volInfo->nextCatalogID, indent, kNameSpacer, verbose, NULL);
}
if (options & kFSVolInfoFinderInfo) {
FPFinderInfo("finderInfo", sizeof(volInfo->finderInfo), &volInfo->finderInfo, indent, kNameSpacer, verbose, (void *) (uintptr_t) kVolumeInfo);
}
if (options & kFSVolInfoFlags) {
FPFlags("flags", sizeof(volInfo->flags), &volInfo->flags, indent, kNameSpacer, verbose, kVolAttrFlags);
}
if (options & kFSVolInfoFSInfo) {
FPSignature("filesystemID", sizeof(volInfo->filesystemID), &volInfo->filesystemID, indent, kNameSpacer, verbose, (const void *) (uintptr_t) kFPValueHostEndian);
FPSignature("signature", sizeof(volInfo->signature), &volInfo->signature, indent, kNameSpacer, verbose, (const void *) (uintptr_t) kFPValueHostEndian);
}
if (options & kFSVolInfoDriveInfo) {
FPUDec("driveNumber", sizeof(volInfo->driveNumber), &volInfo->driveNumber, indent, kNameSpacer, verbose, NULL);
FPUDec("driverRefNum", sizeof(volInfo->driverRefNum), &volInfo->driverRefNum, indent, kNameSpacer, verbose, NULL);
}
}
static CommandError PrintFSGetVolumeInfo(CommandArgsRef args, uint32_t indent, uint32_t verbose)
// Uses FSGetVolumeInfo to get information about the specified volume and
// prints the result.
//
// indent and verbose are as per the comments for FPPrinter.
{
OSStatus err;
int options;
ItemCount volIndex;
FSVolumeRefNum volRefNum;
FSVolumeInfo volInfo;
HFSUniStr255 volName;
assert( CommandArgsValid(args) );
volIndex = 0; // quieten warning
if (CommandArgsIsOption(args)) {
err = CommandArgsGetFlagListInt(args, kFSGetVolumeInfoOptions, &options);
} else {
options = kFSVolInfoGettableInfo;
err = noErr;
}
if (err == noErr) {
if ( CommandArgsGetOptionalConstantString(args, "all") ) {
volIndex = 1;
volRefNum = 0;
} else {
volIndex = 0;
err = CommandArgsGetVRefNum(args, &volRefNum);
}
}
if (err == noErr) {
do {
FSVolumeRefNum realVolRefNum;
err = FSGetVolumeInfo(volRefNum, volIndex, &realVolRefNum, options, &volInfo, &volName, NULL);
if (err == noErr) {
if (volIndex > 0) {
// We're printing all volumes
if ( (volIndex > 1) && (options != 0) ) {
fprintf(stdout, "\n");
}
fprintf(stdout, "%*svRefNum = %d\n", (int) indent, "", (int) realVolRefNum);
PrintVolumeInfo(&volName, options, &volInfo, indent + kStdIndent, verbose);
} else {
// We're printing just one volume
PrintVolumeInfo(&volName, options, &volInfo, indent, verbose);
}
}
volIndex += 1;
} while ( (err == noErr) && (volIndex > 1) );
if ( (volIndex > 1) && (err == nsvErr) ) {
err = noErr;
}
}
return CommandErrorMakeWithOSStatus(err);
}
static const CommandHelpEntry kFSGetVolumeInfoCommandHelp[] = {
{CommandHelpString, "-options Volume information to get; default is kFSVolInfoGettableInfo"},
{CommandHelpFlags, kFSGetVolumeInfoOptions},
{NULL, NULL}
};
const CommandInfo kFSGetVolumeInfoCommand = {
PrintFSGetVolumeInfo,
"FSGetVolumeInfo",
"[ -options ] ( all | itemPath )",
"Print information from FSGetVolumeInfo.",
kFSGetVolumeInfoCommandHelp
};
#pragma mark * PBHGetVolParmsSync
// Flags for the vMAttrib field of the GetVolParmsInfoBuffer structure.
static const FPFlagDesc kVolParmsFlags[] = {
{1L << bLimitFCBs, "bLimitFCBs"},
{1L << bLocalWList, "bLocalWList"},
{1L << bNoMiniFndr, "bNoMiniFndr"},
{1L << bNoVNEdit, "bNoVNEdit"},
{1L << bNoLclSync, "bNoLclSync"},
{1L << bTrshOffLine, "bTrshOffLine"},
{1L << bNoSwitchTo, "bNoSwitchTo"},
{1L << bNoDeskItems, "bNoDeskItems"},
{1L << bNoBootBlks, "bNoBootBlks"},
{1L << bAccessCntl, "bAccessCntl"},
{1L << bNoSysDir, "bNoSysDir"},
{1L << bHasExtFSVol, "bHasExtFSVol"},
{1L << bHasOpenDeny, "bHasOpenDeny"},
{1L << bHasCopyFile, "bHasCopyFile"},
{1L << bHasMoveRename, "bHasMoveRename"},
{1L << bHasDesktopMgr, "bHasDesktopMgr"},
{1L << bHasShortName, "bHasShortName"},
{1L << bHasFolderLock, "bHasFolderLock"},
{1L << bHasPersonalAccessPrivileges, "bHasPersonalAccessPrivileges"},
{1L << bHasUserGroupList, "bHasUserGroupList"},
{1L << bHasCatSearch, "bHasCatSearch"},
{1L << bHasFileIDs, "bHasFileIDs"},
{1L << bHasBTreeMgr, "bHasBTreeMgr"},
{1L << bHasBlankAccessPrivileges, "bHasBlankAccessPrivileges"},
{1L << bSupportsAsyncRequests, "bSupportsAsyncRequests"},
{1L << bSupportsTrashVolumeCache, "bSupportsTrashVolumeCache"},
{1L << bHasDirectIO, "bHasDirectIO"},
{0, NULL}
};
// Flags for the vMExtendedAttributes field of the GetVolParmsInfoBuffer structure.
static const FPFlagDesc kVolParmsExtendedFlags[] = {
{1L << bSupportsExtendedFileSecurity, "bSupportsExtendedFileSecurity"},
{1L << bIsOnExternalBus, "bIsOnExternalBus"},
{1L << bNoRootTimes, "bNoRootTimes"},
{1L << bIsRemovable, "bIsRemovable"},
{1L << bDoNotDisplay, "bDoNotDisplay"},
{1L << bIsCasePreserving, "bIsCasePreserving"},
{1L << bIsCaseSensitive, "bIsCaseSensitive"},
{1L << bIsOnInternalBus, "bIsOnInternalBus"},
{1L << bNoVolumeSizes, "bNoVolumeSizes"},
{1L << bSupportsJournaling, "bSupportsJournaling"},
{1L << bSupportsExclusiveLocks, "bSupportsExclusiveLocks"},
{1L << bAllowCDiDataHandler, "bAllowCDiDataHandler"},
{1L << bIsAutoMounted, "bIsAutoMounted"},
{1L << bSupportsSymbolicLinks, "bSupportsSymbolicLinks"},
{1L << bAncestorModDateChanges, "bAncestorModDateChanges"},
{1L << bParentModDateChanges, "bParentModDateChanges"},
{1L << bL2PCanMapFileBlocks, "bL2PCanMapFileBlocks"},
{1L << bSupportsSubtreeIterators, "bSupportsSubtreeIterators"},
{1L << bSupportsNamedForks, "bSupportsNamedForks"},
{1L << bSupportsMultiScriptNames, "bSupportsMultiScriptNames"},
{1L << bSupportsLongNames, "bSupportsLongNames"},
{1L << bSupports2TBFiles, "bSupports2TBFiles"},
{1L << bSupportsFSExchangeObjects, "bSupportsFSExchangeObjects"},
{1L << bSupportsFSCatalogSearch, "bSupportsFSCatalogSearch"},
{1L << bSupportsHFSPlusAPIs, "bSupportsHFSPlusAPIs"},
{1L << bIsEjectable, "bIsEjectable"},
{0, NULL}
};
// Constants for the vMForeignPrivID field of the GetVolParmsInfoBuffer structure
static const FPEnumDesc kForeignPrivEnums[] = {
{0, "HFS"},
{fsUnixPriv, "fsUnixPriv"},
{0, NULL}
};
static const char kGetVolParmsInfoBufferFieldSpacer[32] = "vMExtendedAttributes";
// The fields of the GetVolParmsInfoBuffer structure. These are broken up into five
// groups to account for the various versions of the structure, which are in turn
// assembled into the kGetVolParmsInfoBufferFieldDescByVersion array for easy
// processing by the code.
// The only useful meaning of vMServerAdr in the modern world is a zero/non-zero test
// to see whether the volume is local or remote. I didn't feel that justified a custom
// printer routine.
static const FPFieldDesc kGetVolParmsInfoBufferFieldDescV1[] = {
{"vMVersion", offsetof(GetVolParmsInfoBuffer, vMVersion), sizeof(SInt16), FPSDec, NULL},
{"vMAttrib", offsetof(GetVolParmsInfoBuffer, vMAttrib), sizeof(SInt32), FPFlags, kVolParmsFlags},
{"vMLocalHand", offsetof(GetVolParmsInfoBuffer, vMLocalHand), sizeof(Handle), FPPtr, NULL},
{"vMServerAdr", offsetof(GetVolParmsInfoBuffer, vMServerAdr), sizeof(SInt32), FPHex, NULL},
{kGetVolParmsInfoBufferFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{NULL, 0, 0, NULL, NULL}
};
// While there is a definition for vMVolumeGrade (see DTS Technote 1121 "Mac OS 8.1"
// <http://developer.apple.com/technotes/tn/tn1121.html>), Core Services File Manager
// provides no way for a file system to return a value (it always returns 0), so there's
// no point providing a sophisticated interpretation.
static const FPFieldDesc kGetVolParmsInfoBufferFieldDescV2[] = {
{"vMVolumeGrade", offsetof(GetVolParmsInfoBuffer, vMVolumeGrade), sizeof(SInt32), FPSDec, NULL},
{"vMForeignPrivID", offsetof(GetVolParmsInfoBuffer, vMForeignPrivID), sizeof(SInt16), FPEnum, kForeignPrivEnums},
{kGetVolParmsInfoBufferFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{NULL, 0, 0, NULL, NULL}
};
static const FPFieldDesc kGetVolParmsInfoBufferFieldDescV3[] = {
{"vMExtendedAttributes", offsetof(GetVolParmsInfoBuffer, vMExtendedAttributes), sizeof(SInt32), FPFlags, kVolParmsExtendedFlags},
{NULL, 0, 0, NULL, NULL}
};
static const FPFieldDesc kGetVolParmsInfoBufferFieldDescV4[] = {
{"vMDeviceID", offsetof(GetVolParmsInfoBuffer, vMDeviceID), sizeof(void *), FPCStringPtr, NULL},
{kGetVolParmsInfoBufferFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{NULL, 0, 0, NULL, NULL}
};
static const FPFieldDesc kGetVolParmsInfoBufferFieldDescV5[] = {
{"vMMaxNameLength", offsetof(GetVolParmsInfoBuffer, vMMaxNameLength), sizeof(UniCharCount), FPUDec, NULL},
{kGetVolParmsInfoBufferFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{NULL, 0, 0, NULL, NULL}
};
static const FPFieldDesc * kGetVolParmsInfoBufferFieldDescByVersion[] = {
kGetVolParmsInfoBufferFieldDescV1,
kGetVolParmsInfoBufferFieldDescV2,
kGetVolParmsInfoBufferFieldDescV3,
kGetVolParmsInfoBufferFieldDescV4,
kGetVolParmsInfoBufferFieldDescV5
};
static void PrintVolumeParms(const GetVolParmsInfoBuffer *volParms, uint32_t indent, uint32_t verbose)
// Code to print a volume parms buffer, common to both the PBHGetVolParms
// and FSGetVolumeParms commands.
{
size_t versionIndex;
size_t versionLimit;
assert(volParms != NULL);
if (volParms->vMVersion < 1) {
fprintf(stdout, " vMVersion = %hd\n", volParms->vMVersion);
} else {
versionIndex = 0;
versionLimit = (sizeof(kGetVolParmsInfoBufferFieldDescByVersion) / sizeof(FPFieldDesc *));
if (versionLimit > (size_t) volParms->vMVersion) {
versionLimit = volParms->vMVersion;
}
while (versionIndex < versionLimit) {
FPPrintFields(kGetVolParmsInfoBufferFieldDescByVersion[versionIndex], volParms, sizeof(*volParms), indent, verbose);
versionIndex += 1;
}
}
}
#if ! TARGET_RT_64_BIT
static CommandError PrintPBHGetVolParms(CommandArgsRef args, uint32_t indent, uint32_t verbose)
// Uses PBHGetVolParmsSync to get information about the specified volume and
// prints the result.
//
// indent and verbose are as per the comments for FPPrinter.
{
OSStatus err;
FSVolumeRefNum volRefNum;
HParamBlockRec hpb;
GetVolParmsInfoBuffer volParms;
assert( CommandArgsValid(args) );
err = CommandArgsGetVRefNum(args, &volRefNum);
if (err == noErr) {
hpb.ioParam.ioNamePtr = NULL;
hpb.ioParam.ioVRefNum = volRefNum;
hpb.ioParam.ioBuffer = (Ptr) &volParms;
hpb.ioParam.ioReqCount = sizeof(volParms);
err = PBHGetVolParmsSync(&hpb);
}
if (err == noErr) {
PrintVolumeParms(&volParms, indent, verbose);
}
return CommandErrorMakeWithOSStatus(err);
}
const CommandInfo kPBHGetVolParmsCommand = {
PrintPBHGetVolParms,
"PBHGetVolParms",
"itemPath",
"Print information from PBHGetVolParms.",
NULL
};
#endif
static CommandError PrintFSGetVolumeParms(CommandArgsRef args, uint32_t indent, uint32_t verbose)
// Uses FSGetVolumeParms to get information about the specified volume and
// prints the result.
//
// indent and verbose are as per the comments for FPPrinter.
{
OSStatus err;
FSVolumeRefNum volRefNum;
GetVolParmsInfoBuffer volParms;
assert( CommandArgsValid(args) );
if ( FSGetVolumeParms == NULL ) {
return CommandErrorMakeWithCustom(kUnavailableCustomError);
}
err = CommandArgsGetVRefNum(args, &volRefNum);
if (err == noErr) {
err = FSGetVolumeParms(volRefNum, &volParms, sizeof(volParms));
}
if (err == noErr) {
PrintVolumeParms(&volParms, indent, verbose);
}
return CommandErrorMakeWithOSStatus(err);
}
const CommandInfo kFSGetVolumeParmsCommand = {
PrintFSGetVolumeParms,
"FSGetVolumeParms",
"itemPath",
"Print information from FSGetVolumeParms.",
NULL
};
#pragma mark * PBGetVolMountInfo
// Values for the uamType field of the AFPVolMountInfo.
static const FPEnumDesc kVolMountInfoUAMType[] = {
{ 1, "No User Authent" },
{ 2, "Cleartxt Passwrd" },
{ 3, "Randnum Exchange" },
{ 4, "Cleartxt Passwrd (variable length)" },
{ 5, "Randnum Exchange (variable length)" },
{ 6, "2-Way Randnum" },
{ 7, "DHCAST128" },
{ 8, "DHX2" },
{ 9, "Client Krb v2" },
{ 0, NULL }
};
// The following two enums document extra constants that should be in "Files.h" <rdar://problem/5439845>.
enum {
kAFPTagTypeIPv6 = 0x06,
kAFPTagTypeIPv6Port = 0x07
};
enum {
kAFPTagLengthIPv6 = 0x12,
kAFPTagLengthIPv6Port = 0x14
};
static void PrintAlternateAddresses(AFPXVolMountInfoPtr afpXVolInfoBuffer, short offset, uint32_t indent)
// Prints any alternative addresses embedded within the AFPXVolMountInfo structure.
//
// indent is per the comments for FPPrinter.
{
int junk;
AFPAlternateAddress * addrList;
AFPTagData * thisAddr;
int i;
UInt8 thisAddrType;
size_t addrIndex;
struct sockaddr_in addr;
struct sockaddr_in6 addr6;
Str255 dns;
char hostStr[NI_MAXHOST];
char servStr[NI_MAXSERV];
static const char *kAddrTypeNames[] = {
"unknown", "kAFPTagTypeIP", "kAFPTagTypeIPPort", "kAFPTagTypeDDP",
"kAFPTagTypeDNS", "unknown", "kAFPTagTypeIPv6", "kAFPTagTypeIPv6Port"
};
assert(offset >= 0);
addrList = (AFPAlternateAddress *) (((char *) afpXVolInfoBuffer) + offset);
assert(addrList->fVersion == 0);
thisAddr = (AFPTagData *) &addrList->fAddressList[0];
for (i = 0; i < addrList->fAddressCount; i++) {
Boolean understood;
thisAddrType = thisAddr->fType;
if (thisAddrType >= (sizeof(kAddrTypeNames) / sizeof(*kAddrTypeNames))) {
thisAddrType = 0;
}
fprintf(stdout, "%*saddr[%d].fType = %s (%" PRIu8 ")\n", (int) indent, "", i, kAddrTypeNames[thisAddrType], (uint8_t) thisAddr->fType);
memset(&addr, 0, sizeof(addr));
addr.sin_len = sizeof(addr);
addr.sin_family = AF_INET;
memset(&addr6, 0, sizeof(addr6));
addr6.sin6_len = sizeof(addr6);
addr6.sin6_family = AF_INET6;
// Print the address data based on its type.
//
// IMPORTANT: This data is always big endian (because of the PowerPC
// heritage of this structure) but that's OK because the data in the
// struct sockaddr_in[6] is also big endian (because it is in network
// byte order).
understood = false;
switch (thisAddr->fType) {
case kAFPTagTypeIP:
if (thisAddr->fLength == kAFPTagLengthIP) {
memcpy(&addr.sin_addr, &thisAddr->fData[0], sizeof(addr.sin_addr));
junk = getnameinfo( (struct sockaddr *) &addr, (socklen_t) sizeof(addr), hostStr, (socklen_t) sizeof(hostStr), NULL, 0, NI_NUMERICHOST);
assert(junk == 0);
fprintf(stdout, "%*saddr[%d].fData = %s\n", (int) indent, "", i, hostStr);
understood = true;
}
break;
case kAFPTagTypeIPPort:
if (thisAddr->fLength == kAFPTagLengthIPPort) {
memcpy(&addr.sin_addr, &thisAddr->fData[0], sizeof(addr.sin_addr));
memcpy(&addr.sin_port, &thisAddr->fData[sizeof(addr.sin_addr)], sizeof(addr.sin_port));
junk = getnameinfo( (struct sockaddr *) &addr, (socklen_t) sizeof(addr), hostStr, (socklen_t) sizeof(hostStr), servStr, (socklen_t) sizeof(servStr), NI_NUMERICHOST | NI_NUMERICSERV);
assert(junk == 0);
fprintf(stdout, "%*saddr[%d].fData = %s:%s\n", (int) indent, "", i, hostStr, servStr);
understood = true;
}
break;
case kAFPTagTypeDNS:
if (thisAddr->fLength > offsetof(AFPTagData, fLength)) {
dns[0] = thisAddr->fLength - offsetof(AFPTagData, fData);
memcpy(&dns[1], &thisAddr->fData[0], dns[0]);
fprintf(stdout, "%*saddr[%d].fData = %.*s\n", (int) indent, "", i, (int) dns[0], (char *) &dns[1]);
understood = true;
}
break;
case kAFPTagTypeIPv6:
if (thisAddr->fLength == kAFPTagLengthIPv6) {
memcpy(&addr6.sin6_addr, &thisAddr->fData[0], sizeof(addr6.sin6_addr));
junk = getnameinfo( (struct sockaddr *) &addr6, (socklen_t) sizeof(addr6), hostStr, (socklen_t) sizeof(hostStr), NULL, 0, NI_NUMERICHOST);
assert(junk == 0);
fprintf(stdout, "%*saddr[%d].fData = %s\n", (int) indent, "", i, hostStr);
understood = true;
}
break;
case kAFPTagTypeIPv6Port:
if (thisAddr->fLength == kAFPTagLengthIPv6Port) {
memcpy(&addr6.sin6_addr, &thisAddr->fData[0], sizeof(addr6.sin6_addr));
memcpy(&addr6.sin6_port, &thisAddr->fData[sizeof(addr6.sin6_addr)], sizeof(addr6.sin6_port));
junk = getnameinfo( (struct sockaddr *) &addr6, (socklen_t) sizeof(addr6), hostStr, (socklen_t) sizeof(hostStr), NULL, 0, NI_NUMERICHOST);
assert(junk == 0);
fprintf(stdout, "%*saddr[%d].fData = %s\n", (int) indent, "", i, hostStr);
understood = true;
}
break;
default:
break;
}
// If we don't recognise the address type, just dump the hex.
if ( ! understood ) {
fprintf(stdout, "%*saddr[%d].fData =", (int) indent, "", i);
for (addrIndex = 0; addrIndex < ((size_t) thisAddr->fLength); addrIndex++) {
fprintf(stdout, " 0x%02x", thisAddr->fData[addrIndex]);
}
fprintf(stdout, "\n");
}
thisAddr = (AFPTagData *) ( ((char *) thisAddr) + thisAddr->fLength );
}
}
// Flags for the flags field of the VolumeMountInfoHeader.
static const FPFlagDesc kAFPFlags[] = {
{volMountExtendedFlagsMask, "volMountExtendedFlagsMask"},
{0, NULL}
};
// The fields of the VolumeMountInfoHeader structure.
static const char kVolMountInfoFieldSpacer[32] = "volInfoBuffer";
static const FPFieldDesc kVolMountInfoFieldDesc[] = {
{kVolMountInfoFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{"length", offsetof(VolumeMountInfoHeader, length), sizeof(short), FPSDec, NULL},
{"media", offsetof(VolumeMountInfoHeader, media), sizeof(VolumeType), FPSignature, (const void *) (uintptr_t) kFPValueHostEndian},
{"flags", offsetof(VolumeMountInfoHeader, flags), sizeof(short), FPFlags, kAFPFlags},
{NULL, 0, 0, NULL, NULL}
};
// The fields of the AFPVolMountInfo structure.
static const char kAFPVolMountInfoFieldSpacer[32] = "alternateAddressOffset";
static const FPFieldDesc kAFPVolMountInfoFieldDesc[] = {
{kAFPVolMountInfoFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{"nbpInterval", offsetof(AFPVolMountInfo, nbpInterval), sizeof(SInt8), FPSDec, NULL},
{"nbpCount", offsetof(AFPVolMountInfo, nbpCount), sizeof(SInt8), FPSDec, NULL},
{"uamType", offsetof(AFPVolMountInfo, uamType), sizeof(short), FPEnum, kVolMountInfoUAMType},
{"zoneNameOffset", offsetof(AFPVolMountInfo, zoneNameOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, zoneNameOffset)},
{"serverNameOffset", offsetof(AFPVolMountInfo, serverNameOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, serverNameOffset)},
{"volNameOffset", offsetof(AFPVolMountInfo, volNameOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, volNameOffset)},
{"userNameOffset", offsetof(AFPVolMountInfo, userNameOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, userNameOffset)},
{"userPasswordOffset", offsetof(AFPVolMountInfo, userPasswordOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, userPasswordOffset)},
{"volPasswordOffset", offsetof(AFPVolMountInfo, volPasswordOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPVolMountInfo, volPasswordOffset)},
{NULL, 0, 0, NULL, NULL}
};
// Flags for the extendedFlags field of the AFPXVolMountInfo.
static const FPFlagDesc kAFPExtendedFlags[] = {
{kAFPExtendedFlagsAlternateAddressMask, "kAFPExtendedFlagsAlternateAddressMask"},
{0, NULL}
};
// The fields of the AFPXVolMountInfo structure. These are broken up into
// two groups because the second group of fields is only present if
// kAFPExtendedFlagsAlternateAddressMask is set in extendedFlags.
static const FPFieldDesc kAFPXVolMountInfoFieldDesc[] = {
{kAFPVolMountInfoFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{"extendedFlags", offsetof(AFPXVolMountInfo, extendedFlags), sizeof(short), FPFlags, kAFPExtendedFlags},
{"uamNameOffset", offsetof(AFPXVolMountInfo, uamNameOffset), sizeof(short), FPAFPString, (void *) offsetof(AFPXVolMountInfo, uamNameOffset)},
{NULL, 0, 0, NULL, NULL}
};
static const FPFieldDesc kAFPXVolMountInfoFieldDesc2[] = {
{kAFPVolMountInfoFieldSpacer, 0, 0, FPNull, NULL}, // present to pad out field widths
{"alternateAddressOffset", offsetof(AFPXVolMountInfo, alternateAddressOffset), sizeof(short), FPSDec, NULL},
{NULL, 0, 0, NULL, NULL}
};
static void PrintVolumeMountInfo(size_t volInfoSize, VolumeMountInfoHeaderPtr volInfoBuffer, uint32_t indent, uint32_t verbose)
// Common code used to print a volume mount info buffer. Called by both
// the FSGetVolumeMountInfo and the PBGetVolMountInfo commands.
{
assert(volInfoBuffer != NULL);
assert(volInfoSize >= sizeof(*volInfoBuffer));
fprintf(stdout, "%*svolInfoSize = %zd\n", (int) indent, "", volInfoSize);
FPPrintFields(kVolMountInfoFieldDesc, volInfoBuffer, sizeof(*volInfoBuffer), indent, verbose);
// If this is an AFP volume, we know the structure of the mount info
// data, and thus we print it. Otherwise we just dump the data as hex.
if (volInfoBuffer->media == AppleShareMediaType) {
AFPVolMountInfoPtr afpVolInfoBuffer;
afpVolInfoBuffer = (AFPVolMountInfoPtr) volInfoBuffer;
fprintf(stdout, "%*sAppleShareMediaType\n", (int) indent, "");
FPPrintFields(kAFPVolMountInfoFieldDesc, afpVolInfoBuffer, sizeof(*afpVolInfoBuffer), indent + kStdIndent, verbose);
if (afpVolInfoBuffer->flags & volMountExtendedFlagsMask) {
AFPXVolMountInfoPtr afpXVolInfoBuffer;
afpXVolInfoBuffer = (AFPXVolMountInfoPtr) afpVolInfoBuffer;
FPPrintFields(kAFPXVolMountInfoFieldDesc, afpVolInfoBuffer, sizeof(*afpVolInfoBuffer), indent + kStdIndent, verbose);
if (afpXVolInfoBuffer->extendedFlags & kAFPExtendedFlagsAlternateAddressMask) {
FPPrintFields(kAFPXVolMountInfoFieldDesc2, afpVolInfoBuffer, sizeof(*afpVolInfoBuffer), indent + kStdIndent, verbose);
PrintAlternateAddresses(afpXVolInfoBuffer, afpXVolInfoBuffer->alternateAddressOffset, indent + 2 * kStdIndent);
}
}
} else {
if (verbose > 0) {
FPHex("volInfoBuffer", volInfoSize, volInfoBuffer, 4, strlen(kVolMountInfoFieldSpacer), false, NULL);
}
}
}
#if ! TARGET_RT_64_BIT
static CommandError PrintPBGetVolMountInfo(CommandArgsRef args, uint32_t indent, uint32_t verbose)
// Uses PBGetVolMountInfo to get information about the specified volume and
// prints the result.
//
// indent and verbose are as per the comments for FPPrinter.
{
OSStatus err;
FSVolumeRefNum volRefNum;
ParamBlockRec pb;
short volInfoSize;
VolumeMountInfoHeaderPtr volInfoBuffer;
assert( CommandArgsValid(args) );