Merge branch 'pm-cpuidle'
[linux-block.git] / drivers / staging / lustre / lustre / obdclass / class_obd.c
index af1c2d09c47b2f513bac4d4f9e85a2969d96280b..b1024a6d37dd95ef215a489d07b5de76f2ec3f66 100644 (file)
@@ -112,18 +112,18 @@ int lustre_get_jobid(char *jobid)
 {
        int jobid_len = JOBSTATS_JOBID_SIZE;
        int rc = 0;
-       ENTRY;
 
        memset(jobid, 0, JOBSTATS_JOBID_SIZE);
        /* Jobstats isn't enabled */
        if (strcmp(obd_jobid_var, JOBSTATS_DISABLE) == 0)
-               RETURN(0);
+               return 0;
 
        /* Use process name + fsuid as jobid */
        if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
                snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
-                        current_comm(), current_fsuid());
-               RETURN(0);
+                        current_comm(),
+                        from_kuid(&init_user_ns, current_fsuid()));
+               return 0;
        }
 
        rc = cfs_get_environ(obd_jobid_var, jobid, &jobid_len);
@@ -150,7 +150,7 @@ int lustre_get_jobid(char *jobid)
                               obd_jobid_var, rc);
                }
        }
-       RETURN(rc);
+       return rc;
 }
 EXPORT_SYMBOL(lustre_get_jobid);
 
@@ -193,7 +193,6 @@ int class_resolve_dev_name(__u32 len, const char *name)
        int rc;
        int dev;
 
-       ENTRY;
        if (!len || !name) {
                CERROR("No name passed,!\n");
                GOTO(out, rc = -EINVAL);
@@ -214,7 +213,7 @@ int class_resolve_dev_name(__u32 len, const char *name)
        rc = dev;
 
 out:
-       RETURN(rc);
+       return rc;
 }
 
 int class_handle_ioctl(unsigned int cmd, unsigned long arg)
@@ -224,7 +223,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
        struct libcfs_debug_ioctl_data *debug_data;
        struct obd_device *obd = NULL;
        int err = 0, len = 0;
-       ENTRY;
 
        /* only for debugging */
        if (cmd == LIBCFS_IOC_DEBUG_MASK) {
@@ -237,7 +235,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
        CDEBUG(D_IOCTL, "cmd = %x\n", cmd);
        if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
                CERROR("OBD ioctl: data error\n");
-               RETURN(-EINVAL);
+               return -EINVAL;
        }
        data = (struct obd_ioctl_data *)buf;
 
@@ -428,10 +426,10 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
  out:
        if (buf)
                obd_ioctl_freedata(buf, len);
-       RETURN(err);
+       return err;
 } /* class_handle_ioctl */
 
-extern psdev_t obd_psdev;
+extern struct miscdevice obd_psdev;
 
 #define OBD_INIT_CHECK
 int obd_init_checks(void)
@@ -524,7 +522,7 @@ static int __init init_obdclass(void)
                                         LPROCFS_STATS_FLAG_IRQ_SAFE);
        if (obd_memory == NULL) {
                CERROR("kmalloc of 'obd_memory' failed\n");
-               RETURN(-ENOMEM);
+               return -ENOMEM;
        }
 
        lprocfs_counter_init(obd_memory, OBD_MEMORY_STAT,
@@ -558,10 +556,10 @@ static int __init init_obdclass(void)
        /* Default the dirty page cache cap to 1/2 of system memory.
         * For clients with less memory, a larger fraction is needed
         * for other purposes (mostly for BGL). */
-       if (num_physpages <= 512 << (20 - PAGE_CACHE_SHIFT))
-               obd_max_dirty_pages = num_physpages / 4;
+       if (totalram_pages <= 512 << (20 - PAGE_CACHE_SHIFT))
+               obd_max_dirty_pages = totalram_pages / 4;
        else
-               obd_max_dirty_pages = num_physpages / 2;
+               obd_max_dirty_pages = totalram_pages / 2;
 
        err = obd_init_caches();
        if (err)
@@ -638,7 +636,6 @@ static void cleanup_obdclass(void)
        int lustre_unregister_fs(void);
        __u64 memory_leaked, pages_leaked;
        __u64 memory_max, pages_max;
-       ENTRY;
 
        lustre_unregister_fs();
 
@@ -678,12 +675,12 @@ static void cleanup_obdclass(void)
        CDEBUG((pages_leaked) ? D_ERROR : D_INFO,
               "obd_memory_pages max: "LPU64", leaked: "LPU64"\n",
               pages_max, pages_leaked);
-
-       EXIT;
 }
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION);
 MODULE_LICENSE("GPL");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
 
-cfs_module(obdclass, LUSTRE_VERSION_STRING, init_obdclass, cleanup_obdclass);
+module_init(init_obdclass);
+module_exit(cleanup_obdclass);