From a1e8b08807bc4159cc1d9fdaa7e022848a3960cb Mon Sep 17 00:00:00 2001 From: comatose Date: Tue, 11 Dec 2012 16:13:14 +0900 Subject: [PATCH] * BUSEDevice.cpp: --- BUSEDevice.cpp | 37 ------------------------------------- BUSEDevice.hpp | 28 ---------------------------- Makefile | 2 +- 3 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 BUSEDevice.cpp delete mode 100644 BUSEDevice.hpp diff --git a/BUSEDevice.cpp b/BUSEDevice.cpp deleted file mode 100644 index 380b855..0000000 --- a/BUSEDevice.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "BUSEDevice.hpp" - -using namespace std; - -int xmp_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata) -{ - BUSEDevice* owner = static_cast(userdata); - return owner->handleRead(offset, len, buf); -} - -int xmp_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata) -{ - BUSEDevice* owner = static_cast(userdata); - return owner->handleWrite(offset, len, buf); -} - -void xmp_disc(void *userdata) -{ - BUSEDevice* owner = static_cast(userdata); - return owner->handleDisc(); -} - -int xmp_flush(void *userdata) -{ - BUSEDevice* owner = static_cast(userdata); - return owner->handleFlush(); -} - -int xmp_trim(u_int64_t from, u_int32_t len, void *userdata){ - BUSEDevice* owner = static_cast(userdata); - return owner->handleTrim(from, len); -} - -int BUSEDevice::run(const char* devPath, uint64_t capacity){ - _aop = {xmp_read, xmp_write, xmp_disc, xmp_flush, xmp_trim, capacity}; - return buse_main(devPath, &_aop, this); -} diff --git a/BUSEDevice.hpp b/BUSEDevice.hpp deleted file mode 100644 index 7da30e9..0000000 --- a/BUSEDevice.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef BUSEDevice_HPP -#define BUSEDevice_HPP - -#include - -#include "buse.h" - -class BUSEDevice { - friend int xmp_read(void *buf, u_int32_t len, u_int64_t offset, void *userdata); - friend int xmp_write(const void *buf, u_int32_t len, u_int64_t offset, void *userdata); - friend void xmp_disc(void *userdata); - friend int xmp_flush(void *userdata); - friend int xmp_trim(u_int64_t from, u_int32_t len, void *userdata); - -public: - virtual int run(const char* devPath, uint64_t capacity); - -protected: - virtual int handleRead(uint64_t offset, uint32_t len, void* buf) = 0; - virtual int handleWrite(uint64_t offset, uint32_t len, const void* buf) = 0; - virtual void handleDisc() = 0; - virtual int handleFlush() = 0; - virtual int handleTrim(uint64_t offset, uint32_t len) = 0; - -private: - struct buse_operations _aop; -}; -#endif diff --git a/Makefile b/Makefile index 2859ef4..3c768d7 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ LIBOBJS := buse.o OBJS := $(TARGET:=.o) $(LIBOBJS) STATIC_LIB := libbuse.a -CC := /usr/bin/gcc +CC := /usr/bin/gcc CFLAGS := -g -pedantic -Wall -Wextra -std=c99 LDFLAGS := -L. -lbuse