Changeset 17857 in vbox for trunk/src/VBox/Additions/linux/module/vboxmod.c
- Timestamp:
- Mar 13, 2009 7:29:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/module/vboxmod.c
r17853 r17857 666 666 667 667 /** 668 * IOCTL handler 669 * 668 * IOCTL handler for vboxadd 670 669 */ 671 670 static int vboxadd_ioctl(struct inode *inode, struct file *filp, … … 852 851 853 852 /** 853 * IOCTL handler for vboxuser 854 */ 855 static int vboxuser_ioctl(struct inode *inode, struct file *filp, 856 unsigned int cmd, unsigned long arg) 857 { 858 int rc = 0; 859 860 /* Deal with variable size ioctls first. */ 861 if ( VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL(0)) 862 == VBOXGUEST_IOCTL_STRIP_SIZE(cmd)) 863 { 864 /* Do the HGCM call using the Vbgl bits */ 865 IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_CALL", arg); 866 rc = vboxadd_hgcm_call(arg, _IOC_SIZE(cmd)); 867 IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CALL", arg); 868 } 869 else if ( VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0)) 870 == VBOXGUEST_IOCTL_STRIP_SIZE(cmd)) 871 { 872 /* Do the HGCM call using the Vbgl bits */ 873 IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_CALL_TIMED", arg); 874 rc = vboxadd_hgcm_call_timed(arg, _IOC_SIZE(cmd)); 875 IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CALL_TIMED", arg); 876 } 877 else 878 { 879 switch (cmd) { 880 case VBOXGUEST_IOCTL_HGCM_CONNECT: 881 IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_CONNECT", arg); 882 rc = vboxadd_hgcm_connect(filp, arg); 883 IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_CONNECT", arg); 884 break; 885 case VBOXGUEST_IOCTL_HGCM_DISCONNECT: 886 IOCTL_ENTRY("VBOXGUEST_IOCTL_HGCM_DISCONNECT", arg); 887 vboxadd_hgcm_disconnect(filp, arg); 888 IOCTL_EXIT("VBOXGUEST_IOCTL_HGCM_DISCONNECT", arg); 889 break; 890 default: 891 LogRelFunc(("unknown command: %x\n", cmd)); 892 rc = -EINVAL; 893 break; 894 } 895 } 896 return rc; 897 } 898 899 /** 854 900 * Poll function. This returns "ready to read" if the guest is in absolute 855 901 * mouse pointer mode and the pointer position has changed since the last … … 890 936 891 937 /** 892 * File close handler . Clean up any HGCM connections associated with the open file893 * w hich might still be open.938 * File close handler for vboxadd. Clean up any HGCM connections associated 939 * with the open file which might still be open. 894 940 */ 895 941 static int vboxadd_release(struct inode *inode, struct file * filp) … … 898 944 /* Deactivate our asynchronous queue. */ 899 945 vboxadd_fasync(-1, filp, 0); 946 return 0; 947 } 948 949 /** 950 * File close handler for vboxuser. Clean up any HGCM connections associated 951 * with the open file which might still be open. 952 */ 953 static int vboxuser_release(struct inode *inode, struct file * filp) 954 { 955 vboxadd_unregister_all_hgcm_connections(filp); 900 956 return 0; 901 957 } … … 920 976 name: VBOXADD_NAME, 921 977 fops: &vboxadd_fops 978 }; 979 980 /** file operations for the vboxuser device */ 981 static struct file_operations vboxuser_fops = 982 { 983 .owner = THIS_MODULE, 984 .open = vboxadd_open, 985 .ioctl = vboxuser_ioctl, 986 .release = vboxuser_release, 987 .llseek = no_llseek 988 }; 989 990 /** Miscellaneous device allocation for vboxuser */ 991 static struct miscdevice gMiscVBoxUser = 992 { 993 minor: MISC_DYNAMIC_MINOR, 994 name: VBOXUSER_NAME, 995 fops: &vboxuser_fops 922 996 }; 923 997 … … 1171 1245 { 1172 1246 int rc = 0, rcVBox = VINF_SUCCESS; 1173 bool haveVBoxAdd = false, have GuestLib = false;1247 bool haveVBoxAdd = false, haveVBoxUser = false, haveGuestLib = false; 1174 1248 struct pci_dev *pcidev = NULL; 1175 1249 … … 1219 1293 if (!rc) 1220 1294 haveVBoxAdd = true; 1295 1296 /* Register our user session device */ 1297 if (!rc) { 1298 rc = misc_register(&gMiscVBoxUser); 1299 if (rc) 1300 LogRel(("vboxadd: misc_register failed for %s (rc=%d)\n", 1301 VBOXUSER_NAME, rc)); 1302 } 1303 if (!rc) 1304 haveVBoxUser = true; 1221 1305 1222 1306 /* allocate and initialize device extension */ … … 1428 1512 if (vboxDev) 1429 1513 free_resources(); 1514 if (haveVBoxUser) 1515 misc_deregister(&gMiscVBoxUser); 1430 1516 if (haveVBoxAdd && vbox_major > 0) 1431 1517 unregister_chrdev(vbox_major, VBOXADD_NAME); … … 1446 1532 static __exit void fini(void) 1447 1533 { 1534 misc_deregister(&gMiscVBoxUser); 1448 1535 if (vbox_major > 0) 1449 1536 unregister_chrdev(vbox_major, VBOXADD_NAME);
Note:
See TracChangeset
for help on using the changeset viewer.