diff options
author | Felipe Franciosi <felipe@nutanix.com> | 2019-11-02 05:53:53 +0000 |
---|---|---|
committer | Felipe Franciosi <felipe@nutanix.com> | 2019-11-02 06:37:05 +0000 |
commit | 08d1f382ba4067284c027adb7daf0baf7d3969c9 (patch) | |
tree | 4c4617da945c9279e42c5cbe5b45b59c561621ad /lib | |
parent | be9dcc0364b43f4b0dc954412296a1a867b289e4 (diff) | |
download | libvfio-user-08d1f382ba4067284c027adb7daf0baf7d3969c9.zip libvfio-user-08d1f382ba4067284c027adb7daf0baf7d3969c9.tar.gz libvfio-user-08d1f382ba4067284c027adb7daf0baf7d3969c9.tar.bz2 |
Fix various format issues
Remove various spurious whitespaces and empty lines. Some other
alignment issues, too.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/caps/pm.h | 2 | ||||
-rw-r--r-- | lib/dma.c | 4 | ||||
-rw-r--r-- | lib/libmuser.c | 7 | ||||
-rw-r--r-- | lib/muser.h | 8 | ||||
-rw-r--r-- | lib/muser_priv.h | 4 | ||||
-rw-r--r-- | lib/pci.h | 1 | ||||
-rw-r--r-- | lib/python_bindings.c | 78 | ||||
-rwxr-xr-x | lib/python_bindings_install.sh | 2 | ||||
-rw-r--r-- | lib/setup.py | 2 |
10 files changed, 58 insertions, 52 deletions
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"); @@ -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); @@ -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 |