Re: [PATCH 5/6] tools: hv: Add new fcopy application based on uio driver

Greg KH
2024-02-19T09:52:16Z

On Mon, Feb 19, 2024 at 01:24:21AM -0800, Saurabh Singh Sengar wrote:
> > > +#define HV_RING_SIZE (4 * 4096)
> >
> > Hey, that doesn't match the kernel driver! Why these values?
>
> This application talks to device which is recognize as HV_FCOPY
> is kernel. In the first patch of current patch series I have
> mentioned .pref_ring_size = 0x4000 for HV_FCOPY which matches this.
>
> This code is well tested.

I'm commenting on the fact the 4096 is sometimes PAGE_SIZE and sometimes
not, and you have a default of using PAGE_SIZE values in the kernel
driver, and as such, this will not match up. So be careful here.

> > > +
> > > +unsigned char desc[HV_RING_SIZE];
> > > +
> > > +static int target_fd;
> > > +static char target_fname[PATH_MAX];
> > > +static unsigned long long filesize;
> > > +
> > > +static int hv_fcopy_create_file(char *file_name, char *path_name, __u32 flags)
> > > +{
> > > + int error = HV_E_FAIL;
> > > + char *q, *p;
> > > +
> > > + filesize = 0;
> > > + p = (char *)path_name;
> >
> > Why the unneeded cast?
>
> This code is existing today as form of hv_fcopy_daemon. As this new
> application is replacing hv_fcopy_daemon I reused the same code and
> casting.

That wasn't obvious that this was copied code, please be explicit about
that.

thanks,

greg k-h