<commit_before>#ifndef FILESYSTEM_H_5
#define FILESYSTEM_H_5

#include <string>

#include "../Interface/Types.h"
#include "../Interface/File.h"

#include "IFilesystem.h"

#include <memory>

class VHDFile;

namespace
{
	class ReadaheadThread;
}

class Filesystem : public IFilesystem
{
	friend class ReadaheadThread;

public:
	Filesystem(const std::wstring &pDev, bool read_ahead);
	Filesystem(IFile *pDev, bool read_ahead);
	virtual ~Filesystem();
	virtual int64 getBlocksize(void)=0;
	virtual int64 getSize(void)=0;
	virtual const unsigned char *getBitmap(void)=0;

	virtual bool hasBlock(int64 pBlock);
	virtual char* readBlock(int64 pBlock);
	std::vector<int64> readBlocks(int64 pStartBlock, unsigned int n,
		const std::vector<char*>& buffers, unsigned int buffer_offset);
	bool hasError(void);
	int64 calculateUsedSpace(void);
	virtual void releaseBuffer(char* buf);

	virtual void shutdownReadahead();

protected:
	virtual char* readBlockInt(int64 pBlock, bool use_readahead);
	bool readFromDev(char *buf, _u32 bsize);
	IFile *dev;

	bool has_error;

	bool own_dev;

	char* getBuffer();

	std::vector<char*> buffers;
	std::auto_ptr<IMutex> buffer_mutex;
	std::auto_ptr<ReadaheadThread> readahead_thread;
	THREADPOOL_TICKET readahead_thread_ticket;
};

#endif //FILESYSTEM_H_5<commit_msg>Anonymous friend does not seem to work with gcc<commit_after>#ifndef FILESYSTEM_H_5
#define FILESYSTEM_H_5

#include <string>

#include "../Interface/Types.h"
#include "../Interface/File.h"

#include "IFilesystem.h"

#include <memory>

class VHDFile;

namespace
{
	class ReadaheadThread;
}

class Filesystem : public IFilesystem
{
public:
	Filesystem(const std::wstring &pDev, bool read_ahead);
	Filesystem(IFile *pDev, bool read_ahead);
	virtual ~Filesystem();
	virtual int64 getBlocksize(void)=0;
	virtual int64 getSize(void)=0;
	virtual const unsigned char *getBitmap(void)=0;

	virtual bool hasBlock(int64 pBlock);
	virtual char* readBlock(int64 pBlock);
	std::vector<int64> readBlocks(int64 pStartBlock, unsigned int n,
		const std::vector<char*>& buffers, unsigned int buffer_offset);
	bool hasError(void);
	int64 calculateUsedSpace(void);
	virtual void releaseBuffer(char* buf);

	virtual void shutdownReadahead();

	virtual char* readBlockInt(int64 pBlock, bool use_readahead);

protected:
	bool readFromDev(char *buf, _u32 bsize);
	IFile *dev;

	bool has_error;

	bool own_dev;

	char* getBuffer();

	std::vector<char*> buffers;
	std::auto_ptr<IMutex> buffer_mutex;
	std::auto_ptr<ReadaheadThread> readahead_thread;
	THREADPOOL_TICKET readahead_thread_ticket;
};

#endif //FILESYSTEM_H_5
{'fraction_non_alphanumeric': 0.11162611046736191, 'fraction_numerical': 0.01853997682502897, 'mean_word_length': 6.507246376811594, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '783948', 'n_tokens_mistral': 936, 'n_tokens_neox': 889, 'n_words': 224}