#include <errno.h>
#include <fcntl.h>
-#include <linux/btrfs.h>
#if WANT_LINUX_FS_H
#include <linux/fs.h>
#endif
return 1024 * 1024;
}
-/* This is here because it's fd-related and is called from sd-journal code. Other btrfs-related utilities are
- * in src/shared, but libsystemd must not link to libsystemd-shared, see docs/ARCHITECTURE.md. */
-int btrfs_defrag_fd(int fd) {
- int r;
-
- assert(fd >= 0);
-
- r = fd_verify_regular(fd);
- if (r < 0)
- return r;
-
- return RET_NERRNO(ioctl(fd, BTRFS_IOC_DEFRAG, NULL));
-}
-
int fd_get_diskseq(int fd, uint64_t *ret) {
uint64_t diskseq;
int fd_reopen(int fd, int flags);
int read_nr_open(void);
-int btrfs_defrag_fd(int fd);
int fd_get_diskseq(int fd, uint64_t *ret);
/* The maximum length a buffer for a /proc/self/fd/<fd> path needs */
return btrfs_subvol_get_subtree_quota_fd(fd, subvol_id, ret);
}
+int btrfs_defrag_fd(int fd) {
+ int r;
+
+ assert(fd >= 0);
+
+ r = fd_verify_regular(fd);
+ if (r < 0)
+ return r;
+
+ return RET_NERRNO(ioctl(fd, BTRFS_IOC_DEFRAG, NULL));
+}
+
int btrfs_defrag(const char *p) {
_cleanup_close_ int fd = -1;
int btrfs_get_block_device_fd(int fd, dev_t *dev);
int btrfs_get_block_device(const char *path, dev_t *dev);
+int btrfs_defrag_fd(int fd);
int btrfs_defrag(const char *p);
int btrfs_quota_enable_fd(int fd, bool b);