Deleted Added
full compact
ext2_htree.c (294504) ext2_htree.c (294653)
1/*-
2 * Copyright (c) 2010, 2012 Zheng Liu <lz@freebsd.org>
3 * Copyright (c) 2012, Vyacheslav Matyushin
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2010, 2012 Zheng Liu <lz@freebsd.org>
3 * Copyright (c) 2012, Vyacheslav Matyushin
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/fs/ext2fs/ext2_htree.c 294504 2016-01-21 14:50:28Z pfg $
27 * $FreeBSD: head/sys/fs/ext2fs/ext2_htree.c 294653 2016-01-24 02:41:49Z pfg $
28 */
29
30#include <sys/param.h>
31#include <sys/endian.h>
32#include <sys/systm.h>
33#include <sys/namei.h>
34#include <sys/bio.h>
35#include <sys/buf.h>

--- 49 unchanged lines hidden (view full) ---

85static void ext2_htree_release(struct ext2fs_htree_lookup_info *info);
86static uint32_t ext2_htree_root_limit(struct inode *ip, int len);
87static int ext2_htree_writebuf(struct ext2fs_htree_lookup_info *info);
88
89int
90ext2_htree_has_idx(struct inode *ip)
91{
92 if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) &&
28 */
29
30#include <sys/param.h>
31#include <sys/endian.h>
32#include <sys/systm.h>
33#include <sys/namei.h>
34#include <sys/bio.h>
35#include <sys/buf.h>

--- 49 unchanged lines hidden (view full) ---

85static void ext2_htree_release(struct ext2fs_htree_lookup_info *info);
86static uint32_t ext2_htree_root_limit(struct inode *ip, int len);
87static int ext2_htree_writebuf(struct ext2fs_htree_lookup_info *info);
88
89int
90ext2_htree_has_idx(struct inode *ip)
91{
92 if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) &&
93 ip->i_flag & IN_E4INDEX)
93 ip->i_flag & IN_E3INDEX)
94 return (1);
95 else
96 return (0);
97}
98
99static int
100ext2_htree_check_next(struct inode *ip, uint32_t hash, const char *name,
101 struct ext2fs_htree_lookup_info *info)

--- 546 unchanged lines hidden (view full) ---

648 dirlen = (char *)root + blksize - (char *)ep;
649 memcpy(buf1, ep, dirlen);
650 ep = (struct ext2fs_direct_2 *)buf1;
651 while ((char *)ep < buf1 + dirlen)
652 ep = (struct ext2fs_direct_2 *)
653 ((char *)ep + ep->e2d_reclen);
654 ep->e2d_reclen = buf1 + blksize - (char *)ep;
655
94 return (1);
95 else
96 return (0);
97}
98
99static int
100ext2_htree_check_next(struct inode *ip, uint32_t hash, const char *name,
101 struct ext2fs_htree_lookup_info *info)

--- 546 unchanged lines hidden (view full) ---

648 dirlen = (char *)root + blksize - (char *)ep;
649 memcpy(buf1, ep, dirlen);
650 ep = (struct ext2fs_direct_2 *)buf1;
651 while ((char *)ep < buf1 + dirlen)
652 ep = (struct ext2fs_direct_2 *)
653 ((char *)ep + ep->e2d_reclen);
654 ep->e2d_reclen = buf1 + blksize - (char *)ep;
655
656 dp->i_flag |= IN_E4INDEX;
656 dp->i_flag |= IN_E3INDEX;
657
658 /*
659 * Initialize index root.
660 */
661 dotdot->e2d_reclen = blksize - EXT2_DIR_REC_LEN(1);
662 memset(&root->h_info, 0, sizeof(root->h_info));
663 root->h_info.h_hash_version = fs->e3fs_def_hash_version;
664 root->h_info.h_info_len = sizeof(root->h_info);

--- 235 unchanged lines hidden ---
657
658 /*
659 * Initialize index root.
660 */
661 dotdot->e2d_reclen = blksize - EXT2_DIR_REC_LEN(1);
662 memset(&root->h_info, 0, sizeof(root->h_info));
663 root->h_info.h_hash_version = fs->e3fs_def_hash_version;
664 root->h_info.h_info_len = sizeof(root->h_info);

--- 235 unchanged lines hidden ---