Commit fbe22b60 authored by unknown's avatar unknown

The pagae cache added.


mysys/Makefile.am:
  the page cache and test proms for it added
include/pagecache.h:
  New BitKeeper file ``include/pagecache.h''
mysys/mf_pagecache.c:
  New BitKeeper file ``mysys/mf_pagecache.c''
mysys/test_file.c:
  New BitKeeper file ``mysys/test_file.c''
mysys/test_file.h:
  New BitKeeper file ``mysys/test_file.h''
mysys/test_pagecache_consist.c:
  New BitKeeper file ``mysys/test_pagecache_consist.c''
mysys/test_pagecache_single.c:
  New BitKeeper file ``mysys/test_pagecache_single.c''
parent c262b880
This diff is collapsed.
......@@ -54,7 +54,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_netware.c my_largepage.c \
my_memmem.c \
my_windac.c my_access.c base64.c
my_windac.c my_access.c base64.c mf_pagecache.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c \
CMakeLists.txt mf_soundex.c \
......@@ -129,5 +129,61 @@ test_base64$(EXEEXT): base64.c $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN ./test_base64.c $(LDADD) $(LIBS)
$(RM) -f ./test_base64.c
test_mf_pagecache.o: mf_pagecache.c ../include/pagecache.h $(LIBRARIES)
$(CP) $(srcdir)/mf_pagecache.c test_mf_pagecache.c
$(COMPILE) $(FLAGS) -DPAGECACHE_DEBUG -DEXTRA_DEBUG -c test_mf_pagecache.c
test_file.o: test_file.c test_file.h
$(COMPILE) $(FLAGS) -DPAGECACHE_DEBUG -DEXTRA_DEBUG -c test_file.c
test_pagecache_single1k$(EXEEXT): test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DPAGE_SIZE=1024 -DEXTRA_DEBUG $(srcdir)/test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LDADD) $(LIBS)
test_pagecache_single8k$(EXEEXT): test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DPAGE_SIZE=8192 -DEXTRA_DEBUG $(srcdir)/test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LDADD) $(LIBS)
test_pagecache_single64k$(EXEEXT): test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DPAGE_SIZE=65536 -DEXTRA_DEBUG $(srcdir)/test_pagecache_single.c test_mf_pagecache.o ../unittest/mytap/tap.o test_file.o $(LDADD) $(LIBS)
test_pagecache_single: test_pagecache_single1k$(EXEEXT) test_pagecache_single8k$(EXEEXT) test_pagecache_single64k$(EXEEXT)
./test_pagecache_single64k$(EXEEXT)
./test_pagecache_single8k$(EXEEXT)
./test_pagecache_single1k$(EXEEXT)
test_pagecache_consist1k$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DPAGE_SIZE=1024 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist64k$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DPAGE_SIZE=65536 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist1kHC$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_HIGH_CONCURENCY -DPAGE_SIZE=1024 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist64kHC$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_HIGH_CONCURENCY -DPAGE_SIZE=65536 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist1kRD$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_READERS -DPAGE_SIZE=1024 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist64kRD$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_READERS -DPAGE_SIZE=65536 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist1kWR$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_WRITERS -DPAGE_SIZE=1024 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist64kWR$(EXEEXT): test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LIBRARIES)
$(LINK) $(FLAGS) -DMAIN -DPAGECACHE_DEBUG -DTEST_WRITERS -DPAGE_SIZE=65536 -DEXTRA_DEBUG $(srcdir)/test_pagecache_consist.c test_mf_pagecache.o ../unittest/mytap/tap.o $(LDADD) $(LIBS)
test_pagecache_consist: test_pagecache_consist1k$(EXEEXT) test_pagecache_consist64k$(EXEEXT) test_pagecache_consist1kHC$(EXEEXT) test_pagecache_consist64kHC$(EXEEXT) test_pagecache_consist1kRD$(EXEEXT) test_pagecache_consist64kRD$(EXEEXT) test_pagecache_consist1kWR$(EXEEXT) test_pagecache_consist64kWR$(EXEEXT)
./test_pagecache_consist1k$(EXEEXT)
./test_pagecache_consist64k$(EXEEXT)
./test_pagecache_consist1kHC$(EXEEXT)
./test_pagecache_consist64kHC$(EXEEXT)
./test_pagecache_consist1kRD$(EXEEXT)
./test_pagecache_consist64kRD$(EXEEXT)
./test_pagecache_consist1kWR$(EXEEXT)
./test_pagecache_consist64kWR$(EXEEXT)
# Don't update the files from bitkeeper
%::SCCS/s.%
This source diff could not be displayed because it is too large. You can view the blob instead.
#include "mysys_priv.h"
#include "my_dir.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <pagecache.h>
#include "test_file.h"
/*
Check that file contance correspond to descriptor
SYNOPSIS
test_file()
file File to test
file_name Path (and name) of file which is tested
size size of file
buff_size size of buffer which is enought to check the file
desc file descriptor to check with
RETURN
1 file if OK
0 error
*/
int test_file(PAGECACHE_FILE file, char *file_name,
off_t size, size_t buff_size, struct file_desc *desc)
{
MY_STAT stat_buff, *stat;
unsigned char *buffr= malloc(buff_size);
off_t pos= 0;
size_t byte;
int step= 0;
if ((stat= my_stat(file_name, &stat_buff, MYF(0))) == NULL)
{
diag("Can't stat() %s (errno: %d)\n", file_name, errno);
return 0;
}
if (stat->st_size != size)
{
diag("file %s size is %lu (should be %lu)\n",
file_name, (ulong) stat->st_size, (ulong) size);
return 0;
}
/* check content */
my_seek(file.file, 0, SEEK_SET, MYF(0));
while (desc[step].length != 0)
{
if (my_read(file.file, (char*)buffr, desc[step].length, MYF(0)) !=
desc[step].length)
{
diag("Can't read %u bytes from %s (errno: %d)\n",
(uint)desc[step].length, file_name, errno);
return 0;
}
for (byte= 0; byte < desc[step].length; byte++)
{
if (buffr[byte] != desc[step].content)
{
diag("content of %s mismatch 0x%x in position %lu instead of 0x%x\n",
file_name, (uint) buffr[byte], (ulong) (pos + byte),
desc[step].content);
return 0;
}
}
pos+= desc[step].length;
step++;
}
return 1;
}
#include <pagecache.h>
/*
File content descriptor
*/
struct file_desc
{
unsigned int length;
unsigned char content;
};
int test_file(PAGECACHE_FILE file, char *file_name,
off_t size, size_t buff_size, struct file_desc *desc);
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment