Giter Club home page Giter Club logo

tarfs's Introduction

tarfs

tarfs is implemented as Linux kernel module filesystem driver. It's more of a research thing. If you're interested in actually using something like this, consider writing it using libFuse :)

Features

  • Supports GNU tar files
  • Regular files, directories and symlinks
  • UID, GID, access/modification/creation time
  • Read-only access to files and directories

Compiling

You'll require the linux development files. For ArchLinux, you need the linux-headers packet.

After that, just run make to build the tarfs.ko, which is a loadable kernel module.

Note: The module was tested with Linux 4.9.11, on a x64 ArchLinux computer.

Usage

# If not already done, build the module
make

# Now you can load the module:
sudo insmod tarfs.ko

# You need a mount directory
mkdir mnt

# Mount some tar archive.  A sample one is included:
sudo mount sample.tar -o loop -t tarfs mnt

# Discover the archives content
ls mnt -R
cat mnt/hello.c

# Unmount
sudo umount mnt

# And unload the kernel module
sudo rmmod tarfs.ko

File overview

Implementation

This project focuses on the interaction part with Linux. That's why the implementation of the Tar reading code is kept really simple: On mount, all file entries are read from the tar file, and stored as a linked list. Some data, like the file path, is stored separatly in the structure to ease access.

When Linux wants the module to list a directory, or find a specific file, the whole linked list is iterated, making most file system operations O(n).

Attention

Please note that you're actually loading stuff into your kernel. That means the module runs with highest permissions possible (Ring 0 on x86 machines). Also, if something goes really wrong, your entire computer could hang/crash/freeze.

It's recommended to try this in a virtual machine. You can create one easily using programs like QEMU or VirtualBox.

License

The enclosed source code, and the sample.tar file including its contents, are subject to the General Public License version 3 (GPLv3). Please see the included LICENSE file for the whole license text. If you're interested in a legally non-binding explanation of this license, have a look at its tl;drLegal page.

Still reading?

Thanks for your interest - Have a nice day, and happy hacking!

tarfs's People

Contributors

papierkorb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

distobj mikiyaf

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.