Files
Ernesto A. Fernández 72e6425af6 Set up a standalone repository for the APFS module
Copy the code of the APFS module into its own repository, without the
rest of the kernel tree.  Development will continue upstream, but the
intention is to make life easier for potential users.

To get the module to build independently, rewrite the Makefile and
add a definition for the APFS_SUPER_MAGIC macro.  Since the intention is
to support a range of kernel versions, use preprocessor checks to handle
kernels without statx, without iversion, and without SB_RDONLY.

Provide a README file based on the upstream documentation, but with
additional build and mount instructions.  Add a LICENSE file as well.

Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
2019-03-03 17:29:23 -03:00

64 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* linux/fs/apfs/xattr.h
*
* Copyright (C) 2018 Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
*/
#ifndef _APFS_XATTR_H
#define _APFS_XATTR_H
#include <linux/types.h>
#include "inode.h"
/* Extended attributes constants */
#define APFS_XATTR_MAX_EMBEDDED_SIZE 3804
/* Extended attributes names */
#define APFS_XATTR_NAME_SYMLINK "com.apple.fs.symlink"
#define APFS_XATTR_NAME_COMPRESSED "com.apple.decmpfs"
/* Extended attributes flags */
enum {
APFS_XATTR_DATA_STREAM = 0x00000001,
APFS_XATTR_DATA_EMBEDDED = 0x00000002,
APFS_XATTR_FILE_SYSTEM_OWNED = 0x00000004,
APFS_XATTR_RESERVED_8 = 0x00000008,
};
/*
* Structure of the value of an extended attributes record
*/
struct apfs_xattr_val {
__le16 flags;
__le16 xdata_len;
u8 xdata[0];
} __packed;
/*
* Structure used to store the data of an extended attributes record
*/
struct apfs_xattr_dstream {
__le64 xattr_obj_id;
struct apfs_dstream dstream;
} __packed;
/*
* Xattr record data in memory
*/
struct apfs_xattr {
u8 *name;
u8 *xdata;
int name_len;
int xdata_len;
bool has_dstream;
};
extern int apfs_xattr_get(struct inode *inode, const char *name, void *buffer,
size_t size);
extern ssize_t apfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
extern const struct xattr_handler *apfs_xattr_handlers[];
#endif /* _APFS_XATTR_H */