2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2015-10-26 20:39:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-28 17:54:04 +01:00
|
|
|
#include <linux/fs.h>
|
|
|
|
|
|
|
|
#include "missing_fs.h"
|
|
|
|
|
|
|
|
/* The chattr() flags to apply when creating a new file *before* writing to it. In particular, flags such as
|
|
|
|
* FS_NOCOW_FL don't work if applied a-posteriori. All other flags are fine (or even necessary, think
|
|
|
|
* FS_IMMUTABLE_FL!) to apply after writing to the files. */
|
|
|
|
#define CHATTR_EARLY_FL \
|
|
|
|
(FS_NOATIME_FL | \
|
|
|
|
FS_COMPR_FL | \
|
|
|
|
FS_NOCOW_FL | \
|
|
|
|
FS_NOCOMP_FL | \
|
|
|
|
FS_PROJINHERIT_FL)
|
|
|
|
|
2019-03-28 18:41:39 +01:00
|
|
|
#define CHATTR_ALL_FL \
|
|
|
|
(FS_NOATIME_FL | \
|
|
|
|
FS_SYNC_FL | \
|
|
|
|
FS_DIRSYNC_FL | \
|
|
|
|
FS_APPEND_FL | \
|
|
|
|
FS_COMPR_FL | \
|
|
|
|
FS_NODUMP_FL | \
|
|
|
|
FS_EXTENT_FL | \
|
|
|
|
FS_IMMUTABLE_FL | \
|
|
|
|
FS_JOURNAL_DATA_FL | \
|
|
|
|
FS_SECRM_FL | \
|
|
|
|
FS_UNRM_FL | \
|
|
|
|
FS_NOTAIL_FL | \
|
|
|
|
FS_TOPDIR_FL | \
|
|
|
|
FS_NOCOW_FL | \
|
|
|
|
FS_PROJINHERIT_FL)
|
|
|
|
|
2018-06-25 20:04:07 +02:00
|
|
|
int chattr_fd(int fd, unsigned value, unsigned mask, unsigned *previous);
|
|
|
|
int chattr_path(const char *p, unsigned value, unsigned mask, unsigned *previous);
|
2015-10-26 20:39:23 +01:00
|
|
|
|
|
|
|
int read_attr_fd(int fd, unsigned *ret);
|
|
|
|
int read_attr_path(const char *p, unsigned *ret);
|