Windows: Add AFSFileCleanupResultCB
[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 //
594 // Control structure for read and write requests through the PIOCtl interface
595 //
596 // CommRequest FileId field contains the active directory
597
598 typedef struct _AFS_PIOCTL_IO_CB
599 {
600     ULONG       RequestId;
601
602     AFSFileID   RootId;
603
604     ULONG       BufferLength;
605
606     void        *MappedBuffer;
607
608 } AFSPIOCtlIORequestCB;
609
610 //
611 // The returned information for the IO Request
612 //
613
614 typedef struct _AFS_PIOCTL_IO_RESULT_CB
615 {
616
617     ULONG       BytesProcessed;
618
619 } AFSPIOCtlIOResultCB;
620
621
622 //
623 // Control structure for open and close requests through the PIOCtl interface
624 //
625 // CommRequest FileId field contains the active directory
626 //
627 // There is no return structure.
628 //
629 typedef struct _AFS_PIOCTL_OPEN_CLOSE_CB
630 {
631
632     ULONG       RequestId;
633
634     AFSFileID   RootId;
635
636 } AFSPIOCtlOpenCloseRequestCB;
637
638 //
639 // Cache invalidation control block
640 //
641
642 typedef struct _AFS_INVALIDATE_CACHE_CB
643 {
644
645     AFSFileID   FileID;
646
647     ULONG       FileType;
648
649     BOOLEAN     WholeVolume;
650
651     ULONG       Reason;
652
653 } AFSInvalidateCacheCB;
654
655 //
656 // Network Status Control Block
657 //
658
659 typedef struct _AFS_NETWORK_STATUS_CB
660 {
661
662     BOOLEAN     Online;
663
664 } AFSNetworkStatusCB;
665
666 //
667 // Volume Status Control Block
668 //
669
670 typedef struct _AFS_VOLUME_STATUS_CB
671 {
672
673     AFSFileID   FileID;         // only cell and volume fields are set
674
675     BOOLEAN     Online;
676
677 } AFSVolumeStatusCB;
678
679
680 typedef struct _AFS_SYSNAME
681 {
682
683     ULONG       Length;         /* bytes */
684
685     WCHAR       String[AFS_MAX_SYSNAME_LENGTH];
686
687 } AFSSysName;
688
689 //
690 // SysName Notification Control Block
691 //   Sent as the buffer with IOCTL_AFS_SYSNAME_NOTIFICATION
692 //   There is no response
693 //
694
695 typedef struct _AFS_SYSNAME_NOTIFICATION_CB
696 {
697
698     ULONG       Architecture;
699
700     ULONG       NumberOfNames;
701
702     AFSSysName  SysNames[1];
703
704 } AFSSysNameNotificationCB;
705
706
707 //
708 // File System Status Query Control Block
709 //   Received as a response to IOCTL_AFS_STATUS_REQUEST
710 //
711 typedef struct _AFS_DRIVER_STATUS_RESPONSE_CB
712 {
713
714     ULONG       Status;         // bit flags - see below
715
716 } AFSDriverStatusRespCB;
717
718 // Bit flags
719 #define AFS_DRIVER_STATUS_READY         0
720 #define AFS_DRIVER_STATUS_NOT_READY     1
721 #define AFS_DRIVER_STATUS_NO_SERVICE    2
722
723 //
724 // Byte Range Lock Request
725 //
726 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST
727 {
728     ULONG               LockType;
729
730     LARGE_INTEGER       Offset;
731
732     LARGE_INTEGER       Length;
733
734 } AFSByteRangeLockRequest;
735
736 #define AFS_BYTE_RANGE_LOCK_TYPE_SHARED 0
737 #define AFS_BYTE_RANGE_LOCK_TYPE_EXCL   1
738
739
740 //
741 // Byte Range Lock Request Control Block
742 //
743 // Set ProcessId and FileId in the Comm Request Block
744 //
745 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST_CB
746 {
747
748     ULONG                       Count;
749
750     ULONGLONG                   ProcessId;
751
752     AFSByteRangeLockRequest     Request[1];
753
754 } AFSByteRangeLockRequestCB;
755
756 //
757 // Byte Range Lock Result
758 //
759 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT
760 {
761
762     ULONG               LockType;
763
764     LARGE_INTEGER       Offset;
765
766     LARGE_INTEGER       Length;
767
768     ULONG               Status;
769
770 } AFSByteRangeLockResult;
771
772 //
773 // Byte Range Lock Results Control Block
774 //
775
776 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT_CB
777 {
778
779     AFSFileID                   FileId;
780
781     ULONG                       Count;
782
783     AFSByteRangeLockResult      Result[1];
784
785 } AFSByteRangeLockResultCB;
786
787 //
788 // Set Byte Range Lock Results Control Block
789 //
790
791 typedef struct _AFS_SET_BYTE_RANGE_LOCK_RESULT_CB
792 {
793
794     ULONG                       SerialNumber;
795
796     AFSFileID                   FileId;
797
798     ULONG                       Count;
799
800     AFSByteRangeLockResult      Result[1];
801
802 } AFSSetByteRangeLockResultCB;
803
804
805 //
806 // Byte Range Unlock Request Control Block
807 //
808
809 typedef struct _AFS_BYTE_RANGE_UNLOCK_CB
810 {
811
812     ULONG                       Count;
813
814     ULONGLONG                   ProcessId;
815
816     AFSByteRangeLockRequest     Request[1];
817
818 } AFSByteRangeUnlockRequestCB;
819
820
821 //
822 // Byte Range Unlock Request Control Block
823 //
824
825 typedef struct _AFS_BYTE_RANGE_UNLOCK_RESULT_CB
826 {
827
828     ULONG                       Count;
829
830     AFSByteRangeLockResult      Result[1];
831
832 } AFSByteRangeUnlockResultCB;
833
834
835 //
836 // Control structure for read and write requests through the PIPE interface
837 //
838 // CommRequest FileId field contains the active directory
839
840 typedef struct _AFS_PIPE_IO_CB
841 {
842     ULONG       RequestId;
843
844     AFSFileID   RootId;
845
846     ULONG       BufferLength;
847
848 } AFSPipeIORequestCB;   // For read requests the buffer is mapped in the request cb block.
849                         // For write requests, the buffer immediately follows this structure
850
851 //
852 // The returned information for the Pipe IO Request. Note that this is
853 // only returned in the write request. Read request info is returned in
854 // the request cb
855 //
856
857 typedef struct _AFS_PIPE_IO_RESULT_CB
858 {
859
860     ULONG       BytesProcessed;
861
862 } AFSPipeIOResultCB;
863
864 //
865 // Control structure for set and query info requests through the PIPE interface
866 //
867
868 typedef struct _AFS_PIPE_INFO_CB
869 {
870
871     ULONG       RequestId;
872
873     AFSFileID   RootId;
874
875     ULONG       InformationClass;
876
877     ULONG       BufferLength;
878
879 } AFSPipeInfoRequestCB;   // For query info requests the buffer is mapped in the request cb block.
880                           // For set info requests, the buffer immediately follows this structure
881
882 //
883 // Control structure for open and close requests through the Pipe interface
884 //
885 // CommRequest FileId field contains the active directory
886 //
887 // There is no return structure.
888 //
889 typedef struct _AFS_PIPE_OPEN_CLOSE_CB
890 {
891
892     ULONG       RequestId;
893
894     AFSFileID   RootId;
895
896 } AFSPipeOpenCloseRequestCB;
897
898
899 //
900 // Hold Fid Request Control Block
901 //
902
903 typedef struct _AFS_HOLD_FID_REQUEST_CB
904 {
905
906     ULONG                       Count;
907
908     AFSFileID                   FileID[ 1];
909
910 } AFSHoldFidRequestCB;
911
912
913 typedef struct _AFS_FID_RESULT
914 {
915
916     AFSFileID                   FileID;
917
918     ULONG                       Status;
919
920 } AFSFidResult;
921
922 typedef struct _AFS_HOLD_FID_RESULT_CB
923 {
924
925     ULONG                       Count;
926
927     AFSFidResult                Result[ 1];
928
929 } AFSHoldFidResultCB;
930
931
932 //
933 // Release Fid Request Control Block
934 //
935
936 typedef struct _AFS_RELEASE_FID_REQUEST_CB
937 {
938
939     ULONG                       Count;
940
941     AFSFileID                   FileID[ 1];
942
943 } AFSReleaseFidRequestCB;
944
945 typedef struct _AFS_RELEASE_FID_RESULT_CB
946 {
947
948     ULONG                       Count;
949
950     AFSFidResult                Result[ 1];
951
952 } AFSReleaseFidResultCB;
953
954
955 //
956 // File cleanup CB
957 //
958
959 typedef struct _AFS_FILE_CLEANUP_CB
960 {
961
962     AFSFileID       ParentId;
963
964     LARGE_INTEGER   LastAccessTime;
965
966     LARGE_INTEGER   LastWriteTime;
967
968     LARGE_INTEGER   ChangeTime;
969
970     LARGE_INTEGER   CreateTime;
971
972     LARGE_INTEGER   AllocationSize;
973
974     ULONG           FileAttributes;
975
976     ULONGLONG       ProcessId;
977
978     ULONG           FileAccess;
979
980     ULONGLONG       Identifier;
981
982 } AFSFileCleanupCB;
983
984 typedef struct _AFS_FILE_CLEANUP_RESULT_CB
985 {
986
987     LARGE_INTEGER   ParentDataVersion;
988
989 } AFSFileCleanupResultCB;
990
991
992 //
993 // Trace configuration cb
994 //
995
996 typedef struct _AFS_DEBUG_TRACE_CONFIG_CB
997 {
998
999     ULONG       TraceLevel;
1000
1001     ULONG       Subsystem;
1002
1003     ULONG       TraceBufferLength;
1004
1005     ULONG       DebugFlags;
1006
1007 } AFSTraceConfigCB;
1008
1009 //
1010 // Object Status Information request
1011 //
1012
1013 typedef struct _AFS_REDIR_GET_OBJECT_STATUS_CB
1014 {
1015
1016     AFSFileID       FileID;
1017
1018     USHORT          FileNameLength;
1019
1020     WCHAR           FileName[ 1];
1021
1022 } AFSGetStatusInfoCB;
1023
1024 typedef struct _AFS_REDIR_OBJECT_STATUS_CB
1025 {
1026
1027     AFSFileID               FileId;
1028
1029     AFSFileID               TargetFileId;
1030
1031     LARGE_INTEGER           Expiration;         /* FILETIME */
1032
1033     LARGE_INTEGER           DataVersion;
1034
1035     ULONG                   FileType;           /* File, Dir, MountPoint, Symlink */
1036
1037     ULONG                   ObjectFlags;
1038
1039     LARGE_INTEGER           CreationTime;       /* FILETIME */
1040
1041     LARGE_INTEGER           LastAccessTime;     /* FILETIME */
1042
1043     LARGE_INTEGER           LastWriteTime;      /* FILETIME */
1044
1045     LARGE_INTEGER           ChangeTime;         /* FILETIME */
1046
1047     ULONG                   FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
1048
1049     LARGE_INTEGER           EndOfFile;
1050
1051     LARGE_INTEGER           AllocationSize;
1052
1053     ULONG                   EaSize;
1054
1055     ULONG                   Links;
1056
1057 } AFSStatusInfoCB;
1058
1059 //
1060 // Auth Group (Process and Thread) Processing
1061 //
1062 // afsredir.sys implements a set of generic Authentication Group
1063 // operations that can be executed by processes.  The model supports
1064 // one or more authentication groups per process.  A process may switch
1065 // the active AuthGroup for any thread to any other AuthGroup the process
1066 // is a member of.  However, processes cannot assign itself to an
1067 // AuthGroup that it is not presently a member of.  A process can reset
1068 // its AuthGroup to the SID-AuthGroup or can create a new AuthGroup that
1069 // has not previously been used.
1070 //
1071 //  IOCTL_AFS_AUTHGROUP_CREATE_AND_SET
1072 //      Creates a new AuthGroup and either activates it for
1073 //      the process or the current thread.  If set as the
1074 //      new process AuthGroup, the prior AuthGroup list is
1075 //      cleared.
1076 //
1077 //  IOCTL_AFS_AUTHGROUP_QUERY
1078 //      Returns a list of the AuthGroup GUIDS associated
1079 //      with the current process, the current process GUID,
1080 //      and the current thread GUID.
1081 //
1082 //  IOCTL_AFS_AUTHGROUP_SET
1083 //      Permits the current AuthGroup for the process or
1084 //      thread to be set to the specified GUID.  The GUID
1085 //      must be in the list of current values for the process.
1086 //
1087 //  IOCTL_AFS_AUTHGROUP_RESET
1088 //      Resets the current AuthGroup for the process or
1089 //      thread to the SID-AuthGroup
1090 //
1091 //  IOCTL_AFS_AUTHGROUP_SID_CREATE
1092 //      Given a SID as input, assigns a new AuthGroup GUID.
1093 //      (May only be executed by LOCAL_SYSTEM or the active SID)
1094 //
1095 //  IOCTL_AFS_AUTHGROUP_SID_QUERY
1096 //      Given a SID as input, returns the associated AuthGroup GUID.
1097 //
1098 //  IOCTL_AFS_AUTHGROUP_LOGON_CREATE
1099 //      Given a logon Session as input, assigns a new AuthGroup GUID.
1100 //      (May only be executed by LOCAL_SYSTEM.)
1101 //
1102 // New processes inherit only the active AuthGroup at the time of process
1103 // creation.  Either that of the active thread (if set) or the process.
1104 // All of the other AuthGroups associated with a parent process are
1105 // off-limits.
1106 //
1107
1108 //
1109 // Auth Group processing flags
1110 //
1111
1112 #define AFS_PAG_FLAGS_SET_AS_ACTIVE         0x00000001 // If set, the newly created authgroup is set to the active group
1113 #define AFS_PAG_FLAGS_THREAD_AUTH_GROUP     0x00000002 // If set, the request is targeted for the thread not the process
1114
1115 typedef struct _AFS_AUTH_GROUP_REQUEST
1116 {
1117
1118     USHORT              SIDLength; // If zero the SID of the caller is used
1119
1120     ULONG               SessionId; // If -1 the session id of the caller is used
1121
1122     ULONG               Flags;
1123
1124     GUID                AuthGroup; // The auth group for certain requests
1125
1126     WCHAR               SIDString[ 1];
1127
1128 } AFSAuthGroupRequestCB;
1129
1130 //
1131 // Reparse tag AFS Specific information buffer
1132 //
1133
1134 #define OPENAFS_SUBTAG_MOUNTPOINT 1
1135 #define OPENAFS_SUBTAG_SYMLINK    2
1136 #define OPENAFS_SUBTAG_UNC        3
1137
1138 #define OPENAFS_MOUNTPOINT_TYPE_NORMAL   L'#'
1139 #define OPENAFS_MOUNTPOINT_TYPE_RW       L'%'
1140
1141 typedef struct _AFS_REPARSE_TAG_INFORMATION
1142 {
1143
1144     ULONG SubTag;
1145
1146     union
1147     {
1148         struct
1149         {
1150             ULONG  Type;
1151             USHORT MountPointCellLength;
1152             USHORT MountPointVolumeLength;
1153             WCHAR  Buffer[1];
1154         } AFSMountPoint;
1155
1156         struct
1157         {
1158             BOOLEAN RelativeLink;
1159             USHORT  SymLinkTargetLength;
1160             WCHAR   Buffer[1];
1161         } AFSSymLink;
1162
1163         struct
1164         {
1165             USHORT UNCTargetLength;
1166             WCHAR  Buffer[1];
1167         } UNCReferral;
1168     };
1169
1170 } AFSReparseTagInfo;
1171
1172 #endif /* _AFS_USER_STRUCT_H */
1173