63 lines · c
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 9struct xfs_icluster;10 11uint16_t xfs_flags2diflags(struct xfs_inode *ip, unsigned int xflags);12uint64_t xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags);13uint32_t xfs_dic2xflags(struct xfs_inode *ip);14uint32_t xfs_ip2xflags(struct xfs_inode *ip);15 16prid_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 values22 * according to accepted Unix behaviors, callers must initialize idmap to the23 * correct idmapping structure to get the correct inheritance behaviors when24 * XFS_MOUNT_GRPID is set.25 *26 * To create files detached from the directory tree (e.g. quota inodes), set27 * idmap to NULL. To create a tree root, set pip to NULL.28 */29struct 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 */48void xfs_trans_ichgtime(struct xfs_trans *tp, struct xfs_inode *ip, int flags);49 50void xfs_inode_init(struct xfs_trans *tp, const struct xfs_icreate_args *args,51 struct xfs_inode *ip);52 53int xfs_inode_uninit(struct xfs_trans *tp, struct xfs_perag *pag,54 struct xfs_inode *ip, struct xfs_icluster *xic);55 56int xfs_iunlink(struct xfs_trans *tp, struct xfs_inode *ip);57int xfs_iunlink_remove(struct xfs_trans *tp, struct xfs_perag *pag,58 struct xfs_inode *ip);59int xfs_droplink(struct xfs_trans *tp, struct xfs_inode *ip);60void xfs_bumplink(struct xfs_trans *tp, struct xfs_inode *ip);61 62#endif /* __XFS_INODE_UTIL_H__ */63