*/
#include <klibc/string.h>
-#include <lunaix/dirent.h>
#include <lunaix/foptions.h>
#include <lunaix/fs.h>
#include <lunaix/mm/cake.h>
#include <lunaix/fs/twifs.h>
+#include <sys/dirent_defs.h>
+
static struct cake_pile* dnode_pile;
static struct cake_pile* inode_pile;
static struct cake_pile* file_pile;
const int len,
const int dtype)
{
- struct dirent* dent = (struct dirent*)dctx->cb_data;
+ struct lx_dirent* dent = (struct lx_dirent*)dctx->cb_data;
strncpy(dent->d_name, name, DIRENT_NAME_MAX_LEN);
dent->d_nlen = len;
dent->d_type = dtype;
}
-__DEFINE_LXSYSCALL2(int, sys_readdir, int, fd, struct dirent*, dent)
+__DEFINE_LXSYSCALL2(int, sys_readdir, int, fd, struct lx_dirent*, dent)
{
struct v_fd* fd_s;
int errno;
size_t cpy_size = MIN(dnode->name.len, size - len);
strncpy(buf + len, dnode->name.value, cpy_size);
- len += cpy_size;
+ len += cpy_size + !!cpy_size;
return len;
}
return DO_STATUS(errno);
}
+void
+vfs_ref_file(struct v_file* file)
+{
+ atomic_fetch_add(&file->ref_count, 1);
+}
+
void
vfs_ref_dnode(struct v_dnode* dnode)
{
}
}
- buf[len + 1] = '\0';
+ buf[len] = '\0';
ret_ptr = buf;