aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile2
-rw-r--r--kmod/CMakeLists.txt2
-rw-r--r--kmod/muser.c3
-rw-r--r--lib/CMakeLists.txt2
-rw-r--r--lib/caps/pm.h2
-rw-r--r--lib/dma.c4
-rw-r--r--lib/libmuser.c7
-rw-r--r--lib/muser.h8
-rw-r--r--lib/muser_priv.h4
-rw-r--r--lib/pci.h1
-rw-r--r--lib/python_bindings.c78
-rwxr-xr-xlib/python_bindings_install.sh2
-rw-r--r--lib/setup.py2
-rw-r--r--samples/CMakeLists.txt2
15 files changed, 63 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47a8e6f..7975983 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/Makefile b/Makefile
index 11bd3fe..5a4482e 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/kmod/CMakeLists.txt b/kmod/CMakeLists.txt
index 74d3047..685cf2b 100644
--- a/kmod/CMakeLists.txt
+++ b/kmod/CMakeLists.txt
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/kmod/muser.c b/kmod/muser.c
index f0b4700..2102c09 100644
--- a/kmod/muser.c
+++ b/kmod/muser.c
@@ -441,7 +441,6 @@ static void unpin_pages(struct page_map *const pg_map)
pg_map->pages = NULL;
}
-
static int vm_insert_pages(struct vm_area_struct *const vma,
struct page *const pages[], const int nr_pages)
{
@@ -1006,7 +1005,7 @@ static ssize_t muser_read(struct mdev_device *mdev, char __user *buf,
_count = err;
else
_count = mucmd.muser_cmd.err;
-
+
if (_count < 0)
muser_dbg("failed to process read: %d, %d\n", err,
mucmd.muser_cmd.err);
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 3a0a811..1ae48f2 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/lib/caps/pm.h b/lib/caps/pm.h
index 942f28a..f62ac44 100644
--- a/lib/caps/pm.h
+++ b/lib/caps/pm.h
@@ -44,7 +44,7 @@ struct pc {
unsigned int auxc:3;
unsigned int d1s:1;
unsigned int d2s:1;
- unsigned int psup:5;
+ unsigned int psup:5;
} __attribute__((packed));
_Static_assert(sizeof(struct pc) == 0x2, "bad PC size");
diff --git a/lib/dma.c b/lib/dma.c
index 40b12b3..400d01e 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -13,7 +13,7 @@
* * Neither the name of Nutanix nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -25,7 +25,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
- *
+ *
*/
#include <sys/types.h>
diff --git a/lib/libmuser.c b/lib/libmuser.c
index d7f62a5..9ba163e 100644
--- a/lib/libmuser.c
+++ b/lib/libmuser.c
@@ -648,7 +648,7 @@ lm_get_region(const loff_t pos, const size_t count, loff_t * const off)
r = offset_to_region(pos);
if (offset_to_region(pos + count) != r) {
- return -ENOENT;
+ return -ENOENT;
}
*off = pos - region_to_offset(r);
return r;
@@ -707,7 +707,7 @@ do_access(lm_ctx_t * const lm_ctx, char * const buf, size_t count, loff_t pos,
if (idx < 0 || idx >= LM_DEV_NUM_REGS) {
lm_log(lm_ctx, LM_ERR, "bad region %d\n", idx);
return -EINVAL;
- }
+ }
if (idx == LM_DEV_CFG_REG_IDX) {
return handle_pci_config_space_access(lm_ctx, buf, count, offset,
@@ -781,7 +781,6 @@ lm_access(lm_ctx_t * const lm_ctx, char *buf, size_t count,
return done;
}
-
static inline int
muser_access(lm_ctx_t * const lm_ctx, struct muser_cmd *const cmd,
const bool is_write)
@@ -1116,7 +1115,7 @@ lm_caps_init(lm_ctx_t *lm_ctx, lm_cap_t *caps, int nr_caps)
}
lm_ctx->pci_config_space->hdr.sts.cl = 0x1;
- lm_ctx->pci_config_space->hdr.cap = PCI_STD_HEADER_SIZEOF;
+ lm_ctx->pci_config_space->hdr.cap = PCI_STD_HEADER_SIZEOF;
return 0;
}
diff --git a/lib/muser.h b/lib/muser.h
index 67050f4..f0756a7 100644
--- a/lib/muser.h
+++ b/lib/muser.h
@@ -92,7 +92,7 @@ struct lm_sparse_mmap_areas {
typedef ssize_t (lm_region_access_t) (void *pvt, char * const buf, size_t count,
loff_t offset, const bool is_write);
-/**
+/**
* Prototype for memory access callback. The program MUST first map device
* memory in its own virtual address space using lm_mmap, do any additional
* work required, and finally return that memory. When a region is memory
@@ -114,7 +114,7 @@ typedef unsigned long (lm_map_region_t) (void *pvt, unsigned long off,
*
* @lm_ctx: the libmuser context to create mapping from
* @offset: offset of the region being mapped
- * @length: size of the region being mapped
+ * @length: size of the region being mapped
*
* @returns a pointer to the requested memory or MAP_FAILED on error. Sets errno.
*/
@@ -188,7 +188,7 @@ typedef struct {
/*
* Class code.
- */
+ */
lm_pci_hdr_cc_t cc;
} lm_pci_info_t;
@@ -299,7 +299,6 @@ typedef struct {
* Number of capabilities in above array.
*/
int nr_caps;
-
} lm_dev_info_t;
/**
@@ -326,7 +325,6 @@ void lm_ctx_destroy(lm_ctx_t * lm_ctx);
*
* @returns 0 on success, -errno on failure.
*/
-
int lm_ctx_drive(lm_ctx_t * lm_ctx);
/**
diff --git a/lib/muser_priv.h b/lib/muser_priv.h
index e5af663..950cb39 100644
--- a/lib/muser_priv.h
+++ b/lib/muser_priv.h
@@ -2,8 +2,8 @@
int
muser_pci_hdr_access(lm_ctx_t * const lm_ctx, size_t * const count,
- loff_t * const pos, const bool write,
- unsigned char *const buf);
+ loff_t * const pos, const bool write,
+ unsigned char *const buf);
lm_reg_info_t *lm_get_region_info(lm_ctx_t * const lm_ctx);
diff --git a/lib/pci.h b/lib/pci.h
index e4b7a78..6e018de 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -35,7 +35,6 @@
#include <stdint.h>
#include <stdbool.h>
-
#include <linux/pci_regs.h>
/*
diff --git a/lib/python_bindings.c b/lib/python_bindings.c
index 874a58d..75bef91 100644
--- a/lib/python_bindings.c
+++ b/lib/python_bindings.c
@@ -52,7 +52,7 @@ handle_read(char *dst, PyObject *result, int count)
*
* FIXME need a way to provide private pointer.
*/
-static ssize_t
+static ssize_t
region_access_wrap(void *pvt, char * const buf, size_t count, loff_t offset,
const bool is_write, int region)
{
@@ -107,16 +107,17 @@ REGION_WRAP(6)
REGION_WRAP(7)
REGION_WRAP(8)
-static ssize_t (*region_access_wraps[LM_DEV_NUM_REGS])(void*, char * const, size_t, loff_t, const bool) = {
- r_0_wrap,
- r_1_wrap,
- r_2_wrap,
- r_3_wrap,
- r_4_wrap,
- r_5_wrap,
- r_6_wrap,
- r_7_wrap,
- r_8_wrap
+static ssize_t (*region_access_wraps[LM_DEV_NUM_REGS])(void *, char *, size_t,
+ loff_t, bool) = {
+ r_0_wrap,
+ r_1_wrap,
+ r_2_wrap,
+ r_3_wrap,
+ r_4_wrap,
+ r_5_wrap,
+ r_6_wrap,
+ r_7_wrap,
+ r_8_wrap
};
struct _region_info {
@@ -155,25 +156,30 @@ libmuser_run(PyObject *self, PyObject *args, PyObject *kwargs)
int i;
struct _region_info _ri[LM_DEV_NUM_REGS] = { 0 };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "HHs|Oi(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)IIIII", kwlist,
- &dev_info.pci_info.id.vid,
- &dev_info.pci_info.id.did,
- &dev_info.uuid,
- &log_fn, &log_lvl,
- &_ri[0].perm, &_ri[0].size, &_ri[0].fn,
- &_ri[1].perm, &_ri[1].size, &_ri[1].fn,
- &_ri[2].perm, &_ri[2].size, &_ri[2].fn,
- &_ri[3].perm, &_ri[3].size, &_ri[3].fn,
- &_ri[4].perm, &_ri[4].size, &_ri[4].fn,
- &_ri[5].perm, &_ri[5].size, &_ri[5].fn,
- &_ri[6].perm, &_ri[6].size, &_ri[6].fn,
- &_ri[7].perm, &_ri[7].size, &_ri[7].fn,
- &_ri[8].perm, &_ri[8].size, &_ri[8].fn,
- &dev_info.pci_info.irq_count[0],
- &dev_info.pci_info.irq_count[1],
- &dev_info.pci_info.irq_count[2],
- &dev_info.pci_info.irq_count[3],
- &dev_info.pci_info.irq_count[4])) {
+ if (!PyArg_ParseTupleAndKeywords(
+ args,
+ kwargs,
+ "HHs|Oi(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)(sIO)IIIII",
+ kwlist,
+ &dev_info.pci_info.id.vid,
+ &dev_info.pci_info.id.did,
+ &dev_info.uuid,
+ &log_fn,
+ &log_lvl,
+ &_ri[0].perm, &_ri[0].size, &_ri[0].fn,
+ &_ri[1].perm, &_ri[1].size, &_ri[1].fn,
+ &_ri[2].perm, &_ri[2].size, &_ri[2].fn,
+ &_ri[3].perm, &_ri[3].size, &_ri[3].fn,
+ &_ri[4].perm, &_ri[4].size, &_ri[4].fn,
+ &_ri[5].perm, &_ri[5].size, &_ri[5].fn,
+ &_ri[6].perm, &_ri[6].size, &_ri[6].fn,
+ &_ri[7].perm, &_ri[7].size, &_ri[7].fn,
+ &_ri[8].perm, &_ri[8].size, &_ri[8].fn,
+ &dev_info.pci_info.irq_count[0],
+ &dev_info.pci_info.irq_count[1],
+ &dev_info.pci_info.irq_count[2],
+ &dev_info.pci_info.irq_count[3],
+ &dev_info.pci_info.irq_count[4])) {
return NULL;
}
@@ -205,7 +211,7 @@ libmuser_run(PyObject *self, PyObject *args, PyObject *kwargs)
}
if (log_fn != NULL) {
- if (!PyCallable_Check(log_fn)) {
+ if (!PyCallable_Check(log_fn)) {
return NULL;
}
dev_info.log = _log_fn;
@@ -217,14 +223,18 @@ libmuser_run(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyMethodDef LibmuserMethods[] = {
- {"run", (PyCFunction)libmuser_run, METH_VARARGS | METH_KEYWORDS, "runs a device"},
- {NULL, NULL, 0, NULL}
+ { "run",
+ (PyCFunction)libmuser_run,
+ METH_VARARGS | METH_KEYWORDS,
+ "runs a device"
+ },
+ { NULL, NULL, 0, NULL }
};
PyMODINIT_FUNC
initmuser(void)
{
- (void) Py_InitModule("muser", LibmuserMethods);
+ (void)Py_InitModule("muser", LibmuserMethods);
}
/* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lib/python_bindings_install.sh b/lib/python_bindings_install.sh
index 7b209f2..d1cb3fd 100755
--- a/lib/python_bindings_install.sh
+++ b/lib/python_bindings_install.sh
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/lib/setup.py b/lib/setup.py
index b1ad34c..73bd93d 100644
--- a/lib/setup.py
+++ b/lib/setup.py
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
index 8a03c30..7f30be5 100644
--- a/samples/CMakeLists.txt
+++ b/samples/CMakeLists.txt
@@ -15,7 +15,7 @@
# * Neither the name of Nutanix nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE