changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/ip/cifsd/dat.h

changeset 7384: cfe13a9d53a3
parent: 3773da2a0a97
author: cinap_lenrek@felloff.net
date: Tue, 10 Sep 2019 21:19:34 +0200
permissions: -rw-r--r--
description: ip/cifsd: add basic support for UNIX extensions
1 typedef struct Rop Rop;
2 typedef struct Req Req;
3 typedef struct Trans Trans;
4 
5 typedef struct Share Share;
6 typedef struct File File;
7 typedef struct Find Find;
8 typedef struct Tree Tree;
9 
10 struct Rop
11 {
12  int (*strpack)(uchar *, uchar *, uchar *, void *);
13  int (*strunpack)(uchar *, uchar *, uchar *, void *);
14  int (*namepack)(uchar *, uchar *, uchar *, void *);
15  int (*nameunpack)(uchar *, uchar *, uchar *, void *);
16  int (*untermstrpack)(uchar *, uchar *, uchar *, void *);
17  int (*untermnamepack)(uchar *, uchar *, uchar *, void *);
18 };
19 
20 struct Req
21 {
22  int cmd;
23  int tid;
24  int pid;
25  int uid;
26  int mid;
27  int flags;
28  int flags2;
29 
30  uchar sig[8];
31 
32  uchar *lh, *rh, *rp, *re;
33 
34  Rop *o;
35  char *name;
36  void (*respond)(Req *r, int err);
37  int (*namecmp)(char *, char *);
38 };
39 
40 struct Trans
41 {
42  int cmd;
43  int flags;
44 
45  struct {
46  struct {
47  uchar *b, *p, *e;
48  } param, data, setup;
49  } in, out;
50 
51  Req *r;
52  Rop *o;
53  char *name;
54  void (*respond)(Trans *t, int err);
55  int (*namecmp)(char *, char *);
56 };
57 
58 struct File
59 {
60  int ref;
61  int fd;
62  int rtype;
63  int dacc;
64  char *path;
65  void *aux;
66 };
67 
68 struct Find
69 {
70  int ref;
71  int attr;
72  char *base;
73  char *pattern;
74  int casesensitive;
75  int index;
76  Dir *dotdot;
77  Dir *dot;
78  Dir *dir;
79  int ndir;
80 };
81 
82 struct Share
83 {
84  Share *next;
85 
86  char *service;
87  int stype;
88 
89  char *name;
90  char *root;
91  char *remark;
92 
93  char *fsname;
94  int namelen;
95  vlong allocsize;
96  vlong freesize;
97  int sectorsize;
98  int blocksize;
99 };
100 
101 struct Tree
102 {
103  int tid;
104 
105  void **file;
106  int nfile;
107 
108  void **find;
109  int nfind;
110 
111  Share *share;
112 };
113 
114 int debug;
115 int trspaces;
116 int needauth;
117 char *domain;
118 char *progname;
119 char *osname;
120 
121 char *remotesys;
122 char *remoteuser;
123 int remotebuffersize;
124 
125 long starttime;
126 int tzoff;
127 
128 enum
129 {
130  BUFFERSIZE = 0x8000,
131 
132  STATUS_INVALID_SMB = 0x00010002,
133  STATUS_SMB_BAD_TID = 0x00050002,
134  STATUS_SMB_BAD_FID = 0x00060001,
135  STATUS_OS2_INVALID_ACCESS = 0x000C0001,
136  STATUS_SMB_BAD_UID = 0x005B0002,
137  STATUS_OS2_INVALID_LEVEL = 0x007C0001,
138  STATUS_NO_MORE_FILES = 0x80000006,
139  STATUS_INVALID_HANDLE = 0xC0000008,
140  STATUS_NO_SUCH_FILE = 0xC000000F,
141  STATUS_ACCESS_DENIED = 0xC0000022,
142  STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034,
143  STATUS_OBJECT_NAME_COLLISION = 0xC0000035,
144  STATUS_OBJECT_PATH_INVALID = 0xC0000039,
145  STATUS_OBJECT_PATH_NOT_FOUND = 0xC000003A,
146  STATUS_OBJECT_PATH_SYNTAX_BAD = 0xC000003B,
147  STATUS_SHARING_VIOLATION = 0xC0000043,
148  STATUS_LOGON_FAILURE = 0xC000006D,
149  STATUS_FILE_IS_A_DIRECTORY = 0xC00000BA,
150  STATUS_NOT_SUPPORTED = 0xC00000BB,
151  STATUS_BAD_DEVICE_TYPE = 0xC00000CB,
152  STATUS_BAD_NETWORK_NAME = 0xC00000CC,
153  STATUS_NOT_SAME_DEVICE = 0xC00000D4,
154  STATUS_DIRECTORY_NOT_EMPTY = 0xC0000101,
155 
156  /* resource type */
157  FileTypeDisk = 0,
158 
159  /* stype */
160  STYPE_DISKTREE = 0,
161  STYPE_PRINTQ = 1,
162  STYPE_DEVICE = 2,
163  STYPE_IPC = 3,
164 
165  /* capabilities */
166  CAP_UNICODE = 0x4,
167  CAP_LARGEFILES = 0x8,
168  CAP_NT_SMBS = 0x10,
169  CAP_NT_STATUS = 0x40,
170  CAP_NT_FIND = 0x200,
171  CAP_UNIX = 0x800000,
172 
173  /* extended file attributes */
174  ATTR_READONLY = 0x1,
175  ATTR_HIDDEN = 0x2,
176  ATTR_SYSTEM = 0x4,
177  ATTR_DIRECTORY = 0x10,
178  ATTR_ARCHIVE = 0x20,
179  ATTR_NORMAL = 0x80,
180 
181  DOSMASK = 0x37,
182 
183  /* access */
184  FILE_READ_DATA = 0x1,
185  FILE_WRITE_DATA = 0x2,
186  FILE_APPEND_DATA = 0x4,
187  FILE_EXECUTE = 0x20,
188  FILE_DELETE = 0x10000,
189  GENERIC_ALL = 0x10000000,
190  GENERIC_EXECUTE = 0x20000000,
191  GENERIC_WRITE = 0x40000000,
192  GENERIC_READ = 0x80000000,
193 
194  READMASK =
195  FILE_READ_DATA |
196  FILE_EXECUTE |
197  GENERIC_ALL |
198  GENERIC_EXECUTE |
199  GENERIC_READ,
200 
201  WRITEMASK =
202  FILE_WRITE_DATA |
203  FILE_APPEND_DATA |
204  GENERIC_ALL |
205  GENERIC_WRITE,
206 
207  /* share access */
208  FILE_SHARE_NONE = 0,
209  FILE_SHARE_READ = 1,
210  FILE_SHARE_WRITE = 2,
211  FILE_SHARE_DELETE = 4,
212  FILE_SHARE_COMPAT = -1,
213 
214  /* createdisposition */
215  FILE_SUPERSEDE = 0,
216  FILE_OPEN,
217  FILE_CREATE,
218  FILE_OPEN_IF,
219  FILE_OVERWRITE,
220  FILE_OVERWRITE_IF,
221 
222  /* createaction */
223  FILE_SUPERSEDED = 0,
224  FILE_OPEND,
225  FILE_CREATED,
226  FILE_OVERWRITTEN,
227 
228  /* createoptions */
229  FILE_DIRECTORY_FILE = 0x1,
230  FILE_NON_DIRECTORY_FILE = 0x40,
231  FILE_DELETE_ON_CLOSE = 0x1000,
232  FILE_OPEN_BY_FILE_ID = 0x2000,
233 };