2014-12-12 03:15:58 +01:00
|
|
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2014 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
2015-01-23 15:20:59 +01:00
|
|
|
#pragma once
|
|
|
|
|
2014-12-12 03:15:58 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2014-12-25 03:19:19 +01:00
|
|
|
#include "time-util.h"
|
|
|
|
|
|
|
|
typedef struct BtrfsSubvolInfo {
|
|
|
|
uint64_t subvol_id;
|
|
|
|
usec_t otime;
|
|
|
|
|
|
|
|
sd_id128_t uuid;
|
|
|
|
sd_id128_t parent_uuid;
|
|
|
|
|
|
|
|
bool read_only;
|
|
|
|
} BtrfsSubvolInfo;
|
|
|
|
|
2014-12-28 02:05:28 +01:00
|
|
|
typedef struct BtrfsQuotaInfo {
|
2015-03-10 15:55:58 +01:00
|
|
|
uint64_t referenced;
|
2014-12-28 02:05:28 +01:00
|
|
|
uint64_t exclusive;
|
2015-03-10 15:55:58 +01:00
|
|
|
uint64_t referenced_max;
|
2014-12-28 02:05:28 +01:00
|
|
|
uint64_t exclusive_max;
|
|
|
|
} BtrfsQuotaInfo;
|
|
|
|
|
2014-12-12 03:15:58 +01:00
|
|
|
int btrfs_is_snapshot(int fd);
|
|
|
|
|
|
|
|
int btrfs_subvol_make(const char *path);
|
2014-12-27 18:46:36 +01:00
|
|
|
int btrfs_subvol_make_label(const char *path);
|
2014-12-12 03:15:58 +01:00
|
|
|
int btrfs_subvol_remove(const char *path);
|
2015-03-09 17:55:07 +01:00
|
|
|
|
|
|
|
int btrfs_subvol_snapshot_fd(int old_fd, const char *new_path, bool read_only, bool fallback_copy);
|
2014-12-12 03:15:58 +01:00
|
|
|
int btrfs_subvol_snapshot(const char *old_path, const char *new_path, bool read_only, bool fallback_copy);
|
2014-12-25 03:19:19 +01:00
|
|
|
|
2015-01-20 03:00:07 +01:00
|
|
|
int btrfs_subvol_set_read_only_fd(int fd, bool b);
|
2014-12-25 03:19:19 +01:00
|
|
|
int btrfs_subvol_set_read_only(const char *path, bool b);
|
|
|
|
int btrfs_subvol_get_read_only_fd(int fd);
|
|
|
|
int btrfs_subvol_get_id_fd(int fd, uint64_t *ret);
|
|
|
|
int btrfs_subvol_get_info_fd(int fd, BtrfsSubvolInfo *info);
|
2014-12-28 02:05:28 +01:00
|
|
|
int btrfs_subvol_get_quota_fd(int fd, BtrfsQuotaInfo *quota);
|
2014-12-12 03:15:58 +01:00
|
|
|
|
|
|
|
int btrfs_reflink(int infd, int outfd);
|
2015-01-17 18:11:45 +01:00
|
|
|
int btrfs_clone_range(int infd, uint64_t in_offset, int ofd, uint64_t out_offset, uint64_t sz);
|
2014-12-12 03:15:58 +01:00
|
|
|
|
2015-02-26 00:40:43 +01:00
|
|
|
int btrfs_get_block_device_fd(int fd, dev_t *dev);
|
2014-12-12 03:15:58 +01:00
|
|
|
int btrfs_get_block_device(const char *path, dev_t *dev);
|
2015-01-06 19:51:03 +01:00
|
|
|
|
|
|
|
int btrfs_defrag_fd(int fd);
|
|
|
|
int btrfs_defrag(const char *p);
|
2015-02-24 18:43:37 +01:00
|
|
|
|
|
|
|
int btrfs_quota_enable_fd(int fd, bool b);
|
|
|
|
int btrfs_quota_enable(const char *path, bool b);
|
2015-02-24 23:50:37 +01:00
|
|
|
|
2015-03-10 15:55:58 +01:00
|
|
|
int btrfs_quota_limit_fd(int fd, uint64_t referenced_max);
|
|
|
|
int btrfs_quota_limit(const char *path, uint64_t referenced_max);
|
2015-02-26 00:40:43 +01:00
|
|
|
|
2015-03-03 00:13:12 +01:00
|
|
|
int btrfs_resize_loopback_fd(int fd, uint64_t size, bool grow_only);
|
|
|
|
int btrfs_resize_loopback(const char *path, uint64_t size, bool grow_only);
|