| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
| 5 | */ |
| 6 | #ifndef __XFS_INODE_UTIL_H__ |
| 7 | #define __XFS_INODE_UTIL_H__ |
| 8 | |
| 9 | struct xfs_icluster; |
| 10 | |
| 11 | uint16_t xfs_flags2diflags(struct xfs_inode *ip, unsigned int xflags); |
| 12 | uint64_t xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags); |
| 13 | uint32_t xfs_dic2xflags(struct xfs_inode *ip); |
| 14 | uint32_t xfs_ip2xflags(struct xfs_inode *ip); |
| 15 | |
| 16 | prid_t xfs_get_initial_prid(struct xfs_inode *dp); |
| 17 | |
| 18 | /* |
| 19 | * File creation context. |
| 20 | * |
| 21 | * Due to our only partial reliance on the VFS to propagate uid and gid values |
| 22 | * according to accepted Unix behaviors, callers must initialize idmap to the |
| 23 | * correct idmapping structure to get the correct inheritance behaviors when |
| 24 | * XFS_MOUNT_GRPID is set. |
| 25 | * |
| 26 | * To create files detached from the directory tree (e.g. quota inodes), set |
| 27 | * idmap to NULL. To create a tree root, set pip to NULL. |
| 28 | */ |
| 29 | struct xfs_icreate_args { |
| 30 | struct mnt_idmap *idmap; |
| 31 | struct xfs_inode *pip; /* parent inode or null */ |
| 32 | dev_t rdev; |
| 33 | umode_t mode; |
| 34 | |
| 35 | #define XFS_ICREATE_TMPFILE (1U << 0) /* create an unlinked file */ |
| 36 | #define XFS_ICREATE_INIT_XATTRS (1U << 1) /* will set xattrs immediately */ |
| 37 | #define XFS_ICREATE_UNLINKABLE (1U << 2) /* cannot link into dir tree */ |
| 38 | uint16_t flags; |
| 39 | }; |
| 40 | |
| 41 | /* |
| 42 | * Flags for xfs_trans_ichgtime(). |
| 43 | */ |
| 44 | #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ |
| 45 | #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ |
| 46 | #define XFS_ICHGTIME_CREATE 0x4 /* inode create timestamp */ |
| 47 | #define XFS_ICHGTIME_ACCESS 0x8 /* last access timestamp */ |
| 48 | void xfs_trans_ichgtime(struct xfs_trans *tp, struct xfs_inode *ip, int flags); |
| 49 | |
| 50 | void xfs_inode_init(struct xfs_trans *tp, const struct xfs_icreate_args *args, |
| 51 | struct xfs_inode *ip); |
| 52 | |
| 53 | int xfs_inode_uninit(struct xfs_trans *tp, struct xfs_perag *pag, |
| 54 | struct xfs_inode *ip, struct xfs_icluster *xic); |
| 55 | |
| 56 | int xfs_iunlink(struct xfs_trans *tp, struct xfs_inode *ip); |
| 57 | int xfs_iunlink_remove(struct xfs_trans *tp, struct xfs_perag *pag, |
| 58 | struct xfs_inode *ip); |
| 59 | int xfs_droplink(struct xfs_trans *tp, struct xfs_inode *ip); |
| 60 | void xfs_bumplink(struct xfs_trans *tp, struct xfs_inode *ip); |
| 61 | |
| 62 | #endif /* __XFS_INODE_UTIL_H__ */ |
| 63 | |