[pso] test windows corectat

Ioana Cutcutache pso@cursuri.cs.pub.ro
Mon, 17 May 2004 12:50:01 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C43C0D.77DA1980
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_001B_01C43C0D.77DA1980"


------=_NextPart_001_001B_01C43C0D.77DA1980
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Am atasat testul corectat.
Mai era o greseala si la truncate la calculul FreeBlocks care se facea =
dupa trunchiere cand dimensiunea deja se schimbase, trebuia actualizat =
inainte de truchiere.

------=_NextPart_001_001B_01C43C0D.77DA1980
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Am atasat testul corectat.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Mai era o greseala si la truncate la =
calculul=20
FreeBlocks care se facea dupa trunchiere cand dimensiunea deja se =
schimbase,=20
trebuia&nbsp;actualizat inainte de truchiere.</FONT></DIV></BODY></HTML>

------=_NextPart_001_001B_01C43C0D.77DA1980--

------=_NextPart_000_001A_01C43C0D.77DA1980
Content-Type: text/plain;
	name="test.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="test.c"

#include <stdio.h>=0A=
#include <stdlib.h>=0A=
#include <time.h>=0A=
#include <fcntl.h>=0A=
#include <string.h>=0A=
#include <assert.h>=0A=
#include <errno.h>=0A=
#include <io.h>=0A=
#include <windows.h>

#include "pitix.h"

#define PITIX_MAGIC 		0x58495450=0A=

char * load		=3D "net start pitix";
char * unload	=3D "unload pitix";
char * mount	=3D "filedisk.exe /mount 0 =
c:\\_drivers\\test_pitix\\Debug\\pitix.loop p:";
char * umount	=3D "filedisk.exe /umount p:";

#define LOAD_PITIX		execute(load);
#define UNLOAD_PITIX	execute(unload);
#define MOUNT_PITIX		execute(mount);
#define UMOUNT_PITIX	execute(umount);

unsigned int BlockSize =3D 512;
unsigned int InodeDataBlocks =3D 64;

unsigned int DirEntriesPerDir;
unsigned int Blocks;
unsigned int Inodes;
unsigned int FreeBlocks;
unsigned int FreeInodes;
struct pitix_super_block PitixSuperBlock;
=0A=
const char* print_error()=0A=
{=0A=
	char *error;=0A=
=0A=
	=
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|F=
ORMAT_MESSAGE_IGNORE_INSERTS,=0A=
		NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), =
(char*)&error, 0, NULL);=0A=
	return error;=0A=
}=0A=
=0A=
#define test(s1, s2, t) \=0A=
{\=0A=
	unsigned int j;\=0A=
	char dummy[60];\=0A=
	\=0A=
	sprintf(dummy, s1, s2);\=0A=
        printf("%s", dummy);\=0A=
	fflush(stdout);\=0A=
	for(j=3D0; j<40-strlen(dummy); j++)\=0A=
		putchar('.');\=0A=
	if (!(t)) {\=0A=
	        printf("failed: %s", print_error());\=0A=
	} else\=0A=
		printf("passed\n");\=0A=
	fflush(stdout);\=0A=
}=0A=

void execute(char * command)
{
	STARTUPINFO			si;
    PROCESS_INFORMATION pi;

    ZeroMemory( &si, sizeof(si) );
    si.cb =3D sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    CreateProcess(NULL, command, NULL, NULL, FALSE, 0, NULL, NULL, &si, =
&pi);
    WaitForSingleObject( pi.hProcess, INFINITE );

    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
}

void test_file(char * directory)
{
	char *			pitix_full_path;
	char *			host_full_path;
	HANDLE			PitixHandle;
	HANDLE			HostHandle;
	char *			str;
	unsigned int	file_size;
	char *			pitix_file_buffer;
	char *			host_file_buffer;
	unsigned int	count;
	unsigned int	i;
	BY_HANDLE_FILE_INFORMATION file_info;

	pitix_full_path =3D (char*)malloc(sizeof("p:\\") + =
strlen(directory)+1);
	if (!pitix_full_path) {
		printf("malloc\n");
		return;
	}
	host_full_path =3D (char*)malloc(sizeof("c:\\pitix\\") + =
strlen(directory)+1);
	if (!host_full_path) {
		printf("malloc\n");
		return;
	}

	strcpy(pitix_full_path, "p:\\");
	strcat(pitix_full_path, (const char*)directory);

	strcpy(host_full_path, "c:\\pitix\\");
	strcat(host_full_path, (const char*)directory);

	PitixHandle =3D CreateFile(pitix_full_path, GENERIC_READ | =
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
	HostHandle =3D CreateFile(host_full_path, GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);

	if (HostHandle =3D=3D INVALID_HANDLE_VALUE) {
		printf("nu am putut deschide %s\n", host_full_path);
		return;
	}

	str =3D (char*)malloc(sizeof("open ") + strlen(directory)+1);
	if (!str) {
		printf("malloc\n");
		return;
	}
	strcpy(str, "open ");
	strcat(str, (const char*)directory);
	test(str, 0, PitixHandle !=3D INVALID_HANDLE_VALUE);
	free (str);

	str =3D (char*)malloc(sizeof("test type ") + strlen(directory)+1);
	if (!str) {
		printf("malloc\n");
		return;
	}
	strcpy(str, "test type ");
	strcat(str, (const char*)directory);
	test(str, 0, GetFileType(PitixHandle) =3D=3D GetFileType(HostHandle));
	free (str);

	str =3D (char*)malloc(sizeof("test size ") + strlen(directory)+1);
	if (!str) {
		printf("malloc\n");
		return;
	}
	strcpy(str, "test size ");
	strcat(str, (const char*)directory);

	//daca este director trebuie sa compar dimensiunea cu dimensiunea =
blocului de date
	GetFileInformationByHandle(PitixHandle, &file_info);
	if ((file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) =3D=3D =
FILE_ATTRIBUTE_DIRECTORY)
		test(str, 0, GetFileSize(PitixHandle, NULL) =3D=3D BlockSize);
	if ((file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=3D =
FILE_ATTRIBUTE_DIRECTORY)
		test(str, 0, GetFileSize(PitixHandle, NULL) =3D=3D =
GetFileSize(HostHandle, NULL));
	free (str);

	file_size =3D GetFileSize(PitixHandle, NULL);

	pitix_file_buffer =3D (char*)malloc(file_size * sizeof(char));
	host_file_buffer =3D (char*)malloc(file_size * sizeof(char));

	ReadFile(HostHandle, host_file_buffer, file_size, &count, NULL);
	ReadFile(PitixHandle, pitix_file_buffer, file_size, &count, NULL);

	for (i =3D 0; i < file_size; i++)
	{
		if (pitix_file_buffer[i] !=3D host_file_buffer[i])
			break;
	}

	if (count !=3D 0)
	{
		str =3D (char*)malloc(sizeof("test file data ") + =
strlen(directory)+1);
		if (!str) {
			printf("malloc\n");
			return;
		}
		strcpy(str, "test file data ");
		strcat(str, (const char*)directory);
		test(str, 0, i =3D=3D file_size);
		free (str);
	}

	str =3D (char*)malloc(sizeof("close ") + strlen(directory)+1);
	if (!str) {
		printf("malloc\n");
		return;
	}
	strcpy(str, "close ");
	strcat(str, (const char*)directory);
	test(str, 0, CloseHandle(PitixHandle));
	free(str);

	CloseHandle(HostHandle);
}

void test_statfs(void)
{
	HANDLE VolumeHandle;
	char   buffer[4096];
	int    count;
	//recitesc superblocul de pe disc
	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	ReadFile(VolumeHandle, buffer, 4096, &count, NULL);
	CloseHandle(VolumeHandle);
	memcpy(&PitixSuperBlock, buffer, sizeof(struct pitix_super_block));
	test("test free blocks", 0, FreeBlocks =3D=3D PitixSuperBlock.bfree);
	test("test free inodes", 0, FreeInodes =3D=3D PitixSuperBlock.ffree);
}

void test_mkdir(char * directory)
{
	WIN32_FIND_DATA		FileData;
	BOOL				fFinished =3D FALSE;
	HANDLE				hFind;
	BOOL				FoundDirectory =3D FALSE;
	char *				pitix_directory;

	pitix_directory =3D (char*)malloc(sizeof("c:\\pitix\\") + strlen((const =
char*)directory)+1);
	strcpy(pitix_directory, "c:\\pitix\\");
	strcat(pitix_directory, (const char*)directory);

	SetCurrentDirectory("p:\\");
	CreateDirectory(directory, NULL);
	CreateDirectory(pitix_directory, NULL);
	FreeBlocks--;
	FreeInodes--;
	hFind =3D FindFirstFile(directory, &FileData);
	if (hFind !=3D INVALID_HANDLE_VALUE)
	{
		FindClose(hFind);
		FoundDirectory =3D TRUE;
	}
	SetCurrentDirectory("c:\\");

	test("check mkdir", 0, FoundDirectory);

	test_file(directory);
	test_statfs();
}=0A=

void test_create(char * file, unsigned int size)
{
	char *				pitix_full_path;
	char *				host_full_path;
	HANDLE				HostHandle;
	char *				str;
	BOOL				fFinished =3D FALSE;
	BOOL				FoundFile =3D FALSE;
	char *				WriteBuffer;
	unsigned int		count;
	unsigned int		i;

	pitix_full_path =3D (char*)malloc(sizeof("p:\\") + strlen(file)+1);
	host_full_path =3D (char*)malloc(sizeof("c:\\pitix\\") + =
strlen(file)+1);

	strcpy(pitix_full_path, "p:\\");
	strcat(pitix_full_path, (const char*)file);

	strcpy(host_full_path, "c:\\pitix\\");
	strcat(host_full_path, (const char*)file);

	HostHandle =3D CreateFile(host_full_path, GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

	WriteBuffer =3D (char*)malloc(size * sizeof(char));
	for (i =3D 0; i < size; i++)
		WriteBuffer[i] =3D 'a' + i;
	WriteFile(HostHandle, WriteBuffer, size, &count, NULL);
	CloseHandle(HostHandle);

	str =3D (char*)malloc(sizeof("test copy file to ") + strlen(file)+1);
	strcpy(str, "test copy file to ");
	strcat(str, (const char*)file);
	test(str, 0, CopyFile(host_full_path, pitix_full_path, FALSE));
	FreeBlocks =3D FreeBlocks - (size + BlockSize-1) / BlockSize;
	FreeInodes--;
	free (str);

	test_file(file);
	test_statfs();
}

void test_truncate(char * file)
{
	char *				pitix_full_path;
	char *				host_full_path;
	HANDLE				PitixHandle;
	HANDLE				HostHandle;
	unsigned int		count;
	char *				str;

	pitix_full_path =3D (char*)malloc(sizeof("p:\\") + strlen(file)+1);
	host_full_path =3D (char*)malloc(sizeof("c:\\pitix\\") + =
strlen(file)+1);

	strcpy(pitix_full_path, "p:\\");
	strcat(pitix_full_path, (const char*)file);

	strcpy(host_full_path, "c:\\pitix\\");
	strcat(host_full_path, (const char*)file);

	PitixHandle =3D CreateFile(pitix_full_path, GENERIC_READ | =
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);

	//aici trebuie actualizat FreeBlocks pt. ca pe urma se modifica =
dimensiunea
	FreeBlocks =3D FreeBlocks + (GetFileSize(PitixHandle,NULL) + =
BlockSize-1) / BlockSize ;

	HostHandle =3D CreateFile(host_full_path, GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);

	SetFilePointer(PitixHandle, 0, NULL, FILE_BEGIN);
	SetFilePointer(HostHandle, 0, NULL, FILE_BEGIN);

	WriteFile(PitixHandle, "dummy", sizeof("dummy"), &count, NULL);
	WriteFile(HostHandle, "dummy", sizeof("dummy"), &count, NULL);

	str =3D (char*)malloc(sizeof("test truncate ") + strlen(file)+1);
	strcpy(str, "test truncate ");
	strcat(str, (const char*)file);
	test(str, 0, SetEndOfFile(PitixHandle));
	free (str);

	SetEndOfFile(HostHandle);

	CloseHandle(PitixHandle);
	CloseHandle(HostHandle);

	test_file(file);
	test_statfs();
}

void test_delete(char * file)
{
	char *				pitix_full_path;
	char *				host_full_path;
	HANDLE				PitixHandle;
	HANDLE				hFind;
	WIN32_FIND_DATA		FileData;
	BOOL				fFinished =3D FALSE;
	BOOL				FoundFile =3D FALSE;
	char *				str;
	char *				token;
	int					i =3D 0;
	char *				file_name;

	pitix_full_path =3D (char*)malloc(sizeof("p:\\") + strlen(file)+1);
	host_full_path =3D (char*)malloc(sizeof("c:\\pitix\\") + =
strlen(file)+1);

	strcpy(pitix_full_path, "p:\\");
	strcat(pitix_full_path, (const char*)file);

	strcpy(host_full_path, "c:\\pitix\\");
	strcat(host_full_path, (const char*)file);

	DeleteFile(host_full_path);

	PitixHandle =3D CreateFile(pitix_full_path, GENERIC_READ | =
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

	FreeBlocks =3D FreeBlocks + (GetFileSize(PitixHandle,NULL) + =
BlockSize-1) / BlockSize;
	FreeInodes++;

	CloseHandle(PitixHandle);

	str =3D (char*)malloc(sizeof("test delete ") + strlen(file)+1);
	strcpy(str, "test delete ");
	strcat(str, (const char*)file);
	test(str, 0, DeleteFile(pitix_full_path));
	free (str);

	token =3D strtok(file, "\\");
	while( token !=3D NULL )
	{
		if (i =3D=3D 0)
		{
			str =3D (char*)malloc (sizeof("p:\\") + strlen(token) + 1);
			strcpy(str, "p:\\");
			strcat(str, token);
			SetCurrentDirectory(str);
			free(str);
		}
		else if (i =3D=3D 1)
		{
			file_name =3D (char*)malloc (strlen(token) + 1);
			strcpy(file_name, token);
		}
		token =3D strtok( NULL, "\\");
		i++;
	}

	hFind =3D FindFirstFile(file_name, &FileData);
	free(file_name);
	if (hFind !=3D INVALID_HANDLE_VALUE)
	{
		FindClose(hFind);
		FoundFile =3D TRUE;
	}
	SetCurrentDirectory("c:\\");

	str =3D (char*)malloc(sizeof("test delete entry ") + strlen(file)+1);
	strcpy(str, "test delete entry ");
	strcat(str, (const char*)file);
	test(str, 0, FoundFile =3D=3D FALSE);
	free (str);

	free(pitix_full_path);
	free(host_full_path);

	test_statfs();
}

void test_rmdir(char * directory)
{
	char *				pitix_full_path;
	char *				host_full_path;
	char *				str;
	HANDLE				hFind;
	WIN32_FIND_DATA		FileData;
	BOOL				fFinished =3D FALSE;
	BOOL				FoundFile =3D FALSE;

	pitix_full_path =3D (char*)malloc(sizeof("p:\\") + strlen((const =
char*)directory)+1);
	strcpy(pitix_full_path, "p:\\");
	strcat(pitix_full_path, (const char*)directory);

	host_full_path =3D (char*)malloc(sizeof("c:\\pitix:\\") + strlen((const =
char*)directory)+1);
	strcpy(host_full_path, "c:\\pitix\\");
	strcat(host_full_path, (const char*)directory);

	str =3D (char*)malloc(sizeof("test rmdir ") + strlen(directory)+1);
	strcpy(str, "test rmdir ");
	strcat(str, (const char*)directory);
	test(str, 0, RemoveDirectory(pitix_full_path));
	free (str);

	RemoveDirectory(host_full_path);

	SetCurrentDirectory("p:\\");
	hFind =3D FindFirstFile(directory, &FileData);
	if (hFind !=3D INVALID_HANDLE_VALUE)
	{
		FindClose(hFind);
		FoundFile =3D TRUE;
	}
	SetCurrentDirectory("c:\\");

	str =3D (char*)malloc(sizeof("test rmdir entry ") + =
strlen(directory)+1);
	strcpy(str, "test rmdir entry ");
	strcat(str, (const char*)directory);
	test(str, 0, !FoundFile);
	free (str);

	FreeBlocks++;
	FreeInodes++;

	test_statfs();
}
=0A=
int main(int argc, char **argv)=0A=
{
	HANDLE			FileHandle;
	HANDLE			VolumeHandle;
	char			buffer[4096];
	unsigned int	count;
	unsigned int	i;
	unsigned long	magic;
	char *			str;

	srand(time(NULL));

	if (argc=3D=3D2) {
		if (!strcmp(argv[1], "load")) {
			LOAD_PITIX;
			return 0;
		}
		if (!strcmp(argv[1], "mount")) {
			MOUNT_PITIX;
			return 0;
		}
		if (!strcmp(argv[1], "umount")) {
			UMOUNT_PITIX;
			return 0;
		}
		if (!strcmp(argv[1], "unload")) {
			UNLOAD_PITIX;
			return 0;
		}
		printf("bad usage\n");
		return 0;
	}

	for (i=3D0; i < 4096; i++)
		buffer[i] =3D ' ';

	LOAD_PITIX;
	RemoveDirectory("c:\\pitix");
	CreateDirectory("c:\\pitix", NULL);
	DeleteFile("pitix.loop");

	FileHandle =3D CreateFile("pitix.loop", GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
		NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
	WriteFile(FileHandle, buffer, 4096, &count, NULL);
	CloseHandle(FileHandle);

	MOUNT_PITIX;
	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	ReadFile(VolumeHandle, buffer, 4096, &count, NULL);
	CloseHandle(VolumeHandle);

	memcpy(&magic, buffer, sizeof(unsigned long));
	test("mounting bad fs 1", 0, magic !=3D PITIX_MAGIC);
	UMOUNT_PITIX;
	DeleteFile("pitix.loop");

	execute("mk_pitix.exe 512 64 pitix.loop 2");
	MOUNT_PITIX;
	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	ReadFile(VolumeHandle, buffer, 4096, &count, NULL);
	CloseHandle(VolumeHandle);
	memcpy(&magic, buffer, sizeof(unsigned long));
	test("mounting bad fs 2", 0, magic !=3D PITIX_MAGIC);
	UMOUNT_PITIX;
	DeleteFile("pitix.loop");

	execute("mk_pitix.exe 512 64 pitix.loop 1");
	MOUNT_PITIX;
	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	ReadFile(VolumeHandle, buffer, 4096, &count, NULL);
	CloseHandle(VolumeHandle);
	memcpy(&magic, buffer, sizeof(unsigned long));
	test("mounting fs", 0, magic =3D=3D PITIX_MAGIC);

	memcpy(&PitixSuperBlock, buffer, sizeof(struct pitix_super_block));

	BlockSize =3D 1 << PitixSuperBlock.block_size_bits;
	InodeDataBlocks =3D PitixSuperBlock.inode_data_blocks;
	DirEntriesPerDir =3D BlockSize / 20;
	Blocks =3D 8 * BlockSize;
	Inodes =3D 32 * BlockSize/(20+2 * InodeDataBlocks);
	FreeBlocks =3D Blocks - 1;
	FreeInodes =3D Inodes - 1;

	test("test free blocks", 0, FreeBlocks =3D=3D PitixSuperBlock.bfree);
	test("test free inodes", 0, FreeInodes =3D=3D PitixSuperBlock.ffree);

	test_mkdir("lots_of_files");

	str =3D (char*)malloc(sizeof("lots_of_files\\file") + 2*sizeof(char));
	for (i=3D0; i < DirEntriesPerDir; i++)
	{
		sprintf(str, "lots_of_files\\file%d\0", i);
		test_create(str, ((i + 1) % 20) * 1024);
	}

	FileHandle =3D CreateFile("p:\\lots_of_files\\the_drop",GENERIC_READ | =
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, CREATE_NEW, FILE_FLAG_NO_BUFFERING, NULL);
	test("test dir overflow lots_of_files", 0, FileHandle =3D=3D =
INVALID_HANDLE_VALUE);
	if (FileHandle !=3D INVALID_HANDLE_VALUE)
		CloseHandle(FileHandle);
	free(str);

	Sleep(15000); //ca sa mearga unmount

	UMOUNT_PITIX;

	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	test("umounting fs", 0, VolumeHandle =3D=3D INVALID_HANDLE_VALUE);
	if (VolumeHandle !=3D INVALID_HANDLE_VALUE)
		CloseHandle(VolumeHandle);

	MOUNT_PITIX;
	VolumeHandle =3D CreateFile("\\\\.\\p:",GENERIC_READ | GENERIC_WRITE, =
FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
	ReadFile(VolumeHandle, buffer, 4096, &count, NULL);
	CloseHandle(VolumeHandle);
	memcpy(&magic, buffer, sizeof(unsigned long));
	test("mounting fs", 0, magic =3D=3D PITIX_MAGIC);

	str =3D (char*)malloc(sizeof("lots_of_files\\file") + 2*sizeof(char));

	for (i=3D0; i < DirEntriesPerDir; i++)
	{
		sprintf(str, "lots_of_files\\file%d\0", i);
		test_file(str);
		if (i%2 =3D=3D 0)
			test_truncate(str);
		else
			test_delete(str);
	}
	free(str);

	str =3D (char*)malloc(sizeof("dir") + 2 * sizeof(char) + =
sizeof("\\dummy"));
	for (i =3D 0; i < DirEntriesPerDir-1; i++)
	{
		sprintf(str, "dir%d\0", i);
		test_mkdir(str);
		sprintf(str, "dir%d\\dummy\0", i);
		test_create(str, 4096);
	}

	for (i =3D 0; i < DirEntriesPerDir-1; i++)
	{
		sprintf(str, "dir%d\\dummy\0", i);
		test_delete(str);
		sprintf(str, "dir%d\0", i);
		test_rmdir(str);
	}


	Sleep(10000); //ca sa mearga unmount

	UMOUNT_PITIX;
	UNLOAD_PITIX;=0A=
=0A=
	return 0;=0A=
}=0A=

------=_NextPart_000_001A_01C43C0D.77DA1980--