Changeset 6054 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Dec 12, 2007 12:42:44 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/regops.c
r5999 r6054 345 345 buf = kmap (page); 346 346 off = (vaddr - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); 347 348 347 err = sf_reg_read_aux (__func__, sf_g, sf_r, buf, &nread, off); 349 348 if (err) { … … 390 389 391 390 struct file_operations sf_reg_fops = { 392 .read = sf_reg_read, 393 .open = sf_reg_open, 394 .write = sf_reg_write, 395 .release = sf_reg_release, 396 .mmap = sf_reg_mmap, 391 .read = sf_reg_read, 392 .aio_read = generic_file_aio_read, 393 .open = sf_reg_open, 394 .write = sf_reg_write, 395 .aio_write = generic_file_aio_write, 396 .release = sf_reg_release, 397 .mmap = sf_reg_mmap, 397 398 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) 398 399 # if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 23) 399 400 .splice_read = generic_file_splice_read, 400 401 # else 401 .sendfile = generic_file_sendfile,402 .sendfile = generic_file_sendfile, 402 403 # endif 403 .fsync = simple_sync_file, 404 .fsync = simple_sync_file, 405 .llseek = generic_file_llseek, 404 406 #endif 405 407 }; 406 408 407 408 /* iops */409 409 410 410 struct inode_operations sf_reg_iops = { … … 415 415 #endif 416 416 }; 417 418 419 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) 420 static int 421 sf_readpage(struct file *file, struct page *page) 422 { 423 char *buf = kmap(page); 424 struct inode *inode = file->f_dentry->d_inode; 425 struct sf_glob_info *sf_g = GET_GLOB_INFO (inode->i_sb); 426 struct sf_reg_info *sf_r = file->private_data; 427 uint32_t nread = PAGE_SIZE; 428 loff_t off = page->index << PAGE_SHIFT; 429 int ret; 430 431 TRACE (); 432 433 ret = sf_reg_read_aux (__func__, sf_g, sf_r, buf, &nread, off); 434 if (ret) { 435 kunmap (page); 436 return ret; 437 } 438 flush_dcache_page (page); 439 kunmap (page); 440 SetPageUptodate(page); 441 if (PageLocked(page)) 442 unlock_page(page); 443 return 0; 444 } 445 446 struct address_space_operations sf_reg_aops = { 447 .readpage = sf_readpage, 448 # if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 24) 449 .write_begin = simple_write_begin, 450 .write_end = simple_write_end, 451 # else 452 .prepare_write = simple_prepare_write, 453 .commit_write = simple_commit_write, 454 # endif 455 }; 456 #endif -
trunk/src/VBox/Additions/linux/sharedfolders/utils.c
r6038 r6054 26 26 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) 27 27 /* 28 * sf_ aops and sf_backing_dev_info are just quick implementations to make28 * sf_reg_aops and sf_backing_dev_info are just quick implementations to make 29 29 * sendfile work. For more information have a look at 30 30 * … … 35 35 * http://pserver.samba.org/samba/ftp/cifs-cvs/samplefs.tar.gz 36 36 */ 37 static struct address_space_operations sf_aops = {38 .readpage = simple_readpage,39 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 24)40 .write_begin = simple_write_begin,41 .write_end = simple_write_end,42 #else43 .prepare_write = simple_prepare_write,44 .commit_write = simple_commit_write,45 #endif46 };47 37 48 38 static struct backing_dev_info sf_backing_dev_info = { … … 112 102 113 103 #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) 114 inode->i_mapping->a_ops = &sf_ aops;104 inode->i_mapping->a_ops = &sf_reg_aops; 115 105 inode->i_mapping->backing_dev_info = &sf_backing_dev_info; 116 106 #endif -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c
r6042 r6054 393 393 init (void) 394 394 { 395 int rc; 395 int rcVBox; 396 int rcRet = 0; 396 397 int err; 397 398 … … 404 405 sizeof (struct vbsf_mount_info), 405 406 PAGE_SIZE); 407 return -EINVAL; 406 408 } 407 409 … … 413 415 414 416 if (vboxadd_cmc_ctl_guest_filter_mask (VMMDEV_EVENT_HGCM, 0)) { 417 rcRet = -EINVAL; 415 418 goto fail0; 416 419 } 417 420 418 rc = vboxInit (); 419 if (VBOX_FAILURE (rc)) { 420 LogRelFunc (("vboxInit failed, rc=%d\n", rc)); 421 rcVBox = vboxInit (); 422 if (VBOX_FAILURE (rcVBox)) { 423 LogRelFunc (("vboxInit failed, rc=%d\n", rcVBox)); 424 rcRet = -EPROTO; 421 425 goto fail0; 422 426 } 423 427 424 rc = vboxConnect (&client_handle); 425 if (VBOX_FAILURE (rc)) { 426 LogRelFunc (("vboxConnect failed, rc=%d\n", rc)); 428 rcVBox = vboxConnect (&client_handle); 429 if (VBOX_FAILURE (rcVBox)) { 430 LogRelFunc (("vboxConnect failed, rc=%d\n", rcVBox)); 431 rcRet = -EPROTO; 427 432 goto fail1; 428 433 } 429 434 430 rc = vboxCallSetUtf8 (&client_handle); 431 if (VBOX_FAILURE (rc)) { 432 LogRelFunc (("vboxCallSetUtf8 failed, rc=%d\n", rc)); 435 rcVBox = vboxCallSetUtf8 (&client_handle); 436 if (VBOX_FAILURE (rcVBox)) { 437 LogRelFunc (("vboxCallSetUtf8 failed, rc=%d\n", rcVBox)); 438 rcRet = -EPROTO; 433 439 goto fail2; 434 440 } … … 447 453 vboxadd_cmc_ctl_guest_filter_mask (0, VMMDEV_EVENT_HGCM); 448 454 unregister_filesystem (&vboxsf_fs_type); 449 return -1;455 return rcRet; 450 456 } 451 457 -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r5999 r6054 59 59 60 60 /* forward declarations */ 61 extern struct inode_operations sf_dir_iops; 62 extern struct inode_operations sf_reg_iops; 63 extern struct file_operations sf_dir_fops; 64 extern struct file_operations sf_reg_fops; 65 extern struct dentry_operations sf_dentry_ops; 61 extern struct inode_operations sf_dir_iops; 62 extern struct inode_operations sf_reg_iops; 63 extern struct file_operations sf_dir_fops; 64 extern struct file_operations sf_reg_fops; 65 extern struct dentry_operations sf_dentry_ops; 66 extern struct address_space_operations sf_reg_aops; 66 67 67 68 extern void
Note:
See TracChangeset
for help on using the changeset viewer.