windows-64-bit-type-safety-20051105
[openafs.git] / src / WINNT / afsrdr / kif.h
1 /* copyright (c) 2005
2  * the regents of the university of michigan
3  * all rights reserved
4  * 
5  * permission is granted to use, copy, create derivative works and
6  * redistribute this software and such derivative works for any purpose,
7  * so long as the name of the university of michigan is not used in
8  * any advertising or publicity pertaining to the use or distribution
9  * of this software without specific, written prior authorization.  if
10  * the above copyright notice or any other identification of the
11  * university of michigan is included in any copy of any portion of
12  * this software, then the disclaimer below must also be included.
13  * 
14  * this software is provided as is, without representation from the
15  * university of michigan as to its fitness for any purpose, and without
16  * warranty by the university of michigan of any kind, either express 
17  * or implied, including without limitation the implied warranties of
18  * merchantability and fitness for a particular purpose.  the regents
19  * of the university of michigan shall not be liable for any damages,   
20  * including special, indirect, incidental, or consequential damages, 
21  * with respect to any claim arising out or in connection with the use
22  * of the software, even if it has been or is hereafter advised of the
23  * possibility of such damages.
24  */
25
26 /* versioning history
27  * 
28  * 03-jun 2005 (eric williams) entered into versioning
29  */
30
31
32 /* this is based on BUF_FILEHASH, but we were not getting unique hashes */
33 #define FID_HASH_FN(fidp)               ((((fidp)->vnode + \
34                                            ((fidp)->unique << 13) + ((fidp)->unique >> (32-13)) + \
35                                            (fidp)->volume + \
36                                            (fidp)->cell)))
37
38
39 /* dirent information */
40 struct readdir_data
41         {
42         LARGE_INTEGER cookie;
43         long offset;
44         LARGE_INTEGER creation, access, write, change, size;
45         ULONG attribs, name_length;                     /* chars */
46         CCHAR short_name_length;                        /* chars */
47         WCHAR short_name[14];
48         WCHAR name[];
49         };
50 typedef struct readdir_data readdir_data_t;
51
52
53 /* error codes */
54 #define IFSL_SUCCESS_BASE                       0x00000000
55 #define IFSL_FAIL_BASE                          0x80000000
56
57 #define IFSL_SUCCESS                            (IFSL_SUCCESS_BASE + 0)
58 #define IFSL_DOES_NOT_EXIST                     (IFSL_FAIL_BASE + 1)
59 #define IFSL_NOT_IMPLEMENTED            (IFSL_FAIL_BASE + 2)
60 #define IFSL_END_OF_ENUM                        (IFSL_SUCCESS_BASE + 3)
61 #define IFSL_CANNOT_MAKE                        (IFSL_FAIL_BASE + 4)
62 #define IFSL_END_OF_FILE                        (IFSL_SUCCESS_BASE + 5)
63 #define IFSL_NO_ACCESS                          (IFSL_FAIL_BASE + 6)
64 #define IFSL_BUFFER_TOO_SMALL           (IFSL_FAIL_BASE + 7)
65 #define IFSL_SHARING_VIOLATION          (IFSL_FAIL_BASE + 8)
66 #define IFSL_BAD_INPUT                          (IFSL_FAIL_BASE + 9)
67 #define IFSL_GENERIC_FAILURE            (IFSL_FAIL_BASE + 10)
68 #define IFSL_OPEN_CREATED                       (IFSL_SUCCESS_BASE + 11)
69 #define IFSL_OPEN_EXISTS                        (IFSL_FAIL_BASE + 12)
70 #define IFSL_OPEN_OPENED                        (IFSL_SUCCESS_BASE + 13)
71 #define IFSL_OPEN_OVERWRITTEN           (IFSL_SUCCESS_BASE + 14)
72 #define IFSL_OPEN_SUPERSCEDED           (IFSL_SUCCESS_BASE + 15)
73 #define IFSL_BADFILENAME                        (IFSL_FAIL_BASE + 16)
74 #define IFSL_READONLY                           (IFSL_FAIL_BASE + 17)
75 #define IFSL_IS_A_DIR                           (IFSL_FAIL_BASE + 18)
76 #define IFSL_PATH_DOES_NOT_EXIST        (IFSL_FAIL_BASE + 19)
77 #define IFSL_IS_A_FILE                          (IFSL_FAIL_BASE + 20)
78 #define IFSL_NO_FILE                            (IFSL_FAIL_BASE + 21)
79 #define IFSL_NOT_EMPTY                          (IFSL_FAIL_BASE + 22)
80 #define IFSL_RPC_TIMEOUT                        (IFSL_FAIL_BASE + 23)
81 #define IFSL_OVERQUOTA                          (IFSL_FAIL_BASE + 24)
82 #define IFSL_MEMORY                                     (IFSL_FAIL_BASE + 25)
83 #define IFSL_UNSPEC                                     (IFSL_FAIL_BASE + 26)
84
85
86 /* ioctl codes */
87 #define IOCTL_AFSRDR_IOCTL              CTL_CODE(IOCTL_DISK_BASE, 0x007, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
88 #define IOCTL_AFSRDR_DOWNCALL   CTL_CODE(IOCTL_DISK_BASE, 0x008, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
89 #define IOCTL_AFSRDR_GET_PATH   CTL_CODE(IOCTL_DISK_BASE, 0x009, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
90
91
92 /* upcalls */
93 long uc_namei(WCHAR *name, ULONG *fid);
94 long uc_check_access(ULONG fid, ULONG access, ULONG *granted);
95 long uc_create(WCHAR *str, ULONG attribs, LARGE_INTEGER alloc, ULONG access, ULONG *granted, ULONG *fid);
96 long uc_stat(ULONG fid, ULONG *attribs, LARGE_INTEGER *size, LARGE_INTEGER *creation, LARGE_INTEGER *access, LARGE_INTEGER *change, LARGE_INTEGER *written);
97 long uc_setinfo(ULONG fid, ULONG attribs, LARGE_INTEGER creation, LARGE_INTEGER access, LARGE_INTEGER change, LARGE_INTEGER written);
98 long uc_trunc(ULONG fid, LARGE_INTEGER size);
99 long uc_read(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *read, char *data);
100 long uc_write(ULONG fid, LARGE_INTEGER offset, ULONG length, ULONG *written, char *data);
101 long uc_readdir(ULONG fid, LARGE_INTEGER cookie_in, WCHAR *filter, ULONG *count, char *data, ULONG_PTR *len);
102 long uc_close(ULONG fid);
103 long uc_unlink(WCHAR *name);
104 long uc_ioctl_write(ULONG length, char *data, ULONG_PTR *key);
105 long uc_ioctl_read(ULONG_PTR key, ULONG *length, char *data);
106 long uc_rename(ULONG fid, WCHAR *curr, WCHAR *new_dir, WCHAR *new_name, ULONG *new_fid);
107 long uc_flush(ULONG fid);
108
109
110 /* downcalls */
111 long dc_break_callback(ULONG fid);
112 long dc_release_hooks();