xfs_inode_util.h 2.2 KB

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