26 #include <linux/slab.h>
107 struct inode *dent_inode;
111 unsigned long dent_ino;
114 ntfs_debug(
"Looking up %s in directory inode 0x%lx.",
123 return ERR_PTR(uname_len);
129 dent_ino =
MREF(mref);
130 ntfs_debug(
"Found inode 0x%lx. Calling ntfs_iget.", dent_ino);
132 if (
likely(!IS_ERR(dent_inode))) {
135 NTFS_I(dent_inode)->
seq_no ||
149 "0x%lx (reference sequence number = "
150 "0x%x, inode sequence number = 0x%x), "
151 "returning -EIO. Run chkdsk.",
153 NTFS_I(dent_inode)->
seq_no);
155 dent_inode = ERR_PTR(-
EIO);
158 "error code %li.", dent_ino,
159 PTR_ERR(dent_inode));
162 return (
struct dentry *)dent_inode;
166 ntfs_debug(
"Entry was not found, adding negative dentry.");
172 ntfs_error(vol->
sb,
"ntfs_lookup_ino_by_name() failed with error "
182 struct qstr nls_name;
189 (
unsigned char**)&nls_name.name, 0);
198 ni = NTFS_I(dent_inode);
219 "namespace counterpart to DOS "
220 "file name. Run chkdsk.");
227 if (a->non_resident || a->flags)
229 val_len =
le32_to_cpu(a->data.resident.value_length);
234 ctx->
attr->data.resident.value_offset));
235 if ((
u32)(fn->file_name_length *
sizeof(
ntfschar) +
236 sizeof(FILE_NAME_ATTR)) > val_len)
242 (
ntfschar*)&fn->file_name, fn->file_name_length,
243 (
unsigned char**)&nls_name.name, 0);
252 if ((
signed)nls_name.len < 0) {
253 err = (signed)nls_name.len;
258 dent =
d_add_ci(dent, dent_inode, &nls_name);
259 kfree(nls_name.name);
263 ntfs_error(vol->
sb,
"Illegal file name attribute. Run chkdsk.");
271 ntfs_error(vol->
sb,
"Failed, returning error code %i.", err);
280 .lookup = ntfs_lookup,
300 static struct dentry *ntfs_get_parent(
struct dentry *child_dent)
315 return (
struct dentry *)mrec;
330 "file name attribute. Run chkdsk.",
337 fn = (FILE_NAME_ATTR *)((
u8 *)attr +
343 parent_ino =
MREF_LE(fn->parent_directory);
357 if (!IS_ERR(inode)) {
368 int fh_len,
int fh_type)
375 int fh_len,
int fh_type)
401 .get_parent = ntfs_get_parent,
403 .fh_to_dentry = ntfs_fh_to_dentry,
404 .fh_to_parent = ntfs_fh_to_parent,