{
struct dentry *real_dent, *new_dent;
MFT_RECORD *m;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ntfs_inode *ni = NTFS_I(dent_inode);
int err;
struct qstr nls_name;
ctx = NULL;
goto err_out;
}
- ctx = get_attr_search_ctx(ni, m);
- if (!ctx) {
+ ctx = ntfs_attr_get_search_ctx(ni, m);
+ if (unlikely(!ctx)) {
err = -ENOMEM;
goto err_out;
}
ATTR_RECORD *a;
u32 val_len;
- if (!lookup_attr(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0,
- ctx)) {
+ err = ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, 0, 0,
+ NULL, 0, ctx);
+ if (unlikely(err)) {
ntfs_error(vol->sb, "Inode corrupt: No WIN32 "
"namespace counterpart to DOS "
"file name. Run chkdsk.");
- err = -EIO;
+ if (err == -ENOENT)
+ err = -EIO;
goto err_out;
}
/* Consistency checks. */
(ntfschar*)&fn->file_name, fn->file_name_length,
(unsigned char**)&nls_name.name, 0);
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
}
m = NULL;
err = -EIO;
err_out:
if (ctx)
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
if (m)
unmap_mft_record(ni);
iput(dent_inode);
struct inode *vi = child_dent->d_inode;
ntfs_inode *ni = NTFS_I(vi);
MFT_RECORD *mrec;
- attr_search_context *ctx;
+ ntfs_attr_search_ctx *ctx;
ATTR_RECORD *attr;
FILE_NAME_ATTR *fn;
struct inode *parent_vi;
struct dentry *parent_dent;
unsigned long parent_ino;
+ int err;
ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
/* Get the mft record of the inode belonging to the child dentry. */
mrec = map_mft_record(ni);
- if (unlikely(IS_ERR(mrec)))
+ if (IS_ERR(mrec))
return (struct dentry *)mrec;
/* Find the first file name attribute in the mft record. */
- ctx = get_attr_search_ctx(ni, mrec);
+ ctx = ntfs_attr_get_search_ctx(ni, mrec);
if (unlikely(!ctx)) {
unmap_mft_record(ni);
return ERR_PTR(-ENOMEM);
}
try_next:
- if (unlikely(!lookup_attr(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0,
- NULL, 0, ctx))) {
- put_attr_search_ctx(ctx);
+ err = ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, NULL,
+ 0, ctx);
+ if (unlikely(err)) {
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
- ntfs_error(vi->i_sb, "Inode 0x%lx does not have a file name "
- "attribute. Run chkdsk.", vi->i_ino);
- return ERR_PTR(-ENOENT);
+ if (err == -ENOENT)
+ ntfs_error(vi->i_sb, "Inode 0x%lx does not have a "
+ "file name attribute. Run chkdsk.",
+ vi->i_ino);
+ return ERR_PTR(err);
}
attr = ctx->attr;
if (unlikely(attr->non_resident))
/* Get the inode number of the parent directory. */
parent_ino = MREF_LE(fn->parent_directory);
/* Release the search context and the mft record of the child. */
- put_attr_search_ctx(ctx);
+ ntfs_attr_put_search_ctx(ctx);
unmap_mft_record(ni);
/* Get the inode of the parent directory. */
parent_vi = ntfs_iget(vi->i_sb, parent_ino);
- if (unlikely(IS_ERR(parent_vi) || is_bad_inode(parent_vi))) {
+ if (IS_ERR(parent_vi) || unlikely(is_bad_inode(parent_vi))) {
if (!IS_ERR(parent_vi))
iput(parent_vi);
ntfs_error(vi->i_sb, "Failed to get parent directory inode "
ntfs_debug("Entering for inode 0x%lx, generation 0x%x.", ino, gen);
vi = ntfs_iget(sb, ino);
- if (unlikely(IS_ERR(vi))) {
+ if (IS_ERR(vi)) {
ntfs_error(sb, "Failed to get inode 0x%lx.", ino);
return (struct dentry *)vi;
}