cmogstored 1.8.1 - use default system stack size
[cmogstored.git] / fs.h
blobd0e54a1d0c4ad7d6cecc16ef538e7fbdf3213283
1 /*
2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4 */
5 #ifdef HAVE_FSTATAT
6 static inline int
7 mog_stat(struct mog_svc *svc, const char *path, struct stat *sb)
9 return fstatat(svc->docroot_fd, path + 1, sb, 0);
11 #else /* HAVE_FSTATAT */
12 int mog_stat(struct mog_svc *svc, const char *path, struct stat *sb);
13 #endif /* HAVE_FSTATAT */
15 #ifdef HAVE_UNLINKAT
16 static inline int mog_unlink(struct mog_svc *svc, const char *path)
18 return unlinkat(svc->docroot_fd, path + 1, 0);
20 #else /* HAVE_UNLINKAT */
21 int mog_unlink(struct mog_svc *svc, const char *path);
22 #endif /* HAVE_UNLINKAT */
24 #ifdef HAVE_RENAMEAT
25 static inline
26 int mog_rename(struct mog_svc *svc, const char *old, const char *new)
28 return renameat(svc->docroot_fd, old + 1, svc->docroot_fd, new + 1);
30 #else /* !HAVE_RENAMEAT */
31 int mog_rename(struct mog_svc *svc, const char *old, const char *new);
32 #endif /* !HAVE_RENAMEAT */
34 #ifdef HAVE_MKDIRAT
35 static inline int mog_mkdir(struct mog_svc *svc, const char *path, mode_t mode)
37 return mkdirat(svc->docroot_fd, path + 1, mode);
39 #else /* !HAVE_MKDIRAT */
40 int mog_mkdir(struct mog_svc *svc, const char *path, mode_t mode);
41 #endif /* !HAVE_MKDIRAT */
43 int mog_open_put(struct mog_svc *svc, const char *path, int flags);
44 int mog_open_read(struct mog_svc *svc, const char *path);
45 #ifdef O_CLOEXEC
46 void mog_cloexec_works(void);
47 #endif
49 int mog_statvfs(struct mog_svc *, struct mog_dev *, struct statvfs *);