aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/obdclass/linux
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/linux')
-rw-r--r--drivers/staging/lustre/lustre/obdclass/linux/linux-module.c48
-rw-r--r--drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c4
-rw-r--r--drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c10
3 files changed, 29 insertions, 33 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index d2c3072541d1..d1a57ebfda95 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -83,27 +83,26 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
struct obd_ioctl_data *data;
int err;
int offset = 0;
- ENTRY;
err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));
if ( err )
- RETURN(err);
+ return err;
if (hdr.ioc_version != OBD_IOCTL_VERSION) {
CERROR("Version mismatch kernel (%x) vs application (%x)\n",
OBD_IOCTL_VERSION, hdr.ioc_version);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr.ioc_len > OBD_MAX_IOCTL_BUFFER) {
CERROR("User buffer len %d exceeds %d max buffer\n",
hdr.ioc_len, OBD_MAX_IOCTL_BUFFER);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr.ioc_len < sizeof(struct obd_ioctl_data)) {
CERROR("User buffer too small for ioctl (%d)\n", hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* When there are lots of processes calling vmalloc on multi-core
@@ -114,7 +113,7 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
if (*buf == NULL) {
CERROR("Cannot allocate control buffer of len %d\n",
hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
*len = hdr.ioc_len;
data = (struct obd_ioctl_data *)*buf;
@@ -122,13 +121,13 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
err = copy_from_user(*buf, (void *)arg, hdr.ioc_len);
if ( err ) {
OBD_FREE_LARGE(*buf, hdr.ioc_len);
- RETURN(err);
+ return err;
}
if (obd_ioctl_is_invalid(data)) {
CERROR("ioctl not correctly formatted\n");
OBD_FREE_LARGE(*buf, hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (data->ioc_inllen1) {
@@ -150,7 +149,6 @@ int obd_ioctl_getdata(char **buf, int *len, void *arg)
data->ioc_inlbuf4 = &data->ioc_bulk[0] + offset;
}
- EXIT;
return 0;
}
EXPORT_SYMBOL(obd_ioctl_getdata);
@@ -169,19 +167,15 @@ EXPORT_SYMBOL(obd_ioctl_popdata);
/* opening /dev/obd */
static int obd_class_open(struct inode * inode, struct file * file)
{
- ENTRY;
-
try_module_get(THIS_MODULE);
- RETURN(0);
+ return 0;
}
/* closing /dev/obd */
static int obd_class_release(struct inode * inode, struct file * file)
{
- ENTRY;
-
module_put(THIS_MODULE);
- RETURN(0);
+ return 0;
}
/* to control /dev/obd */
@@ -189,17 +183,16 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
int err = 0;
- ENTRY;
/* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
- RETURN(err = -EACCES);
+ return err = -EACCES;
if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
- RETURN(err = -ENOTTY);
+ return err = -ENOTTY;
err = class_handle_ioctl(cmd, (unsigned long)arg);
- RETURN(err);
+ return err;
}
/* declare character device */
@@ -211,7 +204,7 @@ static struct file_operations obd_psdev_fops = {
};
/* modules setup */
-psdev_t obd_psdev = {
+struct miscdevice obd_psdev = {
.minor = OBD_DEV_MINOR,
.name = OBD_DEV_NAME,
.fops = &obd_psdev_fops,
@@ -385,24 +378,29 @@ struct file_operations obd_device_list_fops = {
int class_procfs_init(void)
{
- int rc;
- ENTRY;
+ int rc = 0;
obd_sysctl_init();
proc_lustre_root = lprocfs_register("fs/lustre", NULL,
lprocfs_base, NULL);
+ if (IS_ERR(proc_lustre_root)) {
+ rc = PTR_ERR(proc_lustre_root);
+ proc_lustre_root = NULL;
+ goto out;
+ }
+
rc = lprocfs_seq_create(proc_lustre_root, "devices", 0444,
&obd_device_list_fops, NULL);
+out:
if (rc)
CERROR("error adding /proc/fs/lustre/devices file\n");
- RETURN(0);
+ return 0;
}
int class_procfs_clean(void)
{
- ENTRY;
if (proc_lustre_root) {
lprocfs_remove(&proc_lustre_root);
}
- RETURN(0);
+ return 0;
}
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
index 6ee347153a16..d3bb5ffc564b 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
@@ -213,9 +213,9 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
if (valid & OBD_MD_FLMODE)
dst->i_mode = (dst->i_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
if (valid & OBD_MD_FLUID)
- dst->i_uid = src->o_uid;
+ dst->i_uid = make_kuid(&init_user_ns, src->o_uid);
if (valid & OBD_MD_FLGID)
- dst->i_gid = src->o_gid;
+ dst->i_gid = make_kgid(&init_user_ns, src->o_gid);
if (valid & OBD_MD_FLFLAGS)
dst->i_flags = src->o_flags;
}
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 46aad6813cab..acd2619227df 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -38,8 +38,6 @@
#include <linux/sysctl.h>
#include <linux/sched.h>
#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/version.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/stat.h>
@@ -202,12 +200,12 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb)
1 << (20 - PAGE_CACHE_SHIFT));
/* Don't allow them to let dirty pages exceed 90% of system
* memory and set a hard minimum of 4MB. */
- if (obd_max_dirty_pages > ((num_physpages / 10) * 9)) {
+ if (obd_max_dirty_pages > ((totalram_pages / 10) * 9)) {
CERROR("Refusing to set max dirty pages to %u, which "
"is more than 90%% of available RAM; setting "
"to %lu\n", obd_max_dirty_pages,
- ((num_physpages / 10) * 9));
- obd_max_dirty_pages = ((num_physpages / 10) * 9);
+ ((totalram_pages / 10) * 9));
+ obd_max_dirty_pages = ((totalram_pages / 10) * 9);
} else if (obd_max_dirty_pages < 4 << (20 - PAGE_CACHE_SHIFT)) {
obd_max_dirty_pages = 4 << (20 - PAGE_CACHE_SHIFT);
}
@@ -431,7 +429,7 @@ void obd_sysctl_init (void)
{
#ifdef CONFIG_SYSCTL
if ( !obd_table_header )
- obd_table_header = cfs_register_sysctl_table(parent_table, 0);
+ obd_table_header = register_sysctl_table(parent_table);
#endif
}