Whamcloud - gitweb
LU-9859 libcfs: prepare for switch to container_of_safe()
[fs/lustre-release.git] / lustre / llite / llite_nfs.c
index 6f0d511..4907d68 100644 (file)
@@ -177,17 +177,9 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
  * 2 -- contains child file handle and parent file handle;
  * 255 -- error.
  */
-#ifndef HAVE_ENCODE_FH_PARENT
-static int ll_encode_fh(struct dentry *de, u32 *fh, int *plen,
-                       int connectable)
-{
-       struct inode *inode = de->d_inode;
-       struct inode *parent = de->d_parent->d_inode;
-#else
 static int ll_encode_fh(struct inode *inode, u32 *fh, int *plen,
                        struct inode *parent)
 {
-#endif
        int fileid_len = sizeof(struct lustre_file_handle) / 4;
        struct lustre_file_handle *lfh = (void *)fh;
 
@@ -227,9 +219,11 @@ ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, int namelen,
 #endif /* HAVE_FILLDIR_USE_CTX */
        /*
         * It is hack to access lde_fid for comparison with lgd_fid.
-        * So the input 'name' must be part of the 'lu_dirent'.
+        * So the input 'name' must be part of the 'lu_dirent', and
+        * so must appear to be a non-const pointer to an empty array.
         */
-       struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name);
+       char (*n)[0] = (void *)name;
+       struct lu_dirent *lde = container_of0(n, struct lu_dirent, lde_name);
        struct lu_fid fid;
 
        fid_le_to_cpu(&fid, &lde->lde_fid);