forked from trapexit/mergerfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request trapexit#720 from trapexit/readdir_plus
Readdir plus
- Loading branch information
Showing
40 changed files
with
1,826 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
typedef struct fuse_attr_s fuse_attr_t; | ||
struct fuse_attr_s | ||
{ | ||
uint64_t ino; | ||
uint64_t size; | ||
uint64_t blocks; | ||
uint64_t atime; | ||
uint64_t mtime; | ||
uint64_t ctime; | ||
uint32_t atimensec; | ||
uint32_t mtimensec; | ||
uint32_t ctimensec; | ||
uint32_t mode; | ||
uint32_t nlink; | ||
uint32_t uid; | ||
uint32_t gid; | ||
uint32_t rdev; | ||
uint32_t blksize; | ||
uint32_t _padding; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
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 | ||
|
||
#include <stdint.h> | ||
|
||
typedef struct fuse_dirent_s fuse_dirent_t; | ||
struct fuse_dirent_s | ||
{ | ||
uint64_t ino; | ||
uint64_t off; | ||
uint32_t namelen; | ||
uint32_t type; | ||
char name[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
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 | ||
|
||
#include "fuse_attr.h" | ||
#include "fuse_dirent.h" | ||
#include "fuse_entry.h" | ||
|
||
typedef struct fuse_direntplus_s fuse_direntplus_t; | ||
struct fuse_direntplus_s | ||
{ | ||
fuse_entry_t entry; | ||
fuse_attr_t attr; | ||
fuse_dirent_t dirent; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
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 | ||
|
||
#include "fuse_dirent.h" | ||
#include "fuse_direntplus.h" | ||
#include "fuse_entry.h" | ||
|
||
#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; | ||
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); | ||
|
||
int fuse_dirents_add(fuse_dirents_t *d, | ||
const struct dirent *de); | ||
int fuse_dirents_add_plus(fuse_dirents_t *d, | ||
const struct dirent *de, | ||
const fuse_entry_t *entry, | ||
const struct stat *st); | ||
#ifdef __linux__ | ||
struct linux_dirent64; | ||
int fuse_dirents_add_linux(fuse_dirents_t *d, | ||
const struct linux_dirent64 *de); | ||
int fuse_dirents_add_linux_plus(fuse_dirents_t *d, | ||
const struct linux_dirent64 *de, | ||
const fuse_entry_t *entry, | ||
const struct stat *st); | ||
#endif | ||
|
||
void *fuse_dirents_find(fuse_dirents_t *d, | ||
const uint64_t ino); | ||
|
||
int fuse_dirents_convert_plus2normal(fuse_dirents_t *d); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
typedef struct fuse_entry_s fuse_entry_t; | ||
struct fuse_entry_s | ||
{ | ||
uint64_t nodeid; | ||
uint64_t generation; | ||
uint64_t entry_valid; | ||
uint64_t attr_valid; | ||
uint32_t entry_valid_nsec; | ||
uint32_t attr_valid_nsec; | ||
}; |
Oops, something went wrong.