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>
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 */
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 */
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 */
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
);
46 void mog_cloexec_works(void);
49 int mog_statvfs(struct mog_svc
*, struct mog_dev
*, struct statvfs
*);