4 * 9P protocol definitions.
6 * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
7 * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
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)
106 /* ample room for Twrite/Rread header (iounit) */
107 #define V9FS_IOHDRSZ 24
109 /* qids are the unique ID for a file (like an inode */
116 /* Plan 9 file metadata (stat) structure */
130 char *extension; /* 9p2000.u extensions */
131 u32 n_uid; /* 9p2000.u extensions */
132 u32 n_gid; /* 9p2000.u extensions */
133 u32 n_muid; /* 9p2000.u extensions */
137 /* Structures for Protocol Operations */
161 u32 errno; /* 9p2000.u extension */
191 struct v9fs_qid *wqids;
257 struct v9fs_stat *stat;
262 struct v9fs_stat *stat;
269 * fcall is the primary packet structure
279 struct Tversion tversion;
280 struct Rversion rversion;
283 struct Rerror rerror;
284 struct Tflush tflush;
285 struct Rflush rflush;
286 struct Tattach tattach;
287 struct Rattach rattach;
292 struct Tcreate tcreate;
293 struct Rcreate rcreate;
296 struct Twrite twrite;
297 struct Rwrite rwrite;
298 struct Tclunk tclunk;
299 struct Rclunk rclunk;
300 struct Tremove tremove;
301 struct Rremove rremove;
304 struct Twstat twstat;
305 struct Rwstat rwstat;
309 #define V9FS_FCALLHDRSZ (sizeof(struct v9fs_fcall) + \
310 sizeof(struct v9fs_stat) + 16*sizeof(struct v9fs_qid) + 16)
312 #define FCALL_ERROR(fcall) (fcall ? fcall->params.rerror.error : "")
314 int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize,
315 char *version, struct v9fs_fcall **rcall);
317 int v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
318 u32 fid, u32 afid, struct v9fs_fcall **rcall);
320 int v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid);
322 int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag);
324 int v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid,
325 struct v9fs_fcall **rcall);
327 int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid,
328 struct v9fs_stat *stat, struct v9fs_fcall **rcall);
330 int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid,
331 char *name, struct v9fs_fcall **rcall);
333 int v9fs_t_open(struct v9fs_session_info *v9ses, u32 fid, u8 mode,
334 struct v9fs_fcall **rcall);
336 int v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
337 struct v9fs_fcall **rcall);
339 int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
340 u32 perm, u8 mode, struct v9fs_fcall **rcall);
342 int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid,
343 u64 offset, u32 count, struct v9fs_fcall **rcall);
345 int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset,
346 u32 count, void *data, struct v9fs_fcall **rcall);