~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to hw/block/block.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    }
52
52
}
53
53
 
54
 
void blkconf_apply_backend_options(BlockConf *conf)
 
54
void blkconf_apply_backend_options(BlockConf *conf, bool readonly,
 
55
                                   bool resizable, Error **errp)
55
56
{
56
57
    BlockBackend *blk = conf->blk;
57
58
    BlockdevOnError rerror, werror;
 
59
    uint64_t perm, shared_perm;
58
60
    bool wce;
 
61
    int ret;
 
62
 
 
63
    perm = BLK_PERM_CONSISTENT_READ;
 
64
    if (!readonly) {
 
65
        perm |= BLK_PERM_WRITE;
 
66
    }
 
67
 
 
68
    shared_perm = BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
 
69
                  BLK_PERM_GRAPH_MOD;
 
70
    if (resizable) {
 
71
        shared_perm |= BLK_PERM_RESIZE;
 
72
    }
 
73
    if (conf->share_rw) {
 
74
        shared_perm |= BLK_PERM_WRITE;
 
75
    }
 
76
 
 
77
    ret = blk_set_perm(blk, perm, shared_perm, errp);
 
78
    if (ret < 0) {
 
79
        return;
 
80
    }
59
81
 
60
82
    switch (conf->wce) {
61
83
    case ON_OFF_AUTO_ON:    wce = true; break;