utility::Task zuluMountTask::volumeUnmount( const QString& volumePath,const QString& volumeType ) { auto _run = []( const QString& exe ){ auto e = utility::Task( exe ) ; QString output = e.output() ; int index = output.indexOf( QChar( ':' ) ) ; e.output( output.mid( index + 1 ).toLatin1() ) ; return e ; } ; QString volume = _device( volumePath ) ; auto r = _run( utility::appendUserUID( "%1 -u -d \"%2\"" ).arg( zuluMountPath,volume ) ) ; if( r.failed() ){ if( volumeType.contains( "crypto_PLAIN\n" ) ){ /* * we could be trying to unmount a volume with an offset */ r = _run( utility::appendUserUID( "%1 -o bogusNecessaryArgument -u -d \"%2\"" ).arg( zuluMountPath,volume ) ) ; } } return r ; }
volumeEntryProperties _getVolumeProperties( const QString& e ) { QString device = _device( e ) ; auto r = utility::Task( utility::appendUserUID( "%1 -L -d \"%2\"" ).arg( zuluMountPath,device ) ) ; if( r.success() ) { return volumeEntryProperties( r.splitOutput( '\t' ),_volumeIsSystemVolume( device ) ) ; }else{ return volumeEntryProperties() ; } }
TEST_F(DeviceTest, CreateDevice) { size_t id = 0; skelcl::detail::Device device(_device, _platform, id); EXPECT_EQ(id, device.id()); // test id EXPECT_EQ(_device(), device.clDevice()()); // test clDevice cl::Context context = device.clContext(); // test clContext cl_int err; std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>(&err); EXPECT_EQ(CL_SUCCESS, err); // getInfo succeeded EXPECT_EQ(1, devices.size()); // exactly one device found EXPECT_EQ(device.clDevice()(), devices[0]()); // device in context is the same device // TODO: Test command queue }
Task::future< QString >& zuluMountTask::volumeProperties( const QString& v,const QString& volumeType ) { return Task::run< QString >( [ = ](){ if( v.isEmpty() ){ return QString() ; } QString volume = _device( v ) ; auto r = utility::Task( utility::appendUserUID( "%1 -s -d \"%2\"" ).arg( zuluMountPath,volume ) ) ; if( r.ok() ){ return QString( r.output() ) ; }else{ if( volumeType.contains( "crypto_PLAIN\n" ) ){ /* * this could be a plain volume opened with an offset */ QString e = utility::appendUserUID( "%1 -s -o bogusNecessaryArgument -d \"%2\"" ) ; r = utility::Task( e.arg( zuluMountPath,volume ) ) ; if( r.ok() ){ return QString( r.output() ) ; }else{ return QString() ; } }else{ return QString() ; } } } ) ; }
void zuluMountTask::checkUnMount( const QString& volume ) { utility::Task( utility::appendUserUID( "%1 -c -d \"%2\"" ).arg( zuluMountPath,_device( volume ) ) ) ; }