Stefan Hajnoczi <stefa...@redhat.com> 于2022年8月23日周二 07:05写道: > > On Tue, Aug 16, 2022 at 02:25:16PM +0800, Sam Li wrote: > > +static int hdev_get_max_segments(int fd, struct stat *st) { > > + int ret; > > + if (S_ISCHR(st->st_mode)) { > > + if (ioctl(fd, SG_GET_SG_TABLESIZE, &ret) == 0) { > > The ioctl must be within #ifdef CONFIG_LINUX since SG_GET_SG_TABLESIZE > will be undefined on other operating systems and a compiler error will > be encountered. Maybe keep the #ifdef around the entire body of this > hdev_get_max_segments(). > > > + return ret; > > + } > > + return -ENOTSUP; > > } > > - g_free(sysfspath); > > - return ret; > > -#else > > - return -ENOTSUP; > > -#endif > > + return get_sysfs_long_val(st, "max_segments"); > > Where is get_sysfs_long_val() defined? Maybe in a later patch? The code > must compile after each patch. You can test this with "git rebase -i > origin/master" and then adding "x make" lines after each commit in the > interactive rebase file. When rebase runs it will execute make after > each commit and will stop if make fails.
Explained in the next patch. I will make sure the patches compile in future.