47 static int smb_drv_detach(dev_info_t *, ddi_detach_cmd_t);
48 static int smb_drv_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
49
50 /*
51 * *****************************************************************************
52 * ****************************** Global Variables *****************************
53 * *****************************************************************************
54 *
55 * These variables can only be changed through the /etc/system file.
56 */
57
58 /*
59 * Maximum buffer size for NT: configurable based on the client environment.
60 * IR104720 Experiments with Windows 2000 indicate that we achieve better
61 * SmbWriteX performance with a buffer size of 64KB instead of the 37KB used
62 * with Windows NT4.0. Previous experiments with NT4.0 resulted in directory
63 * listing problems so this buffer size is configurable based on the end-user
64 * environment. When in doubt use 37KB.
65 */
66 int smb_maxbufsize = SMB_NT_MAXBUF;
67 int smb_oplock_levelII = 1;
68 int smb_oplock_timeout = OPLOCK_STD_TIMEOUT;
69 int smb_oplock_min_timeout = OPLOCK_MIN_TIMEOUT;
70 int smb_flush_required = 1;
71 int smb_dirsymlink_enable = 1;
72 int smb_sign_debug = 0;
73 int smb_shortnames = 1;
74 uint_t smb_audit_flags =
75 #ifdef DEBUG
76 SMB_AUDIT_NODE;
77 #else
78 0;
79 #endif
80
81 /*
82 * Maximum number of simultaneous authentication, share mapping, pipe open
83 * requests to be processed.
84 */
85 int smb_ssetup_threshold = SMB_AUTHSVC_MAXTHREAD;
86 int smb_tcon_threshold = 1024;
87 int smb_opipe_threshold = 1024;
88
89 /*
90 * Number of milliseconds that a request will be stalled if it comes in after
91 * the maximum number of inflight operations are being proccessed.
92 */
93 int smb_ssetup_timeout = (30 * 1000);
94 int smb_tcon_timeout = (30 * 1000);
95 int smb_opipe_timeout = (30 * 1000);
96
97 /*
98 * Thread priorities used in smbsrv. Our threads spend most of their time
99 * blocked on various conditions. However, if the system gets heavy load,
100 * the scheduler has to choose an order to run these. We want the order:
231 /*
232 * We need a unique minor per zone otherwise an smbd in any other
233 * zone will keep this minor open and we won't get a close call.
234 * The zone ID is good enough as a minor number.
235 */
236 zid = crgetzoneid(cr);
237 if (zid < 0)
238 return (ENODEV);
239 *devp = makedevice(getmajor(*devp), zid);
240
241 /*
242 * Start SMB service state machine
243 */
244 return (smb_server_create());
245 }
246
247 /* ARGSUSED */
248 static int
249 smb_drv_close(dev_t dev, int flag, int otyp, cred_t *credp)
250 {
251 return (smb_server_delete());
252 }
253
254 /* ARGSUSED */
255 static int
256 smb_drv_ioctl(dev_t drv, int cmd, intptr_t argp, int flags, cred_t *cred,
257 int *retval)
258 {
259 smb_ioc_t *ioc;
260 smb_ioc_header_t ioc_hdr;
261 uint32_t crc;
262 boolean_t copyout = B_FALSE;
263 int rc = 0;
264 size_t alloclen;
265
266 if (ddi_copyin((void *)argp, &ioc_hdr, sizeof (ioc_hdr), flags))
267 return (EFAULT);
268
269 /*
270 * Check version and length.
271 *
|
47 static int smb_drv_detach(dev_info_t *, ddi_detach_cmd_t);
48 static int smb_drv_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
49
50 /*
51 * *****************************************************************************
52 * ****************************** Global Variables *****************************
53 * *****************************************************************************
54 *
55 * These variables can only be changed through the /etc/system file.
56 */
57
58 /*
59 * Maximum buffer size for NT: configurable based on the client environment.
60 * IR104720 Experiments with Windows 2000 indicate that we achieve better
61 * SmbWriteX performance with a buffer size of 64KB instead of the 37KB used
62 * with Windows NT4.0. Previous experiments with NT4.0 resulted in directory
63 * listing problems so this buffer size is configurable based on the end-user
64 * environment. When in doubt use 37KB.
65 */
66 int smb_maxbufsize = SMB_NT_MAXBUF;
67 int smb_flush_required = 1;
68 int smb_dirsymlink_enable = 1;
69 int smb_sign_debug = 0;
70 int smb_shortnames = 1;
71 uint_t smb_audit_flags =
72 #ifdef DEBUG
73 SMB_AUDIT_NODE;
74 #else
75 0;
76 #endif
77
78 int smb_allow_advisory_locks = 0; /* See smb_vops.c */
79
80 /*
81 * Maximum number of simultaneous authentication, share mapping, pipe open
82 * requests to be processed.
83 */
84 int smb_ssetup_threshold = SMB_AUTHSVC_MAXTHREAD;
85 int smb_tcon_threshold = 1024;
86 int smb_opipe_threshold = 1024;
87
88 /*
89 * Number of milliseconds that a request will be stalled if it comes in after
90 * the maximum number of inflight operations are being proccessed.
91 */
92 int smb_ssetup_timeout = (30 * 1000);
93 int smb_tcon_timeout = (30 * 1000);
94 int smb_opipe_timeout = (30 * 1000);
95
96 /*
97 * Thread priorities used in smbsrv. Our threads spend most of their time
98 * blocked on various conditions. However, if the system gets heavy load,
99 * the scheduler has to choose an order to run these. We want the order:
230 /*
231 * We need a unique minor per zone otherwise an smbd in any other
232 * zone will keep this minor open and we won't get a close call.
233 * The zone ID is good enough as a minor number.
234 */
235 zid = crgetzoneid(cr);
236 if (zid < 0)
237 return (ENODEV);
238 *devp = makedevice(getmajor(*devp), zid);
239
240 /*
241 * Start SMB service state machine
242 */
243 return (smb_server_create());
244 }
245
246 /* ARGSUSED */
247 static int
248 smb_drv_close(dev_t dev, int flag, int otyp, cred_t *credp)
249 {
250 smb_server_t *sv;
251 int rc;
252
253 rc = smb_server_lookup(&sv);
254 if (rc == 0)
255 rc = smb_server_delete(sv);
256
257 return (rc);
258 }
259
260 /* ARGSUSED */
261 static int
262 smb_drv_ioctl(dev_t drv, int cmd, intptr_t argp, int flags, cred_t *cred,
263 int *retval)
264 {
265 smb_ioc_t *ioc;
266 smb_ioc_header_t ioc_hdr;
267 uint32_t crc;
268 boolean_t copyout = B_FALSE;
269 int rc = 0;
270 size_t alloclen;
271
272 if (ddi_copyin((void *)argp, &ioc_hdr, sizeof (ioc_hdr), flags))
273 return (EFAULT);
274
275 /*
276 * Check version and length.
277 *
|