Revision cf03eb2c

b/hw/virtio-9p-debug.c
169 169
    pprint_str(pdu, rx, offsetp, ", uid");
170 170
    pprint_str(pdu, rx, offsetp, ", gid");
171 171
    pprint_str(pdu, rx, offsetp, ", muid");
172
    if (dotu) {
173
        pprint_str(pdu, rx, offsetp, ", extension");
174
        pprint_int32(pdu, rx, offsetp, ", uid");
175
        pprint_int32(pdu, rx, offsetp, ", gid");
176
        pprint_int32(pdu, rx, offsetp, ", muid");
177
    }
172
    pprint_str(pdu, rx, offsetp, ", extension");
173
    pprint_int32(pdu, rx, offsetp, ", uid");
174
    pprint_int32(pdu, rx, offsetp, ", gid");
175
    pprint_int32(pdu, rx, offsetp, ", muid");
178 176
    fprintf(llogfile, "}");
179 177
}
180 178

  
......
401 399
        pprint_int32(pdu, 0, &offset, "afid");
402 400
        pprint_str(pdu, 0, &offset, ", uname");
403 401
        pprint_str(pdu, 0, &offset, ", aname");
404
        if (dotu) {
405
            pprint_int32(pdu, 0, &offset, ", n_uname");
406
        }
402
        pprint_int32(pdu, 0, &offset, ", n_uname");
407 403
        break;
408 404
    case P9_RAUTH:
409 405
        fprintf(llogfile, "RAUTH: (");
......
415 411
        pprint_int32(pdu, 0, &offset, ", afid");
416 412
        pprint_str(pdu, 0, &offset, ", uname");
417 413
        pprint_str(pdu, 0, &offset, ", aname");
418
        if (dotu) {
419
            pprint_int32(pdu, 0, &offset, ", n_uname");
420
        }
414
        pprint_int32(pdu, 0, &offset, ", n_uname");
421 415
        break;
422 416
    case P9_RATTACH:
423 417
        fprintf(llogfile, "RATTACH: (");
......
429 423
    case P9_RERROR:
430 424
        fprintf(llogfile, "RERROR: (");
431 425
        pprint_str(pdu, 1, &offset, "ename");
432
        if (dotu) {
433
            pprint_int32(pdu, 1, &offset, ", ecode");
434
        }
426
        pprint_int32(pdu, 1, &offset, ", ecode");
435 427
        break;
436 428
    case P9_TFLUSH:
437 429
        fprintf(llogfile, "TFLUSH: (");
......
466 458
        pprint_str(pdu, 0, &offset, ", name");
467 459
        pprint_int32(pdu, 0, &offset, ", perm");
468 460
        pprint_int8(pdu, 0, &offset, ", mode");
469
        if (dotu) {
470
            pprint_str(pdu, 0, &offset, ", extension");
471
        }
461
        pprint_str(pdu, 0, &offset, ", extension");
472 462
        break;
473 463
    case P9_RCREATE:
474 464
        fprintf(llogfile, "RCREATE: (");
b/hw/virtio-9p-debug.h
1 1
#ifndef _QEMU_VIRTIO_9P_DEBUG_H
2 2
#define _QEMU_VIRTIO_9P_DEBUG_H
3 3

  
4
extern int dotu;
5 4
void pprint_pdu(V9fsPDU *pdu);
6 5

  
7 6
#endif
b/hw/virtio-9p.c
18 18
#include "fsdev/qemu-fsdev.h"
19 19
#include "virtio-9p-debug.h"
20 20

  
21
int dotu = 1;
22 21
int debug_9p_pdu;
23 22

  
24 23
enum {
......
853 852

  
854 853
        len = 7;
855 854
        len += pdu_marshal(pdu, len, "s", &str);
856
        if (dotu) {
857
            len += pdu_marshal(pdu, len, "d", err);
858
        }
855
        len += pdu_marshal(pdu, len, "d", err);
859 856

  
860 857
        id = P9_RERROR;
861 858
    }
......
885 882
        ret |= S_IFDIR;
886 883
    }
887 884

  
888
    if (dotu) {
889
        if (mode & P9_STAT_MODE_SYMLINK) {
890
            ret |= S_IFLNK;
891
        }
892
        if (mode & P9_STAT_MODE_SOCKET) {
893
            ret |= S_IFSOCK;
894
        }
895
        if (mode & P9_STAT_MODE_NAMED_PIPE) {
896
            ret |= S_IFIFO;
897
        }
898
        if (mode & P9_STAT_MODE_DEVICE) {
899
            if (extension && extension->data[0] == 'c') {
900
                ret |= S_IFCHR;
901
            } else {
902
                ret |= S_IFBLK;
903
            }
885
    if (mode & P9_STAT_MODE_SYMLINK) {
886
        ret |= S_IFLNK;
887
    }
888
    if (mode & P9_STAT_MODE_SOCKET) {
889
        ret |= S_IFSOCK;
890
    }
891
    if (mode & P9_STAT_MODE_NAMED_PIPE) {
892
        ret |= S_IFIFO;
893
    }
894
    if (mode & P9_STAT_MODE_DEVICE) {
895
        if (extension && extension->data[0] == 'c') {
896
            ret |= S_IFCHR;
897
        } else {
898
            ret |= S_IFBLK;
904 899
        }
905 900
    }
906 901

  
......
963 958
        mode |= P9_STAT_MODE_DIR;
964 959
    }
965 960

  
966
    if (dotu) {
967
        if (S_ISLNK(stbuf->st_mode)) {
968
            mode |= P9_STAT_MODE_SYMLINK;
969
        }
961
    if (S_ISLNK(stbuf->st_mode)) {
962
        mode |= P9_STAT_MODE_SYMLINK;
963
    }
970 964

  
971
        if (S_ISSOCK(stbuf->st_mode)) {
972
            mode |= P9_STAT_MODE_SOCKET;
973
        }
965
    if (S_ISSOCK(stbuf->st_mode)) {
966
        mode |= P9_STAT_MODE_SOCKET;
967
    }
974 968

  
975
        if (S_ISFIFO(stbuf->st_mode)) {
976
            mode |= P9_STAT_MODE_NAMED_PIPE;
977
        }
969
    if (S_ISFIFO(stbuf->st_mode)) {
970
        mode |= P9_STAT_MODE_NAMED_PIPE;
971
    }
978 972

  
979
        if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) {
980
            mode |= P9_STAT_MODE_DEVICE;
981
        }
973
    if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) {
974
        mode |= P9_STAT_MODE_DEVICE;
975
    }
982 976

  
983
        if (stbuf->st_mode & S_ISUID) {
984
            mode |= P9_STAT_MODE_SETUID;
985
        }
977
    if (stbuf->st_mode & S_ISUID) {
978
        mode |= P9_STAT_MODE_SETUID;
979
    }
986 980

  
987
        if (stbuf->st_mode & S_ISGID) {
988
            mode |= P9_STAT_MODE_SETGID;
989
        }
981
    if (stbuf->st_mode & S_ISGID) {
982
        mode |= P9_STAT_MODE_SETGID;
983
    }
990 984

  
991
        if (stbuf->st_mode & S_ISVTX) {
992
            mode |= P9_STAT_MODE_SETVTX;
993
        }
985
    if (stbuf->st_mode & S_ISVTX) {
986
        mode |= P9_STAT_MODE_SETVTX;
994 987
    }
995 988

  
996 989
    return mode;
......
1015 1008
    v9fs_string_null(&v9stat->gid);
1016 1009
    v9fs_string_null(&v9stat->muid);
1017 1010

  
1018
    if (dotu) {
1019
        v9stat->n_uid = stbuf->st_uid;
1020
        v9stat->n_gid = stbuf->st_gid;
1021
        v9stat->n_muid = 0;
1011
    v9stat->n_uid = stbuf->st_uid;
1012
    v9stat->n_gid = stbuf->st_gid;
1013
    v9stat->n_muid = 0;
1022 1014

  
1023
        v9fs_string_null(&v9stat->extension);
1015
    v9fs_string_null(&v9stat->extension);
1024 1016

  
1025
        if (v9stat->mode & P9_STAT_MODE_SYMLINK) {
1026
            err = v9fs_do_readlink(s, name, &v9stat->extension);
1027
            if (err == -1) {
1028
                err = -errno;
1029
                return err;
1030
            }
1031
            v9stat->extension.data[err] = 0;
1032
            v9stat->extension.size = err;
1033
        } else if (v9stat->mode & P9_STAT_MODE_DEVICE) {
1034
            v9fs_string_sprintf(&v9stat->extension, "%c %u %u",
1035
                    S_ISCHR(stbuf->st_mode) ? 'c' : 'b',
1036
                    major(stbuf->st_rdev), minor(stbuf->st_rdev));
1037
        } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) {
1038
            v9fs_string_sprintf(&v9stat->extension, "%s %u",
1039
                    "HARDLINKCOUNT", stbuf->st_nlink);
1040
        }
1017
    if (v9stat->mode & P9_STAT_MODE_SYMLINK) {
1018
        err = v9fs_do_readlink(s, name, &v9stat->extension);
1019
        if (err == -1) {
1020
            err = -errno;
1021
            return err;
1022
        }
1023
        v9stat->extension.data[err] = 0;
1024
        v9stat->extension.size = err;
1025
    } else if (v9stat->mode & P9_STAT_MODE_DEVICE) {
1026
        v9fs_string_sprintf(&v9stat->extension, "%c %u %u",
1027
                S_ISCHR(stbuf->st_mode) ? 'c' : 'b',
1028
                major(stbuf->st_rdev), minor(stbuf->st_rdev));
1029
    } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) {
1030
        v9fs_string_sprintf(&v9stat->extension, "%s %u",
1031
                "HARDLINKCOUNT", stbuf->st_nlink);
1041 1032
    }
1042 1033

  
1043 1034
    str = strrchr(name->data, '/');

Also available in: Unified diff