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