ext2fs_get_mem:
 1912|     15|{
 1913|     15|	void *pp;
 1914|       |
 1915|     15|	pp = malloc(size);
 1916|     15|	if (!pp)
  ------------------
  |  Branch (1916:6): [True: 0, False: 15]
  ------------------
 1917|      0|		return EXT2_ET_NO_MEMORY;
  ------------------
  |  |   78|      0|#define EXT2_ET_NO_MEMORY                        (2133571398L)
  ------------------
 1918|     15|	memcpy(ptr, &pp, sizeof (pp));
 1919|     15|	return 0;
 1920|     15|}
ext2fs_free_mem:
 1955|     15|{
 1956|     15|	void *p;
 1957|       |
 1958|     15|	memcpy(&p, ptr, sizeof(p));
 1959|     15|	free(p);
 1960|     15|	p = 0;
 1961|     15|	memcpy(ptr, &p, sizeof(p));
 1962|     15|	return 0;
 1963|     15|}

unix_io.c:ext2fsP_is_disk_device:
   21|      1|{
   22|       |#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   23|       |	return S_ISBLK(mode) || S_ISCHR(mode);
   24|       |#else
   25|      1|	return S_ISBLK(mode);
   26|      1|#endif
   27|      1|}

ext2fs_free:
   23|      1|{
   24|      1|	if (!fs || (fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS))
  ------------------
  |  |    9|      1|#define EXT2_ET_MAGIC_EXT2FS_FILSYS              (2133571329L)
  ------------------
  |  Branch (24:6): [True: 0, False: 1]
  |  Branch (24:13): [True: 0, False: 1]
  ------------------
   25|      0|		return;
   26|      1|	if (fs->image_io != fs->io) {
  ------------------
  |  Branch (26:6): [True: 0, False: 1]
  ------------------
   27|      0|		if (fs->image_io)
  ------------------
  |  Branch (27:7): [True: 0, False: 0]
  ------------------
   28|      0|			io_channel_close(fs->image_io);
  ------------------
  |  |  114|      0|#define io_channel_close(c) 		((c)->manager->close((c)))
  ------------------
   29|      0|	}
   30|      1|	if (fs->io) {
  ------------------
  |  Branch (30:6): [True: 1, False: 0]
  ------------------
   31|      1|		io_channel_close(fs->io);
  ------------------
  |  |  114|      1|#define io_channel_close(c) 		((c)->manager->close((c)))
  ------------------
   32|      1|	}
   33|      1|	if (fs->device_name)
  ------------------
  |  Branch (33:6): [True: 1, False: 0]
  ------------------
   34|      1|		ext2fs_free_mem(&fs->device_name);
   35|      1|	if (fs->super)
  ------------------
  |  Branch (35:6): [True: 1, False: 0]
  ------------------
   36|      1|		ext2fs_free_mem(&fs->super);
   37|      1|	if (fs->orig_super)
  ------------------
  |  Branch (37:6): [True: 1, False: 0]
  ------------------
   38|      1|		ext2fs_free_mem(&fs->orig_super);
   39|      1|	if (fs->group_desc)
  ------------------
  |  Branch (39:6): [True: 0, False: 1]
  ------------------
   40|      0|		ext2fs_free_mem(&fs->group_desc);
   41|      1|	if (fs->block_map)
  ------------------
  |  Branch (41:6): [True: 0, False: 1]
  ------------------
   42|      0|		ext2fs_free_block_bitmap(fs->block_map);
   43|      1|	if (fs->inode_map)
  ------------------
  |  Branch (43:6): [True: 0, False: 1]
  ------------------
   44|      0|		ext2fs_free_inode_bitmap(fs->inode_map);
   45|      1|	if (fs->image_header)
  ------------------
  |  Branch (45:6): [True: 0, False: 1]
  ------------------
   46|      0|		ext2fs_free_mem(&fs->image_header);
   47|       |
   48|      1|	if (fs->badblocks)
  ------------------
  |  Branch (48:6): [True: 0, False: 1]
  ------------------
   49|      0|		ext2fs_badblocks_list_free(fs->badblocks);
   50|      1|	fs->badblocks = 0;
   51|       |
   52|      1|	if (fs->dblist)
  ------------------
  |  Branch (52:6): [True: 0, False: 1]
  ------------------
   53|      0|		ext2fs_free_dblist(fs->dblist);
   54|       |
   55|      1|	if (fs->icache)
  ------------------
  |  Branch (55:6): [True: 0, False: 1]
  ------------------
   56|      0|		ext2fs_free_inode_cache(fs->icache);
   57|       |
   58|      1|	if (fs->mmp_buf)
  ------------------
  |  Branch (58:6): [True: 0, False: 1]
  ------------------
   59|      0|		ext2fs_free_mem(&fs->mmp_buf);
   60|      1|	if (fs->mmp_cmp)
  ------------------
  |  Branch (60:6): [True: 0, False: 1]
  ------------------
   61|      0|		ext2fs_free_mem(&fs->mmp_cmp);
   62|       |
   63|      1|	if (fs->block_sha_map)
  ------------------
  |  Branch (63:6): [True: 0, False: 1]
  ------------------
   64|      0|		ext2fs_hashmap_free(fs->block_sha_map);
   65|       |
   66|      1|	fs->magic = 0;
   67|       |
   68|      1|	ext2fs_zero_blocks2(NULL, 0, 0, NULL, NULL);
   69|      1|	ext2fs_free_mem(&fs);
   70|      1|}

io_channel_alloc_buf:
  127|      9|{
  128|      9|	size_t	size;
  129|       |
  130|      9|	if (count == 0)
  ------------------
  |  Branch (130:6): [True: 8, False: 1]
  ------------------
  131|      8|		size = io->block_size;
  132|      1|	else if (count > 0)
  ------------------
  |  Branch (132:11): [True: 0, False: 1]
  ------------------
  133|      0|		size = io->block_size * count;
  134|      1|	else
  135|      1|		size = -count;
  136|       |
  137|      9|	if (io->align > 0) {
  ------------------
  |  Branch (137:6): [True: 0, False: 9]
  ------------------
  138|      0|		if ((unsigned) io->align > size)
  ------------------
  |  Branch (138:7): [True: 0, False: 0]
  ------------------
  139|      0|			size = io->align;
  140|      0|		return ext2fs_get_memalign(size, io->align, ptr);
  141|      0|	} else
  142|      9|		return ext2fs_get_mem(size, ptr);
  143|      9|}

ext2fs_llseek:
   96|      1|{
   97|      1|#if SIZEOF_OFF_T >= SIZEOF_LONG_LONG
   98|      1|	return my_llseek (fd, offset, origin);
  ------------------
  |  |   40|      1|#define my_llseek lseek64
  ------------------
   99|       |#else
  100|       |	ext2_loff_t result;
  101|       |	static int do_compat = 0;
  102|       |
  103|       |	if (do_compat)
  104|       |		goto fallback;
  105|       |
  106|       |	result = my_llseek (fd, offset, origin);
  107|       |	if (result == -1 && errno == ENOSYS) {
  108|       |		/*
  109|       |		 * Just in case this code runs on top of an old kernel
  110|       |		 * which does not support the llseek system call
  111|       |		 */
  112|       |		do_compat++;
  113|       |	fallback:
  114|       |		if (offset < ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))
  115|       |			return lseek(fd, (off_t) offset, origin);
  116|       |		errno = EINVAL;
  117|       |		return -1;
  118|       |	}
  119|       |	return result;
  120|       |#endif
  121|      1|}

ext2fs_zero_blocks2:
  168|      1|{
  169|      1|	int		j, count;
  170|      1|	static void	*buf;
  171|      1|	static int	stride_length;
  172|      1|	errcode_t	retval;
  173|       |
  174|       |	/* If fs is null, clean up the static buffer and return */
  175|      1|	if (!fs) {
  ------------------
  |  Branch (175:6): [True: 1, False: 0]
  ------------------
  176|      1|		if (buf) {
  ------------------
  |  Branch (176:7): [True: 0, False: 1]
  ------------------
  177|      0|			free(buf);
  178|      0|			buf = 0;
  179|      0|			stride_length = 0;
  180|      0|		}
  181|      1|		return 0;
  182|      1|	}
  183|       |
  184|       |	/* Deal with zeroing less than 1 block */
  185|      0|	if (num <= 0)
  ------------------
  |  Branch (185:6): [True: 0, False: 0]
  ------------------
  186|      0|		return 0;
  187|       |
  188|       |	/* Try a zero out command, if supported */
  189|      0|	retval = io_channel_zeroout(fs->io, blk, num);
  190|      0|	if (retval == 0)
  ------------------
  |  Branch (190:6): [True: 0, False: 0]
  ------------------
  191|      0|		return 0;
  192|       |
  193|       |	/* Allocate the zeroizing buffer if necessary */
  194|      0|	if (num > stride_length && stride_length < MAX_STRIDE_LENGTH) {
  ------------------
  |  |  165|      0|#define MAX_STRIDE_LENGTH (4194304 / (int) fs->blocksize)
  ------------------
  |  Branch (194:6): [True: 0, False: 0]
  |  Branch (194:29): [True: 0, False: 0]
  ------------------
  195|      0|		void *p;
  196|      0|		int new_stride = num;
  197|       |
  198|      0|		if (new_stride > MAX_STRIDE_LENGTH)
  ------------------
  |  |  165|      0|#define MAX_STRIDE_LENGTH (4194304 / (int) fs->blocksize)
  ------------------
  |  Branch (198:7): [True: 0, False: 0]
  ------------------
  199|      0|			new_stride = MAX_STRIDE_LENGTH;
  ------------------
  |  |  165|      0|#define MAX_STRIDE_LENGTH (4194304 / (int) fs->blocksize)
  ------------------
  200|      0|		p = realloc(buf, fs->blocksize * new_stride);
  201|      0|		if (!p)
  ------------------
  |  Branch (201:7): [True: 0, False: 0]
  ------------------
  202|      0|			return EXT2_ET_NO_MEMORY;
  ------------------
  |  |   78|      0|#define EXT2_ET_NO_MEMORY                        (2133571398L)
  ------------------
  203|      0|		buf = p;
  204|      0|		stride_length = new_stride;
  205|      0|		memset(buf, 0, fs->blocksize * stride_length);
  206|      0|	}
  207|       |	/* OK, do the write loop */
  208|      0|	j=0;
  209|      0|	while (j < num) {
  ------------------
  |  Branch (209:9): [True: 0, False: 0]
  ------------------
  210|      0|		if (blk % stride_length) {
  ------------------
  |  Branch (210:7): [True: 0, False: 0]
  ------------------
  211|      0|			count = stride_length - (blk % stride_length);
  212|      0|			if (count > (num - j))
  ------------------
  |  Branch (212:8): [True: 0, False: 0]
  ------------------
  213|      0|				count = num - j;
  214|      0|		} else {
  215|      0|			count = num - j;
  216|      0|			if (count > stride_length)
  ------------------
  |  Branch (216:8): [True: 0, False: 0]
  ------------------
  217|      0|				count = stride_length;
  218|      0|		}
  219|      0|		retval = io_channel_write_blk64(fs->io, blk, count, buf);
  220|      0|		if (retval) {
  ------------------
  |  Branch (220:7): [True: 0, False: 0]
  ------------------
  221|      0|			if (ret_count)
  ------------------
  |  Branch (221:8): [True: 0, False: 0]
  ------------------
  222|      0|				*ret_count = count;
  223|      0|			if (ret_blk)
  ------------------
  |  Branch (223:8): [True: 0, False: 0]
  ------------------
  224|      0|				*ret_blk = blk;
  225|      0|			return retval;
  226|      0|		}
  227|      0|		j += count; blk += count;
  228|      0|	}
  229|      0|	return 0;
  230|      0|}

ext2fs_open:
   91|      1|{
   92|      1|	return ext2fs_open2(name, 0, flags, superblock, block_size,
   93|      1|			    manager, ret_fs);
   94|      1|}
ext2fs_open2:
  120|      1|{
  121|      1|	ext2_filsys	fs;
  122|      1|	errcode_t	retval;
  123|      1|	unsigned long	i, first_meta_bg;
  124|      1|	__u32		features;
  125|      1|	unsigned int	blocks_per_group, io_flags;
  126|      1|	blk64_t		group_block, blk;
  127|      1|	char		*dest, *cp;
  128|      1|	int		group_zero_adjust = 0;
  129|      1|	unsigned int	inode_size;
  130|      1|	__u64		groups_cnt;
  131|       |#ifdef WORDS_BIGENDIAN
  132|       |	unsigned int	groups_per_block;
  133|       |	struct ext2_group_desc *gdp;
  134|       |	int		j;
  135|       |#endif
  136|      1|	char		*time_env;
  137|      1|	int		csum_retries = 0;
  138|       |
  139|      1|	EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);
  ------------------
  |  |  624|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (624:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  140|       |
  141|      1|	retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
  142|      1|	if (retval)
  ------------------
  |  Branch (142:6): [True: 0, False: 1]
  ------------------
  143|      0|		return retval;
  144|       |
  145|      1|	memset(fs, 0, sizeof(struct struct_ext2_filsys));
  146|      1|	fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
  ------------------
  |  |    9|      1|#define EXT2_ET_MAGIC_EXT2FS_FILSYS              (2133571329L)
  ------------------
  147|      1|	fs->flags = flags;
  148|       |	/* don't overwrite sb backups unless flag is explicitly cleared */
  149|      1|	fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
  ------------------
  |  |  204|      1|#define EXT2_FLAG_MASTER_SB_ONLY	0x200
  ------------------
  150|      1|	fs->umask = 022;
  151|       |
  152|      1|	time_env = getenv("E2FSPROGS_FAKE_TIME");
  153|      1|	if (time_env)
  ------------------
  |  Branch (153:6): [True: 0, False: 1]
  ------------------
  154|      0|		fs->now = strtoul(time_env, NULL, 0);
  155|       |
  156|      1|	retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
  157|      1|	if (retval)
  ------------------
  |  Branch (157:6): [True: 0, False: 1]
  ------------------
  158|      0|		goto cleanup;
  159|      1|	strcpy(fs->device_name, name);
  160|      1|	cp = strchr(fs->device_name, '?');
  161|      1|	if (!io_options && cp) {
  ------------------
  |  Branch (161:6): [True: 1, False: 0]
  |  Branch (161:21): [True: 0, False: 1]
  ------------------
  162|      0|		*cp++ = 0;
  163|      0|		io_options = cp;
  164|      0|	}
  165|       |
  166|      1|	io_flags = 0;
  167|      1|	if (flags & EXT2_FLAG_RW)
  ------------------
  |  |  195|      1|#define EXT2_FLAG_RW			0x01
  ------------------
  |  Branch (167:6): [True: 0, False: 1]
  ------------------
  168|      0|		io_flags |= IO_FLAG_RW;
  ------------------
  |  |  104|      0|#define IO_FLAG_RW		0x0001
  ------------------
  169|      1|	if (flags & EXT2_FLAG_EXCLUSIVE)
  ------------------
  |  |  209|      1|#define EXT2_FLAG_EXCLUSIVE		0x4000
  ------------------
  |  Branch (169:6): [True: 0, False: 1]
  ------------------
  170|      0|		io_flags |= IO_FLAG_EXCLUSIVE;
  ------------------
  |  |  105|      0|#define IO_FLAG_EXCLUSIVE	0x0002
  ------------------
  171|      1|	if (flags & EXT2_FLAG_DIRECT_IO)
  ------------------
  |  |  214|      1|#define EXT2_FLAG_DIRECT_IO		0x80000
  ------------------
  |  Branch (171:6): [True: 0, False: 1]
  ------------------
  172|      0|		io_flags |= IO_FLAG_DIRECT_IO;
  ------------------
  |  |  106|      0|#define IO_FLAG_DIRECT_IO	0x0004
  ------------------
  173|      1|	if (flags & EXT2_FLAG_THREADS)
  ------------------
  |  |  221|      1|#define EXT2_FLAG_THREADS		0x4000000
  ------------------
  |  Branch (173:6): [True: 0, False: 1]
  ------------------
  174|      0|		io_flags |= IO_FLAG_THREADS;
  ------------------
  |  |  108|      0|#define IO_FLAG_THREADS		0x0010
  ------------------
  175|      1|	retval = manager->open(fs->device_name, io_flags, &fs->io);
  176|      1|	if (retval)
  ------------------
  |  Branch (176:6): [True: 0, False: 1]
  ------------------
  177|      0|		goto cleanup;
  178|      1|	if (io_options &&
  ------------------
  |  Branch (178:6): [True: 0, False: 1]
  ------------------
  179|      1|	    (retval = io_channel_set_options(fs->io, io_options)))
  ------------------
  |  Branch (179:6): [True: 0, False: 0]
  ------------------
  180|      0|		goto cleanup;
  181|      1|	fs->image_io = fs->io;
  182|      1|	fs->io->app_data = fs;
  183|      1|	retval = io_channel_alloc_buf(fs->io, -SUPERBLOCK_SIZE, &fs->super);
  ------------------
  |  |   58|      1|#define SUPERBLOCK_SIZE		1024
  ------------------
  184|      1|	if (retval)
  ------------------
  |  Branch (184:6): [True: 0, False: 1]
  ------------------
  185|      0|		goto cleanup;
  186|      1|	if (flags & EXT2_FLAG_IMAGE_FILE) {
  ------------------
  |  |  208|      1|#define EXT2_FLAG_IMAGE_FILE		0x2000
  ------------------
  |  Branch (186:6): [True: 0, False: 1]
  ------------------
  187|      0|		retval = ext2fs_get_mem(sizeof(struct ext2_image_hdr),
  188|      0|					&fs->image_header);
  189|      0|		if (retval)
  ------------------
  |  Branch (189:7): [True: 0, False: 0]
  ------------------
  190|      0|			goto cleanup;
  191|      0|		retval = io_channel_read_blk(fs->io, 0,
  ------------------
  |  |  116|      0|#define io_channel_read_blk(c,b,n,d)	((c)->manager->read_blk((c),b,n,d))
  ------------------
  192|      0|					     -(int)sizeof(struct ext2_image_hdr),
  193|      0|					     fs->image_header);
  194|      0|		if (retval)
  ------------------
  |  Branch (194:7): [True: 0, False: 0]
  ------------------
  195|      0|			goto cleanup;
  196|      0|		if (ext2fs_le32_to_cpu(fs->image_header->magic_number) != EXT2_ET_MAGIC_E2IMAGE)
  ------------------
  |  |   31|      0|#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x))
  ------------------
              		if (ext2fs_le32_to_cpu(fs->image_header->magic_number) != EXT2_ET_MAGIC_E2IMAGE)
  ------------------
  |  |   24|      0|#define EXT2_ET_MAGIC_E2IMAGE                    (2133571344L)
  ------------------
  |  Branch (196:7): [True: 0, False: 0]
  ------------------
  197|      0|			return EXT2_ET_MAGIC_E2IMAGE;
  ------------------
  |  |   24|      0|#define EXT2_ET_MAGIC_E2IMAGE                    (2133571344L)
  ------------------
  198|      0|		superblock = 1;
  199|      0|		block_size = ext2fs_le32_to_cpu(fs->image_header->fs_blocksize);
  ------------------
  |  |   31|      0|#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x))
  ------------------
  200|      0|	}
  201|       |
  202|       |	/*
  203|       |	 * If the user specifies a specific block # for the
  204|       |	 * superblock, then he/she must also specify the block size!
  205|       |	 * Otherwise, read the master superblock located at offset
  206|       |	 * SUPERBLOCK_OFFSET from the start of the partition.
  207|       |	 *
  208|       |	 * Note: we only save a backup copy of the superblock if we
  209|       |	 * are reading the superblock from the primary superblock location.
  210|       |	 */
  211|      1|	if (superblock) {
  ------------------
  |  Branch (211:6): [True: 0, False: 1]
  ------------------
  212|      0|		if (!block_size) {
  ------------------
  |  Branch (212:7): [True: 0, False: 0]
  ------------------
  213|      0|			retval = EXT2_ET_INVALID_ARGUMENT;
  ------------------
  |  |   79|      0|#define EXT2_ET_INVALID_ARGUMENT                 (2133571399L)
  ------------------
  214|      0|			goto cleanup;
  215|      0|		}
  216|      0|		io_channel_set_blksize(fs->io, block_size);
  ------------------
  |  |  115|      0|#define io_channel_set_blksize(c,s)	((c)->manager->set_blksize((c),s))
  ------------------
  217|      0|		group_block = superblock;
  218|      0|		fs->orig_super = 0;
  219|      1|	} else {
  220|      1|		io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
  ------------------
  |  |  115|      1|#define io_channel_set_blksize(c,s)	((c)->manager->set_blksize((c),s))
  ------------------
  221|      1|		superblock = 1;
  222|      1|		group_block = 0;
  223|      1|		retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->orig_super);
  ------------------
  |  |   58|      1|#define SUPERBLOCK_SIZE		1024
  ------------------
  224|      1|		if (retval)
  ------------------
  |  Branch (224:7): [True: 0, False: 1]
  ------------------
  225|      0|			goto cleanup;
  226|      1|	}
  227|      1|retry:
  228|      1|	retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE,
  ------------------
  |  |  116|      1|#define io_channel_read_blk(c,b,n,d)	((c)->manager->read_blk((c),b,n,d))
  ------------------
  229|      1|				     fs->super);
  230|      1|	if (retval)
  ------------------
  |  Branch (230:6): [True: 1, False: 0]
  ------------------
  231|      1|		goto cleanup;
  232|      0|	if (fs->orig_super)
  ------------------
  |  Branch (232:6): [True: 0, False: 0]
  ------------------
  233|      0|		memcpy(fs->orig_super, fs->super, SUPERBLOCK_SIZE);
  ------------------
  |  |   58|      0|#define SUPERBLOCK_SIZE		1024
  ------------------
  234|       |
  235|      0|	if (!(fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) {
  ------------------
  |  |  216|      0|#define EXT2_FLAG_IGNORE_CSUM_ERRORS	0x200000
  ------------------
  |  Branch (235:6): [True: 0, False: 0]
  ------------------
  236|      0|		retval = 0;
  237|      0|		if (!ext2fs_verify_csum_type(fs, fs->super))
  ------------------
  |  Branch (237:7): [True: 0, False: 0]
  ------------------
  238|      0|			retval = EXT2_ET_UNKNOWN_CSUM;
  ------------------
  |  |  161|      0|#define EXT2_ET_UNKNOWN_CSUM                     (2133571481L)
  ------------------
  239|      0|		if (!ext2fs_superblock_csum_verify(fs, fs->super)) {
  ------------------
  |  Branch (239:7): [True: 0, False: 0]
  ------------------
  240|      0|			if (csum_retries++ < 3)
  ------------------
  |  Branch (240:8): [True: 0, False: 0]
  ------------------
  241|      0|				goto retry;
  242|      0|			retval = EXT2_ET_SB_CSUM_INVALID;
  ------------------
  |  |  160|      0|#define EXT2_ET_SB_CSUM_INVALID                  (2133571480L)
  ------------------
  243|      0|		}
  244|      0|	}
  245|       |
  246|       |#ifdef WORDS_BIGENDIAN
  247|       |	fs->flags |= EXT2_FLAG_SWAP_BYTES;
  248|       |	ext2fs_swap_super(fs->super);
  249|       |#else
  250|      0|	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
  ------------------
  |  |  201|      0|#define EXT2_FLAG_SWAP_BYTES		0x40
  ------------------
  |  Branch (250:6): [True: 0, False: 0]
  ------------------
  251|      0|		retval = EXT2_ET_UNIMPLEMENTED;
  ------------------
  |  |   88|      0|#define EXT2_ET_UNIMPLEMENTED                    (2133571408L)
  ------------------
  252|      0|		goto cleanup;
  253|      0|	}
  254|      0|#endif
  255|       |
  256|      0|	if (fs->super->s_magic != EXT2_SUPER_MAGIC)
  ------------------
  |  |   83|      0|#define EXT2_SUPER_MAGIC	0xEF53
  ------------------
  |  Branch (256:6): [True: 0, False: 0]
  ------------------
  257|      0|		retval = EXT2_ET_BAD_MAGIC;
  ------------------
  |  |   27|      0|#define EXT2_ET_BAD_MAGIC                        (2133571347L)
  ------------------
  258|      0|	if (retval)
  ------------------
  |  Branch (258:6): [True: 0, False: 0]
  ------------------
  259|      0|		goto cleanup;
  260|       |
  261|      0|	if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) {
  ------------------
  |  |   66|      0|#define EXT2_LIB_CURRENT_REV	EXT2_DYNAMIC_REV
  |  |  ------------------
  |  |  |  |  797|      0|#define EXT2_DYNAMIC_REV	1	/* V2 format w/ dynamic inode sizes */
  |  |  ------------------
  ------------------
  |  Branch (261:6): [True: 0, False: 0]
  ------------------
  262|      0|		retval = EXT2_ET_REV_TOO_HIGH;
  ------------------
  |  |   28|      0|#define EXT2_ET_REV_TOO_HIGH                     (2133571348L)
  ------------------
  263|      0|		goto cleanup;
  264|      0|	}
  265|       |
  266|       |	/*
  267|       |	 * Check for feature set incompatibility
  268|       |	 */
  269|      0|	if (!(flags & EXT2_FLAG_FORCE)) {
  ------------------
  |  |  205|      0|#define EXT2_FLAG_FORCE			0x400
  ------------------
  |  Branch (269:6): [True: 0, False: 0]
  ------------------
  270|      0|		features = fs->super->s_feature_incompat;
  271|      0|#ifdef EXT2_LIB_SOFTSUPP_INCOMPAT
  272|      0|		if (flags & EXT2_FLAG_SOFTSUPP_FEATURES)
  ------------------
  |  |  210|      0|#define EXT2_FLAG_SOFTSUPP_FEATURES	0x8000
  ------------------
  |  Branch (272:7): [True: 0, False: 0]
  ------------------
  273|      0|			features &= ~EXT2_LIB_SOFTSUPP_INCOMPAT;
  ------------------
  |  |  680|      0|#define EXT2_LIB_SOFTSUPP_INCOMPAT	(0)
  ------------------
  274|      0|#endif
  275|      0|		if (features & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
  ------------------
  |  |  646|      0|#define EXT2_LIB_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE|\
  |  |  ------------------
  |  |  |  |  858|      0|#define EXT2_FEATURE_INCOMPAT_FILETYPE		0x0002
  |  |  ------------------
  |  |  647|      0|					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
  |  |  ------------------
  |  |  |  |  860|      0|#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008 /* Journal device */
  |  |  ------------------
  |  |  648|      0|					 EXT2_FEATURE_INCOMPAT_META_BG|\
  |  |  ------------------
  |  |  |  |  861|      0|#define EXT2_FEATURE_INCOMPAT_META_BG		0x0010
  |  |  ------------------
  |  |  649|      0|					 EXT3_FEATURE_INCOMPAT_RECOVER|\
  |  |  ------------------
  |  |  |  |  859|      0|#define EXT3_FEATURE_INCOMPAT_RECOVER		0x0004 /* Needs recovery */
  |  |  ------------------
  |  |  650|      0|					 EXT3_FEATURE_INCOMPAT_EXTENTS|\
  |  |  ------------------
  |  |  |  |  862|      0|#define EXT3_FEATURE_INCOMPAT_EXTENTS		0x0040
  |  |  ------------------
  |  |  651|      0|					 EXT4_FEATURE_INCOMPAT_FLEX_BG|\
  |  |  ------------------
  |  |  |  |  865|      0|#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
  |  |  ------------------
  |  |  652|      0|					 EXT4_FEATURE_INCOMPAT_EA_INODE|\
  |  |  ------------------
  |  |  |  |  866|      0|#define EXT4_FEATURE_INCOMPAT_EA_INODE		0x0400
  |  |  ------------------
  |  |  653|      0|					 EXT4_LIB_INCOMPAT_MMP|\
  |  |  ------------------
  |  |  |  |  641|      0|#define EXT4_LIB_INCOMPAT_MMP		EXT4_FEATURE_INCOMPAT_MMP
  |  |  |  |  ------------------
  |  |  |  |  |  |  864|      0|#define EXT4_FEATURE_INCOMPAT_MMP		0x0100
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  654|      0|					 EXT4_FEATURE_INCOMPAT_64BIT|\
  |  |  ------------------
  |  |  |  |  863|      0|#define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
  |  |  ------------------
  |  |  655|      0|					 EXT4_FEATURE_INCOMPAT_INLINE_DATA|\
  |  |  ------------------
  |  |  |  |  870|      0|#define EXT4_FEATURE_INCOMPAT_INLINE_DATA	0x8000 /* data in inode */
  |  |  ------------------
  |  |  656|      0|					 EXT4_FEATURE_INCOMPAT_ENCRYPT|\
  |  |  ------------------
  |  |  |  |  871|      0|#define EXT4_FEATURE_INCOMPAT_ENCRYPT		0x10000
  |  |  ------------------
  |  |  657|      0|					 EXT4_FEATURE_INCOMPAT_CASEFOLD|\
  |  |  ------------------
  |  |  |  |  872|      0|#define EXT4_FEATURE_INCOMPAT_CASEFOLD		0x20000
  |  |  ------------------
  |  |  658|      0|					 EXT4_FEATURE_INCOMPAT_CSUM_SEED|\
  |  |  ------------------
  |  |  |  |  868|      0|#define EXT4_FEATURE_INCOMPAT_CSUM_SEED		0x2000
  |  |  ------------------
  |  |  659|      0|					 EXT4_FEATURE_INCOMPAT_LARGEDIR)
  |  |  ------------------
  |  |  |  |  869|      0|#define EXT4_FEATURE_INCOMPAT_LARGEDIR		0x4000 /* >2GB or 3-lvl htree */
  |  |  ------------------
  ------------------
  |  Branch (275:7): [True: 0, False: 0]
  ------------------
  276|      0|			retval = EXT2_ET_UNSUPP_FEATURE;
  ------------------
  |  |   75|      0|#define EXT2_ET_UNSUPP_FEATURE                   (2133571395L)
  ------------------
  277|      0|			goto cleanup;
  278|      0|		}
  279|       |
  280|      0|		features = fs->super->s_feature_ro_compat;
  281|      0|#ifdef EXT2_LIB_SOFTSUPP_RO_COMPAT
  282|      0|		if (flags & EXT2_FLAG_SOFTSUPP_FEATURES)
  ------------------
  |  |  210|      0|#define EXT2_FLAG_SOFTSUPP_FEATURES	0x8000
  ------------------
  |  Branch (282:7): [True: 0, False: 0]
  ------------------
  283|      0|			features &= ~EXT2_LIB_SOFTSUPP_RO_COMPAT;
  ------------------
  |  |  681|      0|#define EXT2_LIB_SOFTSUPP_RO_COMPAT	(EXT4_FEATURE_RO_COMPAT_REPLICA)
  |  |  ------------------
  |  |  |  |  850|      0|#define EXT4_FEATURE_RO_COMPAT_REPLICA		0x0800
  |  |  ------------------
  ------------------
  284|      0|#endif
  285|      0|		if ((flags & EXT2_FLAG_RW) &&
  ------------------
  |  |  195|      0|#define EXT2_FLAG_RW			0x01
  ------------------
  |  Branch (285:7): [True: 0, False: 0]
  ------------------
  286|      0|		    (features & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP)) {
  ------------------
  |  |  661|      0|#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
  |  |  ------------------
  |  |  |  |  834|      0|#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
  |  |  ------------------
  |  |  662|      0|					 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
  |  |  ------------------
  |  |  |  |  837|      0|#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE	0x0008
  |  |  ------------------
  |  |  663|      0|					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
  |  |  ------------------
  |  |  |  |  835|      0|#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
  |  |  ------------------
  |  |  664|      0|					 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
  |  |  ------------------
  |  |  |  |  839|      0|#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK	0x0020
  |  |  ------------------
  |  |  665|      0|					 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
  |  |  ------------------
  |  |  |  |  840|      0|#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE	0x0040
  |  |  ------------------
  |  |  666|      0|					 EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\
  |  |  ------------------
  |  |  |  |  838|      0|#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM		0x0010
  |  |  ------------------
  |  |  667|      0|					 EXT4_FEATURE_RO_COMPAT_BIGALLOC|\
  |  |  ------------------
  |  |  |  |  843|      0|#define EXT4_FEATURE_RO_COMPAT_BIGALLOC		0x0200
  |  |  ------------------
  |  |  668|      0|					 EXT4_FEATURE_RO_COMPAT_QUOTA|\
  |  |  ------------------
  |  |  |  |  842|      0|#define EXT4_FEATURE_RO_COMPAT_QUOTA		0x0100
  |  |  ------------------
  |  |  669|      0|					 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
  |  |  ------------------
  |  |  |  |  849|      0|#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM	0x0400
  |  |  ------------------
  |  |  670|      0|					 EXT4_FEATURE_RO_COMPAT_READONLY |\
  |  |  ------------------
  |  |  |  |  851|      0|#define EXT4_FEATURE_RO_COMPAT_READONLY		0x1000
  |  |  ------------------
  |  |  671|      0|					 EXT4_FEATURE_RO_COMPAT_PROJECT |\
  |  |  ------------------
  |  |  |  |  852|      0|#define EXT4_FEATURE_RO_COMPAT_PROJECT		0x2000 /* Project quota */
  |  |  ------------------
  |  |  672|      0|					 EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS |\
  |  |  ------------------
  |  |  |  |  853|      0|#define EXT4_FEATURE_RO_COMPAT_SHARED_BLOCKS	0x4000
  |  |  ------------------
  |  |  673|      0|					 EXT4_FEATURE_RO_COMPAT_VERITY |\
  |  |  ------------------
  |  |  |  |  854|      0|#define EXT4_FEATURE_RO_COMPAT_VERITY		0x8000
  |  |  ------------------
  |  |  674|      0|					 EXT4_FEATURE_RO_COMPAT_ORPHAN_PRESENT)
  |  |  ------------------
  |  |  |  |  855|      0|#define EXT4_FEATURE_RO_COMPAT_ORPHAN_PRESENT	0x10000
  |  |  ------------------
  ------------------
  |  Branch (286:7): [True: 0, False: 0]
  ------------------
  287|      0|			retval = EXT2_ET_RO_UNSUPP_FEATURE;
  ------------------
  |  |   76|      0|#define EXT2_ET_RO_UNSUPP_FEATURE                (2133571396L)
  ------------------
  288|      0|			goto cleanup;
  289|      0|		}
  290|       |
  291|      0|		if (!(flags & EXT2_FLAG_JOURNAL_DEV_OK) &&
  ------------------
  |  |  207|      0|#define EXT2_FLAG_JOURNAL_DEV_OK	0x1000
  ------------------
  |  Branch (291:7): [True: 0, False: 0]
  ------------------
  292|      0|		    ext2fs_has_feature_journal_dev(fs->super)) {
  ------------------
  |  Branch (292:7): [True: 0, False: 0]
  ------------------
  293|      0|			retval = EXT2_ET_UNSUPP_FEATURE;
  ------------------
  |  |   75|      0|#define EXT2_ET_UNSUPP_FEATURE                   (2133571395L)
  ------------------
  294|      0|			goto cleanup;
  295|      0|		}
  296|      0|	}
  297|       |
  298|      0|	if ((fs->super->s_log_block_size >
  ------------------
  |  Branch (298:6): [True: 0, False: 0]
  ------------------
  299|      0|	     (unsigned) (EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE)) ||
  ------------------
  |  |  103|      0|#define EXT2_MAX_BLOCK_LOG_SIZE		16	/* 65536 */
  ------------------
              	     (unsigned) (EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE)) ||
  ------------------
  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  ------------------
  300|      0|	    (fs->super->s_log_cluster_size >
  ------------------
  |  Branch (300:6): [True: 0, False: 0]
  ------------------
  301|      0|	     (unsigned) (EXT2_MAX_CLUSTER_LOG_SIZE - EXT2_MIN_CLUSTER_LOG_SIZE)) ||
  ------------------
  |  |  126|      0|#define EXT2_MAX_CLUSTER_LOG_SIZE	29	/* 512MB  */
  ------------------
              	     (unsigned) (EXT2_MAX_CLUSTER_LOG_SIZE - EXT2_MIN_CLUSTER_LOG_SIZE)) ||
  ------------------
  |  |  125|      0|#define EXT2_MIN_CLUSTER_LOG_SIZE	EXT2_MIN_BLOCK_LOG_SIZE
  |  |  ------------------
  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  ------------------
  ------------------
  302|      0|	    (fs->super->s_log_block_size > fs->super->s_log_cluster_size) ||
  ------------------
  |  Branch (302:6): [True: 0, False: 0]
  ------------------
  303|      0|	    (fs->super->s_log_groups_per_flex > 31)) {
  ------------------
  |  Branch (303:6): [True: 0, False: 0]
  ------------------
  304|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  305|      0|		goto cleanup;
  306|      0|	}
  307|       |
  308|       |	/*
  309|       |	 * bigalloc requires cluster-aware bitfield operations, which at the
  310|       |	 * moment means we need EXT2_FLAG_64BITS.
  311|       |	 */
  312|      0|	if (ext2fs_has_feature_bigalloc(fs->super) &&
  ------------------
  |  Branch (312:6): [True: 0, False: 0]
  ------------------
  313|      0|	    !(flags & EXT2_FLAG_64BITS)) {
  ------------------
  |  |  212|      0|#define EXT2_FLAG_64BITS		0x20000
  ------------------
  |  Branch (313:6): [True: 0, False: 0]
  ------------------
  314|      0|		retval = EXT2_ET_CANT_USE_LEGACY_BITMAPS;
  ------------------
  |  |  145|      0|#define EXT2_ET_CANT_USE_LEGACY_BITMAPS          (2133571465L)
  ------------------
  315|      0|		goto cleanup;
  316|      0|	}
  317|       |
  318|      0|	if (!ext2fs_has_feature_bigalloc(fs->super) &&
  ------------------
  |  Branch (318:6): [True: 0, False: 0]
  ------------------
  319|      0|	    (fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {
  ------------------
  |  Branch (319:6): [True: 0, False: 0]
  ------------------
  320|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  321|      0|		goto cleanup;
  322|      0|	}
  323|      0|	fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
  ------------------
  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  ------------------
  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  324|      0|	inode_size = EXT2_INODE_SIZE(fs->super);
  ------------------
  |  |  115|      0|#define EXT2_INODE_SIZE(s)	(((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
  |  |  ------------------
  |  |  |  |  796|      0|#define EXT2_GOOD_OLD_REV	0	/* The good old (original) format */
  |  |  ------------------
  |  |  |  Branch (115:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|				 EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
  |  |  ------------------
  |  |  |  |  802|      0|#define EXT2_GOOD_OLD_INODE_SIZE 128
  |  |  ------------------
  ------------------
  325|      0|	if ((inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
  ------------------
  |  |  802|      0|#define EXT2_GOOD_OLD_INODE_SIZE 128
  ------------------
  |  Branch (325:6): [True: 0, False: 0]
  ------------------
  326|      0|	    (inode_size > fs->blocksize) ||
  ------------------
  |  Branch (326:6): [True: 0, False: 0]
  ------------------
  327|      0|	    (inode_size & (inode_size - 1))) {
  ------------------
  |  Branch (327:6): [True: 0, False: 0]
  ------------------
  328|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  329|      0|		goto cleanup;
  330|      0|	}
  331|       |
  332|       |	/* Enforce the block group descriptor size */
  333|      0|	if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
  ------------------
  |  |  218|      0|#define EXT2_FLAG_IGNORE_SB_ERRORS	0x800000
  ------------------
  |  Branch (333:6): [True: 0, False: 0]
  ------------------
  334|      0|	    ext2fs_has_feature_64bit(fs->super)) {
  ------------------
  |  Branch (334:6): [True: 0, False: 0]
  ------------------
  335|      0|		unsigned desc_size = fs->super->s_desc_size;
  336|       |
  337|      0|		if ((desc_size < EXT2_MIN_DESC_SIZE_64BIT) ||
  ------------------
  |  |  281|      0|#define EXT2_MIN_DESC_SIZE_64BIT       64
  ------------------
  |  Branch (337:7): [True: 0, False: 0]
  ------------------
  338|      0|		    (desc_size > EXT2_MAX_DESC_SIZE) ||
  ------------------
  |  |  282|      0|#define EXT2_MAX_DESC_SIZE             EXT2_MIN_BLOCK_SIZE
  |  |  ------------------
  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (338:7): [True: 0, False: 0]
  ------------------
  339|      0|		    (desc_size & (desc_size - 1)) != 0) {
  ------------------
  |  Branch (339:7): [True: 0, False: 0]
  ------------------
  340|      0|			retval = EXT2_ET_BAD_DESC_SIZE;
  ------------------
  |  |  153|      0|#define EXT2_ET_BAD_DESC_SIZE                    (2133571473L)
  ------------------
  341|      0|			goto cleanup;
  342|      0|		}
  343|      0|	}
  344|       |
  345|      0|	fs->cluster_ratio_bits = fs->super->s_log_cluster_size -
  346|      0|		fs->super->s_log_block_size;
  347|      0|	if (EXT2_BLOCKS_PER_GROUP(fs->super) !=
  ------------------
  |  |  286|      0|#define EXT2_BLOCKS_PER_GROUP(s)	(EXT2_SB(s)->s_blocks_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  |  Branch (347:6): [True: 0, False: 0]
  ------------------
  348|      0|	    EXT2_CLUSTERS_PER_GROUP(fs->super) << fs->cluster_ratio_bits) {
  ------------------
  |  |  288|      0|#define EXT2_CLUSTERS_PER_GROUP(s)	(EXT2_SB(s)->s_clusters_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  349|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  350|      0|		goto cleanup;
  351|      0|	}
  352|      0|	fs->inode_blocks_per_group = ((EXT2_INODES_PER_GROUP(fs->super) *
  ------------------
  |  |  287|      0|#define EXT2_INODES_PER_GROUP(s)	(EXT2_SB(s)->s_inodes_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  353|      0|				       EXT2_INODE_SIZE(fs->super) +
  ------------------
  |  |  115|      0|#define EXT2_INODE_SIZE(s)	(((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
  |  |  ------------------
  |  |  |  |  796|      0|#define EXT2_GOOD_OLD_REV	0	/* The good old (original) format */
  |  |  ------------------
  |  |  |  Branch (115:29): [True: 0, False: 0]
  |  |  ------------------
  |  |  116|      0|				 EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
  |  |  ------------------
  |  |  |  |  802|      0|#define EXT2_GOOD_OLD_INODE_SIZE 128
  |  |  ------------------
  ------------------
  354|      0|				       EXT2_BLOCK_SIZE(fs->super) - 1) /
  ------------------
  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  ------------------
  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  355|      0|				      EXT2_BLOCK_SIZE(fs->super));
  ------------------
  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  ------------------
  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  356|      0|	if (block_size) {
  ------------------
  |  Branch (356:6): [True: 0, False: 0]
  ------------------
  357|      0|		if (block_size != fs->blocksize) {
  ------------------
  |  Branch (357:7): [True: 0, False: 0]
  ------------------
  358|      0|			retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE;
  ------------------
  |  |   42|      0|#define EXT2_ET_UNEXPECTED_BLOCK_SIZE            (2133571362L)
  ------------------
  359|      0|			goto cleanup;
  360|      0|		}
  361|      0|	}
  362|       |	/*
  363|       |	 * Set the blocksize to the filesystem's blocksize.
  364|       |	 */
  365|      0|	io_channel_set_blksize(fs->io, fs->blocksize);
  ------------------
  |  |  115|      0|#define io_channel_set_blksize(c,s)	((c)->manager->set_blksize((c),s))
  ------------------
  366|       |
  367|       |	/*
  368|       |	 * If this is an external journal device, don't try to read
  369|       |	 * the group descriptors, because they're not there.
  370|       |	 */
  371|      0|	if (ext2fs_has_feature_journal_dev(fs->super)) {
  ------------------
  |  Branch (371:6): [True: 0, False: 0]
  ------------------
  372|      0|		fs->group_desc_count = 0;
  373|      0|		*ret_fs = fs;
  374|      0|		return 0;
  375|      0|	}
  376|       |
  377|      0|	if (EXT2_INODES_PER_GROUP(fs->super) == 0) {
  ------------------
  |  |  287|      0|#define EXT2_INODES_PER_GROUP(s)	(EXT2_SB(s)->s_inodes_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  |  Branch (377:6): [True: 0, False: 0]
  ------------------
  378|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  379|      0|		goto cleanup;
  380|      0|	}
  381|       |	/* Precompute the FS UUID to seed other checksums */
  382|      0|	ext2fs_init_csum_seed(fs);
  383|       |
  384|       |	/*
  385|       |	 * Read group descriptors
  386|       |	 */
  387|      0|	blocks_per_group = EXT2_BLOCKS_PER_GROUP(fs->super);
  ------------------
  |  |  286|      0|#define EXT2_BLOCKS_PER_GROUP(s)	(EXT2_SB(s)->s_blocks_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  388|      0|	if (blocks_per_group < 8 ||
  ------------------
  |  Branch (388:6): [True: 0, False: 0]
  ------------------
  389|      0|	    blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) ||
  ------------------
  |  |  291|      0|#define EXT2_MAX_BLOCKS_PER_GROUP(s)	((((unsigned) 1 << 16) - 8) *	\
  |  |  292|      0|					 (EXT2_CLUSTER_SIZE(s) / \
  |  |  ------------------
  |  |  |  |  129|      0|#define EXT2_CLUSTER_SIZE(s)		(EXT2_MIN_BLOCK_SIZE << \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  130|      0|						(s)->s_log_cluster_size)
  |  |  ------------------
  |  |  293|      0|					  EXT2_BLOCK_SIZE(s)))
  |  |  ------------------
  |  |  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (389:6): [True: 0, False: 0]
  ------------------
  390|      0|	    fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) ||
  ------------------
  |  |  295|      0|#define EXT2_MAX_INODES_PER_GROUP(s)	(((unsigned) 1 << 16) - \
  |  |  296|      0|					 EXT2_INODES_PER_BLOCK(s))
  |  |  ------------------
  |  |  |  |  289|      0|#define EXT2_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define EXT2_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|      0|#define EXT2_INODE_SIZE(s)	(((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  796|      0|#define EXT2_GOOD_OLD_REV	0	/* The good old (original) format */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      0|				 EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  802|      0|#define EXT2_GOOD_OLD_INODE_SIZE 128
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (390:6): [True: 0, False: 0]
  ------------------
  391|      0|           EXT2_DESC_PER_BLOCK(fs->super) == 0 ||
  ------------------
  |  |  301|      0|#define EXT2_DESC_PER_BLOCK(s)		(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
  |  |  ------------------
  |  |  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define EXT2_DESC_PER_BLOCK(s)		(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
  |  |  ------------------
  |  |  |  |  284|      0|	(ext2fs_has_feature_64bit(s) ? (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#define EXT2_MIN_DESC_SIZE             32
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (284:3): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (391:12): [True: 0, False: 0]
  ------------------
  392|      0|           fs->super->s_first_data_block >= ext2fs_blocks_count(fs->super)) {
  ------------------
  |  Branch (392:12): [True: 0, False: 0]
  ------------------
  393|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  394|      0|		goto cleanup;
  395|      0|	}
  396|      0|	groups_cnt = ext2fs_div64_ceil(ext2fs_blocks_count(fs->super) -
  397|      0|				       fs->super->s_first_data_block,
  398|      0|				       blocks_per_group);
  399|      0|	if (groups_cnt >> 32) {
  ------------------
  |  Branch (399:6): [True: 0, False: 0]
  ------------------
  400|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  401|      0|		goto cleanup;
  402|      0|	}
  403|      0|	fs->group_desc_count = 	groups_cnt;
  404|      0|	if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS) &&
  ------------------
  |  |  218|      0|#define EXT2_FLAG_IGNORE_SB_ERRORS	0x800000
  ------------------
  |  Branch (404:6): [True: 0, False: 0]
  ------------------
  405|      0|	    (__u64)fs->group_desc_count * EXT2_INODES_PER_GROUP(fs->super) !=
  ------------------
  |  |  287|      0|#define EXT2_INODES_PER_GROUP(s)	(EXT2_SB(s)->s_inodes_per_group)
  |  |  ------------------
  |  |  |  |   91|      0|#define EXT2_SB(sb)	(sb)
  |  |  ------------------
  ------------------
  |  Branch (405:6): [True: 0, False: 0]
  ------------------
  406|      0|	    fs->super->s_inodes_count) {
  407|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  408|      0|		goto cleanup;
  409|      0|	}
  410|      0|	fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
  411|      0|					  EXT2_DESC_PER_BLOCK(fs->super));
  ------------------
  |  |  301|      0|#define EXT2_DESC_PER_BLOCK(s)		(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
  |  |  ------------------
  |  |  |  |  113|      0|#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      0|#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define EXT2_DESC_PER_BLOCK(s)		(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
  |  |  ------------------
  |  |  |  |  284|      0|	(ext2fs_has_feature_64bit(s) ? (s)->s_desc_size : EXT2_MIN_DESC_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  280|      0|#define EXT2_MIN_DESC_SIZE             32
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (284:3): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|      0|	if (ext2fs_has_feature_meta_bg(fs->super) &&
  ------------------
  |  Branch (412:6): [True: 0, False: 0]
  ------------------
  413|      0|	    (fs->super->s_first_meta_bg > fs->desc_blocks) &&
  ------------------
  |  Branch (413:6): [True: 0, False: 0]
  ------------------
  414|      0|	    !(flags & EXT2_FLAG_IGNORE_SB_ERRORS)) {
  ------------------
  |  |  218|      0|#define EXT2_FLAG_IGNORE_SB_ERRORS	0x800000
  ------------------
  |  Branch (414:6): [True: 0, False: 0]
  ------------------
  415|      0|		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
  ------------------
  |  |   68|      0|#define EXT2_ET_CORRUPT_SUPERBLOCK               (2133571388L)
  ------------------
  416|      0|		goto cleanup;
  417|      0|	}
  418|      0|	if (flags & EXT2_FLAG_SUPER_ONLY)
  ------------------
  |  |  206|      0|#define EXT2_FLAG_SUPER_ONLY		0x800
  ------------------
  |  Branch (418:6): [True: 0, False: 0]
  ------------------
  419|      0|		goto skip_read_bg;
  420|      0|	retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize,
  421|      0|				&fs->group_desc);
  422|      0|	if (retval)
  ------------------
  |  Branch (422:6): [True: 0, False: 0]
  ------------------
  423|      0|		goto cleanup;
  424|      0|	if (!group_block)
  ------------------
  |  Branch (424:6): [True: 0, False: 0]
  ------------------
  425|      0|		group_block = fs->super->s_first_data_block;
  426|       |	/*
  427|       |	 * On a FS with a 1K blocksize, block 0 is reserved for bootloaders
  428|       |	 * so we must increment block numbers to any group 0 items.
  429|       |	 *
  430|       |	 * However, we cannot touch group_block directly because in the meta_bg
  431|       |	 * case, the ext2fs_descriptor_block_loc2() function will interpret
  432|       |	 * group_block != s_first_data_block to mean that we want to access the
  433|       |	 * backup group descriptors.  This is not what we want if the caller
  434|       |	 * set superblock == 0 (i.e. auto-detect the superblock), which is
  435|       |	 * what's going on here.
  436|       |	 */
  437|      0|	if (group_block == 0 && fs->blocksize == 1024)
  ------------------
  |  Branch (437:6): [True: 0, False: 0]
  |  Branch (437:26): [True: 0, False: 0]
  ------------------
  438|      0|		group_zero_adjust = 1;
  439|      0|	dest = (char *) fs->group_desc;
  440|       |#ifdef WORDS_BIGENDIAN
  441|       |	groups_per_block = EXT2_DESC_PER_BLOCK(fs->super);
  442|       |#endif
  443|      0|	if (ext2fs_has_feature_meta_bg(fs->super) &&
  ------------------
  |  Branch (443:6): [True: 0, False: 0]
  ------------------
  444|      0|	    !(flags & EXT2_FLAG_IMAGE_FILE)) {
  ------------------
  |  |  208|      0|#define EXT2_FLAG_IMAGE_FILE		0x2000
  ------------------
  |  Branch (444:6): [True: 0, False: 0]
  ------------------
  445|      0|		first_meta_bg = fs->super->s_first_meta_bg;
  446|      0|		if (first_meta_bg > fs->desc_blocks)
  ------------------
  |  Branch (446:7): [True: 0, False: 0]
  ------------------
  447|      0|			first_meta_bg = fs->desc_blocks;
  448|      0|	} else
  449|      0|		first_meta_bg = fs->desc_blocks;
  450|      0|	if (first_meta_bg) {
  ------------------
  |  Branch (450:6): [True: 0, False: 0]
  ------------------
  451|      0|		retval = io_channel_read_blk(fs->io, group_block +
  ------------------
  |  |  116|      0|#define io_channel_read_blk(c,b,n,d)	((c)->manager->read_blk((c),b,n,d))
  ------------------
  452|      0|					     group_zero_adjust + 1,
  453|      0|					     first_meta_bg, dest);
  454|      0|		if (retval)
  ------------------
  |  Branch (454:7): [True: 0, False: 0]
  ------------------
  455|      0|			goto cleanup;
  456|       |#ifdef WORDS_BIGENDIAN
  457|       |		gdp = (struct ext2_group_desc *) dest;
  458|       |		for (j=0; j < groups_per_block*first_meta_bg; j++) {
  459|       |			gdp = ext2fs_group_desc(fs, fs->group_desc, j);
  460|       |			if (gdp)
  461|       |				ext2fs_swap_group_desc2(fs, gdp);
  462|       |		}
  463|       |#endif
  464|      0|		dest += fs->blocksize*first_meta_bg;
  465|      0|	}
  466|       |
  467|      0|	for (i = first_meta_bg ; i < fs->desc_blocks; i++) {
  ------------------
  |  Branch (467:27): [True: 0, False: 0]
  ------------------
  468|      0|		blk = ext2fs_descriptor_block_loc2(fs, group_block, i);
  469|      0|		io_channel_cache_readahead(fs->io, blk, 1);
  470|      0|	}
  471|       |
  472|      0|	for (i=first_meta_bg ; i < fs->desc_blocks; i++) {
  ------------------
  |  Branch (472:25): [True: 0, False: 0]
  ------------------
  473|      0|		blk = ext2fs_descriptor_block_loc2(fs, group_block, i);
  474|      0|		retval = io_channel_read_blk64(fs->io, blk, 1, dest);
  475|      0|		if (retval)
  ------------------
  |  Branch (475:7): [True: 0, False: 0]
  ------------------
  476|      0|			goto cleanup;
  477|       |#ifdef WORDS_BIGENDIAN
  478|       |		for (j=0; j < groups_per_block; j++) {
  479|       |			gdp = ext2fs_group_desc(fs, fs->group_desc,
  480|       |						i * groups_per_block + j);
  481|       |			if (gdp)
  482|       |				ext2fs_swap_group_desc2(fs, gdp);
  483|       |		}
  484|       |#endif
  485|      0|		dest += fs->blocksize;
  486|      0|	}
  487|       |
  488|      0|	fs->stride = fs->super->s_raid_stride;
  489|       |
  490|       |	/*
  491|       |	 * If recovery is from backup superblock, Clear _UNININT flags &
  492|       |	 * reset bg_itable_unused to zero
  493|       |	 */
  494|      0|	if (superblock > 1 && ext2fs_has_group_desc_csum(fs)) {
  ------------------
  |  Branch (494:6): [True: 0, False: 0]
  |  Branch (494:24): [True: 0, False: 0]
  ------------------
  495|      0|		dgrp_t group;
  496|       |
  497|      0|		for (group = 0; group < fs->group_desc_count; group++) {
  ------------------
  |  Branch (497:19): [True: 0, False: 0]
  ------------------
  498|      0|			ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT);
  ------------------
  |  |  224|      0|#define EXT2_BG_BLOCK_UNINIT	0x0002 /* Block bitmap not initialized */
  ------------------
  499|      0|			ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT);
  ------------------
  |  |  223|      0|#define EXT2_BG_INODE_UNINIT	0x0001 /* Inode table/bitmap not initialized */
  ------------------
  500|      0|			ext2fs_bg_itable_unused_set(fs, group, 0);
  501|       |			/* The checksum will be reset later, but fix it here
  502|       |			 * anyway to avoid printing a lot of spurious errors. */
  503|      0|			ext2fs_group_desc_csum_set(fs, group);
  504|      0|		}
  505|      0|		if (fs->flags & EXT2_FLAG_RW)
  ------------------
  |  |  195|      0|#define EXT2_FLAG_RW			0x01
  ------------------
  |  Branch (505:7): [True: 0, False: 0]
  ------------------
  506|      0|			ext2fs_mark_super_dirty(fs);
  507|      0|	}
  508|      0|skip_read_bg:
  509|      0|	if (ext2fs_has_feature_mmp(fs->super) &&
  ------------------
  |  Branch (509:6): [True: 0, False: 0]
  ------------------
  510|      0|	    !(flags & EXT2_FLAG_SKIP_MMP) &&
  ------------------
  |  |  215|      0|#define EXT2_FLAG_SKIP_MMP		0x100000
  ------------------
  |  Branch (510:6): [True: 0, False: 0]
  ------------------
  511|      0|	    (flags & (EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE))) {
  ------------------
  |  |  195|      0|#define EXT2_FLAG_RW			0x01
  ------------------
              	    (flags & (EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE))) {
  ------------------
  |  |  209|      0|#define EXT2_FLAG_EXCLUSIVE		0x4000
  ------------------
  |  Branch (511:6): [True: 0, False: 0]
  ------------------
  512|      0|		retval = ext2fs_mmp_start(fs);
  513|      0|		if (retval) {
  ------------------
  |  Branch (513:7): [True: 0, False: 0]
  ------------------
  514|      0|			fs->flags |= EXT2_FLAG_SKIP_MMP; /* just do cleanup */
  ------------------
  |  |  215|      0|#define EXT2_FLAG_SKIP_MMP		0x100000
  ------------------
  515|      0|			ext2fs_mmp_stop(fs);
  516|      0|			goto cleanup;
  517|      0|		}
  518|      0|	}
  519|       |
  520|      0|	if (fs->flags & EXT2_FLAG_SHARE_DUP) {
  ------------------
  |  |  217|      0|#define EXT2_FLAG_SHARE_DUP		0x400000
  ------------------
  |  Branch (520:6): [True: 0, False: 0]
  ------------------
  521|      0|		fs->block_sha_map = ext2fs_hashmap_create(ext2fs_djb2_hash,
  522|      0|					block_sha_map_free_entry, 4096);
  523|      0|		if (!fs->block_sha_map) {
  ------------------
  |  Branch (523:7): [True: 0, False: 0]
  ------------------
  524|      0|			retval = EXT2_ET_NO_MEMORY;
  ------------------
  |  |   78|      0|#define EXT2_ET_NO_MEMORY                        (2133571398L)
  ------------------
  525|      0|			goto cleanup;
  526|      0|		}
  527|      0|		ext2fs_set_feature_shared_blocks(fs->super);
  528|      0|	}
  529|       |
  530|      0|	if (ext2fs_has_feature_casefold(fs->super))
  ------------------
  |  Branch (530:6): [True: 0, False: 0]
  ------------------
  531|      0|		fs->encoding = ext2fs_load_nls_table(fs->super->s_encoding);
  532|       |
  533|      0|	fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;
  ------------------
  |  |  211|      0|#define EXT2_FLAG_NOFREE_ON_ERROR	0x10000
  ------------------
  534|      0|	*ret_fs = fs;
  535|       |
  536|      0|	return 0;
  537|      1|cleanup:
  538|      1|	if (!(flags & EXT2_FLAG_NOFREE_ON_ERROR)) {
  ------------------
  |  |  211|      1|#define EXT2_FLAG_NOFREE_ON_ERROR	0x10000
  ------------------
  |  Branch (538:6): [True: 1, False: 0]
  ------------------
  539|      1|		ext2fs_free(fs);
  540|      1|		fs = NULL;
  541|      1|	}
  542|      1|	*ret_fs = fs;
  543|      1|	return retval;
  544|      0|}

ext2fs_open_file:
  687|      1|{
  688|      1|	if (mode)
  ------------------
  |  Branch (688:6): [True: 0, False: 1]
  ------------------
  689|      0|#if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
  690|      0|		return open64(pathname, flags, mode);
  691|      1|	else
  692|      1|		return open64(pathname, flags);
  693|       |#else
  694|       |		return open(pathname, flags, mode);
  695|       |	else
  696|       |		return open(pathname, flags);
  697|       |#endif
  698|      1|}
ext2fs_fstat:
  710|      1|{
  711|      1|#if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
  712|      1|	return fstat64(fd, buf);
  713|       |#else
  714|       |	return fstat(fd, buf);
  715|       |#endif
  716|      1|}
unix_io.c:unix_open:
  936|      1|{
  937|      1|	int fd = -1;
  938|      1|	int open_flags;
  939|       |
  940|      1|	if (name == 0)
  ------------------
  |  Branch (940:6): [True: 0, False: 1]
  ------------------
  941|      0|		return EXT2_ET_BAD_DEVICE_NAME;
  ------------------
  |  |   66|      0|#define EXT2_ET_BAD_DEVICE_NAME                  (2133571386L)
  ------------------
  942|       |
  943|      1|	open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
  ------------------
  |  |  104|      1|#define IO_FLAG_RW		0x0001
  ------------------
  |  Branch (943:15): [True: 0, False: 1]
  ------------------
  944|      1|	if (flags & IO_FLAG_EXCLUSIVE)
  ------------------
  |  |  105|      1|#define IO_FLAG_EXCLUSIVE	0x0002
  ------------------
  |  Branch (944:6): [True: 0, False: 1]
  ------------------
  945|      0|		open_flags |= O_EXCL;
  946|      1|#if defined(O_DIRECT)
  947|      1|	if (flags & IO_FLAG_DIRECT_IO)
  ------------------
  |  |  106|      1|#define IO_FLAG_DIRECT_IO	0x0004
  ------------------
  |  Branch (947:6): [True: 0, False: 1]
  ------------------
  948|      0|		open_flags |= O_DIRECT;
  949|      1|#endif
  950|      1|	fd = ext2fs_open_file(name, open_flags, 0);
  951|      1|	if (fd < 0)
  ------------------
  |  Branch (951:6): [True: 0, False: 1]
  ------------------
  952|      0|		return errno;
  953|       |#if defined(F_NOCACHE) && !defined(IO_DIRECT)
  954|       |	if (flags & IO_FLAG_DIRECT_IO) {
  955|       |		if (fcntl(fd, F_NOCACHE, 1) < 0)
  956|       |			return errno;
  957|       |	}
  958|       |#endif
  959|      1|	return unix_open_channel(name, fd, flags, channel, unix_io_manager);
  960|      1|}
unix_io.c:unix_open_channel:
  722|      1|{
  723|      1|	io_channel	io = NULL;
  724|      1|	struct unix_private_data *data = NULL;
  725|      1|	errcode_t	retval;
  726|      1|	ext2fs_struct_stat st;
  727|      1|#ifdef __linux__
  728|      1|	struct		utsname ut;
  729|      1|#endif
  730|       |
  731|      1|	if (safe_getenv("UNIX_IO_FORCE_BOUNCE"))
  ------------------
  |  Branch (731:6): [True: 0, False: 1]
  ------------------
  732|      0|		flags |= IO_FLAG_FORCE_BOUNCE;
  ------------------
  |  |  107|      0|#define IO_FLAG_FORCE_BOUNCE	0x0008
  ------------------
  733|       |
  734|      1|#ifdef __linux__
  735|       |	/*
  736|       |	 * We need to make sure any previous errors in the block
  737|       |	 * device are thrown away, sigh.
  738|       |	 */
  739|      1|	(void) fsync(fd);
  740|      1|#endif
  741|       |
  742|      1|	retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
  743|      1|	if (retval)
  ------------------
  |  Branch (743:6): [True: 0, False: 1]
  ------------------
  744|      0|		goto cleanup;
  745|      1|	memset(io, 0, sizeof(struct struct_io_channel));
  746|      1|	io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
  ------------------
  |  |   13|      1|#define EXT2_ET_MAGIC_IO_CHANNEL                 (2133571333L)
  ------------------
  747|      1|	retval = ext2fs_get_mem(sizeof(struct unix_private_data), &data);
  748|      1|	if (retval)
  ------------------
  |  Branch (748:6): [True: 0, False: 1]
  ------------------
  749|      0|		goto cleanup;
  750|       |
  751|      1|	io->manager = io_mgr;
  752|      1|	retval = ext2fs_get_mem(strlen(name)+1, &io->name);
  753|      1|	if (retval)
  ------------------
  |  Branch (753:6): [True: 0, False: 1]
  ------------------
  754|      0|		goto cleanup;
  755|       |
  756|      1|	strcpy(io->name, name);
  757|      1|	io->private_data = data;
  758|      1|	io->block_size = 1024;
  759|      1|	io->read_error = 0;
  760|      1|	io->write_error = 0;
  761|      1|	io->refcount = 1;
  762|      1|	io->flags = 0;
  763|       |
  764|      1|	memset(data, 0, sizeof(struct unix_private_data));
  765|      1|	data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
  ------------------
  |  |   14|      1|#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL            (2133571334L)
  ------------------
  766|      1|	data->io_stats.num_fields = 2;
  767|      1|	data->flags = flags;
  768|      1|	data->dev = fd;
  769|       |
  770|      1|#if defined(O_DIRECT)
  771|      1|	if (flags & IO_FLAG_DIRECT_IO)
  ------------------
  |  |  106|      1|#define IO_FLAG_DIRECT_IO	0x0004
  ------------------
  |  Branch (771:6): [True: 0, False: 1]
  ------------------
  772|      0|		io->align = ext2fs_get_dio_alignment(data->dev);
  773|       |#elif defined(F_NOCACHE)
  774|       |	if (flags & IO_FLAG_DIRECT_IO)
  775|       |		io->align = 4096;
  776|       |#endif
  777|       |
  778|       |	/*
  779|       |	 * If the device is really a block device, then set the
  780|       |	 * appropriate flag, otherwise we can set DISCARD_ZEROES flag
  781|       |	 * because we are going to use punch hole instead of discard
  782|       |	 * and if it succeed, subsequent read from sparse area returns
  783|       |	 * zero.
  784|       |	 */
  785|      1|	if (ext2fs_fstat(data->dev, &st) == 0) {
  ------------------
  |  Branch (785:6): [True: 1, False: 0]
  ------------------
  786|      1|		if (ext2fsP_is_disk_device(st.st_mode))
  ------------------
  |  Branch (786:7): [True: 0, False: 1]
  ------------------
  787|      0|			io->flags |= CHANNEL_FLAGS_BLOCK_DEVICE;
  ------------------
  |  |   35|      0|#define CHANNEL_FLAGS_BLOCK_DEVICE	0x04
  ------------------
  788|      1|		else
  789|      1|			io->flags |= CHANNEL_FLAGS_DISCARD_ZEROES;
  ------------------
  |  |   34|      1|#define CHANNEL_FLAGS_DISCARD_ZEROES	0x02
  ------------------
  790|      1|	}
  791|       |
  792|      1|#ifdef BLKDISCARDZEROES
  793|      1|	{
  794|      1|		int zeroes = 0;
  795|      1|		if (ioctl(data->dev, BLKDISCARDZEROES, &zeroes) == 0 &&
  ------------------
  |  |  682|      1|#define BLKDISCARDZEROES _IO(0x12,124)
  ------------------
  |  Branch (795:7): [True: 0, False: 1]
  ------------------
  796|      1|		    zeroes)
  ------------------
  |  Branch (796:7): [True: 0, False: 0]
  ------------------
  797|      0|			io->flags |= CHANNEL_FLAGS_DISCARD_ZEROES;
  ------------------
  |  |   34|      0|#define CHANNEL_FLAGS_DISCARD_ZEROES	0x02
  ------------------
  798|      1|	}
  799|      1|#endif
  800|       |
  801|       |#if defined(__CYGWIN__)
  802|       |	/*
  803|       |	 * Some operating systems require that the buffers be aligned,
  804|       |	 * regardless of O_DIRECT
  805|       |	 */
  806|       |	if (!io->align)
  807|       |		io->align = 512;
  808|       |#endif
  809|       |
  810|       |#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
  811|       |	if (io->flags & CHANNEL_FLAGS_BLOCK_DEVICE) {
  812|       |		int dio_align = ext2fs_get_dio_alignment(fd);
  813|       |
  814|       |		if (io->align < dio_align)
  815|       |			io->align = dio_align;
  816|       |	}
  817|       |#endif
  818|       |
  819|      1|	if ((retval = alloc_cache(io, data)))
  ------------------
  |  Branch (819:6): [True: 0, False: 1]
  ------------------
  820|      0|		goto cleanup;
  821|       |
  822|      1|#ifdef BLKROGET
  823|      1|	if (flags & IO_FLAG_RW) {
  ------------------
  |  |  104|      1|#define IO_FLAG_RW		0x0001
  ------------------
  |  Branch (823:6): [True: 0, False: 1]
  ------------------
  824|      0|		int error;
  825|      0|		int readonly = 0;
  826|       |
  827|       |		/* Is the block device actually writable? */
  828|      0|		error = ioctl(data->dev, BLKROGET, &readonly);
  829|      0|		if (!error && readonly) {
  ------------------
  |  Branch (829:7): [True: 0, False: 0]
  |  Branch (829:17): [True: 0, False: 0]
  ------------------
  830|      0|			retval = EPERM;
  831|      0|			goto cleanup;
  832|      0|		}
  833|      0|	}
  834|      1|#endif
  835|       |
  836|      1|#ifdef __linux__
  837|      1|#undef RLIM_INFINITY
  838|       |#if (defined(__alpha__) || ((defined(__sparc__) || defined(__mips__)) && (SIZEOF_LONG == 4)))
  839|       |#define RLIM_INFINITY	((unsigned long)(~0UL>>1))
  840|       |#else
  841|      1|#define RLIM_INFINITY  (~0UL)
  842|      1|#endif
  843|       |	/*
  844|       |	 * Work around a bug in 2.4.10-2.4.18 kernels where writes to
  845|       |	 * block devices are wrongly getting hit by the filesize
  846|       |	 * limit.  This workaround isn't perfect, since it won't work
  847|       |	 * if glibc wasn't built against 2.2 header files.  (Sigh.)
  848|       |	 *
  849|       |	 */
  850|      1|	if ((flags & IO_FLAG_RW) &&
  ------------------
  |  |  104|      1|#define IO_FLAG_RW		0x0001
  ------------------
  |  Branch (850:6): [True: 0, False: 1]
  ------------------
  851|      1|	    (uname(&ut) == 0) &&
  ------------------
  |  Branch (851:6): [True: 0, False: 0]
  ------------------
  852|      1|	    ((ut.release[0] == '2') && (ut.release[1] == '.') &&
  ------------------
  |  Branch (852:7): [True: 0, False: 0]
  |  Branch (852:33): [True: 0, False: 0]
  ------------------
  853|      0|	     (ut.release[2] == '4') && (ut.release[3] == '.') &&
  ------------------
  |  Branch (853:7): [True: 0, False: 0]
  |  Branch (853:33): [True: 0, False: 0]
  ------------------
  854|      0|	     (ut.release[4] == '1') && (ut.release[5] >= '0') &&
  ------------------
  |  Branch (854:7): [True: 0, False: 0]
  |  Branch (854:33): [True: 0, False: 0]
  ------------------
  855|      0|	     (ut.release[5] < '8')) &&
  ------------------
  |  Branch (855:7): [True: 0, False: 0]
  ------------------
  856|      1|	    (ext2fs_fstat(data->dev, &st) == 0) &&
  ------------------
  |  Branch (856:6): [True: 0, False: 0]
  ------------------
  857|      1|	    (ext2fsP_is_disk_device(st.st_mode))) {
  ------------------
  |  Branch (857:6): [True: 0, False: 0]
  ------------------
  858|      0|		struct rlimit	rlim;
  859|       |
  860|      0|		rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY;
  ------------------
  |  |  841|      0|#define RLIM_INFINITY  (~0UL)
  ------------------
  861|      0|		setrlimit(RLIMIT_FSIZE, &rlim);
  862|      0|		getrlimit(RLIMIT_FSIZE, &rlim);
  863|      0|		if (((unsigned long) rlim.rlim_cur) <
  ------------------
  |  Branch (863:7): [True: 0, False: 0]
  ------------------
  864|      0|		    ((unsigned long) rlim.rlim_max)) {
  865|      0|			rlim.rlim_cur = rlim.rlim_max;
  866|      0|			setrlimit(RLIMIT_FSIZE, &rlim);
  867|      0|		}
  868|      0|	}
  869|      1|#endif
  870|      1|#ifdef HAVE_PTHREAD
  871|      1|	if (flags & IO_FLAG_THREADS) {
  ------------------
  |  |  108|      1|#define IO_FLAG_THREADS		0x0010
  ------------------
  |  Branch (871:6): [True: 0, False: 1]
  ------------------
  872|      0|		io->flags |= CHANNEL_FLAGS_THREADS;
  ------------------
  |  |   36|      0|#define CHANNEL_FLAGS_THREADS		0x08
  ------------------
  873|      0|		retval = pthread_mutex_init(&data->cache_mutex, NULL);
  874|      0|		if (retval)
  ------------------
  |  Branch (874:7): [True: 0, False: 0]
  ------------------
  875|      0|			goto cleanup;
  876|      0|		retval = pthread_mutex_init(&data->bounce_mutex, NULL);
  877|      0|		if (retval) {
  ------------------
  |  Branch (877:7): [True: 0, False: 0]
  ------------------
  878|      0|			pthread_mutex_destroy(&data->cache_mutex);
  879|      0|			goto cleanup;
  880|      0|		}
  881|      0|		retval = pthread_mutex_init(&data->stats_mutex, NULL);
  882|      0|		if (retval) {
  ------------------
  |  Branch (882:7): [True: 0, False: 0]
  ------------------
  883|      0|			pthread_mutex_destroy(&data->cache_mutex);
  884|      0|			pthread_mutex_destroy(&data->bounce_mutex);
  885|      0|			goto cleanup;
  886|      0|		}
  887|      0|	}
  888|      1|#endif
  889|      1|	*channel = io;
  890|      1|	return 0;
  891|       |
  892|      0|cleanup:
  893|      0|	if (data) {
  ------------------
  |  Branch (893:6): [True: 0, False: 0]
  ------------------
  894|      0|		if (data->dev >= 0)
  ------------------
  |  Branch (894:7): [True: 0, False: 0]
  ------------------
  895|      0|			close(data->dev);
  896|      0|		free_cache(data);
  897|      0|		ext2fs_free_mem(&data);
  898|      0|	}
  899|      0|	if (io) {
  ------------------
  |  Branch (899:6): [True: 0, False: 0]
  ------------------
  900|      0|		if (io->name) {
  ------------------
  |  Branch (900:7): [True: 0, False: 0]
  ------------------
  901|      0|			ext2fs_free_mem(&io->name);
  902|      0|		}
  903|      0|		ext2fs_free_mem(&io);
  904|      0|	}
  905|      0|	return retval;
  906|      1|}
unix_io.c:safe_getenv:
  186|      1|{
  187|      1|	if ((getuid() != geteuid()) || (getgid() != getegid()))
  ------------------
  |  Branch (187:6): [True: 0, False: 1]
  |  Branch (187:33): [True: 0, False: 1]
  ------------------
  188|      0|		return NULL;
  189|      1|#ifdef HAVE_PRCTL
  190|      1|	if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
  ------------------
  |  Branch (190:6): [True: 0, False: 1]
  ------------------
  191|      0|		return NULL;
  192|       |#else
  193|       |#if (defined(linux) && defined(SYS_prctl))
  194|       |	if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
  195|       |		return NULL;
  196|       |#endif
  197|       |#endif
  198|       |
  199|      1|#if defined(HAVE_SECURE_GETENV)
  200|      1|	return secure_getenv(arg);
  201|       |#elif defined(HAVE___SECURE_GETENV)
  202|       |	return __secure_getenv(arg);
  203|       |#else
  204|       |	return getenv(arg);
  205|       |#endif
  206|      1|}
unix_io.c:alloc_cache:
  502|      1|{
  503|      1|	errcode_t		retval;
  504|      1|	struct unix_cache	*cache;
  505|      1|	int			i;
  506|       |
  507|      1|	data->access_time = 0;
  508|      9|	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
  ------------------
  |  |  100|      9|#define CACHE_SIZE 8
  ------------------
  |  Branch (508:33): [True: 8, False: 1]
  ------------------
  509|      8|		cache->block = 0;
  510|      8|		cache->access_time = 0;
  511|      8|		cache->dirty = 0;
  512|      8|		cache->in_use = 0;
  513|      8|		if (cache->buf)
  ------------------
  |  Branch (513:7): [True: 0, False: 8]
  ------------------
  514|      0|			ext2fs_free_mem(&cache->buf);
  515|      8|		retval = io_channel_alloc_buf(channel, 0, &cache->buf);
  516|      8|		if (retval)
  ------------------
  |  Branch (516:7): [True: 0, False: 8]
  ------------------
  517|      0|			return retval;
  518|      8|	}
  519|      1|	if (channel->align || data->flags & IO_FLAG_FORCE_BOUNCE) {
  ------------------
  |  |  107|      1|#define IO_FLAG_FORCE_BOUNCE	0x0008
  ------------------
  |  Branch (519:6): [True: 0, False: 1]
  |  Branch (519:24): [True: 0, False: 1]
  ------------------
  520|      0|		if (data->bounce)
  ------------------
  |  Branch (520:7): [True: 0, False: 0]
  ------------------
  521|      0|			ext2fs_free_mem(&data->bounce);
  522|      0|		retval = io_channel_alloc_buf(channel, 0, &data->bounce);
  523|      0|	}
  524|      1|	return retval;
  525|      1|}
unix_io.c:free_cache:
  529|      1|{
  530|      1|	struct unix_cache	*cache;
  531|      1|	int			i;
  532|       |
  533|      1|	data->access_time = 0;
  534|      9|	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
  ------------------
  |  |  100|      9|#define CACHE_SIZE 8
  ------------------
  |  Branch (534:33): [True: 8, False: 1]
  ------------------
  535|      8|		cache->block = 0;
  536|      8|		cache->access_time = 0;
  537|      8|		cache->dirty = 0;
  538|      8|		cache->in_use = 0;
  539|      8|		if (cache->buf)
  ------------------
  |  Branch (539:7): [True: 8, False: 0]
  ------------------
  540|      8|			ext2fs_free_mem(&cache->buf);
  541|      8|	}
  542|      1|	if (data->bounce)
  ------------------
  |  Branch (542:6): [True: 0, False: 1]
  ------------------
  543|      0|		ext2fs_free_mem(&data->bounce);
  544|      1|}
unix_io.c:unix_close:
  963|      1|{
  964|      1|	struct unix_private_data *data;
  965|      1|	errcode_t	retval = 0;
  966|       |
  967|      1|	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  968|      1|	data = (struct unix_private_data *) channel->private_data;
  969|      1|	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  970|       |
  971|      1|	if (--channel->refcount > 0)
  ------------------
  |  Branch (971:6): [True: 0, False: 1]
  ------------------
  972|      0|		return 0;
  973|       |
  974|      1|#ifndef NO_IO_CACHE
  975|      1|	retval = flush_cached_blocks(channel, data, 0);
  976|      1|#endif
  977|       |
  978|      1|	if (close(data->dev) < 0)
  ------------------
  |  Branch (978:6): [True: 0, False: 1]
  ------------------
  979|      0|		retval = errno;
  980|      1|	free_cache(data);
  981|      1|#ifdef HAVE_PTHREAD
  982|      1|	if (data->flags & IO_FLAG_THREADS) {
  ------------------
  |  |  108|      1|#define IO_FLAG_THREADS		0x0010
  ------------------
  |  Branch (982:6): [True: 0, False: 1]
  ------------------
  983|      0|		pthread_mutex_destroy(&data->cache_mutex);
  984|      0|		pthread_mutex_destroy(&data->bounce_mutex);
  985|      0|		pthread_mutex_destroy(&data->stats_mutex);
  986|      0|	}
  987|      1|#endif
  988|       |
  989|      1|	ext2fs_free_mem(&channel->private_data);
  990|      1|	if (channel->name)
  ------------------
  |  Branch (990:6): [True: 1, False: 0]
  ------------------
  991|      1|		ext2fs_free_mem(&channel->name);
  992|      1|	ext2fs_free_mem(&channel);
  993|      1|	return retval;
  994|      1|}
unix_io.c:flush_cached_blocks:
  614|      2|{
  615|      2|	struct unix_cache	*cache;
  616|      2|	errcode_t		retval, retval2 = 0;
  617|      2|	int			i;
  618|      2|	int			errors_found = 0;
  619|       |
  620|      2|	if ((flags & FLUSH_NOLOCK) == 0)
  ------------------
  |  |  606|      2|#define FLUSH_NOLOCK		0x02
  ------------------
  |  Branch (620:6): [True: 2, False: 0]
  ------------------
  621|      2|		mutex_lock(data, CACHE_MTX);
  622|     18|	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
  ------------------
  |  |  100|     18|#define CACHE_SIZE 8
  ------------------
  |  Branch (622:33): [True: 16, False: 2]
  ------------------
  623|     16|		if (!cache->in_use || !cache->dirty)
  ------------------
  |  Branch (623:7): [True: 16, False: 0]
  |  Branch (623:25): [True: 0, False: 0]
  ------------------
  624|     16|			continue;
  625|      0|		retval = raw_write_blk(channel, data,
  626|      0|				       cache->block, 1, cache->buf,
  627|      0|				       RAW_WRITE_NO_HANDLER);
  ------------------
  |  |  340|      0|#define RAW_WRITE_NO_HANDLER	1
  ------------------
  628|      0|		if (retval) {
  ------------------
  |  Branch (628:7): [True: 0, False: 0]
  ------------------
  629|      0|			cache->write_err = 1;
  630|      0|			errors_found = 1;
  631|      0|			retval2 = retval;
  632|      0|		} else {
  633|      0|			cache->dirty = 0;
  634|      0|			cache->write_err = 0;
  635|      0|			if (flags & FLUSH_INVALIDATE)
  ------------------
  |  |  605|      0|#define FLUSH_INVALIDATE	0x01
  ------------------
  |  Branch (635:8): [True: 0, False: 0]
  ------------------
  636|      0|				cache->in_use = 0;
  637|      0|		}
  638|      0|	}
  639|      2|	if ((flags & FLUSH_NOLOCK) == 0)
  ------------------
  |  |  606|      2|#define FLUSH_NOLOCK		0x02
  ------------------
  |  Branch (639:6): [True: 2, False: 0]
  ------------------
  640|      2|		mutex_unlock(data, CACHE_MTX);
  641|      2|retry:
  642|      2|	while (errors_found) {
  ------------------
  |  Branch (642:9): [True: 0, False: 2]
  ------------------
  643|      0|		if ((flags & FLUSH_NOLOCK) == 0)
  ------------------
  |  |  606|      0|#define FLUSH_NOLOCK		0x02
  ------------------
  |  Branch (643:7): [True: 0, False: 0]
  ------------------
  644|      0|			mutex_lock(data, CACHE_MTX);
  645|      0|		errors_found = 0;
  646|      0|		for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
  ------------------
  |  |  100|      0|#define CACHE_SIZE 8
  ------------------
  |  Branch (646:34): [True: 0, False: 0]
  ------------------
  647|      0|			if (!cache->in_use || !cache->write_err)
  ------------------
  |  Branch (647:8): [True: 0, False: 0]
  |  Branch (647:26): [True: 0, False: 0]
  ------------------
  648|      0|				continue;
  649|      0|			errors_found = 1;
  650|      0|			if (cache->write_err && channel->write_error) {
  ------------------
  |  Branch (650:8): [True: 0, False: 0]
  |  Branch (650:28): [True: 0, False: 0]
  ------------------
  651|      0|				char *err_buf = NULL;
  652|      0|				unsigned long long err_block = cache->block;
  653|       |
  654|      0|				cache->dirty = 0;
  655|      0|				cache->in_use = 0;
  656|      0|				cache->write_err = 0;
  657|      0|				if (io_channel_alloc_buf(channel, 0,
  ------------------
  |  Branch (657:9): [True: 0, False: 0]
  ------------------
  658|      0|							 &err_buf))
  659|      0|					err_buf = NULL;
  660|      0|				else
  661|      0|					memcpy(err_buf, cache->buf,
  662|      0|					       channel->block_size);
  663|      0|				mutex_unlock(data, CACHE_MTX);
  664|      0|				(channel->write_error)(channel, err_block,
  665|      0|					1, err_buf, channel->block_size, -1,
  666|      0|					retval2);
  667|      0|				if (err_buf)
  ------------------
  |  Branch (667:9): [True: 0, False: 0]
  ------------------
  668|      0|					ext2fs_free_mem(&err_buf);
  669|      0|				goto retry;
  670|      0|			} else
  671|      0|				cache->write_err = 0;
  672|      0|		}
  673|      0|		if ((flags & FLUSH_NOLOCK) == 0)
  ------------------
  |  |  606|      0|#define FLUSH_NOLOCK		0x02
  ------------------
  |  Branch (673:7): [True: 0, False: 0]
  ------------------
  674|      0|			mutex_unlock(data, CACHE_MTX);
  675|      0|	}
  676|      2|	return retval2;
  677|      2|}
unix_io.c:mutex_lock:
  147|      4|{
  148|      4|#ifdef HAVE_PTHREAD
  149|      4|	pthread_mutex_t *mtx = get_mutex(data,kind);
  150|       |
  151|      4|	if (mtx)
  ------------------
  |  Branch (151:6): [True: 0, False: 4]
  ------------------
  152|      0|		pthread_mutex_lock(mtx);
  153|      4|#endif
  154|      4|}
unix_io.c:get_mutex:
  131|      8|{
  132|      8|	if (data->flags & IO_FLAG_THREADS) {
  ------------------
  |  |  108|      8|#define IO_FLAG_THREADS		0x0010
  ------------------
  |  Branch (132:6): [True: 0, False: 8]
  ------------------
  133|      0|		switch (kind) {
  ------------------
  |  Branch (133:11): [True: 0, False: 0]
  ------------------
  134|      0|		case CACHE_MTX:
  ------------------
  |  Branch (134:3): [True: 0, False: 0]
  ------------------
  135|      0|			return &data->cache_mutex;
  136|      0|		case BOUNCE_MTX:
  ------------------
  |  Branch (136:3): [True: 0, False: 0]
  ------------------
  137|      0|			return &data->bounce_mutex;
  138|      0|		case STATS_MTX:
  ------------------
  |  Branch (138:3): [True: 0, False: 0]
  ------------------
  139|      0|			return &data->stats_mutex;
  140|      0|		}
  141|      0|	}
  142|      8|	return NULL;
  143|      8|}
unix_io.c:mutex_unlock:
  157|      4|{
  158|      4|#ifdef HAVE_PTHREAD
  159|      4|	pthread_mutex_t *mtx = get_mutex(data,kind);
  160|       |
  161|      4|	if (mtx)
  ------------------
  |  Branch (161:6): [True: 0, False: 4]
  ------------------
  162|      0|		pthread_mutex_unlock(mtx);
  163|      4|#endif
  164|      4|}
unix_io.c:unix_set_blksize:
  997|      1|{
  998|      1|	struct unix_private_data *data;
  999|      1|	errcode_t		retval = 0;
 1000|       |
 1001|      1|	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1002|      1|	data = (struct unix_private_data *) channel->private_data;
 1003|      1|	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1004|       |
 1005|      1|	if (channel->block_size != blksize) {
  ------------------
  |  Branch (1005:6): [True: 0, False: 1]
  ------------------
 1006|      0|		mutex_lock(data, CACHE_MTX);
 1007|      0|		mutex_lock(data, BOUNCE_MTX);
 1008|      0|#ifndef NO_IO_CACHE
 1009|      0|		if ((retval = flush_cached_blocks(channel, data, FLUSH_NOLOCK))){
  ------------------
  |  |  606|      0|#define FLUSH_NOLOCK		0x02
  ------------------
  |  Branch (1009:7): [True: 0, False: 0]
  ------------------
 1010|      0|			mutex_unlock(data, BOUNCE_MTX);
 1011|      0|			mutex_unlock(data, CACHE_MTX);
 1012|      0|			return retval;
 1013|      0|		}
 1014|      0|#endif
 1015|       |
 1016|      0|		channel->block_size = blksize;
 1017|      0|		free_cache(data);
 1018|      0|		retval = alloc_cache(channel, data);
 1019|      0|		mutex_unlock(data, BOUNCE_MTX);
 1020|      0|		mutex_unlock(data, CACHE_MTX);
 1021|      0|	}
 1022|      1|	return retval;
 1023|      1|}
unix_io.c:unix_read_blk:
 1126|      1|{
 1127|      1|	return unix_read_blk64(channel, block, count, buf);
 1128|      1|}
unix_io.c:unix_read_blk64:
 1027|      1|{
 1028|      1|	struct unix_private_data *data;
 1029|      1|	struct unix_cache *cache;
 1030|      1|	errcode_t	retval;
 1031|      1|	char		*cp;
 1032|      1|	int		i, j;
 1033|       |
 1034|      1|	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1035|      1|	data = (struct unix_private_data *) channel->private_data;
 1036|      1|	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
  ------------------
  |  |   89|      1|	  if ((struct)->magic != (code)) return (code)
  |  |  ------------------
  |  |  |  Branch (89:8): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1037|       |
 1038|       |#ifdef NO_IO_CACHE
 1039|       |	return raw_read_blk(channel, data, block, count, buf);
 1040|       |#else
 1041|      1|	if (data->flags & IO_FLAG_NOCACHE)
  ------------------
  |  |  109|      1|#define IO_FLAG_NOCACHE		0x0020
  ------------------
  |  Branch (1041:6): [True: 0, False: 1]
  ------------------
 1042|      0|		return raw_read_blk(channel, data, block, count, buf);
 1043|       |	/*
 1044|       |	 * If we're doing an odd-sized read or a very large read,
 1045|       |	 * flush out the cache and then do a direct read.
 1046|       |	 */
 1047|      1|	if (count < 0 || count > WRITE_DIRECT_SIZE) {
  ------------------
  |  |  101|      0|#define WRITE_DIRECT_SIZE 4	/* Must be smaller than CACHE_SIZE */
  ------------------
  |  Branch (1047:6): [True: 1, False: 0]
  |  Branch (1047:19): [True: 0, False: 0]
  ------------------
 1048|      1|		if ((retval = flush_cached_blocks(channel, data, 0)))
  ------------------
  |  Branch (1048:7): [True: 0, False: 1]
  ------------------
 1049|      0|			return retval;
 1050|      1|		return raw_read_blk(channel, data, block, count, buf);
 1051|      1|	}
 1052|       |
 1053|      0|	cp = buf;
 1054|      0|	mutex_lock(data, CACHE_MTX);
 1055|      0|	while (count > 0) {
  ------------------
  |  Branch (1055:9): [True: 0, False: 0]
  ------------------
 1056|       |		/* If it's in the cache, use it! */
 1057|      0|		if ((cache = find_cached_block(data, block, NULL))) {
  ------------------
  |  Branch (1057:7): [True: 0, False: 0]
  ------------------
 1058|       |#ifdef DEBUG
 1059|       |			printf("Using cached block %lu\n", block);
 1060|       |#endif
 1061|      0|			memcpy(cp, cache->buf, channel->block_size);
 1062|      0|			count--;
 1063|      0|			block++;
 1064|      0|			cp += channel->block_size;
 1065|      0|			continue;
 1066|      0|		}
 1067|       |
 1068|       |		/*
 1069|       |		 * Find the number of uncached blocks so we can do a
 1070|       |		 * single read request
 1071|       |		 */
 1072|      0|		for (i=1; i < count; i++)
  ------------------
  |  Branch (1072:13): [True: 0, False: 0]
  ------------------
 1073|      0|			if (find_cached_block(data, block+i, NULL))
  ------------------
  |  Branch (1073:8): [True: 0, False: 0]
  ------------------
 1074|      0|				break;
 1075|       |#ifdef DEBUG
 1076|       |		printf("Reading %d blocks starting at %lu\n", i, block);
 1077|       |#endif
 1078|      0|		mutex_unlock(data, CACHE_MTX);
 1079|      0|		if ((retval = raw_read_blk(channel, data, block, i, cp)))
  ------------------
  |  Branch (1079:7): [True: 0, False: 0]
  ------------------
 1080|      0|			return retval;
 1081|      0|		mutex_lock(data, CACHE_MTX);
 1082|       |
 1083|       |		/* Save the results in the cache */
 1084|      0|		for (j=0; j < i; j++) {
  ------------------
  |  Branch (1084:13): [True: 0, False: 0]
  ------------------
 1085|      0|			if (!find_cached_block(data, block, &cache)) {
  ------------------
  |  Branch (1085:8): [True: 0, False: 0]
  ------------------
 1086|      0|				retval = reuse_cache(channel, data,
 1087|      0|						     cache, block);
 1088|      0|				if (retval)
  ------------------
  |  Branch (1088:9): [True: 0, False: 0]
  ------------------
 1089|      0|					goto call_write_handler;
 1090|      0|				memcpy(cache->buf, cp, channel->block_size);
 1091|      0|			}
 1092|      0|			count--;
 1093|      0|			block++;
 1094|      0|			cp += channel->block_size;
 1095|      0|		}
 1096|      0|	}
 1097|      0|	mutex_unlock(data, CACHE_MTX);
 1098|      0|	return 0;
 1099|       |
 1100|      0|call_write_handler:
 1101|      0|	if (cache->write_err && channel->write_error) {
  ------------------
  |  Branch (1101:6): [True: 0, False: 0]
  |  Branch (1101:26): [True: 0, False: 0]
  ------------------
 1102|      0|		char *err_buf = NULL;
 1103|      0|		unsigned long long err_block = cache->block;
 1104|       |
 1105|      0|		cache->dirty = 0;
 1106|      0|		cache->in_use = 0;
 1107|      0|		cache->write_err = 0;
 1108|      0|		if (io_channel_alloc_buf(channel, 0, &err_buf))
  ------------------
  |  Branch (1108:7): [True: 0, False: 0]
  ------------------
 1109|      0|			err_buf = NULL;
 1110|      0|		else
 1111|      0|			memcpy(err_buf, cache->buf, channel->block_size);
 1112|      0|		mutex_unlock(data, CACHE_MTX);
 1113|      0|		(channel->write_error)(channel, err_block, 1, err_buf,
 1114|      0|				       channel->block_size, -1,
 1115|      0|				       retval);
 1116|      0|		if (err_buf)
  ------------------
  |  Branch (1116:7): [True: 0, False: 0]
  ------------------
 1117|      0|			ext2fs_free_mem(&err_buf);
 1118|      0|	} else
 1119|      0|		mutex_unlock(data, CACHE_MTX);
 1120|      0|	return retval;
 1121|      0|#endif /* NO_IO_CACHE */
 1122|      0|}
unix_io.c:raw_read_blk:
  215|      1|{
  216|      1|	errcode_t	retval;
  217|      1|	ssize_t		size;
  218|      1|	ext2_loff_t	location;
  219|      1|	int		actual = 0;
  220|      1|	unsigned char	*buf = bufv;
  221|      1|	ssize_t		really_read = 0;
  222|      1|	unsigned long long aligned_blk;
  223|      1|	int		align_size, offset;
  224|       |
  225|      1|	size = (count < 0) ? -count : (ext2_loff_t) count * channel->block_size;
  ------------------
  |  Branch (225:9): [True: 1, False: 0]
  ------------------
  226|      1|	mutex_lock(data, STATS_MTX);
  227|      1|	data->io_stats.bytes_read += size;
  228|      1|	mutex_unlock(data, STATS_MTX);
  229|      1|	location = ((ext2_loff_t) block * channel->block_size) + data->offset;
  230|       |
  231|      1|	if (data->flags & IO_FLAG_FORCE_BOUNCE)
  ------------------
  |  |  107|      1|#define IO_FLAG_FORCE_BOUNCE	0x0008
  ------------------
  |  Branch (231:6): [True: 0, False: 1]
  ------------------
  232|      0|		goto bounce_read;
  233|       |
  234|      1|#ifdef HAVE_PREAD64
  235|       |	/* Try an aligned pread */
  236|      1|	if ((channel->align == 0) ||
  ------------------
  |  Branch (236:6): [True: 1, False: 0]
  ------------------
  237|      1|	    (IS_ALIGNED(buf, channel->align) &&
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  238|      0|	     IS_ALIGNED(location, channel->align) &&
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  239|      1|	     IS_ALIGNED(size, channel->align))) {
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  240|      1|		actual = pread64(data->dev, buf, size, location);
  241|      1|		if (actual == size)
  ------------------
  |  Branch (241:7): [True: 0, False: 1]
  ------------------
  242|      0|			return 0;
  243|      1|		actual = 0;
  244|      1|	}
  245|       |#elif HAVE_PREAD
  246|       |	/* Try an aligned pread */
  247|       |	if ((sizeof(off_t) >= sizeof(ext2_loff_t)) &&
  248|       |	    ((channel->align == 0) ||
  249|       |	     (IS_ALIGNED(buf, channel->align) &&
  250|       |	      IS_ALIGNED(location, channel->align) &&
  251|       |	      IS_ALIGNED(size, channel->align)))) {
  252|       |		actual = pread(data->dev, buf, size, location);
  253|       |		if (actual == size)
  254|       |			return 0;
  255|       |		actual = 0;
  256|       |	}
  257|       |#endif /* HAVE_PREAD */
  258|       |
  259|      1|	if ((channel->align == 0) ||
  ------------------
  |  Branch (259:6): [True: 1, False: 0]
  ------------------
  260|      1|	    (IS_ALIGNED(buf, channel->align) &&
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  261|      0|	     IS_ALIGNED(location, channel->align) &&
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  262|      1|	     IS_ALIGNED(size, channel->align))) {
  ------------------
  |  |  121|      0|#define IS_ALIGNED(n, align) ((((uintptr_t) n) & \
  |  |  ------------------
  |  |  |  Branch (121:30): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|			       ((uintptr_t) ((align)-1))) == 0)
  ------------------
  263|      1|		mutex_lock(data, BOUNCE_MTX);
  264|      1|		if (ext2fs_llseek(data->dev, location, SEEK_SET) < 0) {
  ------------------
  |  Branch (264:7): [True: 0, False: 1]
  ------------------
  265|      0|			retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
  ------------------
  |  |   77|      0|#define EXT2_ET_LLSEEK_FAILED                    (2133571397L)
  ------------------
  266|      0|			goto error_unlock;
  267|      0|		}
  268|      1|		actual = read(data->dev, buf, size);
  269|      1|		if (actual != size) {
  ------------------
  |  Branch (269:7): [True: 1, False: 0]
  ------------------
  270|      1|		short_read:
  271|      1|			if (actual < 0) {
  ------------------
  |  Branch (271:8): [True: 0, False: 1]
  ------------------
  272|      0|				retval = errno;
  273|      0|				actual = 0;
  274|      0|			} else
  275|      1|				retval = EXT2_ET_SHORT_READ;
  ------------------
  |  |   44|      1|#define EXT2_ET_SHORT_READ                       (2133571364L)
  ------------------
  276|      1|			goto error_unlock;
  277|      1|		}
  278|      0|		goto success_unlock;
  279|      1|	}
  280|       |
  281|       |#ifdef ALIGN_DEBUG
  282|       |	printf("raw_read_blk: O_DIRECT fallback: %p %lu\n", buf,
  283|       |	       (unsigned long) size);
  284|       |#endif
  285|       |
  286|       |	/*
  287|       |	 * The buffer or size which we're trying to read isn't aligned
  288|       |	 * to the O_DIRECT rules, so we need to do this the hard way...
  289|       |	 */
  290|      0|bounce_read:
  291|      0|	if (channel->align == 0)
  ------------------
  |  Branch (291:6): [True: 0, False: 0]
  ------------------
  292|      0|		channel->align = 1;
  293|      0|	if ((channel->block_size > channel->align) &&
  ------------------
  |  Branch (293:6): [True: 0, False: 0]
  ------------------
  294|      0|	    (channel->block_size % channel->align) == 0)
  ------------------
  |  Branch (294:6): [True: 0, False: 0]
  ------------------
  295|      0|		align_size = channel->block_size;
  296|      0|	else
  297|      0|		align_size = channel->align;
  298|      0|	aligned_blk = location / align_size;
  299|      0|	offset = location % align_size;
  300|       |
  301|      0|	mutex_lock(data, BOUNCE_MTX);
  302|      0|	if (ext2fs_llseek(data->dev, aligned_blk * align_size, SEEK_SET) < 0) {
  ------------------
  |  Branch (302:6): [True: 0, False: 0]
  ------------------
  303|      0|		retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
  ------------------
  |  |   77|      0|#define EXT2_ET_LLSEEK_FAILED                    (2133571397L)
  ------------------
  304|      0|		goto error_unlock;
  305|      0|	}
  306|      0|	while (size > 0) {
  ------------------
  |  Branch (306:9): [True: 0, False: 0]
  ------------------
  307|      0|		actual = read(data->dev, data->bounce, align_size);
  308|      0|		if (actual != align_size) {
  ------------------
  |  Branch (308:7): [True: 0, False: 0]
  ------------------
  309|      0|			actual = really_read;
  310|      0|			buf -= really_read;
  311|      0|			size += really_read;
  312|      0|			goto short_read;
  313|      0|		}
  314|      0|		if ((actual + offset) > align_size)
  ------------------
  |  Branch (314:7): [True: 0, False: 0]
  ------------------
  315|      0|			actual = align_size - offset;
  316|      0|		if (actual > size)
  ------------------
  |  Branch (316:7): [True: 0, False: 0]
  ------------------
  317|      0|			actual = size;
  318|      0|		memcpy(buf, (char *)data->bounce + offset, actual);
  319|       |
  320|      0|		really_read += actual;
  321|      0|		size -= actual;
  322|      0|		buf += actual;
  323|      0|		offset = 0;
  324|      0|		aligned_blk++;
  325|      0|	}
  326|      0|success_unlock:
  327|      0|	mutex_unlock(data, BOUNCE_MTX);
  328|      0|	return 0;
  329|       |
  330|      1|error_unlock:
  331|      1|	mutex_unlock(data, BOUNCE_MTX);
  332|      1|	if (actual >= 0 && actual < size)
  ------------------
  |  Branch (332:6): [True: 1, False: 0]
  |  Branch (332:21): [True: 1, False: 0]
  ------------------
  333|      1|		memset((char *) buf+actual, 0, size-actual);
  334|      1|	if (channel->read_error)
  ------------------
  |  Branch (334:6): [True: 0, False: 1]
  ------------------
  335|      0|		retval = (channel->read_error)(channel, block, count, buf,
  336|      0|					       size, actual, retval);
  337|      1|	return retval;
  338|      0|}

LLVMFuzzerTestOneInput:
   22|      1|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   23|      1|  static const char* fname = "/tmp/ext2_test_file";
   24|       |
   25|       |  // Write our data to a temp file.
   26|      1|  int fd = open(fname, O_RDWR|O_CREAT|O_TRUNC);
   27|      1|  write(fd, data, size);
   28|      1|  close(fd);
   29|       |
   30|      1|  ext2_filsys fs;
   31|      1|  errcode_t retval = ext2fs_open(
   32|      1|      fname,
   33|      1|      EXT2_FLAG_IGNORE_CSUM_ERRORS, 0, 0,
  ------------------
  |  |  216|      1|#define EXT2_FLAG_IGNORE_CSUM_ERRORS	0x200000
  ------------------
   34|      1|      unix_io_manager,
   35|      1|      &fs);
   36|       |
   37|      1|  if (!retval) {
  ------------------
  |  Branch (37:7): [True: 0, False: 1]
  ------------------
   38|      0|    retval = ext2fs_check_directory(fs, EXT2_ROOT_INO);
  ------------------
  |  |   67|      0|#define EXT2_ROOT_INO		 2	/* Root inode */
  ------------------
   39|      0|    ext2fs_close(fs);
   40|      0|  }
   41|       |
   42|      1|  return 0;
   43|      1|}

