tool/CommandSoeWrite.cpp
changeset 1870 0cee1fb7f0fd
parent 1869 14f634f5b613
child 1872 23d4e121faaf
equal deleted inserted replaced
1869:14f634f5b613 1870:0cee1fb7f0fd
    78 
    78 
    79 /****************************************************************************/
    79 /****************************************************************************/
    80 
    80 
    81 void CommandSoeWrite::execute(const StringVector &args)
    81 void CommandSoeWrite::execute(const StringVector &args)
    82 {
    82 {
    83 	MasterIndexList masterIndices;
       
    84     stringstream strIdn, err;
    83     stringstream strIdn, err;
    85     const DataType *dataType = NULL;
    84     const DataType *dataType = NULL;
    86     ec_ioctl_slave_soe_write_t ioctl;
    85     ec_ioctl_slave_soe_write_t ioctl;
    87     SlaveList slaves;
    86     SlaveList slaves;
    88     size_t memSize;
    87     size_t memSize;
    97     } catch (runtime_error &e) {
    96     } catch (runtime_error &e) {
    98         err << "Invalid IDN '" << args[0] << "': " << e.what();
    97         err << "Invalid IDN '" << args[0] << "': " << e.what();
    99         throwInvalidUsageException(err);
    98         throwInvalidUsageException(err);
   100     }
    99     }
   101 
   100 
   102 	masterIndices = getMasterIndices();
   101     MasterDevice m(getSingleMasterIndex());
   103     if (masterIndices.size() != 1) {
       
   104         err << getName() << " requires to select a single master!";
       
   105         throwInvalidUsageException(err);
       
   106     }
       
   107     MasterDevice m(masterIndices.front());
       
   108     m.open(MasterDevice::ReadWrite);
   102     m.open(MasterDevice::ReadWrite);
   109     slaves = selectedSlaves(m);
   103     slaves = selectedSlaves(m);
   110     if (slaves.size() != 1) {
   104     if (slaves.size() != 1) {
   111         throwSingleSlaveRequired(slaves.size());
   105         throwSingleSlaveRequired(slaves.size());
   112     }
   106     }