Windows: Add AFSFileEvalResultCB
[openafs.git] / src / WINNT / afsrdr / common / AFSUserStructs.h
1 /*
2  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
3  * Copyright (c) 2009-2011 Your File System, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  *   this list of conditions and the following disclaimer.
12  * - Redistributions in binary form must reproduce the above copyright
13  *   notice,
14  *   this list of conditions and the following disclaimer in the
15  *   documentation
16  *   and/or other materials provided with the distribution.
17  * - Neither the name of Kernel Drivers, LLC nor the names of its
18  *   contributors may be
19  *   used to endorse or promote products derived from this software without
20  *   specific prior written permission from Kernel Drivers, LLC
21  *   and Your File System, Inc.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef _AFS_USER_STRUCT_H
37 #define _AFS_USER_STRUCT_H
38
39 typedef struct _AFS_FILE_ID
40 {
41
42     ULONG    Hash;
43
44     ULONG    Cell;
45
46     ULONG    Volume;
47
48     ULONG    Vnode;
49
50     ULONG    Unique;
51
52 } AFSFileID;
53
54 //
55 // This control structure is the request block passed to the filter. The filter will populate the structure
56 // when it requires a request to be handled by the service.
57 //
58
59 typedef struct _AFS_COMM_REQUEST_BLOCK
60 {
61
62     AFSFileID       FileId;             /* Initialize unused elements to 0 */
63
64     ULONG           RequestType;
65
66     ULONG           RequestIndex;    /* Must return to caller */
67
68     ULONG           RequestFlags;    /* AFS_REQUEST_FLAG_xxxx */
69
70     ULONG           NameLength;      // Length of the name in bytes
71
72     ULONG           DataOffset;       // This offset is from the end of the structure, including the name
73
74     ULONG           DataLength;
75
76     GUID            AuthGroup;      // Length: sizeof(GUID) */
77
78     ULONG           ResultBufferLength;    /* Do not exceed this length in response */
79
80     LONG            QueueCount;     // Current outstanding requests in the queue
81
82     WCHAR           Name[ 1];
83
84 } AFSCommRequest;
85
86
87 //
88 // This is the result block passed back to the redirector after a request has been handled
89 //
90
91 typedef struct _AFS_COMM_RESULT_BLOCK
92 {
93
94     ULONG           RequestIndex;        /* Must match the AFSCommRequest value */
95
96     ULONG           ResultStatus;        /* NTSTATUS_xxx */
97
98     ULONG           ResultBufferLength;    /* Not to exceed AFSCommRequest ResultBufferLength */
99
100     ULONG           Reserved;           /* To ease Quad Alignment */
101
102     char            ResultData[ 1];
103
104 } AFSCommResult;
105
106 //
107 // Control block passed to IOCTL_AFS_INITIALIZE_REDIRECTOR_DEVICE
108 //
109
110 #define AFS_REDIR_INIT_FLAG_HIDE_DOT_FILES          0x00000001
111
112 #define AFS_REDIR_INIT_NO_PAGING_FILE               0x00000002
113
114 typedef struct _AFS_REDIR_INIT_INFO_CB
115 {
116
117     ULONG       Flags;
118
119     ULONG       MaximumChunkLength;     // Maximum RPC length issued so we should limit
120                                         // requests for data to this length
121
122     AFSFileID   GlobalFileId;           // AFS FID of the Global root.afs volume
123
124     LARGE_INTEGER  ExtentCount;         // Number of extents in the current data cache
125
126     ULONG       CacheBlockSize;         // Size, in bytes, of the current cache block
127
128     ULONG       MaxPathLinkCount;       // Number of symlinks / mountpoints that may
129                                         // be cross during the evaluation of any path
130
131     ULONG       NameArrayLength;        // Number of components that should be allocated
132                                         // in each name array chunk.  Name arrays are
133                                         // dynamic and will be increased in size as
134                                         // needed by this amount
135
136     LARGE_INTEGER MemoryCacheOffset;    // The offset in the afsd_service process memory
137                                         // space at which the extents are allocated
138     LARGE_INTEGER MemoryCacheLength;    // and the length of the allocated region
139
140     ULONG       DumpFileLocationOffset; // Offset from the beginning of this structure to
141                                         // the start of the directory where dump files
142                                         // are to be stored. The path must be fully
143                                         // qualified such as C:\Windows\Temp
144
145     ULONG       DumpFileLocationLength; // Length, in bytes, of the DumpFileLocation path
146
147     ULONG       CacheFileNameLength;    // size, in bytes, of the cache file name
148
149     WCHAR       CacheFileName[ 1];      // Fully qualified cache file name in the form
150                                         // C:\OPenAFSDir\CacheFile.dat
151
152 } AFSRedirectorInitInfo;
153
154 //
155 // Directory query CB
156 //
157
158 typedef struct _AFS_DIR_QUERY_CB
159 {
160
161     ULONG_PTR        EnumHandle;  // If this is 0 then it is a new query,
162                                   // otherwise it is the FileIndex of the last
163                                   // entry processed.
164
165 } AFSDirQueryCB;
166
167 //
168 // Directory enumeration control block
169 // Entries are aligned on a QuadWord boundary
170 //
171
172 typedef struct _AFS_DIR_ENUM_ENTRY
173 {
174
175     AFSFileID       FileId;
176
177     ULONG           FileIndex;          /* Incremented  */
178
179     LARGE_INTEGER   Expiration;         /* FILETIME */
180
181     LARGE_INTEGER   DataVersion;
182
183     ULONG           FileType;           /* File, Dir, MountPoint, Symlink */
184
185     LARGE_INTEGER   CreationTime;       /* FILETIME */
186
187     LARGE_INTEGER   LastAccessTime;     /* FILETIME */
188
189     LARGE_INTEGER   LastWriteTime;      /* FILETIME */
190
191     LARGE_INTEGER   ChangeTime;         /* FILETIME */
192
193     LARGE_INTEGER   EndOfFile;
194
195     LARGE_INTEGER   AllocationSize;
196
197     ULONG           FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
198
199     ULONG           FileNameLength;
200
201     ULONG           EaSize;
202
203     ULONG           Links;
204
205     ULONG           FileNameOffset;     /* From beginning of this structure */
206
207     ULONG           TargetNameOffset;   /* From beginning of this structure */
208
209     ULONG           TargetNameLength;
210
211     AFSFileID       TargetFileId;       /* Target fid for mp's and symlinks */
212
213     CCHAR           ShortNameLength;
214
215     WCHAR           ShortName[12];
216
217     /* Long Filename and Target (Symlink and MountPoint only) to follow without NULs */
218
219 } AFSDirEnumEntry;
220
221
222 typedef struct _AFS_DIR_ENUM_RESP
223 {
224
225     ULONG_PTR       EnumHandle;
226
227     AFSDirEnumEntry Entry[ 1];     /* Each entry is Quad aligned */
228
229 } AFSDirEnumResp;
230
231 //
232 // Volume information CB passed in the create request
233 //
234
235 typedef struct _AFS_VOLUME_INFORMATION
236 {
237
238     LARGE_INTEGER   TotalAllocationUnits;       /* Partition Max Blocks */
239
240     LARGE_INTEGER   AvailableAllocationUnits;   /* Partition Blocks Avail */
241
242     LARGE_INTEGER   VolumeCreationTime;         /* AFS Last Update - Not Creation */
243
244     ULONG           Characteristics;            /* FILE_READ_ONLY_DEVICE (if readonly)
245                                                  * FILE_REMOTE_DEVICE (always)
246                                                  */
247
248     ULONG           FileSystemAttributes;       /* FILE_CASE_PRESERVED_NAMES (always)
249                                                    FILE_UNICODE_ON_DISK      (always) */
250
251     ULONG           SectorsPerAllocationUnit;   /* = 1 */
252
253     ULONG           BytesPerSector;             /* = 1024 */
254
255     ULONG           CellID;                     /* AFS Cell ID */
256
257     ULONG           VolumeID;                   /* AFS Volume ID */
258
259     ULONG           VolumeLabelLength;
260
261     WCHAR           VolumeLabel[20];            /* Volume:Cell */
262
263 } AFSVolumeInfoCB;
264
265 //
266 // File create CB
267 //
268
269 typedef struct _AFS_FILE_CREATE_CB
270 {
271
272     AFSFileID       ParentId;
273
274     LARGE_INTEGER   AllocationSize;
275
276     ULONG           FileAttributes;
277
278     ULONG           EaSize;
279
280     char            EaBuffer[ 1];
281
282 } AFSFileCreateCB;
283
284 typedef struct _AFS_FILE_CREATE_RESULT_CB
285 {
286
287     LARGE_INTEGER   ParentDataVersion;
288
289     AFSDirEnumEntry DirEnum;
290
291 } AFSFileCreateResultCB;
292
293 //
294 // File open CB
295 //
296
297 typedef struct _AFS_FILE_OPEN_CB
298 {
299
300     AFSFileID       ParentId;
301
302     ULONG           DesiredAccess;
303
304     ULONG           ShareAccess;
305
306     ULONGLONG       ProcessId;
307
308     ULONGLONG       Identifier;
309
310 } AFSFileOpenCB;
311
312 typedef struct _AFS_FILE_OPEN_RESULT_CB
313 {
314
315     ULONG           GrantedAccess;
316
317     ULONG           FileAccess;
318
319 } AFSFileOpenResultCB;
320
321 typedef struct _AFS_FILE_ACCESS_RELEASE_CB
322 {
323
324     ULONG           FileAccess;
325
326     ULONGLONG       ProcessId;
327
328     ULONGLONG       Identifier;
329
330 } AFSFileAccessReleaseCB;
331
332 //
333 // IO Interace control blocks for extent processing when performing
334 // queries via the AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS or synchronous
335 // results from the service
336 //
337
338 typedef struct _AFS_FILE_EXTENT_CB
339 {
340
341     ULONG           Flags;
342
343     ULONG           Length;
344
345     LARGE_INTEGER   FileOffset;
346
347     LARGE_INTEGER   CacheOffset;
348
349     UCHAR           MD5[16];
350
351     ULONG           DirtyOffset;
352
353     ULONG           DirtyLength;
354
355 } AFSFileExtentCB;
356
357 typedef struct _AFS_REQUEST_EXTENTS_CB
358 {
359
360     ULONG           Flags;
361
362     LARGE_INTEGER   ByteOffset;
363
364     ULONG           Length;
365
366 } AFSRequestExtentsCB;
367
368 //
369 // Extent processing when the file system calls the service to
370 // release extents through the AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS interface
371 //
372
373 typedef struct _AFS_RELEASE_EXTENTS_CB
374 {
375
376     ULONG           Flags;
377
378     ULONG           ExtentCount;
379
380     LARGE_INTEGER   LastAccessTime;
381
382     LARGE_INTEGER   LastWriteTime;
383
384     LARGE_INTEGER   ChangeTime;
385
386     LARGE_INTEGER   CreateTime;
387
388     LARGE_INTEGER   AllocationSize;
389
390     AFSFileExtentCB FileExtents[ 1];
391
392 } AFSReleaseExtentsCB;
393
394 //
395 // This is the control structure used when the service passes the extent
396 // information via the IOCTL_AFS_SET_FILE_EXTENTS interface
397 //
398
399 typedef struct _AFS_SET_FILE_EXTENTS_CB
400 {
401
402     AFSFileID       FileId;
403
404     ULONG           ExtentCount;
405
406     ULONG           ResultStatus;
407
408     AFSFileExtentCB FileExtents[ 1];
409
410 } AFSSetFileExtentsCB;
411
412 //
413 // This is the control structure used when the service passes the extent
414 // information via the IOCTL_AFS_RELEASE_FILE_EXTENTS interface
415 //
416
417 #define AFS_RELEASE_EXTENTS_FLAGS_RELEASE_ALL       0x00000001
418
419 typedef struct _AFS_RELEASE_FILE_EXTENTS_CB
420 {
421
422     ULONG           Flags;
423
424     AFSFileID       FileId;
425
426     ULONG           ExtentCount;
427
428     LARGE_INTEGER   HeldExtentCount;
429
430     AFSFileExtentCB FileExtents[ 1];
431
432 } AFSReleaseFileExtentsCB;
433
434 //
435 // These are the control structures that the filesystem returns from a
436 // IOCTL_AFS_RELEASE_FILE_EXTENTS
437 //
438
439 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_FILE_CB
440 {
441     AFSFileID       FileId;
442
443     ULONG           Flags;
444
445     GUID            AuthGroup; /* Length: sizeof(GUID) */
446
447     ULONG           ExtentCount;
448
449     LARGE_INTEGER   LastAccessTime;
450
451     LARGE_INTEGER   LastWriteTime;
452
453     LARGE_INTEGER   ChangeTime;
454
455     LARGE_INTEGER   CreateTime;
456
457     LARGE_INTEGER   AllocationSize;
458
459     AFSFileExtentCB FileExtents[ 1];
460
461 } AFSReleaseFileExtentsResultFileCB;
462
463 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_CB
464 {
465     ULONG           SerialNumber;
466
467     ULONG           Flags;
468
469     ULONG           FileCount;
470
471     AFSReleaseFileExtentsResultFileCB Files[ 1];
472
473 } AFSReleaseFileExtentsResultCB;
474
475
476 typedef struct _AFS_EXTENT_FAILURE_CB
477 {
478
479     AFSFileID       FileId;
480
481     ULONG           FailureStatus;
482
483     GUID            AuthGroup;      // Length: sizeof(GUID) */
484
485 } AFSExtentFailureCB;
486
487 //
488 // File update CB
489 //
490
491 typedef struct _AFS_FILE_UPDATE_CB
492 {
493
494     AFSFileID       ParentId;
495
496     LARGE_INTEGER   LastAccessTime;
497
498     LARGE_INTEGER   LastWriteTime;
499
500     LARGE_INTEGER   ChangeTime;
501
502     LARGE_INTEGER   CreateTime;
503
504     LARGE_INTEGER   AllocationSize;
505
506     ULONG           FileAttributes;
507
508     ULONG           EaSize;
509
510     char            EaBuffer[ 1];
511
512 } AFSFileUpdateCB;
513
514 //
515 // File update CB result
516 //
517
518 typedef struct _AFS_FILE_UPDATE_RESULT_CB
519 {
520
521     AFSDirEnumEntry DirEnum;
522
523 } AFSFileUpdateResultCB;
524
525 //
526 // File delete CB
527 //
528
529 typedef struct _AFS_FILE_DELETE_CB
530 {
531
532     AFSFileID       ParentId;        /* Must be directory */
533
534     ULONGLONG       ProcessId;
535
536                                      /* File Name and FileID in Common Request Block */
537
538 } AFSFileDeleteCB;
539
540 typedef struct _AFS_FILE_DELETE_RESULT_CB
541 {
542
543     LARGE_INTEGER   ParentDataVersion;
544
545 } AFSFileDeleteResultCB;
546
547 //
548 // File rename CB
549 //
550
551 typedef struct _AFS_FILE_RENAME_CB
552 {
553
554     AFSFileID       SourceParentId;        /* Must be directory */
555
556     AFSFileID       TargetParentId;        /* Must be directory */
557
558                                            /* Source Name and FileID in Common Request Block */
559
560     USHORT          TargetNameLength;
561
562     WCHAR           TargetName[ 1];
563
564 } AFSFileRenameCB;
565
566 typedef struct _AFS_FILE_RENAME_RESULT_CB
567 {
568
569     LARGE_INTEGER   SourceParentDataVersion;
570
571     LARGE_INTEGER   TargetParentDataVersion;
572
573     AFSDirEnumEntry DirEnum;
574
575 } AFSFileRenameResultCB;
576
577
578 //
579 // Control structures for AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID
580 // and AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME
581 //
582 // The response to these requests is a AFSDirEnumEntry
583 //
584
585 typedef struct _AFS_FILE_EVAL_TARGET_CB
586 {
587
588     AFSFileID       ParentId;
589
590 } AFSEvalTargetCB;
591
592
593 typedef struct _AFS_FILE_EVAL_RESULT_CB
594 {
595
596     LARGE_INTEGER   ParentDataVersion;
597
598     AFSDirEnumEntry DirEnum;
599
600 } AFSFileEvalResultCB;
601
602
603 //
604 // Control structure for read and write requests through the PIOCtl interface
605 //
606 // CommRequest FileId field contains the active directory
607
608 typedef struct _AFS_PIOCTL_IO_CB
609 {
610     ULONG       RequestId;
611
612     AFSFileID   RootId;
613
614     ULONG       BufferLength;
615
616     void        *MappedBuffer;
617
618 } AFSPIOCtlIORequestCB;
619
620 //
621 // The returned information for the IO Request
622 //
623
624 typedef struct _AFS_PIOCTL_IO_RESULT_CB
625 {
626
627     ULONG       BytesProcessed;
628
629 } AFSPIOCtlIOResultCB;
630
631
632 //
633 // Control structure for open and close requests through the PIOCtl interface
634 //
635 // CommRequest FileId field contains the active directory
636 //
637 // There is no return structure.
638 //
639 typedef struct _AFS_PIOCTL_OPEN_CLOSE_CB
640 {
641
642     ULONG       RequestId;
643
644     AFSFileID   RootId;
645
646 } AFSPIOCtlOpenCloseRequestCB;
647
648 //
649 // Cache invalidation control block
650 //
651
652 typedef struct _AFS_INVALIDATE_CACHE_CB
653 {
654
655     AFSFileID   FileID;
656
657     ULONG       FileType;
658
659     BOOLEAN     WholeVolume;
660
661     ULONG       Reason;
662
663 } AFSInvalidateCacheCB;
664
665 //
666 // Network Status Control Block
667 //
668
669 typedef struct _AFS_NETWORK_STATUS_CB
670 {
671
672     BOOLEAN     Online;
673
674 } AFSNetworkStatusCB;
675
676 //
677 // Volume Status Control Block
678 //
679
680 typedef struct _AFS_VOLUME_STATUS_CB
681 {
682
683     AFSFileID   FileID;         // only cell and volume fields are set
684
685     BOOLEAN     Online;
686
687 } AFSVolumeStatusCB;
688
689
690 typedef struct _AFS_SYSNAME
691 {
692
693     ULONG       Length;         /* bytes */
694
695     WCHAR       String[AFS_MAX_SYSNAME_LENGTH];
696
697 } AFSSysName;
698
699 //
700 // SysName Notification Control Block
701 //   Sent as the buffer with IOCTL_AFS_SYSNAME_NOTIFICATION
702 //   There is no response
703 //
704
705 typedef struct _AFS_SYSNAME_NOTIFICATION_CB
706 {
707
708     ULONG       Architecture;
709
710     ULONG       NumberOfNames;
711
712     AFSSysName  SysNames[1];
713
714 } AFSSysNameNotificationCB;
715
716
717 //
718 // File System Status Query Control Block
719 //   Received as a response to IOCTL_AFS_STATUS_REQUEST
720 //
721 typedef struct _AFS_DRIVER_STATUS_RESPONSE_CB
722 {
723
724     ULONG       Status;         // bit flags - see below
725
726 } AFSDriverStatusRespCB;
727
728 // Bit flags
729 #define AFS_DRIVER_STATUS_READY         0
730 #define AFS_DRIVER_STATUS_NOT_READY     1
731 #define AFS_DRIVER_STATUS_NO_SERVICE    2
732
733 //
734 // Byte Range Lock Request
735 //
736 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST
737 {
738     ULONG               LockType;
739
740     LARGE_INTEGER       Offset;
741
742     LARGE_INTEGER       Length;
743
744 } AFSByteRangeLockRequest;
745
746 #define AFS_BYTE_RANGE_LOCK_TYPE_SHARED 0
747 #define AFS_BYTE_RANGE_LOCK_TYPE_EXCL   1
748
749
750 //
751 // Byte Range Lock Request Control Block
752 //
753 // Set ProcessId and FileId in the Comm Request Block
754 //
755 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST_CB
756 {
757
758     ULONG                       Count;
759
760     ULONGLONG                   ProcessId;
761
762     AFSByteRangeLockRequest     Request[1];
763
764 } AFSByteRangeLockRequestCB;
765
766 //
767 // Byte Range Lock Result
768 //
769 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT
770 {
771
772     ULONG               LockType;
773
774     LARGE_INTEGER       Offset;
775
776     LARGE_INTEGER       Length;
777
778     ULONG               Status;
779
780 } AFSByteRangeLockResult;
781
782 //
783 // Byte Range Lock Results Control Block
784 //
785
786 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT_CB
787 {
788
789     AFSFileID                   FileId;
790
791     ULONG                       Count;
792
793     AFSByteRangeLockResult      Result[1];
794
795 } AFSByteRangeLockResultCB;
796
797 //
798 // Set Byte Range Lock Results Control Block
799 //
800
801 typedef struct _AFS_SET_BYTE_RANGE_LOCK_RESULT_CB
802 {
803
804     ULONG                       SerialNumber;
805
806     AFSFileID                   FileId;
807
808     ULONG                       Count;
809
810     AFSByteRangeLockResult      Result[1];
811
812 } AFSSetByteRangeLockResultCB;
813
814
815 //
816 // Byte Range Unlock Request Control Block
817 //
818
819 typedef struct _AFS_BYTE_RANGE_UNLOCK_CB
820 {
821
822     ULONG                       Count;
823
824     ULONGLONG                   ProcessId;
825
826     AFSByteRangeLockRequest     Request[1];
827
828 } AFSByteRangeUnlockRequestCB;
829
830
831 //
832 // Byte Range Unlock Request Control Block
833 //
834
835 typedef struct _AFS_BYTE_RANGE_UNLOCK_RESULT_CB
836 {
837
838     ULONG                       Count;
839
840     AFSByteRangeLockResult      Result[1];
841
842 } AFSByteRangeUnlockResultCB;
843
844
845 //
846 // Control structure for read and write requests through the PIPE interface
847 //
848 // CommRequest FileId field contains the active directory
849
850 typedef struct _AFS_PIPE_IO_CB
851 {
852     ULONG       RequestId;
853
854     AFSFileID   RootId;
855
856     ULONG       BufferLength;
857
858 } AFSPipeIORequestCB;   // For read requests the buffer is mapped in the request cb block.
859                         // For write requests, the buffer immediately follows this structure
860
861 //
862 // The returned information for the Pipe IO Request. Note that this is
863 // only returned in the write request. Read request info is returned in
864 // the request cb
865 //
866
867 typedef struct _AFS_PIPE_IO_RESULT_CB
868 {
869
870     ULONG       BytesProcessed;
871
872 } AFSPipeIOResultCB;
873
874 //
875 // Control structure for set and query info requests through the PIPE interface
876 //
877
878 typedef struct _AFS_PIPE_INFO_CB
879 {
880
881     ULONG       RequestId;
882
883     AFSFileID   RootId;
884
885     ULONG       InformationClass;
886
887     ULONG       BufferLength;
888
889 } AFSPipeInfoRequestCB;   // For query info requests the buffer is mapped in the request cb block.
890                           // For set info requests, the buffer immediately follows this structure
891
892 //
893 // Control structure for open and close requests through the Pipe interface
894 //
895 // CommRequest FileId field contains the active directory
896 //
897 // There is no return structure.
898 //
899 typedef struct _AFS_PIPE_OPEN_CLOSE_CB
900 {
901
902     ULONG       RequestId;
903
904     AFSFileID   RootId;
905
906 } AFSPipeOpenCloseRequestCB;
907
908
909 //
910 // Hold Fid Request Control Block
911 //
912
913 typedef struct _AFS_HOLD_FID_REQUEST_CB
914 {
915
916     ULONG                       Count;
917
918     AFSFileID                   FileID[ 1];
919
920 } AFSHoldFidRequestCB;
921
922
923 typedef struct _AFS_FID_RESULT
924 {
925
926     AFSFileID                   FileID;
927
928     ULONG                       Status;
929
930 } AFSFidResult;
931
932 typedef struct _AFS_HOLD_FID_RESULT_CB
933 {
934
935     ULONG                       Count;
936
937     AFSFidResult                Result[ 1];
938
939 } AFSHoldFidResultCB;
940
941
942 //
943 // Release Fid Request Control Block
944 //
945
946 typedef struct _AFS_RELEASE_FID_REQUEST_CB
947 {
948
949     ULONG                       Count;
950
951     AFSFileID                   FileID[ 1];
952
953 } AFSReleaseFidRequestCB;
954
955 typedef struct _AFS_RELEASE_FID_RESULT_CB
956 {
957
958     ULONG                       Count;
959
960     AFSFidResult                Result[ 1];
961
962 } AFSReleaseFidResultCB;
963
964
965 //
966 // File cleanup CB
967 //
968
969 typedef struct _AFS_FILE_CLEANUP_CB
970 {
971
972     AFSFileID       ParentId;
973
974     LARGE_INTEGER   LastAccessTime;
975
976     LARGE_INTEGER   LastWriteTime;
977
978     LARGE_INTEGER   ChangeTime;
979
980     LARGE_INTEGER   CreateTime;
981
982     LARGE_INTEGER   AllocationSize;
983
984     ULONG           FileAttributes;
985
986     ULONGLONG       ProcessId;
987
988     ULONG           FileAccess;
989
990     ULONGLONG       Identifier;
991
992 } AFSFileCleanupCB;
993
994 typedef struct _AFS_FILE_CLEANUP_RESULT_CB
995 {
996
997     LARGE_INTEGER   ParentDataVersion;
998
999 } AFSFileCleanupResultCB;
1000
1001
1002 //
1003 // Trace configuration cb
1004 //
1005
1006 typedef struct _AFS_DEBUG_TRACE_CONFIG_CB
1007 {
1008
1009     ULONG       TraceLevel;
1010
1011     ULONG       Subsystem;
1012
1013     ULONG       TraceBufferLength;
1014
1015     ULONG       DebugFlags;
1016
1017 } AFSTraceConfigCB;
1018
1019 //
1020 // Object Status Information request
1021 //
1022
1023 typedef struct _AFS_REDIR_GET_OBJECT_STATUS_CB
1024 {
1025
1026     AFSFileID       FileID;
1027
1028     USHORT          FileNameLength;
1029
1030     WCHAR           FileName[ 1];
1031
1032 } AFSGetStatusInfoCB;
1033
1034 typedef struct _AFS_REDIR_OBJECT_STATUS_CB
1035 {
1036
1037     AFSFileID               FileId;
1038
1039     AFSFileID               TargetFileId;
1040
1041     LARGE_INTEGER           Expiration;         /* FILETIME */
1042
1043     LARGE_INTEGER           DataVersion;
1044
1045     ULONG                   FileType;           /* File, Dir, MountPoint, Symlink */
1046
1047     ULONG                   ObjectFlags;
1048
1049     LARGE_INTEGER           CreationTime;       /* FILETIME */
1050
1051     LARGE_INTEGER           LastAccessTime;     /* FILETIME */
1052
1053     LARGE_INTEGER           LastWriteTime;      /* FILETIME */
1054
1055     LARGE_INTEGER           ChangeTime;         /* FILETIME */
1056
1057     ULONG                   FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
1058
1059     LARGE_INTEGER           EndOfFile;
1060
1061     LARGE_INTEGER           AllocationSize;
1062
1063     ULONG                   EaSize;
1064
1065     ULONG                   Links;
1066
1067 } AFSStatusInfoCB;
1068
1069 //
1070 // Auth Group (Process and Thread) Processing
1071 //
1072 // afsredir.sys implements a set of generic Authentication Group
1073 // operations that can be executed by processes.  The model supports
1074 // one or more authentication groups per process.  A process may switch
1075 // the active AuthGroup for any thread to any other AuthGroup the process
1076 // is a member of.  However, processes cannot assign itself to an
1077 // AuthGroup that it is not presently a member of.  A process can reset
1078 // its AuthGroup to the SID-AuthGroup or can create a new AuthGroup that
1079 // has not previously been used.
1080 //
1081 //  IOCTL_AFS_AUTHGROUP_CREATE_AND_SET
1082 //      Creates a new AuthGroup and either activates it for
1083 //      the process or the current thread.  If set as the
1084 //      new process AuthGroup, the prior AuthGroup list is
1085 //      cleared.
1086 //
1087 //  IOCTL_AFS_AUTHGROUP_QUERY
1088 //      Returns a list of the AuthGroup GUIDS associated
1089 //      with the current process, the current process GUID,
1090 //      and the current thread GUID.
1091 //
1092 //  IOCTL_AFS_AUTHGROUP_SET
1093 //      Permits the current AuthGroup for the process or
1094 //      thread to be set to the specified GUID.  The GUID
1095 //      must be in the list of current values for the process.
1096 //
1097 //  IOCTL_AFS_AUTHGROUP_RESET
1098 //      Resets the current AuthGroup for the process or
1099 //      thread to the SID-AuthGroup
1100 //
1101 //  IOCTL_AFS_AUTHGROUP_SID_CREATE
1102 //      Given a SID as input, assigns a new AuthGroup GUID.
1103 //      (May only be executed by LOCAL_SYSTEM or the active SID)
1104 //
1105 //  IOCTL_AFS_AUTHGROUP_SID_QUERY
1106 //      Given a SID as input, returns the associated AuthGroup GUID.
1107 //
1108 //  IOCTL_AFS_AUTHGROUP_LOGON_CREATE
1109 //      Given a logon Session as input, assigns a new AuthGroup GUID.
1110 //      (May only be executed by LOCAL_SYSTEM.)
1111 //
1112 // New processes inherit only the active AuthGroup at the time of process
1113 // creation.  Either that of the active thread (if set) or the process.
1114 // All of the other AuthGroups associated with a parent process are
1115 // off-limits.
1116 //
1117
1118 //
1119 // Auth Group processing flags
1120 //
1121
1122 #define AFS_PAG_FLAGS_SET_AS_ACTIVE         0x00000001 // If set, the newly created authgroup is set to the active group
1123 #define AFS_PAG_FLAGS_THREAD_AUTH_GROUP     0x00000002 // If set, the request is targeted for the thread not the process
1124
1125 typedef struct _AFS_AUTH_GROUP_REQUEST
1126 {
1127
1128     USHORT              SIDLength; // If zero the SID of the caller is used
1129
1130     ULONG               SessionId; // If -1 the session id of the caller is used
1131
1132     ULONG               Flags;
1133
1134     GUID                AuthGroup; // The auth group for certain requests
1135
1136     WCHAR               SIDString[ 1];
1137
1138 } AFSAuthGroupRequestCB;
1139
1140 //
1141 // Reparse tag AFS Specific information buffer
1142 //
1143
1144 #define OPENAFS_SUBTAG_MOUNTPOINT 1
1145 #define OPENAFS_SUBTAG_SYMLINK    2
1146 #define OPENAFS_SUBTAG_UNC        3
1147
1148 #define OPENAFS_MOUNTPOINT_TYPE_NORMAL   L'#'
1149 #define OPENAFS_MOUNTPOINT_TYPE_RW       L'%'
1150
1151 typedef struct _AFS_REPARSE_TAG_INFORMATION
1152 {
1153
1154     ULONG SubTag;
1155
1156     union
1157     {
1158         struct
1159         {
1160             ULONG  Type;
1161             USHORT MountPointCellLength;
1162             USHORT MountPointVolumeLength;
1163             WCHAR  Buffer[1];
1164         } AFSMountPoint;
1165
1166         struct
1167         {
1168             BOOLEAN RelativeLink;
1169             USHORT  SymLinkTargetLength;
1170             WCHAR   Buffer[1];
1171         } AFSSymLink;
1172
1173         struct
1174         {
1175             USHORT UNCTargetLength;
1176             WCHAR  Buffer[1];
1177         } UNCReferral;
1178     };
1179
1180 } AFSReparseTagInfo;
1181
1182 #endif /* _AFS_USER_STRUCT_H */
1183