2019-06-14 20:59:04 +08:00
|
|
|
/*
|
|
|
|
ISC License
|
|
|
|
|
|
|
|
Copyright (c) 2019, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-07-11 01:50:14 +08:00
|
|
|
#include "kvec.h"
|
2019-06-14 20:59:04 +08:00
|
|
|
#include "fuse_dirent.h"
|
|
|
|
#include "fuse_direntplus.h"
|
|
|
|
#include "fuse_entry.h"
|
2020-06-27 04:50:49 +08:00
|
|
|
#include "linux_dirent.h"
|
2019-06-14 20:59:04 +08:00
|
|
|
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
enum fuse_dirents_type_e
|
|
|
|
{
|
|
|
|
UNSET = 0,
|
|
|
|
NORMAL,
|
|
|
|
PLUS
|
|
|
|
};
|
|
|
|
typedef enum fuse_dirents_type_e fuse_dirents_type_t;
|
|
|
|
|
|
|
|
typedef struct fuse_dirents_s fuse_dirents_t;
|
|
|
|
struct fuse_dirents_s
|
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
uint64_t buf_len;
|
|
|
|
uint64_t data_len;
|
2020-07-11 01:50:14 +08:00
|
|
|
kvec_t(uint32_t) offs;
|
2019-06-14 20:59:04 +08:00
|
|
|
fuse_dirents_type_t type;
|
|
|
|
};
|
|
|
|
|
|
|
|
int fuse_dirents_init(fuse_dirents_t *d);
|
|
|
|
void fuse_dirents_free(fuse_dirents_t *d);
|
|
|
|
void fuse_dirents_reset(fuse_dirents_t *d);
|
|
|
|
|
2020-02-25 07:14:00 +08:00
|
|
|
int fuse_dirents_add(fuse_dirents_t *d,
|
2020-03-13 02:42:08 +08:00
|
|
|
const struct dirent *de,
|
|
|
|
const uint64_t namelen);
|
2019-06-14 20:59:04 +08:00
|
|
|
int fuse_dirents_add_plus(fuse_dirents_t *d,
|
|
|
|
const struct dirent *de,
|
2020-03-13 02:42:08 +08:00
|
|
|
const uint64_t namelen,
|
2019-06-14 20:59:04 +08:00
|
|
|
const fuse_entry_t *entry,
|
|
|
|
const struct stat *st);
|
2020-06-27 04:50:49 +08:00
|
|
|
int fuse_dirents_add_linux(fuse_dirents_t *d,
|
|
|
|
const struct linux_dirent *de,
|
|
|
|
const uint64_t namelen);
|
|
|
|
int fuse_dirents_add_linux_plus(fuse_dirents_t *d,
|
|
|
|
const struct linux_dirent *de,
|
|
|
|
const uint64_t namelen,
|
|
|
|
const fuse_entry_t *entry,
|
|
|
|
const struct stat *st);
|
2019-06-14 20:59:04 +08:00
|
|
|
|
|
|
|
void *fuse_dirents_find(fuse_dirents_t *d,
|
|
|
|
const uint64_t ino);
|
|
|
|
|
|
|
|
int fuse_dirents_convert_plus2normal(fuse_dirents_t *d);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|