4 * 9P protocol definitions.
6 * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
7 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
8 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to:
21 * Free Software Foundation
22 * 51 Franklin Street, Fifth Floor
23 * Boston, MA 02111-1301 USA
74 V9FS_DMDIR
= 0x80000000,
75 V9FS_DMAPPEND
= 0x40000000,
76 V9FS_DMEXCL
= 0x20000000,
77 V9FS_DMMOUNT
= 0x10000000,
78 V9FS_DMAUTH
= 0x08000000,
79 V9FS_DMTMP
= 0x04000000,
80 V9FS_DMSYMLINK
= 0x02000000,
81 V9FS_DMLINK
= 0x01000000,
82 /* 9P2000.u extensions */
83 V9FS_DMDEVICE
= 0x00800000,
84 V9FS_DMNAMEDPIPE
= 0x00200000,
85 V9FS_DMSOCKET
= 0x00100000,
86 V9FS_DMSETUID
= 0x00080000,
87 V9FS_DMSETGID
= 0x00040000,
98 V9FS_QTSYMLINK
= 0x02,
103 #define V9FS_NOTAG (u16)(~0)
104 #define V9FS_NOFID (u32)(~0)
105 #define V9FS_MAXWELEM 16
107 /* ample room for Twrite/Rread header (iounit) */
108 #define V9FS_IOHDRSZ 24
115 /* qids are the unique ID for a file (like an inode */
122 /* Plan 9 file metadata (stat) structure */
132 struct v9fs_str name
;
135 struct v9fs_str muid
;
136 struct v9fs_str extension
; /* 9p2000.u extensions */
137 u32 n_uid
; /* 9p2000.u extensions */
138 u32 n_gid
; /* 9p2000.u extensions */
139 u32 n_muid
; /* 9p2000.u extensions */
142 /* file metadata (stat) structure used to create Twstat message
143 The is similar to v9fs_stat, but the strings don't point to
144 the same memory block and should be freed separately
159 char *extension
; /* 9p2000.u extensions */
160 u32 n_uid
; /* 9p2000.u extensions */
161 u32 n_gid
; /* 9p2000.u extensions */
162 u32 n_muid
; /* 9p2000.u extensions */
165 /* Structures for Protocol Operations */
169 struct v9fs_str version
;
174 struct v9fs_str version
;
179 struct v9fs_str uname
;
180 struct v9fs_str aname
;
188 struct v9fs_str error
;
189 u32 errno
; /* 9p2000.u extension */
202 struct v9fs_str uname
;
203 struct v9fs_str aname
;
214 struct v9fs_str wnames
[16];
219 struct v9fs_qid wqids
[16];
234 struct v9fs_str name
;
237 struct v9fs_str extension
;
286 struct v9fs_stat stat
;
291 struct v9fs_stat stat
;
298 * fcall is the primary packet structure
309 struct Tversion tversion
;
310 struct Rversion rversion
;
313 struct Rerror rerror
;
314 struct Tflush tflush
;
315 struct Rflush rflush
;
316 struct Tattach tattach
;
317 struct Rattach rattach
;
322 struct Tcreate tcreate
;
323 struct Rcreate rcreate
;
326 struct Twrite twrite
;
327 struct Rwrite rwrite
;
328 struct Tclunk tclunk
;
329 struct Rclunk rclunk
;
330 struct Tremove tremove
;
331 struct Rremove rremove
;
334 struct Twstat twstat
;
335 struct Rwstat rwstat
;
339 #define PRINT_FCALL_ERROR(s, fcall) dprintk(DEBUG_ERROR, "%s: %.*s\n", s, \
340 fcall?fcall->params.rerror.error.len:0, \
341 fcall?fcall->params.rerror.error.str:"");
343 int v9fs_t_version(struct v9fs_session_info
*v9ses
, u32 msize
,
344 char *version
, struct v9fs_fcall
**rcall
);
346 int v9fs_t_attach(struct v9fs_session_info
*v9ses
, char *uname
, char *aname
,
347 u32 fid
, u32 afid
, struct v9fs_fcall
**rcall
);
349 int v9fs_t_clunk(struct v9fs_session_info
*v9ses
, u32 fid
);
351 int v9fs_t_stat(struct v9fs_session_info
*v9ses
, u32 fid
,
352 struct v9fs_fcall
**rcall
);
354 int v9fs_t_wstat(struct v9fs_session_info
*v9ses
, u32 fid
,
355 struct v9fs_wstat
*wstat
, struct v9fs_fcall
**rcall
);
357 int v9fs_t_walk(struct v9fs_session_info
*v9ses
, u32 fid
, u32 newfid
,
358 char *name
, struct v9fs_fcall
**rcall
);
360 int v9fs_t_open(struct v9fs_session_info
*v9ses
, u32 fid
, u8 mode
,
361 struct v9fs_fcall
**rcall
);
363 int v9fs_t_remove(struct v9fs_session_info
*v9ses
, u32 fid
,
364 struct v9fs_fcall
**rcall
);
366 int v9fs_t_create(struct v9fs_session_info
*v9ses
, u32 fid
, char *name
,
367 u32 perm
, u8 mode
, char *extension
, struct v9fs_fcall
**rcall
);
369 int v9fs_t_read(struct v9fs_session_info
*v9ses
, u32 fid
,
370 u64 offset
, u32 count
, struct v9fs_fcall
**rcall
);
372 int v9fs_t_write(struct v9fs_session_info
*v9ses
, u32 fid
, u64 offset
,
373 u32 count
, const char __user
* data
,
374 struct v9fs_fcall
**rcall
);
375 int v9fs_printfcall(char *, int, struct v9fs_fcall
*, int);