cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob d0e54a1d0c4ad7d6cecc16ef538e7fbdf3213283 1510 bytes (raw)
$ git show HEAD:fs.h	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
/*
 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 */
#ifdef HAVE_FSTATAT
static inline int
mog_stat(struct mog_svc *svc, const char *path, struct stat *sb)
{
	return fstatat(svc->docroot_fd, path + 1, sb, 0);
}
#else  /* HAVE_FSTATAT */
int mog_stat(struct mog_svc *svc, const char *path, struct stat *sb);
#endif /* HAVE_FSTATAT */

#ifdef HAVE_UNLINKAT
static inline int mog_unlink(struct mog_svc *svc, const char *path)
{
	return unlinkat(svc->docroot_fd, path + 1, 0);
}
#else /* HAVE_UNLINKAT */
int mog_unlink(struct mog_svc *svc, const char *path);
#endif /* HAVE_UNLINKAT */

#ifdef HAVE_RENAMEAT
static inline
int mog_rename(struct mog_svc *svc, const char *old, const char *new)
{
	return renameat(svc->docroot_fd, old + 1, svc->docroot_fd, new + 1);
}
#else  /* !HAVE_RENAMEAT */
int mog_rename(struct mog_svc *svc, const char *old, const char *new);
#endif /* !HAVE_RENAMEAT */

#ifdef HAVE_MKDIRAT
static inline int mog_mkdir(struct mog_svc *svc, const char *path, mode_t mode)
{
	return mkdirat(svc->docroot_fd, path + 1, mode);
}
#else  /* !HAVE_MKDIRAT */
int mog_mkdir(struct mog_svc *svc, const char *path, mode_t mode);
#endif /* !HAVE_MKDIRAT */

int mog_open_put(struct mog_svc *svc, const char *path, int flags);
int mog_open_read(struct mog_svc *svc, const char *path);
#ifdef O_CLOEXEC
void mog_cloexec_works(void);
#endif

int mog_statvfs(struct mog_svc *, struct mog_dev *, struct statvfs *);

git clone https://yhbt.net/cmogstored.git