1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Copyright (c) 2018-2024 Oracle. All Rights Reserved. 4 * Author: Darrick J. Wong <djwong@kernel.org> 5 */ 6 #ifndef __XFS_METADIR_H__ 7 #define __XFS_METADIR_H__ 8 9 /* Cleanup widget for metadata inode creation and deletion. */ 10 struct xfs_metadir_update { 11 /* Parent directory */ 12 struct xfs_inode *dp; 13 14 /* Path to metadata file */ 15 const char *path; 16 17 /* Parent pointer update context */ 18 struct xfs_parent_args *ppargs; 19 20 /* Child metadata file */ 21 struct xfs_inode *ip; 22 23 struct xfs_trans *tp; 24 25 enum xfs_metafile_type metafile_type; 26 27 unsigned int dp_locked:1; 28 unsigned int ip_locked:1; 29 }; 30 31 int xfs_metadir_load(struct xfs_trans *tp, struct xfs_inode *dp, 32 const char *path, enum xfs_metafile_type metafile_type, 33 struct xfs_inode **ipp); 34 35 int xfs_metadir_start_create(struct xfs_metadir_update *upd); 36 int xfs_metadir_create(struct xfs_metadir_update *upd, umode_t mode); 37 38 int xfs_metadir_start_link(struct xfs_metadir_update *upd); 39 int xfs_metadir_link(struct xfs_metadir_update *upd); 40 41 int xfs_metadir_commit(struct xfs_metadir_update *upd); 42 void xfs_metadir_cancel(struct xfs_metadir_update *upd, int error); 43 44 int xfs_metadir_mkdir(struct xfs_inode *dp, const char *path, 45 struct xfs_inode **ipp); 46 47 #endif /* __XFS_METADIR_H__ */ 48