Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 1 | /* |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 2 | * net/9p/fcprint.c |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 3 | * |
| 4 | * Print 9P call. |
| 5 | * |
| 6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
Eric Van Hensbergen | 42e8c50 | 2006-03-25 03:07:28 -0800 | [diff] [blame] | 9 | * it under the terms of the GNU General Public License version 2 |
| 10 | * as published by the Free Software Foundation. |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to: |
| 19 | * Free Software Foundation |
| 20 | * 51 Franklin Street, Fifth Floor |
| 21 | * Boston, MA 02111-1301 USA |
| 22 | * |
| 23 | */ |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 24 | #include <linux/module.h> |
| 25 | #include <linux/errno.h> |
| 26 | #include <linux/fs.h> |
| 27 | #include <linux/idr.h> |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 28 | #include <net/9p/9p.h> |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 29 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 30 | #ifdef CONFIG_NET_9P_DEBUG |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 31 | |
| 32 | static int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 33 | p9_printqid(char *buf, int buflen, struct p9_qid *q) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 34 | { |
| 35 | int n; |
| 36 | char b[10]; |
| 37 | |
| 38 | n = 0; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 39 | if (q->type & P9_QTDIR) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 40 | b[n++] = 'd'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 41 | if (q->type & P9_QTAPPEND) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 42 | b[n++] = 'a'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 43 | if (q->type & P9_QTAUTH) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 44 | b[n++] = 'A'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 45 | if (q->type & P9_QTEXCL) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 46 | b[n++] = 'l'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 47 | if (q->type & P9_QTTMP) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 48 | b[n++] = 't'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 49 | if (q->type & P9_QTSYMLINK) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 50 | b[n++] = 'L'; |
| 51 | b[n] = '\0'; |
| 52 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 53 | return scnprintf(buf, buflen, "(%.16llx %x %s)", |
| 54 | (long long int) q->path, q->version, b); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | static int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 58 | p9_printperm(char *buf, int buflen, int perm) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 59 | { |
| 60 | int n; |
| 61 | char b[15]; |
| 62 | |
| 63 | n = 0; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 64 | if (perm & P9_DMDIR) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 65 | b[n++] = 'd'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 66 | if (perm & P9_DMAPPEND) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 67 | b[n++] = 'a'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 68 | if (perm & P9_DMAUTH) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 69 | b[n++] = 'A'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 70 | if (perm & P9_DMEXCL) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 71 | b[n++] = 'l'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 72 | if (perm & P9_DMTMP) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 73 | b[n++] = 't'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 74 | if (perm & P9_DMDEVICE) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 75 | b[n++] = 'D'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 76 | if (perm & P9_DMSOCKET) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 77 | b[n++] = 'S'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 78 | if (perm & P9_DMNAMEDPIPE) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 79 | b[n++] = 'P'; |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 80 | if (perm & P9_DMSYMLINK) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 81 | b[n++] = 'L'; |
| 82 | b[n] = '\0'; |
| 83 | |
| 84 | return scnprintf(buf, buflen, "%s%03o", b, perm&077); |
| 85 | } |
| 86 | |
| 87 | static int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 88 | p9_printstat(char *buf, int buflen, struct p9_stat *st, int extended) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 89 | { |
| 90 | int n; |
| 91 | |
| 92 | n = scnprintf(buf, buflen, "'%.*s' '%.*s'", st->name.len, |
| 93 | st->name.str, st->uid.len, st->uid.str); |
| 94 | if (extended) |
| 95 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_uid); |
| 96 | |
| 97 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->gid.len, st->gid.str); |
| 98 | if (extended) |
| 99 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_gid); |
| 100 | |
| 101 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->muid.len, st->muid.str); |
| 102 | if (extended) |
| 103 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_muid); |
| 104 | |
| 105 | n += scnprintf(buf+n, buflen-n, " q "); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 106 | n += p9_printqid(buf+n, buflen-n, &st->qid); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 107 | n += scnprintf(buf+n, buflen-n, " m "); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 108 | n += p9_printperm(buf+n, buflen-n, st->mode); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 109 | n += scnprintf(buf+n, buflen-n, " at %d mt %d l %lld", |
| 110 | st->atime, st->mtime, (long long int) st->length); |
| 111 | |
| 112 | if (extended) |
| 113 | n += scnprintf(buf+n, buflen-n, " ext '%.*s'", |
| 114 | st->extension.len, st->extension.str); |
| 115 | |
| 116 | return n; |
| 117 | } |
| 118 | |
| 119 | static int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 120 | p9_dumpdata(char *buf, int buflen, u8 *data, int datalen) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 121 | { |
| 122 | int i, n; |
| 123 | |
| 124 | i = n = 0; |
| 125 | while (i < datalen) { |
| 126 | n += scnprintf(buf + n, buflen - n, "%02x", data[i]); |
| 127 | if (i%4 == 3) |
| 128 | n += scnprintf(buf + n, buflen - n, " "); |
| 129 | if (i%32 == 31) |
| 130 | n += scnprintf(buf + n, buflen - n, "\n"); |
| 131 | |
| 132 | i++; |
| 133 | } |
| 134 | n += scnprintf(buf + n, buflen - n, "\n"); |
| 135 | |
| 136 | return n; |
| 137 | } |
| 138 | |
| 139 | static int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 140 | p9_printdata(char *buf, int buflen, u8 *data, int datalen) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 141 | { |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 142 | return p9_dumpdata(buf, buflen, data, datalen < 16?datalen:16); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | int |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 146 | p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int extended) |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 147 | { |
| 148 | int i, ret, type, tag; |
| 149 | |
| 150 | if (!fc) |
| 151 | return scnprintf(buf, buflen, "<NULL>"); |
| 152 | |
| 153 | type = fc->id; |
| 154 | tag = fc->tag; |
| 155 | |
| 156 | ret = 0; |
| 157 | switch (type) { |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 158 | case P9_TVERSION: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 159 | ret += scnprintf(buf+ret, buflen-ret, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 160 | "Tversion tag %u msize %u version '%.*s'", tag, |
| 161 | fc->params.tversion.msize, |
| 162 | fc->params.tversion.version.len, |
| 163 | fc->params.tversion.version.str); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 164 | break; |
| 165 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 166 | case P9_RVERSION: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 167 | ret += scnprintf(buf+ret, buflen-ret, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 168 | "Rversion tag %u msize %u version '%.*s'", tag, |
| 169 | fc->params.rversion.msize, |
| 170 | fc->params.rversion.version.len, |
| 171 | fc->params.rversion.version.str); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 172 | break; |
| 173 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 174 | case P9_TAUTH: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 175 | ret += scnprintf(buf+ret, buflen-ret, |
| 176 | "Tauth tag %u afid %d uname '%.*s' aname '%.*s'", tag, |
| 177 | fc->params.tauth.afid, fc->params.tauth.uname.len, |
| 178 | fc->params.tauth.uname.str, fc->params.tauth.aname.len, |
| 179 | fc->params.tauth.aname.str); |
| 180 | break; |
| 181 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 182 | case P9_RAUTH: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 183 | ret += scnprintf(buf+ret, buflen-ret, "Rauth tag %u qid ", tag); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 184 | p9_printqid(buf+ret, buflen-ret, &fc->params.rauth.qid); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 185 | break; |
| 186 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 187 | case P9_TATTACH: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 188 | ret += scnprintf(buf+ret, buflen-ret, |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 189 | "Tattach tag %u fid %d afid %d uname '%.*s' aname '%.*s'", tag, |
| 190 | fc->params.tattach.fid, fc->params.tattach.afid, |
| 191 | fc->params.tattach.uname.len, fc->params.tattach.uname.str, |
| 192 | fc->params.tattach.aname.len, fc->params.tattach.aname.str); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 193 | break; |
| 194 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 195 | case P9_RATTACH: |
| 196 | ret += scnprintf(buf+ret, buflen-ret, "Rattach tag %u qid ", |
| 197 | tag); |
| 198 | p9_printqid(buf+ret, buflen-ret, &fc->params.rattach.qid); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 199 | break; |
| 200 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 201 | case P9_RERROR: |
| 202 | ret += scnprintf(buf+ret, buflen-ret, |
| 203 | "Rerror tag %u ename '%.*s'", tag, |
| 204 | fc->params.rerror.error.len, |
| 205 | fc->params.rerror.error.str); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 206 | if (extended) |
| 207 | ret += scnprintf(buf+ret, buflen-ret, " ecode %d\n", |
| 208 | fc->params.rerror.errno); |
| 209 | break; |
| 210 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 211 | case P9_TFLUSH: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 212 | ret += scnprintf(buf+ret, buflen-ret, "Tflush tag %u oldtag %u", |
| 213 | tag, fc->params.tflush.oldtag); |
| 214 | break; |
| 215 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 216 | case P9_RFLUSH: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 217 | ret += scnprintf(buf+ret, buflen-ret, "Rflush tag %u", tag); |
| 218 | break; |
| 219 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 220 | case P9_TWALK: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 221 | ret += scnprintf(buf+ret, buflen-ret, |
| 222 | "Twalk tag %u fid %d newfid %d nwname %d", tag, |
| 223 | fc->params.twalk.fid, fc->params.twalk.newfid, |
| 224 | fc->params.twalk.nwname); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 225 | for (i = 0; i < fc->params.twalk.nwname; i++) |
| 226 | ret += scnprintf(buf+ret, buflen-ret, " '%.*s'", |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 227 | fc->params.twalk.wnames[i].len, |
| 228 | fc->params.twalk.wnames[i].str); |
| 229 | break; |
| 230 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 231 | case P9_RWALK: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 232 | ret += scnprintf(buf+ret, buflen-ret, "Rwalk tag %u nwqid %d", |
| 233 | tag, fc->params.rwalk.nwqid); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 234 | for (i = 0; i < fc->params.rwalk.nwqid; i++) |
| 235 | ret += p9_printqid(buf+ret, buflen-ret, |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 236 | &fc->params.rwalk.wqids[i]); |
| 237 | break; |
| 238 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 239 | case P9_TOPEN: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 240 | ret += scnprintf(buf+ret, buflen-ret, |
| 241 | "Topen tag %u fid %d mode %d", tag, |
| 242 | fc->params.topen.fid, fc->params.topen.mode); |
| 243 | break; |
| 244 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 245 | case P9_ROPEN: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 246 | ret += scnprintf(buf+ret, buflen-ret, "Ropen tag %u", tag); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 247 | ret += p9_printqid(buf+ret, buflen-ret, &fc->params.ropen.qid); |
| 248 | ret += scnprintf(buf+ret, buflen-ret, " iounit %d", |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 249 | fc->params.ropen.iounit); |
| 250 | break; |
| 251 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 252 | case P9_TCREATE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 253 | ret += scnprintf(buf+ret, buflen-ret, |
| 254 | "Tcreate tag %u fid %d name '%.*s' perm ", tag, |
| 255 | fc->params.tcreate.fid, fc->params.tcreate.name.len, |
| 256 | fc->params.tcreate.name.str); |
| 257 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 258 | ret += p9_printperm(buf+ret, buflen-ret, |
| 259 | fc->params.tcreate.perm); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 260 | ret += scnprintf(buf+ret, buflen-ret, " mode %d", |
| 261 | fc->params.tcreate.mode); |
| 262 | break; |
| 263 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 264 | case P9_RCREATE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 265 | ret += scnprintf(buf+ret, buflen-ret, "Rcreate tag %u", tag); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 266 | ret += p9_printqid(buf+ret, buflen-ret, |
| 267 | &fc->params.rcreate.qid); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 268 | ret += scnprintf(buf+ret, buflen-ret, " iounit %d", |
| 269 | fc->params.rcreate.iounit); |
| 270 | break; |
| 271 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 272 | case P9_TREAD: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 273 | ret += scnprintf(buf+ret, buflen-ret, |
| 274 | "Tread tag %u fid %d offset %lld count %u", tag, |
| 275 | fc->params.tread.fid, |
| 276 | (long long int) fc->params.tread.offset, |
| 277 | fc->params.tread.count); |
| 278 | break; |
| 279 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 280 | case P9_RREAD: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 281 | ret += scnprintf(buf+ret, buflen-ret, |
| 282 | "Rread tag %u count %u data ", tag, |
| 283 | fc->params.rread.count); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 284 | ret += p9_printdata(buf+ret, buflen-ret, fc->params.rread.data, |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 285 | fc->params.rread.count); |
| 286 | break; |
| 287 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 288 | case P9_TWRITE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 289 | ret += scnprintf(buf+ret, buflen-ret, |
| 290 | "Twrite tag %u fid %d offset %lld count %u data ", |
| 291 | tag, fc->params.twrite.fid, |
| 292 | (long long int) fc->params.twrite.offset, |
| 293 | fc->params.twrite.count); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 294 | ret += p9_printdata(buf+ret, buflen-ret, fc->params.twrite.data, |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 295 | fc->params.twrite.count); |
| 296 | break; |
| 297 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 298 | case P9_RWRITE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 299 | ret += scnprintf(buf+ret, buflen-ret, "Rwrite tag %u count %u", |
| 300 | tag, fc->params.rwrite.count); |
| 301 | break; |
| 302 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 303 | case P9_TCLUNK: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 304 | ret += scnprintf(buf+ret, buflen-ret, "Tclunk tag %u fid %d", |
| 305 | tag, fc->params.tclunk.fid); |
| 306 | break; |
| 307 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 308 | case P9_RCLUNK: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 309 | ret += scnprintf(buf+ret, buflen-ret, "Rclunk tag %u", tag); |
| 310 | break; |
| 311 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 312 | case P9_TREMOVE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 313 | ret += scnprintf(buf+ret, buflen-ret, "Tremove tag %u fid %d", |
| 314 | tag, fc->params.tremove.fid); |
| 315 | break; |
| 316 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 317 | case P9_RREMOVE: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 318 | ret += scnprintf(buf+ret, buflen-ret, "Rremove tag %u", tag); |
| 319 | break; |
| 320 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 321 | case P9_TSTAT: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 322 | ret += scnprintf(buf+ret, buflen-ret, "Tstat tag %u fid %d", |
| 323 | tag, fc->params.tstat.fid); |
| 324 | break; |
| 325 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 326 | case P9_RSTAT: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 327 | ret += scnprintf(buf+ret, buflen-ret, "Rstat tag %u ", tag); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 328 | ret += p9_printstat(buf+ret, buflen-ret, &fc->params.rstat.stat, |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 329 | extended); |
| 330 | break; |
| 331 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 332 | case P9_TWSTAT: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 333 | ret += scnprintf(buf+ret, buflen-ret, "Twstat tag %u fid %d ", |
| 334 | tag, fc->params.twstat.fid); |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 335 | ret += p9_printstat(buf+ret, buflen-ret, |
| 336 | &fc->params.twstat.stat, extended); |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 337 | break; |
| 338 | |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 339 | case P9_RWSTAT: |
Latchesar Ionkov | 5174fda | 2006-03-25 03:07:25 -0800 | [diff] [blame] | 340 | ret += scnprintf(buf+ret, buflen-ret, "Rwstat tag %u", tag); |
| 341 | break; |
| 342 | |
| 343 | default: |
| 344 | ret += scnprintf(buf+ret, buflen-ret, "unknown type %d", type); |
| 345 | break; |
| 346 | } |
| 347 | |
| 348 | return ret; |
| 349 | } |
Latchesar Ionkov | bd238fb | 2007-07-10 17:57:28 -0500 | [diff] [blame] | 350 | |
| 351 | #else |
| 352 | int |
| 353 | p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int extended) |
| 354 | { |
| 355 | return 0; |
| 356 | } |
| 357 | EXPORT_SYMBOL(p9_printfcall); |
| 358 | #endif /* CONFIG_NET_9P_DEBUG */ |