GithubHelp home page GithubHelp logo

xunop / loopdev Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mdaffin/loopdev

0.0 0.0 0.0 100 KB

A rust library to setup and control loopback devices

License: MIT License

Shell 1.31% Rust 98.69%

loopdev's Introduction

Build Status crates.io

loopdev

Setup and control loop devices.

Provides rust interface with similar functionality to the Linux utility losetup.

Examples

use loopdev::LoopControl;
let lc = LoopControl::open().unwrap();
let ld = lc.next_free().unwrap();

println!("{}", ld.path().unwrap().display());

ld.attach_file("disk.img").unwrap();
// ...
ld.detach().unwrap();

Development

Running The Tests Locally

Unfortunately the tests require root only syscalls and thus must be run as root. There is little point in mocking out these syscalls as I want to test they actually function as expected and if they were to be mocked out then the tests would not really be testing anything useful.

A vagrant file is provided that can be used to create an environment to safely run these tests locally as root. With Vagrant and VirtualBox installed you can do the following to run the tests.

vagrant up
vagrant ssh
sudo -i
cd /vagrant
cargo test

Note that the tests are built with root privileges, but since vagrant maps this directory back to the host as your normal user there is minimal issues with this. At worst the vagrant box will become trashed and can be rebuilt in minutes.

loopdev's People

Contributors

mdaffin avatar mulkieran avatar flxo avatar cuviper avatar joshtriplett avatar mmstick avatar eldebrim avatar rodolpheche avatar banditopazzo avatar jsen- avatar klhowell avatar player-two avatar xunop avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.