[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v4 4/5] lib/devfs: Fix checkpath warnings
Thanks, Vlad! Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx> On 6/7/19 2:58 PM, Vlad-Andrei BĂDOIU (78692) wrote: > 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/devfs/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 edd801c8..9af6aded 100644 > --- a/lib/devfs/devfs_vnops.c > +++ b/lib/devfs/devfs_vnops.c > @@ -71,21 +71,21 @@ devfs_open(struct vfscore_file *fp) > struct device *dev; > int error; > > - uk_pr_debug("devfs_open: path=%s\n", path); > + uk_pr_debug("%s: path=%s\n", __func__, path); > > if (!strcmp(path, "/")) /* root ? */ > return 0; > > if (vp->v_flags & VPROTDEV) { > - uk_pr_debug("devfs_open: failed to open protected device.\n"); > + uk_pr_debug("%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) { > - uk_pr_debug("devfs_open: can not open device = %s error=%d\n", > - path, error); > + uk_pr_debug("%s: can not open device = %s error=%d\n", > + __func__, path, error); > return error; > } > vp->v_data = (void *)dev; /* Store private data */ > @@ -96,33 +96,35 @@ static int > devfs_close(struct vnode *vp, struct vfscore_file *fp) > { > > - uk_pr_debug("devfs_close: fd=%d\n", fp->fd); > + uk_pr_debug("%s: fd=%d\n", __func__, fp->fd); > > 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 __unused, struct uio > *uio, int ioflags) > +devfs_read(struct vnode *vp, struct vfscore_file *fp __unused, > + 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 __unused, unsigned > long cmd, void *arg) > +devfs_ioctl(struct vnode *vp, struct vfscore_file *fp __unused, > + unsigned long cmd, void *arg) > { > int error; > > - error = device_ioctl((struct device*)vp->v_data, cmd, arg); > - uk_pr_debug("devfs_ioctl: cmd=%lu\n", cmd); > + error = device_ioctl((struct device *)vp->v_data, cmd, arg); > + uk_pr_debug("%s: cmd=%lu\n", __func__, cmd); > return error; > } > > @@ -133,7 +135,7 @@ devfs_lookup(struct vnode *dvp, char *name, struct vnode > **vpp) > struct vnode *vp; > int error, i; > > - uk_pr_debug("devfs_lookup:%s\n", name); > + uk_pr_debug("%s:%s\n", __func__, name); > > *vpp = NULL; > > @@ -145,9 +147,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++; > @@ -183,7 +185,7 @@ devfs_readdir(struct vnode *vp __unused, struct > vfscore_file *fp, struct dirent > struct devinfo info; > int error, i; > > - uk_pr_debug("devfs_readdir offset=%li\n", fp->f_offset); > + uk_pr_debug("%s: offset=%li\n", __func__, fp->f_offset); > > i = 0; > error = 0; > @@ -203,7 +205,7 @@ devfs_readdir(struct vnode *vp __unused, struct > vfscore_file *fp, struct dirent > dir->d_fileno = fp->f_offset; > // dir->d_namlen = strlen(dir->d_name); > > - uk_pr_debug("devfs_readdir: %s\n", dir->d_name); > + uk_pr_debug("%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 693a5f9d..7f1e3db2 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/devfs/device.h > b/lib/devfs/include/devfs/device.h > index 6446d330..909020b2 100644 > --- a/lib/devfs/include/devfs/device.h > +++ b/lib/devfs/include/devfs/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); > _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |