Changeset 69983 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Dec 7, 2017 2:55:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-netbsd.c
r69979 r69983 142 142 * Global Variables * 143 143 *********************************************************************************************************************************/ 144 extern struct cfdriver vboxguest_cd; /* CFDRIVER_DECL */ 145 extern struct cfattach vboxguest_ca; /* CFATTACH_DECL */ 146 144 147 /* 145 148 * The /dev/vboxguest character device entry points. … … 177 180 /** selinfo structure used for polling. */ 178 181 static struct selinfo g_SelInfo; 179 180 CFDRIVER_DECL(vboxguest, DV_DULL, NULL);181 extern struct cfdriver vboxguest_cd;182 182 183 183 … … 693 693 MODULE(MODULE_CLASS_DRIVER, vboxguest, "pci"); 694 694 695 static int loc[2] = {-1, -1}; 695 CFDRIVER_DECL(vboxguest, DV_DULL, NULL); 696 697 static struct cfdriver * const cfdriver_ioconf_vboxguest[] = { 698 &vboxguest_cd, NULL 699 }; 700 701 static int loc[2] = { -1, -1 }; 696 702 697 703 static const struct cfparent pspec = { … … 699 705 }; 700 706 701 static struct cfdata vboxguest_cfdata[] = { 707 /* vboxguest0 at pci? dev ? function ? */ 708 static struct cfdata cfdata_ioconf_vboxguest[] = { 702 709 { 703 710 .cf_name = "vboxguest", 704 711 .cf_atname = "vboxguest", 705 712 .cf_unit = 0, /* Only unit 0 is ever used */ 706 .cf_fstate = FSTATE_ STAR,713 .cf_fstate = FSTATE_NOTFOUND, 707 714 .cf_loc = loc, 708 715 .cf_flags = 0, … … 712 719 }; 713 720 721 static struct cfattach * const vboxguest_cfattachinit[] = { 722 &vboxguest_ca, NULL 723 }; 724 725 static const struct cfattachinit cfattach_ioconf_vboxguest[] = { 726 { "vboxguest", vboxguest_cfattachinit }, 727 { NULL, NULL } 728 }; 729 714 730 static int 715 731 vboxguest_modcmd(modcmd_t cmd, void *opaque) 716 732 { 717 733 devmajor_t bmajor, cmajor; 734 register_t retval; 718 735 int error; 719 register_t retval;720 736 721 737 LogFlow((DEVICE_NAME ": %s\n", __func__)); 722 738 723 bmajor = cmajor = NODEVMAJOR;724 739 switch (cmd) 725 740 { 726 741 case MODULE_CMD_INIT: 727 error = config_cfdriver_attach(&vboxguest_cd); 742 error = config_init_component(cfdriver_ioconf_vboxguest, 743 cfattach_ioconf_vboxguest, 744 cfdata_ioconf_vboxguest); 745 if (error) 746 break; 747 748 bmajor = cmajor = NODEVMAJOR; 749 error = devsw_attach("vboxguest", 750 NULL, &bmajor, 751 &g_VBoxGuestNetBSDChrDevSW, &cmajor); 728 752 if (error) 729 753 { 730 printf("config_cfdriver_attach failed: %d", error); 731 break; 754 if (error == EEXIST) 755 error = 0; /* maybe built-in ... improve eventually */ 756 else 757 break; 732 758 } 733 error = config_cfattach_attach(vboxguest_cd.cd_name, &vboxguest_ca); 734 if (error) 735 { 736 config_cfdriver_detach(&vboxguest_cd); 737 printf("%s: unable to register cfattach\n", vboxguest_cd.cd_name); 738 break; 739 } 740 error = config_cfdata_attach(vboxguest_cfdata, 1); 741 if (error) 742 { 743 printf("%s: unable to attach cfdata\n", vboxguest_cd.cd_name); 744 config_cfattach_detach(vboxguest_cd.cd_name, &vboxguest_ca); 745 config_cfdriver_detach(&vboxguest_cd); 746 break; 747 } 748 749 error = devsw_attach("vboxguest", NULL, &bmajor, &g_VBoxGuestNetBSDChrDevSW, &cmajor); 750 751 if (error == EEXIST) 752 error = 0; /* maybe built-in ... improve eventually */ 753 754 if (error) 755 break; 756 757 error = do_sys_mknod(curlwp, "/dev/vboxguest", 0666|S_IFCHR, makedev(cmajor, 0), &retval, UIO_SYSSPACE); 759 760 error = do_sys_mknod(curlwp, "/dev/vboxguest", 761 0666|S_IFCHR, makedev(cmajor, 0), 762 &retval, UIO_SYSSPACE); 758 763 if (error == EEXIST) 759 764 error = 0; … … 761 766 762 767 case MODULE_CMD_FINI: 763 error = config_cfdata_detach(vboxguest_cfdata); 768 error = config_fini_component(cfdriver_ioconf_vboxguest, 769 cfattach_ioconf_vboxguest, 770 cfdata_ioconf_vboxguest); 764 771 if (error) 765 772 break; 766 error = config_cfattach_detach(vboxguest_cd.cd_name, &vboxguest_ca); 767 if (error) 768 break; 769 config_cfdriver_detach(&vboxguest_cd); 770 error = devsw_detach(NULL, &g_VBoxGuestNetBSDChrDevSW); 773 774 devsw_detach(NULL, &g_VBoxGuestNetBSDChrDevSW); 771 775 break; 772 776
Note:
See TracChangeset
for help on using the changeset viewer.