xref: /aosp_15_r20/external/e2fsprogs/misc/create_inode.h (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker #ifndef _CREATE_INODE_H
2*6a54128fSAndroid Build Coastguard Worker #define _CREATE_INODE_H
3*6a54128fSAndroid Build Coastguard Worker 
4*6a54128fSAndroid Build Coastguard Worker #include <sys/types.h>
5*6a54128fSAndroid Build Coastguard Worker #include <sys/stat.h>
6*6a54128fSAndroid Build Coastguard Worker #include <fcntl.h>
7*6a54128fSAndroid Build Coastguard Worker #include "et/com_err.h"
8*6a54128fSAndroid Build Coastguard Worker #include "e2p/e2p.h"
9*6a54128fSAndroid Build Coastguard Worker #include "ext2fs/ext2fs.h"
10*6a54128fSAndroid Build Coastguard Worker 
11*6a54128fSAndroid Build Coastguard Worker struct hdlink_s
12*6a54128fSAndroid Build Coastguard Worker {
13*6a54128fSAndroid Build Coastguard Worker 	dev_t src_dev;
14*6a54128fSAndroid Build Coastguard Worker 	ino_t src_ino;
15*6a54128fSAndroid Build Coastguard Worker 	ext2_ino_t dst_ino;
16*6a54128fSAndroid Build Coastguard Worker };
17*6a54128fSAndroid Build Coastguard Worker 
18*6a54128fSAndroid Build Coastguard Worker struct hdlinks_s
19*6a54128fSAndroid Build Coastguard Worker {
20*6a54128fSAndroid Build Coastguard Worker 	int count;
21*6a54128fSAndroid Build Coastguard Worker 	int size;
22*6a54128fSAndroid Build Coastguard Worker 	struct hdlink_s *hdl;
23*6a54128fSAndroid Build Coastguard Worker };
24*6a54128fSAndroid Build Coastguard Worker 
25*6a54128fSAndroid Build Coastguard Worker #define HDLINK_CNT	(4)
26*6a54128fSAndroid Build Coastguard Worker 
27*6a54128fSAndroid Build Coastguard Worker struct fs_ops_callbacks {
28*6a54128fSAndroid Build Coastguard Worker 	errcode_t (* create_new_inode)(ext2_filsys fs, const char *target_path,
29*6a54128fSAndroid Build Coastguard Worker 		const char *name, ext2_ino_t parent_ino, ext2_ino_t root,
30*6a54128fSAndroid Build Coastguard Worker 		mode_t mode);
31*6a54128fSAndroid Build Coastguard Worker 	errcode_t (* end_create_new_inode)(ext2_filsys fs,
32*6a54128fSAndroid Build Coastguard Worker 		const char *target_path, const char *name,
33*6a54128fSAndroid Build Coastguard Worker 		ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
34*6a54128fSAndroid Build Coastguard Worker };
35*6a54128fSAndroid Build Coastguard Worker 
36*6a54128fSAndroid Build Coastguard Worker extern int no_copy_xattrs; 	/* this should eventually be a flag
37*6a54128fSAndroid Build Coastguard Worker 				   passed to populate_fs3() */
38*6a54128fSAndroid Build Coastguard Worker 
39*6a54128fSAndroid Build Coastguard Worker /* For populating the filesystem */
40*6a54128fSAndroid Build Coastguard Worker extern errcode_t populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
41*6a54128fSAndroid Build Coastguard Worker 			     const char *source_dir, ext2_ino_t root);
42*6a54128fSAndroid Build Coastguard Worker extern errcode_t populate_fs2(ext2_filsys fs, ext2_ino_t parent_ino,
43*6a54128fSAndroid Build Coastguard Worker 			      const char *source_dir, ext2_ino_t root,
44*6a54128fSAndroid Build Coastguard Worker 			      struct fs_ops_callbacks *fs_callbacks);
45*6a54128fSAndroid Build Coastguard Worker extern errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd,
46*6a54128fSAndroid Build Coastguard Worker 				   const char *name, unsigned int st_mode,
47*6a54128fSAndroid Build Coastguard Worker 				   unsigned int st_rdev);
48*6a54128fSAndroid Build Coastguard Worker extern errcode_t do_symlink_internal(ext2_filsys fs, ext2_ino_t cwd,
49*6a54128fSAndroid Build Coastguard Worker 				     const char *name, char *target,
50*6a54128fSAndroid Build Coastguard Worker 				     ext2_ino_t root);
51*6a54128fSAndroid Build Coastguard Worker extern errcode_t do_mkdir_internal(ext2_filsys fs, ext2_ino_t cwd,
52*6a54128fSAndroid Build Coastguard Worker 				   const char *name, ext2_ino_t root);
53*6a54128fSAndroid Build Coastguard Worker extern errcode_t do_write_internal(ext2_filsys fs, ext2_ino_t cwd,
54*6a54128fSAndroid Build Coastguard Worker 				   const char *src, const char *dest,
55*6a54128fSAndroid Build Coastguard Worker 				   ext2_ino_t root);
56*6a54128fSAndroid Build Coastguard Worker 
57*6a54128fSAndroid Build Coastguard Worker #endif /* _CREATE_INODE_H */
58