Re: [PATCH v8] fs: Add VirtualBox guest shared folder (vboxsf) support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.0]
[cannot apply to next-20190306]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Hans-de-Goede/fs-Add-VirtualBox-guest-shared-folder-vboxsf-support/20190307-231837
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

All warnings (new ones prefixed by >>):

>> fs/vboxsf/file.c:215:17: sparse: warning: incorrect type in initializer (incompatible argument 2 (different address spaces))
   fs/vboxsf/file.c:215:17: sparse:    expected long ( *read )( ... )
   fs/vboxsf/file.c:215:17: sparse:    got long ( * )( ... )
   fs/vboxsf/file.c:217:18: sparse: warning: incorrect type in initializer (incompatible argument 2 (different address spaces))
   fs/vboxsf/file.c:217:18: sparse:    expected long ( *write )( ... )
   fs/vboxsf/file.c:217:18: sparse:    got long ( * )( ... )
>> fs/vboxsf/file.c:288:5: sparse: warning: symbol 'sf_write_end' was not declared. Should it be static?

sparse warnings: (new ones prefixed by >>)

   fs/vboxsf/file.c:215:17: sparse: warning: incorrect type in initializer (incompatible argument 2 (different address spaces))
>> fs/vboxsf/file.c:215:17: sparse:    expected long ( *read )( ... )
>> fs/vboxsf/file.c:215:17: sparse:    got long ( * )( ... )
   fs/vboxsf/file.c:217:18: sparse: warning: incorrect type in initializer (incompatible argument 2 (different address spaces))
>> fs/vboxsf/file.c:217:18: sparse:    expected long ( *write )( ... )
   fs/vboxsf/file.c:217:18: sparse:    got long ( * )( ... )
   fs/vboxsf/file.c:288:5: sparse: warning: symbol 'sf_write_end' was not declared. Should it be static?

vim +215 fs/vboxsf/file.c

   213	
   214	const struct file_operations vboxsf_reg_fops = {
 > 215		.read = sf_reg_read,
   216		.open = sf_reg_open,
 > 217		.write = sf_reg_write,
   218		.release = sf_reg_release,
   219		.mmap = generic_file_mmap,
   220		.splice_read = generic_file_splice_read,
   221		.read_iter = generic_file_read_iter,
   222		.write_iter = generic_file_write_iter,
   223		.fsync = noop_fsync,
   224		.llseek = generic_file_llseek,
   225	};
   226	
   227	const struct inode_operations vboxsf_reg_iops = {
   228		.getattr = vboxsf_getattr,
   229		.setattr = vboxsf_setattr
   230	};
   231	
   232	static int sf_readpage(struct file *file, struct page *page)
   233	{
   234		struct sf_glob_info *sf_g = GET_GLOB_INFO(file_inode(file)->i_sb);
   235		struct sf_reg_info *sf_r = file->private_data;
   236		loff_t off = page_offset(page);
   237		u32 nread = PAGE_SIZE;
   238		u8 *buf;
   239		int err;
   240	
   241		buf = kmap(page);
   242	
   243		err = vboxsf_read(sf_g->root, sf_r->handle, off, &nread, buf, false);
   244		if (err == 0) {
   245			memset(&buf[nread], 0, PAGE_SIZE - nread);
   246			flush_dcache_page(page);
   247			SetPageUptodate(page);
   248		} else {
   249			SetPageError(page);
   250		}
   251	
   252		kunmap(page);
   253		unlock_page(page);
   254		return err;
   255	}
   256	
   257	static int sf_writepage(struct page *page, struct writeback_control *wbc)
   258	{
   259		struct inode *inode = page->mapping->host;
   260		struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
   261		struct sf_inode_info *sf_i = GET_INODE_INFO(inode);
   262		struct sf_reg_info *sf_r = sf_i->file->private_data;
   263		loff_t off = page_offset(page);
   264		loff_t size = i_size_read(inode);
   265		u32 nwrite = PAGE_SIZE;
   266		u8 *buf;
   267		int err;
   268	
   269		if (off + PAGE_SIZE > size)
   270			nwrite = size & ~PAGE_MASK;
   271	
   272		buf = kmap(page);
   273		err = vboxsf_write(sf_g->root, sf_r->handle, off, &nwrite, buf, false);
   274		kunmap(page);
   275	
   276		if (err == 0) {
   277			ClearPageError(page);
   278			/* mtime changed */
   279			sf_i->force_restat = 1;
   280		} else {
   281			ClearPageUptodate(page);
   282		}
   283	
   284		unlock_page(page);
   285		return err;
   286	}
   287	
 > 288	int sf_write_end(struct file *file, struct address_space *mapping, loff_t pos,
   289			 unsigned int len, unsigned int copied, struct page *page,
   290			 void *fsdata)
   291	{
   292		struct inode *inode = mapping->host;
   293		struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
   294		struct sf_reg_info *sf_r = file->private_data;
   295		unsigned int from = pos & ~PAGE_MASK;
   296		u32 nwritten = len;
   297		u8 *buf;
   298		int err;
   299	
   300		buf = kmap(page);
   301		err = vboxsf_write(sf_g->root, sf_r->handle, pos, &nwritten,
   302				   buf + from, false);
   303		kunmap(page);
   304	
   305		if (err) {
   306			nwritten = 0;
   307			goto out;
   308		}
   309	
   310		/* mtime changed */
   311		GET_INODE_INFO(inode)->force_restat = 1;
   312	
   313		if (!PageUptodate(page) && nwritten == PAGE_SIZE)
   314			SetPageUptodate(page);
   315	
   316		pos += nwritten;
   317		if (pos > inode->i_size)
   318			i_size_write(inode, pos);
   319	
   320	out:
   321		unlock_page(page);
   322		put_page(page);
   323	
   324		return nwritten;
   325	}
   326	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux