diff options
Diffstat (limited to 'fs/9p/9p.h')
| -rw-r--r-- | fs/9p/9p.h | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/fs/9p/9p.h b/fs/9p/9p.h index f55424216be2..0cd374d94717 100644 --- a/fs/9p/9p.h +++ b/fs/9p/9p.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * 9P protocol definitions. | 4 | * 9P protocol definitions. |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
| 6 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
| 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
| 8 | * | 9 | * |
| @@ -100,9 +101,18 @@ enum { | |||
| 100 | V9FS_QTFILE = 0x00, | 101 | V9FS_QTFILE = 0x00, |
| 101 | }; | 102 | }; |
| 102 | 103 | ||
| 104 | #define V9FS_NOTAG (u16)(~0) | ||
| 105 | #define V9FS_NOFID (u32)(~0) | ||
| 106 | #define V9FS_MAXWELEM 16 | ||
| 107 | |||
| 103 | /* ample room for Twrite/Rread header (iounit) */ | 108 | /* ample room for Twrite/Rread header (iounit) */ |
| 104 | #define V9FS_IOHDRSZ 24 | 109 | #define V9FS_IOHDRSZ 24 |
| 105 | 110 | ||
| 111 | struct v9fs_str { | ||
| 112 | u16 len; | ||
| 113 | char *str; | ||
| 114 | }; | ||
| 115 | |||
| 106 | /* qids are the unique ID for a file (like an inode */ | 116 | /* qids are the unique ID for a file (like an inode */ |
| 107 | struct v9fs_qid { | 117 | struct v9fs_qid { |
| 108 | u8 type; | 118 | u8 type; |
| @@ -120,6 +130,29 @@ struct v9fs_stat { | |||
| 120 | u32 atime; | 130 | u32 atime; |
| 121 | u32 mtime; | 131 | u32 mtime; |
| 122 | u64 length; | 132 | u64 length; |
| 133 | struct v9fs_str name; | ||
| 134 | struct v9fs_str uid; | ||
| 135 | struct v9fs_str gid; | ||
| 136 | struct v9fs_str muid; | ||
| 137 | struct v9fs_str extension; /* 9p2000.u extensions */ | ||
| 138 | u32 n_uid; /* 9p2000.u extensions */ | ||
| 139 | u32 n_gid; /* 9p2000.u extensions */ | ||
| 140 | u32 n_muid; /* 9p2000.u extensions */ | ||
| 141 | }; | ||
| 142 | |||
| 143 | /* file metadata (stat) structure used to create Twstat message | ||
| 144 | The is similar to v9fs_stat, but the strings don't point to | ||
| 145 | the same memory block and should be freed separately | ||
| 146 | */ | ||
| 147 | struct v9fs_wstat { | ||
| 148 | u16 size; | ||
| 149 | u16 type; | ||
| 150 | u32 dev; | ||
| 151 | struct v9fs_qid qid; | ||
| 152 | u32 mode; | ||
| 153 | u32 atime; | ||
| 154 | u32 mtime; | ||
| 155 | u64 length; | ||
| 123 | char *name; | 156 | char *name; |
| 124 | char *uid; | 157 | char *uid; |
| 125 | char *gid; | 158 | char *gid; |
| @@ -128,25 +161,24 @@ struct v9fs_stat { | |||
| 128 | u32 n_uid; /* 9p2000.u extensions */ | 161 | u32 n_uid; /* 9p2000.u extensions */ |
| 129 | u32 n_gid; /* 9p2000.u extensions */ | 162 | u32 n_gid; /* 9p2000.u extensions */ |
| 130 | u32 n_muid; /* 9p2000.u extensions */ | 163 | u32 n_muid; /* 9p2000.u extensions */ |
| 131 | char data[0]; | ||
| 132 | }; | 164 | }; |
| 133 | 165 | ||
| 134 | /* Structures for Protocol Operations */ | 166 | /* Structures for Protocol Operations */ |
| 135 | 167 | ||
| 136 | struct Tversion { | 168 | struct Tversion { |
| 137 | u32 msize; | 169 | u32 msize; |
| 138 | char *version; | 170 | struct v9fs_str version; |
| 139 | }; | 171 | }; |
| 140 | 172 | ||
| 141 | struct Rversion { | 173 | struct Rversion { |
| 142 | u32 msize; | 174 | u32 msize; |
| 143 | char *version; | 175 | struct v9fs_str version; |
| 144 | }; | 176 | }; |
| 145 | 177 | ||
| 146 | struct Tauth { | 178 | struct Tauth { |
| 147 | u32 afid; | 179 | u32 afid; |
| 148 | char *uname; | 180 | struct v9fs_str uname; |
| 149 | char *aname; | 181 | struct v9fs_str aname; |
| 150 | }; | 182 | }; |
| 151 | 183 | ||
| 152 | struct Rauth { | 184 | struct Rauth { |
| @@ -154,12 +186,12 @@ struct Rauth { | |||
| 154 | }; | 186 | }; |
| 155 | 187 | ||
| 156 | struct Rerror { | 188 | struct Rerror { |
| 157 | char *error; | 189 | struct v9fs_str error; |
| 158 | u32 errno; /* 9p2000.u extension */ | 190 | u32 errno; /* 9p2000.u extension */ |
| 159 | }; | 191 | }; |
| 160 | 192 | ||
| 161 | struct Tflush { | 193 | struct Tflush { |
| 162 | u32 oldtag; | 194 | u16 oldtag; |
| 163 | }; | 195 | }; |
| 164 | 196 | ||
| 165 | struct Rflush { | 197 | struct Rflush { |
| @@ -168,8 +200,8 @@ struct Rflush { | |||
| 168 | struct Tattach { | 200 | struct Tattach { |
| 169 | u32 fid; | 201 | u32 fid; |
| 170 | u32 afid; | 202 | u32 afid; |
| 171 | char *uname; | 203 | struct v9fs_str uname; |
| 172 | char *aname; | 204 | struct v9fs_str aname; |
| 173 | }; | 205 | }; |
| 174 | 206 | ||
| 175 | struct Rattach { | 207 | struct Rattach { |
| @@ -179,13 +211,13 @@ struct Rattach { | |||
| 179 | struct Twalk { | 211 | struct Twalk { |
| 180 | u32 fid; | 212 | u32 fid; |
| 181 | u32 newfid; | 213 | u32 newfid; |
| 182 | u32 nwname; | 214 | u16 nwname; |
| 183 | char **wnames; | 215 | struct v9fs_str wnames[16]; |
| 184 | }; | 216 | }; |
| 185 | 217 | ||
| 186 | struct Rwalk { | 218 | struct Rwalk { |
| 187 | u32 nwqid; | 219 | u16 nwqid; |
| 188 | struct v9fs_qid *wqids; | 220 | struct v9fs_qid wqids[16]; |
| 189 | }; | 221 | }; |
| 190 | 222 | ||
| 191 | struct Topen { | 223 | struct Topen { |
| @@ -200,7 +232,7 @@ struct Ropen { | |||
| 200 | 232 | ||
| 201 | struct Tcreate { | 233 | struct Tcreate { |
| 202 | u32 fid; | 234 | u32 fid; |
| 203 | char *name; | 235 | struct v9fs_str name; |
| 204 | u32 perm; | 236 | u32 perm; |
| 205 | u8 mode; | 237 | u8 mode; |
| 206 | }; | 238 | }; |
| @@ -251,12 +283,12 @@ struct Tstat { | |||
| 251 | }; | 283 | }; |
| 252 | 284 | ||
| 253 | struct Rstat { | 285 | struct Rstat { |
| 254 | struct v9fs_stat *stat; | 286 | struct v9fs_stat stat; |
| 255 | }; | 287 | }; |
| 256 | 288 | ||
| 257 | struct Twstat { | 289 | struct Twstat { |
| 258 | u32 fid; | 290 | u32 fid; |
| 259 | struct v9fs_stat *stat; | 291 | struct v9fs_stat stat; |
| 260 | }; | 292 | }; |
| 261 | 293 | ||
| 262 | struct Rwstat { | 294 | struct Rwstat { |
| @@ -271,6 +303,7 @@ struct v9fs_fcall { | |||
| 271 | u32 size; | 303 | u32 size; |
| 272 | u8 id; | 304 | u8 id; |
| 273 | u16 tag; | 305 | u16 tag; |
| 306 | void *sdata; | ||
| 274 | 307 | ||
| 275 | union { | 308 | union { |
| 276 | struct Tversion tversion; | 309 | struct Tversion tversion; |
| @@ -303,7 +336,9 @@ struct v9fs_fcall { | |||
| 303 | } params; | 336 | } params; |
| 304 | }; | 337 | }; |
| 305 | 338 | ||
| 306 | #define FCALL_ERROR(fcall) (fcall ? fcall->params.rerror.error : "") | 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:""); | ||
| 307 | 342 | ||
| 308 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, | 343 | int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, |
| 309 | char *version, struct v9fs_fcall **rcall); | 344 | char *version, struct v9fs_fcall **rcall); |
| @@ -311,8 +346,7 @@ int v9fs_t_version(struct v9fs_session_info *v9ses, u32 msize, | |||
| 311 | int v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname, | 346 | int v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname, |
| 312 | u32 fid, u32 afid, struct v9fs_fcall **rcall); | 347 | u32 fid, u32 afid, struct v9fs_fcall **rcall); |
| 313 | 348 | ||
| 314 | int v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid, | 349 | int v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid); |
| 315 | struct v9fs_fcall **rcall); | ||
| 316 | 350 | ||
| 317 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag); | 351 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag); |
| 318 | 352 | ||
| @@ -320,7 +354,7 @@ int v9fs_t_stat(struct v9fs_session_info *v9ses, u32 fid, | |||
| 320 | struct v9fs_fcall **rcall); | 354 | struct v9fs_fcall **rcall); |
| 321 | 355 | ||
| 322 | int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid, | 356 | int v9fs_t_wstat(struct v9fs_session_info *v9ses, u32 fid, |
| 323 | struct v9fs_stat *stat, struct v9fs_fcall **rcall); | 357 | struct v9fs_wstat *wstat, struct v9fs_fcall **rcall); |
| 324 | 358 | ||
| 325 | int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid, | 359 | int v9fs_t_walk(struct v9fs_session_info *v9ses, u32 fid, u32 newfid, |
| 326 | char *name, struct v9fs_fcall **rcall); | 360 | char *name, struct v9fs_fcall **rcall); |
| @@ -338,4 +372,5 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | |||
| 338 | u64 offset, u32 count, struct v9fs_fcall **rcall); | 372 | u64 offset, u32 count, struct v9fs_fcall **rcall); |
| 339 | 373 | ||
| 340 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, | 374 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, |
| 341 | u32 count, void *data, struct v9fs_fcall **rcall); | 375 | u32 count, const char __user * data, |
| 376 | struct v9fs_fcall **rcall); | ||
