xref: /aosp_15_r20/external/erofs-utils/include/erofs/inode.h (revision 33b1fccf6a0fada2c2875d400ed01119b7676ee5)
1 /* SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0 */
2 /*
3  * Copyright (C) 2018-2019 HUAWEI, Inc.
4  *             http://www.huawei.com/
5  * Created by Li Guifu <[email protected]>
6  * with heavy changes by Gao Xiang <[email protected]>
7  */
8 #ifndef __EROFS_INODE_H
9 #define __EROFS_INODE_H
10 
11 #ifdef __cplusplus
12 extern "C"
13 {
14 #endif
15 
16 #include "erofs/internal.h"
17 
erofs_igrab(struct erofs_inode * inode)18 static inline struct erofs_inode *erofs_igrab(struct erofs_inode *inode)
19 {
20 	(void)erofs_atomic_inc_return(&inode->i_count);
21 	return inode;
22 }
23 
24 u32 erofs_new_encode_dev(dev_t dev);
25 unsigned char erofs_mode_to_ftype(umode_t mode);
26 umode_t erofs_ftype_to_mode(unsigned int ftype, unsigned int perm);
27 unsigned char erofs_ftype_to_dtype(unsigned int filetype);
28 void erofs_inode_manager_init(void);
29 void erofs_insert_ihash(struct erofs_inode *inode);
30 struct erofs_inode *erofs_iget(dev_t dev, ino_t ino);
31 struct erofs_inode *erofs_iget_by_nid(erofs_nid_t nid);
32 unsigned int erofs_iput(struct erofs_inode *inode);
33 erofs_nid_t erofs_lookupnid(struct erofs_inode *inode);
34 int erofs_iflush(struct erofs_inode *inode);
35 struct erofs_dentry *erofs_d_alloc(struct erofs_inode *parent,
36 				   const char *name);
37 bool erofs_dentry_is_wht(struct erofs_sb_info *sbi, struct erofs_dentry *d);
38 int erofs_rebuild_dump_tree(struct erofs_inode *dir, bool incremental);
39 int erofs_init_empty_dir(struct erofs_inode *dir);
40 int __erofs_fill_inode(struct erofs_inode *inode, struct stat *st,
41 		       const char *path);
42 struct erofs_inode *erofs_new_inode(struct erofs_sb_info *sbi);
43 struct erofs_inode *erofs_mkfs_build_tree_from_path(struct erofs_sb_info *sbi,
44 						    const char *path);
45 struct erofs_inode *erofs_mkfs_build_special_from_fd(struct erofs_sb_info *sbi,
46 						     int fd, const char *name);
47 int erofs_fixup_root_inode(struct erofs_inode *root);
48 struct erofs_inode *erofs_rebuild_make_root(struct erofs_sb_info *sbi);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif
55