dir.c (5e2aa2ed08e2e280121dc7cf5609c87d464f12ef) dir.c (89ac9b4d3d1a049ae1054f99b1aed81092cd0a82)
1/*
2 * linux/fs/hfsplus/dir.c
3 *
4 * Copyright (C) 2001
5 * Brad Boyer (flar@allandria.com)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 * Handling of directories

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

39 u16 type;
40
41 sb = dir->i_sb;
42
43 dentry->d_fsdata = NULL;
44 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
45 if (err)
46 return ERR_PTR(err);
1/*
2 * linux/fs/hfsplus/dir.c
3 *
4 * Copyright (C) 2001
5 * Brad Boyer (flar@allandria.com)
6 * (C) 2003 Ardis Technologies <roman@ardistech.com>
7 *
8 * Handling of directories

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

39 u16 type;
40
41 sb = dir->i_sb;
42
43 dentry->d_fsdata = NULL;
44 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
45 if (err)
46 return ERR_PTR(err);
47 hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name);
47 err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino,
48 &dentry->d_name);
49 if (unlikely(err < 0))
50 goto fail;
48again:
49 err = hfs_brec_read(&fd, &entry, sizeof(entry));
50 if (err) {
51 if (err == -ENOENT) {
52 hfs_find_exit(&fd);
53 /* No such entry */
54 inode = NULL;
55 goto out;

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

92 cnid = (unsigned long)dentry->d_fsdata;
93 linkid = 0;
94 } else {
95 dentry->d_fsdata = (void *)(unsigned long)cnid;
96 linkid =
97 be32_to_cpu(entry.file.permissions.dev);
98 str.len = sprintf(name, "iNode%d", linkid);
99 str.name = name;
51again:
52 err = hfs_brec_read(&fd, &entry, sizeof(entry));
53 if (err) {
54 if (err == -ENOENT) {
55 hfs_find_exit(&fd);
56 /* No such entry */
57 inode = NULL;
58 goto out;

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

95 cnid = (unsigned long)dentry->d_fsdata;
96 linkid = 0;
97 } else {
98 dentry->d_fsdata = (void *)(unsigned long)cnid;
99 linkid =
100 be32_to_cpu(entry.file.permissions.dev);
101 str.len = sprintf(name, "iNode%d", linkid);
102 str.name = name;
100 hfsplus_cat_build_key(sb, fd.search_key,
103 err = hfsplus_cat_build_key(sb, fd.search_key,
101 HFSPLUS_SB(sb)->hidden_dir->i_ino,
102 &str);
104 HFSPLUS_SB(sb)->hidden_dir->i_ino,
105 &str);
106 if (unlikely(err < 0))
107 goto fail;
103 goto again;
104 }
105 } else if (!dentry->d_fsdata)
106 dentry->d_fsdata = (void *)(unsigned long)cnid;
107 } else {
108 pr_err("invalid catalog entry type in lookup\n");
109 err = -EIO;
110 goto fail;

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

140 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
141 if (err)
142 return err;
143 strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN + 1, GFP_KERNEL);
144 if (!strbuf) {
145 err = -ENOMEM;
146 goto out;
147 }
108 goto again;
109 }
110 } else if (!dentry->d_fsdata)
111 dentry->d_fsdata = (void *)(unsigned long)cnid;
112 } else {
113 pr_err("invalid catalog entry type in lookup\n");
114 err = -EIO;
115 goto fail;

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

145 err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd);
146 if (err)
147 return err;
148 strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_MAX_STRLEN + 1, GFP_KERNEL);
149 if (!strbuf) {
150 err = -ENOMEM;
151 goto out;
152 }
148 hfsplus_cat_build_key(sb, fd.search_key, inode->i_ino, NULL);
153 hfsplus_cat_build_key_with_cnid(sb, fd.search_key, inode->i_ino);
149 err = hfs_brec_find(&fd, hfs_find_rec_by_key);
150 if (err)
151 goto out;
152
153 if (ctx->pos == 0) {
154 /* This is completely artificial... */
155 if (!dir_emit_dot(file, ctx))
156 goto out;

--- 415 unchanged lines hidden ---
154 err = hfs_brec_find(&fd, hfs_find_rec_by_key);
155 if (err)
156 goto out;
157
158 if (ctx->pos == 0) {
159 /* This is completely artificial... */
160 if (!dir_emit_dot(file, ctx))
161 goto out;

--- 415 unchanged lines hidden ---