vserver 1.9.3
[linux-2.6.git] / fs / ntfs / index.c
index f4396a0..b19a488 100644 (file)
@@ -65,7 +65,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx)
        if (ictx->entry) {
                if (ictx->is_in_root) {
                        if (ictx->actx)
-                               put_attr_search_ctx(ictx->actx);
+                               ntfs_attr_put_search_ctx(ictx->actx);
                        if (ictx->base_ni)
                                unmap_mft_record(ictx->base_ni);
                } else {
@@ -125,6 +125,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx)
 int ntfs_index_lookup(const void *key, const int key_len,
                ntfs_index_context *ictx)
 {
+       VCN vcn, old_vcn;
        ntfs_inode *idx_ni = ictx->idx_ni;
        ntfs_volume *vol = idx_ni->vol;
        struct super_block *sb = vol->sb;
@@ -133,13 +134,11 @@ int ntfs_index_lookup(const void *key, const int key_len,
        INDEX_ROOT *ir;
        INDEX_ENTRY *ie;
        INDEX_ALLOCATION *ia;
-       u8 *index_end;
-       attr_search_context *actx;
-       int rc, err = 0;
-       VCN vcn, old_vcn;
+       u8 *index_end, *kaddr;
+       ntfs_attr_search_ctx *actx;
        struct address_space *ia_mapping;
        struct page *page;
-       u8 *kaddr;
+       int rc, err = 0;
 
        ntfs_debug("Entering.");
        BUG_ON(!NInoAttr(idx_ni));
@@ -157,22 +156,25 @@ int ntfs_index_lookup(const void *key, const int key_len,
        }
        /* Get hold of the mft record for the index inode. */
        m = map_mft_record(base_ni);
-       if (unlikely(IS_ERR(m))) {
+       if (IS_ERR(m)) {
                ntfs_error(sb, "map_mft_record() failed with error code %ld.",
                                -PTR_ERR(m));
                return PTR_ERR(m);
        }
-       actx = get_attr_search_ctx(base_ni, m);
+       actx = ntfs_attr_get_search_ctx(base_ni, m);
        if (unlikely(!actx)) {
                err = -ENOMEM;
                goto err_out;
        }
        /* Find the index root attribute in the mft record. */
-       if (!lookup_attr(AT_INDEX_ROOT, idx_ni->name, idx_ni->name_len,
-                       CASE_SENSITIVE, 0, NULL, 0, actx)) {
-               ntfs_error(sb, "Index root attribute missing in inode 0x%lx.",
-                               idx_ni->mft_no);
-               err = -EIO;
+       err = ntfs_attr_lookup(AT_INDEX_ROOT, idx_ni->name, idx_ni->name_len,
+                       CASE_SENSITIVE, 0, NULL, 0, actx);
+       if (unlikely(err)) {
+               if (err == -ENOENT) {
+                       ntfs_error(sb, "Index root attribute missing in inode "
+                                       "0x%lx.", idx_ni->mft_no);
+                       err = -EIO;
+               }
                goto err_out;
        }
        /* Get to the index root value (it has been verified in read_inode). */
@@ -263,13 +265,13 @@ done:
                goto err_out;
        }
        /* Get the starting vcn of the index_block holding the child node. */
-       vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8);
+       vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8));
        ia_mapping = VFS_I(idx_ni)->i_mapping;
        /*
         * We are done with the index root and the mft record.  Release them,
         * otherwise we deadlock with ntfs_map_page().
         */
-       put_attr_search_ctx(actx);
+       ntfs_attr_put_search_ctx(actx);
        unmap_mft_record(base_ni);
        m = NULL;
        actx = NULL;
@@ -425,7 +427,7 @@ ia_done:
        }
        /* Child node present, descend into it. */
        old_vcn = vcn;
-       vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8);
+       vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8));
        if (vcn >= 0) {
                /*
                 * If vcn is in the same page cache page as old_vcn we recycle
@@ -448,7 +450,7 @@ unm_err_out:
        ntfs_unmap_page(page);
 err_out:
        if (actx)
-               put_attr_search_ctx(actx);
+               ntfs_attr_put_search_ctx(actx);
        if (m)
                unmap_mft_record(base_ni);
        return err;