Whamcloud - gitweb
LU-1346 libcfs: replace CFS_CAP_XXX with kernel definition
[fs/lustre-release.git] / libcfs / libcfs / winnt / winnt-module.c
index 530c38a..72edda0 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,7 +24,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -51,7 +49,7 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
         hdr = (struct libcfs_ioctl_hdr *)buf;
         data = (struct libcfs_ioctl_data *)buf;
 
-        err = cfs_copy_from_user(buf, (void *)arg, sizeof(*hdr));
+       err = copy_from_user(buf, (void *)arg, sizeof(*hdr));
         if (err)
                 RETURN(err);
 
@@ -70,7 +68,7 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
                 RETURN(-EINVAL);
         }
 
-        err = cfs_copy_from_user(buf, (void *)arg, hdr->ioc_len);
+       err = copy_from_user(buf, (void *)arg, hdr->ioc_len);
         if (err)
                 RETURN(err);
 
@@ -91,16 +89,16 @@ int libcfs_ioctl_getdata(char *buf, char *end, void *arg)
 
 int libcfs_ioctl_popdata(void *arg, void *data, int size)
 {
-       if (cfs_copy_to_user((char *)arg, data, size))
+       if (copy_to_user((char *)arg, data, size))
                return -EFAULT;
        return 0;
 }
-                                                                                                                                                                       
-extern struct cfs_psdev_ops          libcfs_psdev_ops;
 
-static int 
-libcfs_psdev_open(struct inode *in, cfs_file_t * file)
-{ 
+extern struct cfs_psdev_ops libcfs_psdev_ops;
+
+static int
+libcfs_psdev_open(struct inode *in, struct file *file)
+{
        struct libcfs_device_userstate **pdu = NULL;
        int    rc = 0;
 
@@ -113,8 +111,8 @@ libcfs_psdev_open(struct inode *in, cfs_file_t * file)
 }
 
 /* called when closing /dev/device */
-static int 
-libcfs_psdev_release(struct inode *in, cfs_file_t * file)
+static int
+libcfs_psdev_release(struct inode *in, struct file *file)
 {
        struct libcfss_device_userstate *pdu;
        int    rc = 0;
@@ -127,9 +125,9 @@ libcfs_psdev_release(struct inode *in, cfs_file_t * file)
        return rc;
 }
 
-static int 
-libcfs_ioctl(cfs_file_t * file, unsigned int cmd, ulong_ptr_t arg)
-{ 
+static int
+libcfs_ioctl(struct file *file, unsigned int cmd, ulong_ptr_t arg)
+{
        struct cfs_psdev_file    pfile;
        int    rc = 0;
 
@@ -144,7 +142,7 @@ libcfs_ioctl(cfs_file_t * file, unsigned int cmd, ulong_ptr_t arg)
        /* Handle platform-dependent IOC requests */
        switch (cmd) { 
        case IOC_LIBCFS_PANIC: 
-               if (!cfs_capable(CFS_CAP_SYS_BOOT)) 
+               if (!cfs_capable(CAP_SYS_BOOT))
                        return (-EPERM); 
                CERROR("debugctl-invoked panic");
                KeBugCheckEx('LUFS', (ULONG_PTR)libcfs_ioctl, (ULONG_PTR)NULL, (ULONG_PTR)NULL, (ULONG_PTR)NULL);
@@ -152,7 +150,7 @@ libcfs_ioctl(cfs_file_t * file, unsigned int cmd, ulong_ptr_t arg)
                return (0);
        case IOC_LIBCFS_MEMHOG:
 
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN)) 
+               if (!cfs_capable(CAP_SYS_ADMIN))
                        return -EPERM;
         break;
        }
@@ -176,7 +174,7 @@ static struct file_operations libcfs_fops = {
     /* release:*/ libcfs_psdev_release
 };
 
-cfs_psdev_t libcfs_dev = { 
+struct miscdevice libcfs_dev = {
        LIBCFS_MINOR, 
        "lnet", 
        &libcfs_fops