// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/acl.h>
#include "../parse.h"
#include "../specifier.h"

extern bool arg_dry_run;

int parse_attribute_from_arg(Item *item);

int fchmod_opath(int fd, mode_t mode);

int fd_set_attribute(Item *i, int fd, const char *path, const struct stat *st);

int path_set_attribute(Item *i, const char *path);

int fd_reopen(int fd, int parent_fd, const char *basename,
              const char *resolved_path, int open_flags);

int acl_get_for_fd(int fd, int parent_fd, const char *basename,
                   const char *resolved_path, acl_type_t type, acl_t *ret);

int acl_set_for_fd(int fd, int parent_fd, const char *basename,
                   const char *resolved_path, acl_type_t type, acl_t acl);
