34 int read(
char *buf,uint size) {
return m_file.readBlock(buf,size); }
46 #if 0 // experimental version using mmap after opening the file as read only.
66 QString name =
m_file.name();
68 m_fd =
::open(name.data(),O_RDONLY);
71 m_size = stat.st_size;
72 m_map = mmap(NULL,m_size,PROT_READ,MAP_SHARED,m_fd,0);
73 if (m_map==MAP_FAILED) perror(
"mmap failed");
74 assert(m_map!=MAP_FAILED);
84 int write(
const char *buf,uint size)
87 return m_file.writeBlock(buf,size);
89 int read(
char *buf,uint size)
92 memcpy(buf,((
char *)m_map)+m_off,size);
116 munmap(m_map,m_size);