Whamcloud - gitweb
LU-819 utils: Fix lfs getstripe -M
[fs/lustre-release.git] / lustre / llite / dir.c
index dcd4331..27edd96 100644 (file)
@@ -1028,9 +1028,14 @@ out:
         RETURN(rc);
 }
 
-static int ll_dir_ioctl(struct inode *inode, struct file *file,
+#ifdef HAVE_UNLOCKED_IOCTL
+static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+#else
+static int  ll_dir_ioctl(struct inode *unuse, struct file *file,
                         unsigned int cmd, unsigned long arg)
+#endif
 {
+        struct inode *inode = file->f_dentry->d_inode;
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct obd_ioctl_data *data;
         int rc = 0;
@@ -1472,15 +1477,9 @@ out_free:
                 OBD_FREE_PTR(qctl);
                 RETURN(rc);
         }
-        case OBD_IOC_GETNAME: {
-                struct obd_device *obd = class_exp2obd(sbi->ll_dt_exp);
-                if (!obd)
-                        RETURN(-EFAULT);
-                if (cfs_copy_to_user((void *)arg, obd->obd_name,
-                                     strlen(obd->obd_name) + 1))
-                        RETURN (-EFAULT);
-                RETURN(0);
-        }
+        case OBD_IOC_GETDTNAME:
+        case OBD_IOC_GETMDNAME:
+                RETURN(ll_get_obd_name(inode, cmd, arg));
         case LL_IOC_FLUSHCTX:
                 RETURN(ll_flush_ctx(inode));
 #ifdef CONFIG_FS_POSIX_ACL
@@ -1614,6 +1613,10 @@ struct file_operations ll_dir_operations = {
         .release  = ll_dir_release,
         .read     = generic_read_dir,
         .readdir  = ll_readdir,
-        .ioctl    = ll_dir_ioctl,
-        .fsync    = ll_fsync
+#ifdef HAVE_UNLOCKED_IOCTL
+        .unlocked_ioctl   = ll_dir_ioctl,
+#else
+        .ioctl          = ll_dir_ioctl,
+#endif
+        .fsync    = ll_fsync,
 };