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 <bluce.liguifu@huawei.com>
6 * with heavy changes by Gao Xiang <xiang@kernel.org>
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 int erofs_allocate_inode_bh_data(struct erofs_inode *inode, erofs_blk_t nblocks);
38 bool erofs_dentry_is_wht(struct erofs_sb_info *sbi, struct erofs_dentry *d);
39 int erofs_rebuild_dump_tree(struct erofs_inode *dir, bool incremental);
40 int erofs_init_empty_dir(struct erofs_inode *dir);
41 int __erofs_fill_inode(struct erofs_inode *inode, struct stat *st,
42 const char *path);
43 struct erofs_inode *erofs_new_inode(struct erofs_sb_info *sbi);
44 struct erofs_inode *erofs_mkfs_build_tree_from_path(struct erofs_sb_info *sbi,
45 const char *path);
46 struct erofs_inode *erofs_mkfs_build_special_from_fd(struct erofs_sb_info *sbi,
47 int fd, const char *name);
48 int erofs_fixup_root_inode(struct erofs_inode *root);
49 struct erofs_inode *erofs_rebuild_make_root(struct erofs_sb_info *sbi);
50
51 #ifdef __cplusplus
52 }
53 #endif
54
55 #endif
56