/* * smbd_kernel_bind * * If smbsrv is already bound, reload the configuration and update smbsrv. * Otherwise, open the smbsrv device and start the kernel service. */ static int smbd_kernel_bind(void) { smb_kmod_cfg_t cfg; int rc; if (smbd.s_kbound) { smb_load_kconfig(&cfg); rc = smb_kmod_setcfg(&cfg); if (rc < 0) smbd_report("kernel configuration update failed: %s", strerror(errno)); return (rc); } if (smb_kmod_isbound()) smbd_kernel_unbind(); if ((rc = smb_kmod_bind()) == 0) { rc = smbd_kernel_start(); if (rc != 0) smb_kmod_unbind(); else smbd.s_kbound = B_TRUE; } if (rc != 0) smbd_report("kernel bind error: %s", strerror(errno)); return (rc); }
static int smbd_kernel_start(void) { smb_kmod_cfg_t cfg; int rc; smb_load_kconfig(&cfg); rc = smb_kmod_setcfg(&cfg); if (rc != 0) { smbd_report("kernel config ioctl error: %s", strerror(rc)); return (rc); } rc = smb_kmod_setgmtoff(smbd_gmtoff()); if (rc != 0) { smbd_report("kernel gmtoff ioctl error: %s", strerror(rc)); return (rc); } rc = smb_kmod_start(smbd.s_door_opipe, smbd.s_door_lmshr, smbd.s_door_srv); if (rc != 0) { smbd_report("kernel start ioctl error: %s", strerror(rc)); return (rc); } return (0); }
static int smbd_kernel_start(void) { smb_kmod_cfg_t cfg; int rc; smb_load_kconfig(&cfg); rc = smb_kmod_setcfg(&cfg); if (rc != 0) return (rc); rc = smb_kmod_setgmtoff(smbd_gmtoff()); if (rc != 0) return (rc); rc = smb_kmod_start(smbd.s_door_opipe, smbd.s_door_lmshr, smbd.s_door_srv); if (rc != 0) return (rc); smbd_spool_init(); return (0); }