]> err.no Git - linux-2.6/blobdiff - fs/xfs/linux-2.6/xfs_file.c
[XFS] allow enabling CONFIG_XFS_DEBUG
[linux-2.6] / fs / xfs / linux-2.6 / xfs_file.c
index e1fcef2eb9285a6f8f449b72deb1e925c540671d..05905246434dc6e2182d2f5bbbceb2d1c480d828 100644 (file)
@@ -261,9 +261,9 @@ xfs_file_readdir(
 #else
 
 struct hack_dirent {
-       int             namlen;
-       loff_t          offset;
        u64             ino;
+       loff_t          offset;
+       int             namlen;
        unsigned int    d_type;
        char            name[];
 };
@@ -285,8 +285,10 @@ xfs_hack_filldir(
 {
        struct hack_callback *buf = __buf;
        struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used);
+       unsigned int reclen;
 
-       if (buf->used + sizeof(struct hack_dirent) + namlen > buf->len)
+       reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
+       if (buf->used + reclen > buf->len)
                return -EINVAL;
 
        de->namlen = namlen;
@@ -294,7 +296,7 @@ xfs_hack_filldir(
        de->ino = ino;
        de->d_type = d_type;
        memcpy(de->name, name, namlen);
-       buf->used += sizeof(struct hack_dirent) + namlen;
+       buf->used += reclen;
        return 0;
 }
 
@@ -334,7 +336,8 @@ xfs_file_readdir(
                offset = filp->f_pos;
 
        while (!eof) {
-               int reclen;
+               unsigned int reclen;
+
                start_offset = offset;
 
                buf.used = 0;
@@ -348,16 +351,17 @@ xfs_file_readdir(
                size = buf.used;
                de = (struct hack_dirent *)buf.dirent;
                while (size > 0) {
+                       curr_offset = de->offset /* & 0x7fffffff */;
                        if (filldir(dirent, de->name, de->namlen,
                                        curr_offset & 0x7fffffff,
                                        de->ino, de->d_type)) {
                                goto done;
                        }
 
-                       reclen = sizeof(struct hack_dirent) + de->namlen;
+                       reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
+                                      sizeof(u64));
                        size -= reclen;
                        de = (struct hack_dirent *)((char *)de + reclen);
-                       curr_offset = de->offset /* & 0x7fffffff */;
                }
        }
 
@@ -465,16 +469,11 @@ xfs_file_open_exec(
        struct inode    *inode)
 {
        struct xfs_mount *mp = XFS_M(inode->i_sb);
+       struct xfs_inode *ip = XFS_I(inode);
 
-       if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI)) {
-               if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) {
-                       bhv_vnode_t *vp = vn_from_inode(inode);
-
-                       return -XFS_SEND_DATA(mp, DM_EVENT_READ,
-                                               vp, 0, 0, 0, NULL);
-               }
-       }
-
+       if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI) &&
+                    DM_EVENT_ENABLED(ip, DM_EVENT_READ))
+               return -XFS_SEND_DATA(mp, DM_EVENT_READ, ip, 0, 0, 0, NULL);
        return 0;
 }
 #endif /* HAVE_FOP_OPEN_EXEC */