1. I am having trouble implementing rnd_next() in the backend:
int ha_fsview::rnd_next(uchar *buf) {
DBUG_ENTER(__PRETTY_FUNCTION__);
if (!dirp) {
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
if (struct dirent* entry = readdir(dirp)) {
uchar *pos = buf;
*pos = 0;
++pos;
// file name (1bytes size + str)
*pos = strlen(entry->d_name);
++pos;
size_t bytes_to_copy = strlen(entry->d_name);
memcpy(pos, entry->d_name, bytes_to_copy);
pos+=bytes_to_copy;
DBUG_PRINT("info", ("fsview filename: %s", entry->d_name));
// content (4 bytes size + content ptr)
static const std::string fake_content = "hello world";
int s = fake_content.size();
memcpy(pos, &s, sizeof(s));
pos+=sizeof(s);
const char* c = fake_content.c_str();
memcpy(pos, &c, sizeof(c));
pos+=sizeof(c);
DBUG_RETURN(0);
} else {
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
}