f2fs_fs.h revision fef98ebdf3a7728017cb3d0ae4ffedc5405e531d
1/**
2 * f2fs_fs.h
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 *             http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __F2FS_FS_H__
12#define __F2FS_FS_H__
13
14#include <inttypes.h>
15#include <linux/types.h>
16#include <sys/types.h>
17#include <endian.h>
18#include <byteswap.h>
19
20#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24#if __BYTE_ORDER == __LITTLE_ENDIAN
25#define le16_to_cpu(x)	((__u16)(x))
26#define le32_to_cpu(x)	((__u32)(x))
27#define le64_to_cpu(x)	((__u64)(x))
28#define cpu_to_le16(x)	((__u16)(x))
29#define cpu_to_le32(x)	((__u32)(x))
30#define cpu_to_le64(x)	((__u64)(x))
31#elif __BYTE_ORDER == __BIG_ENDIAN
32#define le16_to_cpu(x)	bswap_16(x)
33#define le32_to_cpu(x)	bswap_32(x)
34#define le64_to_cpu(x)	bswap_64(x)
35#define cpu_to_le16(x)	bswap_16(x)
36#define cpu_to_le32(x)	bswap_32(x)
37#define cpu_to_le64(x)	bswap_64(x)
38#endif
39
40/*
41 * Debugging interfaces
42 */
43#define ASSERT_MSG(exp, fmt, ...)					\
44	do {								\
45		if (!(exp)) {						\
46			printf("\nAssertion failed!\n");		\
47			printf("[%s:%4d] " #exp, __func__, __LINE__);	\
48			printf("\n --> "fmt, ##__VA_ARGS__);		\
49			exit(-1);					\
50		}							\
51	} while (0);
52
53#define ASSERT(exp)							\
54	do {								\
55		if (!(exp)) {						\
56			printf("\nAssertion failed!\n");		\
57			printf("[%s:%4d] " #exp"\n", __func__, __LINE__);\
58			exit(-1);					\
59		}							\
60	} while (0);
61
62#define MSG(n, fmt, ...)						\
63	do {								\
64		if (config.dbg_lv >= n) {				\
65			printf(fmt, ##__VA_ARGS__);			\
66		}							\
67	} while (0);
68
69#define DBG(n, fmt, ...)						\
70	do {								\
71		if (config.dbg_lv >= n) {				\
72			printf("[%s:%4d] " fmt,				\
73				__func__, __LINE__, ##__VA_ARGS__);	\
74		}							\
75	} while (0);
76
77/* Display on console */
78#define DISP(fmt, ptr, member)				\
79	do {						\
80		printf("%-30s" fmt, #member, ((ptr)->member));	\
81	} while (0);
82
83#define DISP_u32(ptr, member)						\
84	do {								\
85		assert(sizeof((ptr)->member) <= 4);			\
86		printf("%-30s" "\t\t[0x%8x : %u]\n",		\
87			#member, ((ptr)->member), ((ptr)->member) );	\
88	} while (0);
89
90#define DISP_u64(ptr, member)						\
91	do {								\
92		assert(sizeof((ptr)->member) == 8);			\
93		printf("%-30s" "\t\t[0x%8llx : %llu]\n",		\
94			#member, ((ptr)->member), ((ptr)->member) );	\
95	} while (0);
96
97#define DISP_utf(ptr, member)						\
98	do {								\
99		printf(#member "\t\t\t\t[%s]\n", ((ptr)->member) );	\
100	} while (0);
101
102/* Display to buffer */
103#define BUF_DISP_u32(buf, data, len, ptr, member)					\
104	do {										\
105		assert(sizeof((ptr)->member) <= 4);					\
106		snprintf(buf, len, #member);						\
107		snprintf(data, len, "0x%x : %u", ((ptr)->member), ((ptr)->member));	\
108	} while (0);
109
110#define BUF_DISP_u64(buf, data, len, ptr, member)					\
111	do {										\
112		assert(sizeof((ptr)->member) == 8);					\
113		snprintf(buf, len, #member);						\
114		snprintf(data, len, "0x%llx : %llu", ((ptr)->member), ((ptr)->member));	\
115	} while (0);
116
117#define BUF_DISP_utf(buf, data, len, ptr, member)				\
118	do {									\
119		snprintf(buf, len, #member);					\
120	} while (0);
121
122/* these are defined in kernel */
123#define PAGE_SIZE		4096
124#define PAGE_CACHE_SIZE		4096
125#define BITS_PER_BYTE		8
126#define F2FS_SUPER_MAGIC	0xF2F52010	/* F2FS Magic Number */
127
128/* for mkfs */
129#define F2FS_MIN_VOLUME_SIZE	104857600
130#define	F2FS_NUMBER_OF_CHECKPOINT_PACK	2
131#define	DEFAULT_SECTOR_SIZE		512
132#define	DEFAULT_SECTORS_PER_BLOCK	8
133#define	DEFAULT_BLOCKS_PER_SEGMENT	512
134#define DEFAULT_SEGMENTS_PER_SECTION	1
135
136struct f2fs_configuration {
137	u_int32_t sector_size;
138	u_int32_t reserved_segments;
139	u_int32_t overprovision;
140	u_int32_t cur_seg[6];
141	u_int32_t segs_per_sec;
142	u_int32_t secs_per_zone;
143	u_int32_t start_sector;
144	u_int64_t total_sectors;
145	u_int32_t sectors_per_blk;
146	u_int32_t blks_per_seg;
147	char *vol_label;
148	int heap;
149	int32_t fd;
150	char *device_name;
151	char *extension_list;
152	int dbg_lv;
153	int trim;
154} __attribute__((packed));
155
156#ifdef CONFIG_64BIT
157#define BITS_PER_LONG	64
158#else
159#define BITS_PER_LONG	32
160#endif
161
162#define BIT_MASK(nr)	(1 << (nr % BITS_PER_LONG))
163#define BIT_WORD(nr)	(nr / BITS_PER_LONG)
164
165/*
166 * Copied from fs/f2fs/f2fs.h
167 */
168#define	NR_CURSEG_DATA_TYPE	(3)
169#define NR_CURSEG_NODE_TYPE	(3)
170#define NR_CURSEG_TYPE	(NR_CURSEG_DATA_TYPE + NR_CURSEG_NODE_TYPE)
171
172enum {
173	CURSEG_HOT_DATA	= 0,	/* directory entry blocks */
174	CURSEG_WARM_DATA,	/* data blocks */
175	CURSEG_COLD_DATA,	/* multimedia or GCed data blocks */
176	CURSEG_HOT_NODE,	/* direct node blocks of directory files */
177	CURSEG_WARM_NODE,	/* direct node blocks of normal files */
178	CURSEG_COLD_NODE,	/* indirect node blocks */
179	NO_CHECK_TYPE
180};
181
182/*
183 * Copied from fs/f2fs/segment.h
184 */
185#define GET_SUM_TYPE(footer) ((footer)->entry_type)
186#define SET_SUM_TYPE(footer, type) ((footer)->entry_type = type)
187
188/*
189 * Copied from include/linux/f2fs_sb.h
190 */
191#define F2FS_SUPER_OFFSET		1024	/* byte-size offset */
192#define F2FS_LOG_SECTOR_SIZE		9	/* 9 bits for 512 byte */
193#define F2FS_LOG_SECTORS_PER_BLOCK	3	/* 4KB: F2FS_BLKSIZE */
194#define F2FS_BLKSIZE			4096	/* support only 4KB block */
195#define F2FS_MAX_EXTENSION		64	/* # of extension entries */
196
197#define NULL_ADDR		0x0U
198#define NEW_ADDR		-1U
199
200#define F2FS_ROOT_INO(sbi)	(sbi->root_ino_num)
201#define F2FS_NODE_INO(sbi)	(sbi->node_ino_num)
202#define F2FS_META_INO(sbi)	(sbi->meta_ino_num)
203
204/* This flag is used by node and meta inodes, and by recovery */
205#define GFP_F2FS_ZERO	(GFP_NOFS | __GFP_ZERO)
206
207/*
208 * For further optimization on multi-head logs, on-disk layout supports maximum
209 * 16 logs by default. The number, 16, is expected to cover all the cases
210 * enoughly. The implementaion currently uses no more than 6 logs.
211 * Half the logs are used for nodes, and the other half are used for data.
212 */
213#define MAX_ACTIVE_LOGS	16
214#define MAX_ACTIVE_NODE_LOGS	8
215#define MAX_ACTIVE_DATA_LOGS	8
216
217/*
218 * For superblock
219 */
220struct f2fs_super_block {
221	__le32 magic;			/* Magic Number */
222	__le16 major_ver;		/* Major Version */
223	__le16 minor_ver;		/* Minor Version */
224	__le32 log_sectorsize;		/* log2 sector size in bytes */
225	__le32 log_sectors_per_block;	/* log2 # of sectors per block */
226	__le32 log_blocksize;		/* log2 block size in bytes */
227	__le32 log_blocks_per_seg;	/* log2 # of blocks per segment */
228	__le32 segs_per_sec;		/* # of segments per section */
229	__le32 secs_per_zone;		/* # of sections per zone */
230	__le32 checksum_offset;		/* checksum offset inside super block */
231	__le64 block_count;		/* total # of user blocks */
232	__le32 section_count;		/* total # of sections */
233	__le32 segment_count;		/* total # of segments */
234	__le32 segment_count_ckpt;	/* # of segments for checkpoint */
235	__le32 segment_count_sit;	/* # of segments for SIT */
236	__le32 segment_count_nat;	/* # of segments for NAT */
237	__le32 segment_count_ssa;	/* # of segments for SSA */
238	__le32 segment_count_main;	/* # of segments for main area */
239	__le32 segment0_blkaddr;	/* start block address of segment 0 */
240	__le32 cp_blkaddr;		/* start block address of checkpoint */
241	__le32 sit_blkaddr;		/* start block address of SIT */
242	__le32 nat_blkaddr;		/* start block address of NAT */
243	__le32 ssa_blkaddr;		/* start block address of SSA */
244	__le32 main_blkaddr;		/* start block address of main area */
245	__le32 root_ino;		/* root inode number */
246	__le32 node_ino;		/* node inode number */
247	__le32 meta_ino;		/* meta inode number */
248	__u8 uuid[16];			/* 128-bit uuid for volume */
249	__le16 volume_name[512];	/* volume name */
250	__le32 extension_count;		/* # of extensions below */
251	__u8 extension_list[F2FS_MAX_EXTENSION][8];	/* extension array */
252} __attribute__((packed));
253
254/*
255 * For checkpoint
256 */
257#define CP_ERROR_FLAG		0x00000008
258#define CP_COMPACT_SUM_FLAG	0x00000004
259#define CP_ORPHAN_PRESENT_FLAG	0x00000002
260#define CP_UMOUNT_FLAG		0x00000001
261
262struct f2fs_checkpoint {
263	__le64 checkpoint_ver;		/* checkpoint block version number */
264	__le64 user_block_count;	/* # of user blocks */
265	__le64 valid_block_count;	/* # of valid blocks in main area */
266	__le32 rsvd_segment_count;	/* # of reserved segments for gc */
267	__le32 overprov_segment_count;	/* # of overprovision segments */
268	__le32 free_segment_count;	/* # of free segments in main area */
269
270	/* information of current node segments */
271	__le32 cur_node_segno[MAX_ACTIVE_NODE_LOGS];
272	__le16 cur_node_blkoff[MAX_ACTIVE_NODE_LOGS];
273	/* information of current data segments */
274	__le32 cur_data_segno[MAX_ACTIVE_DATA_LOGS];
275	__le16 cur_data_blkoff[MAX_ACTIVE_DATA_LOGS];
276	__le32 ckpt_flags;		/* Flags : umount and journal_present */
277	__le32 cp_pack_total_block_count;	/* total # of one cp pack */
278	__le32 cp_pack_start_sum;	/* start block number of data summary */
279	__le32 valid_node_count;	/* Total number of valid nodes */
280	__le32 valid_inode_count;	/* Total number of valid inodes */
281	__le32 next_free_nid;		/* Next free node number */
282	__le32 sit_ver_bitmap_bytesize;	/* Default value 64 */
283	__le32 nat_ver_bitmap_bytesize; /* Default value 256 */
284	__le32 checksum_offset;		/* checksum offset inside cp block */
285	__le64 elapsed_time;		/* mounted time */
286	/* allocation type of current segment */
287	unsigned char alloc_type[MAX_ACTIVE_LOGS];
288
289	/* SIT and NAT version bitmap */
290	unsigned char sit_nat_version_bitmap[1];
291} __attribute__((packed));
292
293/*
294 * For orphan inode management
295 */
296#define F2FS_ORPHANS_PER_BLOCK	1020
297
298struct f2fs_orphan_block {
299	__le32 ino[F2FS_ORPHANS_PER_BLOCK];	/* inode numbers */
300	__le32 reserved;	/* reserved */
301	__le16 blk_addr;	/* block index in current CP */
302	__le16 blk_count;	/* Number of orphan inode blocks in CP */
303	__le32 entry_count;	/* Total number of orphan nodes in current CP */
304	__le32 check_sum;	/* CRC32 for orphan inode block */
305} __attribute__((packed));
306
307/*
308 * For NODE structure
309 */
310struct f2fs_extent {
311	__le32 fofs;		/* start file offset of the extent */
312	__le32 blk_addr;	/* start block address of the extent */
313	__le32 len;		/* lengh of the extent */
314} __attribute__((packed));
315
316#define F2FS_NAME_LEN		255
317#define ADDRS_PER_INODE         923	/* Address Pointers in an Inode */
318#define ADDRS_PER_BLOCK         1018	/* Address Pointers in a Direct Block */
319#define NIDS_PER_BLOCK          1018	/* Node IDs in an Indirect Block */
320
321struct f2fs_inode {
322	__le16 i_mode;			/* file mode */
323	__u8 i_advise;			/* file hints */
324	__u8 i_reserved;		/* reserved */
325	__le32 i_uid;			/* user ID */
326	__le32 i_gid;			/* group ID */
327	__le32 i_links;			/* links count */
328	__le64 i_size;			/* file size in bytes */
329	__le64 i_blocks;		/* file size in blocks */
330	__le64 i_atime;			/* access time */
331	__le64 i_ctime;			/* change time */
332	__le64 i_mtime;			/* modification time */
333	__le32 i_atime_nsec;		/* access time in nano scale */
334	__le32 i_ctime_nsec;		/* change time in nano scale */
335	__le32 i_mtime_nsec;		/* modification time in nano scale */
336	__le32 i_generation;		/* file version (for NFS) */
337	__le32 i_current_depth;		/* only for directory depth */
338	__le32 i_xattr_nid;		/* nid to save xattr */
339	__le32 i_flags;			/* file attributes */
340	__le32 i_pino;			/* parent inode number */
341	__le32 i_namelen;		/* file name length */
342	__u8 i_name[F2FS_NAME_LEN];	/* file name for SPOR */
343	__u8 i_reserved2;		/* for backward compatibility */
344
345	struct f2fs_extent i_ext;	/* caching a largest extent */
346
347	__le32 i_addr[ADDRS_PER_INODE];	/* Pointers to data blocks */
348
349	__le32 i_nid[5];		/* direct(2), indirect(2),
350						double_indirect(1) node id */
351} __attribute__((packed));
352
353struct direct_node {
354	__le32 addr[ADDRS_PER_BLOCK];	/* array of data block address */
355} __attribute__((packed));
356
357struct indirect_node {
358	__le32 nid[NIDS_PER_BLOCK];	/* array of data block address */
359} __attribute__((packed));
360
361enum {
362	COLD_BIT_SHIFT = 0,
363	FSYNC_BIT_SHIFT,
364	DENT_BIT_SHIFT,
365	OFFSET_BIT_SHIFT
366};
367
368struct node_footer {
369	__le32 nid;		/* node id */
370	__le32 ino;		/* inode nunmber */
371	__le32 flag;		/* include cold/fsync/dentry marks and offset */
372	__le64 cp_ver;		/* checkpoint version */
373	__le32 next_blkaddr;	/* next node page block address */
374} __attribute__((packed));
375
376struct f2fs_node {
377	/* can be one of three types: inode, direct, and indirect types */
378	union {
379		struct f2fs_inode i;
380		struct direct_node dn;
381		struct indirect_node in;
382	};
383	struct node_footer footer;
384} __attribute__((packed));
385
386/*
387 * For NAT entries
388 */
389#define NAT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_nat_entry))
390
391struct f2fs_nat_entry {
392	__u8 version;		/* latest version of cached nat entry */
393	__le32 ino;		/* inode number */
394	__le32 block_addr;	/* block address */
395} __attribute__((packed));
396
397struct f2fs_nat_block {
398	struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
399} __attribute__((packed));
400
401/*
402 * For SIT entries
403 *
404 * Each segment is 2MB in size by default so that a bitmap for validity of
405 * there-in blocks should occupy 64 bytes, 512 bits.
406 * Not allow to change this.
407 */
408#define SIT_VBLOCK_MAP_SIZE 64
409#define SIT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_sit_entry))
410
411/*
412 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
413 * [15:10] : allocation type such as CURSEG_XXXX_TYPE
414 * [9:0] : valid block count
415 */
416#define SIT_VBLOCKS_SHIFT	10
417#define SIT_VBLOCKS_MASK	((1 << SIT_VBLOCKS_SHIFT) - 1)
418#define GET_SIT_VBLOCKS(raw_sit)				\
419	(le16_to_cpu((raw_sit)->vblocks) & SIT_VBLOCKS_MASK)
420#define GET_SIT_TYPE(raw_sit)					\
421	((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK)	\
422	 >> SIT_VBLOCKS_SHIFT)
423
424struct f2fs_sit_entry {
425	__le16 vblocks;				/* reference above */
426	__u8 valid_map[SIT_VBLOCK_MAP_SIZE];	/* bitmap for valid blocks */
427	__le64 mtime;				/* segment age for cleaning */
428} __attribute__((packed));
429
430struct f2fs_sit_block {
431	struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
432} __attribute__((packed));
433
434/*
435 * For segment summary
436 *
437 * One summary block contains exactly 512 summary entries, which represents
438 * exactly 2MB segment by default. Not allow to change the basic units.
439 *
440 * NOTE: For initializing fields, you must use set_summary
441 *
442 * - If data page, nid represents dnode's nid
443 * - If node page, nid represents the node page's nid.
444 *
445 * The ofs_in_node is used by only data page. It represents offset
446 * from node's page's beginning to get a data block address.
447 * ex) data_blkaddr = (block_t)(nodepage_start_address + ofs_in_node)
448 */
449#define ENTRIES_IN_SUM		512
450#define	SUMMARY_SIZE		(7)	/* sizeof(struct summary) */
451#define	SUM_FOOTER_SIZE		(5)	/* sizeof(struct summary_footer) */
452#define SUM_ENTRY_SIZE		(SUMMARY_SIZE * ENTRIES_IN_SUM)
453
454/* a summary entry for a 4KB-sized block in a segment */
455struct f2fs_summary {
456	__le32 nid;		/* parent node id */
457	union {
458		__u8 reserved[3];
459		struct {
460			__u8 version;		/* node version number */
461			__le16 ofs_in_node;	/* block index in parent node */
462		} __attribute__((packed));
463	};
464} __attribute__((packed));
465
466/* summary block type, node or data, is stored to the summary_footer */
467#define SUM_TYPE_NODE		(1)
468#define SUM_TYPE_DATA		(0)
469
470struct summary_footer {
471	unsigned char entry_type;	/* SUM_TYPE_XXX */
472	__u32 check_sum;		/* summary checksum */
473} __attribute__((packed));
474
475#define SUM_JOURNAL_SIZE	(F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
476				SUM_ENTRY_SIZE)
477#define NAT_JOURNAL_ENTRIES	((SUM_JOURNAL_SIZE - 2) /\
478				sizeof(struct nat_journal_entry))
479#define NAT_JOURNAL_RESERVED	((SUM_JOURNAL_SIZE - 2) %\
480				sizeof(struct nat_journal_entry))
481#define SIT_JOURNAL_ENTRIES	((SUM_JOURNAL_SIZE - 2) /\
482				sizeof(struct sit_journal_entry))
483#define SIT_JOURNAL_RESERVED	((SUM_JOURNAL_SIZE - 2) %\
484				sizeof(struct sit_journal_entry))
485/*
486 * frequently updated NAT/SIT entries can be stored in the spare area in
487 * summary blocks
488 */
489enum {
490	NAT_JOURNAL = 0,
491	SIT_JOURNAL
492};
493
494struct nat_journal_entry {
495	__le32 nid;
496	struct f2fs_nat_entry ne;
497} __attribute__((packed));
498
499struct nat_journal {
500	struct nat_journal_entry entries[NAT_JOURNAL_ENTRIES];
501	__u8 reserved[NAT_JOURNAL_RESERVED];
502} __attribute__((packed));
503
504struct sit_journal_entry {
505	__le32 segno;
506	struct f2fs_sit_entry se;
507} __attribute__((packed));
508
509struct sit_journal {
510	struct sit_journal_entry entries[SIT_JOURNAL_ENTRIES];
511	__u8 reserved[SIT_JOURNAL_RESERVED];
512} __attribute__((packed));
513
514/* 4KB-sized summary block structure */
515struct f2fs_summary_block {
516	struct f2fs_summary entries[ENTRIES_IN_SUM];
517	union {
518		__le16 n_nats;
519		__le16 n_sits;
520	};
521	/* spare area is used by NAT or SIT journals */
522	union {
523		struct nat_journal nat_j;
524		struct sit_journal sit_j;
525	};
526	struct summary_footer footer;
527} __attribute__((packed));
528
529/*
530 * For directory operations
531 */
532#define F2FS_DOT_HASH		0
533#define F2FS_DDOT_HASH		F2FS_DOT_HASH
534#define F2FS_MAX_HASH		(~((0x3ULL) << 62))
535#define F2FS_HASH_COL_BIT	((0x1ULL) << 63)
536
537typedef __le32	f2fs_hash_t;
538
539/* One directory entry slot covers 8bytes-long file name */
540#define F2FS_SLOT_LEN		8
541#define F2FS_SLOT_LEN_BITS	3
542
543#define GET_DENTRY_SLOTS(x)	((x + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS)
544
545/* the number of dentry in a block */
546#define NR_DENTRY_IN_BLOCK	214
547
548/* MAX level for dir lookup */
549#define MAX_DIR_HASH_DEPTH	63
550
551#define SIZE_OF_DIR_ENTRY	11	/* by byte */
552#define SIZE_OF_DENTRY_BITMAP	((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
553					BITS_PER_BYTE)
554#define SIZE_OF_RESERVED	(PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
555				F2FS_SLOT_LEN) * \
556				NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
557
558/* One directory entry slot representing F2FS_SLOT_LEN-sized file name */
559struct f2fs_dir_entry {
560	__le32 hash_code;	/* hash code of file name */
561	__le32 ino;		/* inode number */
562	__le16 name_len;	/* lengh of file name */
563	__u8 file_type;		/* file type */
564} __attribute__((packed));
565
566/* 4KB-sized directory entry block */
567struct f2fs_dentry_block {
568	/* validity bitmap for directory entries in each block */
569	__u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
570	__u8 reserved[SIZE_OF_RESERVED];
571	struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
572	__u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
573} __attribute__((packed));
574
575/* file types used in inode_info->flags */
576enum {
577	F2FS_FT_UNKNOWN,
578	F2FS_FT_REG_FILE,
579	F2FS_FT_DIR,
580	F2FS_FT_CHRDEV,
581	F2FS_FT_BLKDEV,
582	F2FS_FT_FIFO,
583	F2FS_FT_SOCK,
584	F2FS_FT_SYMLINK,
585	F2FS_FT_MAX
586};
587
588void ASCIIToUNICODE(u_int16_t *, u_int8_t *);
589int log_base_2(u_int32_t);
590
591int f2fs_test_bit(unsigned int, const char *);
592int f2fs_set_bit(unsigned int, unsigned char *);
593int f2fs_clear_bit(unsigned int, char *);
594
595u_int32_t f2fs_cal_crc32(u_int32_t, void *, int);
596
597void f2fs_init_configuration(struct f2fs_configuration *);
598int f2fs_dev_is_mounted(struct f2fs_configuration *);
599int f2fs_get_device_info(struct f2fs_configuration *);
600
601int dev_read(void *, __u64, size_t);
602int dev_write(void *, __u64, size_t);
603
604int dev_read_block(void *, __u64);
605int dev_read_blocks(void *, __u64, __u32 );
606
607#endif	/*__F2FS_FS_H */
608