[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v3 4/5] lib/devfs: Fix checkpath warnings
From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx> --- lib/devfs/devfs_vnops.c | 36 +++++++++++++++++++----------------- lib/devfs/device.c | 4 ++-- lib/devfs/include/device.h | 22 ++++++++++++---------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/lib/devfs/devfs_vnops.c b/lib/devfs/devfs_vnops.c index 617ed359..014282f3 100644 --- a/lib/devfs/devfs_vnops.c +++ b/lib/devfs/devfs_vnops.c @@ -77,21 +77,21 @@ devfs_open(struct vfscore_file *fp) struct device *dev; int error; - DPRINTF(("devfs_open: path=%s\n", path)); + DPRINTF(("%s: path=%s\n", __func__, path)); if (!strcmp(path, "/")) /* root ? */ return 0; if (vp->v_flags & VPROTDEV) { - DPRINTF(("devfs_open: failed to open protected device.\n")); + DPRINTF(("%s: failed to open protected device.\n", __func__)); return EPERM; } if (*path == '/') path++; error = device_open(path, fp->f_flags & DO_RWMASK, &dev); if (error) { - DPRINTF(("devfs_open: can not open device = %s error=%d\n", - path, error)); + DPRINTF(("%s: can not open device = %s error=%d\n", + __func__, path, error)); return error; } vp->v_data = (void *)dev; /* Store private data */ @@ -102,33 +102,35 @@ static int devfs_close(struct vnode *vp, struct vfscore_file *fp) { - DPRINTF(("devfs_close: fp=%x\n", fp)); + DPRINTF(("%s: fp=%x\n", __func__, fp)); if (!strcmp(fp->f_dentry->d_path, "/")) /* root ? */ return 0; - return device_close((struct device*)vp->v_data); + return device_close((struct device *)vp->v_data); } static int -devfs_read(struct vnode *vp, struct vfscore_file *fp, struct uio *uio, int ioflags) +devfs_read(struct vnode *vp, struct vfscore_file *fp, + struct uio *uio, int ioflags) { - return device_read((struct device*)vp->v_data, uio, ioflags); + return device_read((struct device *)vp->v_data, uio, ioflags); } static int devfs_write(struct vnode *vp, struct uio *uio, int ioflags) { - return device_write((struct device*)vp->v_data, uio, ioflags); + return device_write((struct device *)vp->v_data, uio, ioflags); } static int -devfs_ioctl(struct vnode *vp, struct vfscore_file *fp, unsigned long cmd, void *arg) +devfs_ioctl(struct vnode *vp, struct vfscore_file *fp, unsigned long cmd, + void *arg) { int error; - error = device_ioctl((struct device*)vp->v_data, cmd, arg); - DPRINTF(("devfs_ioctl: cmd=%x\n", cmd)); + error = device_ioctl((struct device *)vp->v_data, cmd, arg); + DPRINTF(("%s: cmd=%x\n", __func__, cmd)); return error; } @@ -139,7 +141,7 @@ devfs_lookup(struct vnode *dvp, char *name, struct vnode **vpp) struct vnode *vp; int error, i; - DPRINTF(("devfs_lookup:%s\n", name)); + DPRINTF(("%s:%s\n", __func__, name)); *vpp = NULL; @@ -151,9 +153,9 @@ devfs_lookup(struct vnode *dvp, char *name, struct vnode **vpp) info.cookie = 0; for (;;) { error = device_info(&info); - if (error) { + if (error) return ENOENT; - } + if (!strncmp(info.name, name, MAXDEVNAME)) break; i++; @@ -185,7 +187,7 @@ devfs_readdir(struct vnode *vp, struct vfscore_file *fp, struct dirent *dir) struct devinfo info; int error, i; - DPRINTF(("devfs_readdir offset=%d\n", fp->f_offset)); + DPRINTF(("%s: offset=%d\n", __func__, fp->f_offset)); i = 0; error = 0; @@ -205,7 +207,7 @@ devfs_readdir(struct vnode *vp, struct vfscore_file *fp, struct dirent *dir) dir->d_fileno = fp->f_offset; // dir->d_namlen = strlen(dir->d_name); - DPRINTF(("devfs_readdir: %s\n", dir->d_name)); + DPRINTF(("%s: %s\n", __func__, dir->d_name)); fp->f_offset++; return 0; } diff --git a/lib/devfs/device.c b/lib/devfs/device.c index d878090d..e2cdfe88 100644 --- a/lib/devfs/device.c +++ b/lib/devfs/device.c @@ -57,7 +57,7 @@ static struct uk_mutex devfs_lock = UK_MUTEX_INITIALIZER(devfs_lock); /* list head of the devices */ -static struct device *device_list = NULL; +static struct device *device_list; /* * Look up a device object by device name. @@ -85,7 +85,7 @@ struct partition_table_entry { uint16_t ending_cylinder:10; uint32_t rela_sector; uint32_t total_sectors; -} __attribute__((packed)); +} __packed; void device_register(struct device *dev, const char *name, int flags) diff --git a/lib/devfs/include/device.h b/lib/devfs/include/device.h index 87fdfd80..a26195f0 100644 --- a/lib/devfs/include/device.h +++ b/lib/devfs/include/device.h @@ -122,7 +122,9 @@ struct device { int active; /* device has not been destroyed */ int refcnt; /* reference count */ off_t size; /* device size */ - off_t offset; /* 0 for the main drive, if we have a partition, this is the start address */ + off_t offset; /* 0 for the main drive, if we have a + * partition, this is the start address + */ size_t max_io_size; void *private_data; /* private storage */ @@ -157,13 +159,13 @@ device_get_desc(device_t dev) } static inline void -device_set_desc(device_t dev, const char* desc) +device_set_desc(device_t dev, const char *desc) { dev->desc = desc; } static inline void -device_set_softc(device_t dev, void* softc) +device_set_softc(device_t dev, void *softc) { dev->softc = softc; } @@ -184,12 +186,12 @@ devtoname(struct device *dev) return dev->name; } -int device_open(const char *, int, struct device **); -int device_close(struct device *); -int device_read(struct device *, struct uio *, int); -int device_write(struct device *, struct uio *, int); -int device_ioctl(struct device *, unsigned long, void *); -int device_info(struct devinfo *); +int device_open(const char *name, int mode, struct device **devp); +int device_close(struct device *dev); +int device_read(struct device *dev, struct uio *uio, int ioflags); +int device_write(struct device *dev, struct uio *uio, int ioflags); +int device_ioctl(struct device *dev, unsigned long cmd, void *arg); +int device_info(struct devinfo *info); int bdev_read(struct device *dev, struct uio *uio, int ioflags); int bdev_write(struct device *dev, struct uio *uio, int ioflags); @@ -197,7 +199,7 @@ int bdev_write(struct device *dev, struct uio *uio, int ioflags); int enodev(void); int nullop(void); -struct device * device_create(struct driver *drv, const char *name, int flags); +struct device *device_create(struct driver *drv, const char *name, int flags); int device_destroy(struct device *dev); int device_destroy_locked(struct device *dev); void device_register(struct device *device, const char *name, int flags); -- 2.21.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |