Commit Graph

157 Commits

Author SHA1 Message Date
jdolecek c2704241db add a comment on SMB packet PID purpose to smb_rq_new()
adjust the commented out code to be compilable, but keep using '1' as the PID
2003-04-08 21:10:33 +00:00
jdolecek dfc728f814 fix pasto in smb_rq_setcallback(), mistakely used SMBRQ_SLOCK() instead
of SMBRQ_SUNLOCK()
found during LOCKDEBUG PR kern/21067 hunt
2003-04-08 18:13:41 +00:00
jdolecek 49d2e49597 FILE_USE()/FILE_UNUSE() file entry returned from fd_getfile() properly
bug discovered with LOCKDEBUG, adresses PR kern/21067 by Martin Husemann
2003-04-08 16:29:11 +00:00
jdolecek ddf683ae7a fix simplelock acquire/release in smb_co_rele()
adresses PR kern/21067 by Martin Husemann
2003-04-08 14:56:49 +00:00
jdolecek 1cd92a1660 use pools instead of malloc(9) for allocation of smb request structures
convert all code to use smb_{rq|t2}_alloc() instead of allocating
structures on stack, make smb_rq_init()/smb_t2_init() static and not
exported outside smb_rq.c
2003-04-07 19:35:39 +00:00
jdolecek b37f22dc9f add support for asynchronous execution of SMB requests:
* add receive hook - if set, this function is called when request is finished
* unstatic smb_rq_enqueue(), smb_rq_reply() so that code can use that
  independant of smb_rq_simple() et al
this is needed for NT DIRECTORY CHANGE NOTIFY SMB, since they typically
take very long to complete and we want to be able to use single kernel thread
to handle them all

add support for 'nowait' requests (flag SMBR_NOWAIT), which don't expect
and answer from server and are marked as 'processed' immediatelly
after they are sent to server - needed for NT CANCEL SMB
2003-04-07 11:23:02 +00:00
jdolecek dfb3906cfb add bunch of NT DIRECTORY CHANGE NOTIFY and NT CREATE AND X related constants
add mapping for ERRDOS:STATUS_NOTIFY_ENUM_DIR and ERRHRD:ERRgeneral
2003-04-07 11:13:24 +00:00
jdolecek dee9f67e51 add SMB_CAPS() macro, which returns session capabilities 2003-04-05 13:13:50 +00:00
jdolecek 55535a9403 smb_iod_addrq(): change vc_maxmux check to #ifdef DIAGNOSTIC panic
change other SMBERROR() calls to SMBIODEBUG() - they are only useful when
debugging, and avoids spamming console/system logs with messages triggerable
from userland
2003-04-05 11:12:23 +00:00
jdolecek cdfa2ea23e #ifdef MCHAIN_DEBUG a too verbose message 2003-04-04 08:20:50 +00:00
jdolecek a1e8c55374 g/c vc_timo from struct smb_vc - it's not used anymore 2003-04-02 15:03:37 +00:00
jdolecek e71b725363 we now use rqp->sr_timo for request timeout value, so don't
reset it in smb_rq_simple(); 5 ticks (vc_timo) would be generally
too small timeout anyway
2003-04-02 15:01:52 +00:00
jdolecek b79183a11f g/c smb_smb_nomux(), use KASSERT() instead - if we get here with
process != iod, it's netsmb/smbfs code error
2003-04-01 08:35:42 +00:00
jdolecek 6e5e05ca45 run iod at splnet, to eliminate race agains receive upcall wakeup,
so that iod wouldn't pause when the reply comes fast enough
to catch iod between smb_iod_recvall() and tsleep()

this gives nice performance boost for workloads with many synchronously
submitted transactions, like ls -lR

iod now doesn't need to wakeup periodically, so don't use any timeout
for its tsleep(); also use higher priority PSOCK instead of PWAIT
2003-03-31 20:59:35 +00:00
jdolecek dc859b2165 do recursive lock in smb_co_gone() - this code could be invoked
on error returns paths with parent still locked, which would
cause 'locking against myself' panic with nonrecursive lock

fixes problem where invalid share name would cause a panic
via smb_sm_lookup() -> smb_share_put()

many thanks to Matthias Drochner for pointing out easy way how to
trigger this problem
2003-03-31 18:24:58 +00:00
jdolecek 95aaf6bde8 use callout for request timeout, so that it could expire independantly
of iod calling smb_iod_sendall()
g/c now unneeded request timeout expire check from smb_iod_sendall()

make it possible to override default request timeout - set timeout
value in smb_rq_init() to default value, caller can adjust the value
before calling smb_iod_sendrq(); value <=0  means no timeout
2003-03-30 11:58:17 +00:00
jdolecek 349bcca42d whitespace fixes
do not inline smb_iod_rqprocessed()
make smb_iod_sendall(), smb_iod_recvall() 'return' void - the return value
  was always ignored
smb_iod_recvall(): turn an programming error condition check to KASSERT()
smb_iod_main(): g/c unused 'error' local
smb_iod_thread(): iod_p is assigned in smb_iod_create(), so just KASSERT()
  it's correct here
2003-03-30 11:27:45 +00:00
jdolecek 3cac807cc4 whitespace KNF 2003-03-30 09:44:28 +00:00
jdolecek 32657d0d79 remove incorrect DEBUG check of recursive lock in smb_co_lock() - the check
incorrectly bombed when the exclusive lock was help by different process
(*yuck*)

lockmgr() checks for 'locking against myself' type of locking problems itself,
so no need to do any additional checks
2003-03-29 21:42:44 +00:00
jdolecek d6eaa60e05 parenthesize NB_ENCNAMELEN value 2003-03-27 11:22:29 +00:00
jdolecek 78b50cb215 Receive packets in a small pieces (NB_SORECEIVE_CHUNK), so TCP slowstart will
get its ACKs faster.
From Darwin via FreeBSD.

XXX I don't have any idea if this is useful or reasonable, but it looks
XXX sane and the code works. "Remove if found nonuseful."
2003-03-24 18:08:51 +00:00
jdolecek 7ba3ded040 fix connecting to (samba) server when share-level security is in effect
(do not send second password at all)
from FreeBSD
2003-03-24 15:07:52 +00:00
jdolecek 01f94cf255 Implement support for mixed case passwords.
From Darwin via FreeBSD.

This will have some effect once the NetBSD iconv routines would
actually do something.
2003-03-24 15:03:58 +00:00
jdolecek b55818f692 Use 'large' (64bit) readx and writex functions if server supports them.
This makes it possible to use files >4G.
From Darwin via FreeBSD, but changed so that smb_{read|write}() directly
calls appropriate i/o variant, and replaced md_get_uint16le() with
md_get_uint16() for target == NULL cases.

Replace some size_t's by int's.
2003-03-24 14:24:14 +00:00
jdolecek fbfa48d0a9 make smb_smb_read() and smb_smb_write() return EFBIG if offset is
at or beyond 4G - this interface supports 32bit offset only
2003-03-24 14:11:32 +00:00
jdolecek de3ee118b5 map ERRDOS/ERRnotlocked to EBUSY 2003-03-24 10:05:43 +00:00
jdolecek 6e843721e9 don't access (u_int32_t *) as (u_int16_t *), this fails on BE machines -
use temporary variable to fetch the 16bit value instead
remove some redundant temporaries, use NULL for those md_get_*() calls instead
make sv_sm 16bit - it is 16bit in later SMB dialects
2003-03-24 09:17:52 +00:00
jdolecek 6d65835e70 one more rename - ERRbaddevice -> ERRnoipc 2003-03-24 08:56:21 +00:00
jdolecek 2b08f4a53d fix some typos. from FreeBSD 2003-03-24 08:42:31 +00:00
jdolecek 3c34ce99af Add more constants for future use in kernel and userland.
From Darwin via FreeBSD smb.h rev. 1.6

This renames some constants added in NetBSD smb.h rev 1.6 - smb_subr.c
adjusted
2003-03-24 08:39:17 +00:00
jdolecek a266be64dc Recongnize more error codes returned by W2K servers.
From FreeBSD
2003-03-24 08:20:01 +00:00
jdolecek fd9fac7cc2 spelling fixes, add SMB_SET_FILE_END_OF_FILE_INFO subfunction for
future use
from FreeBSD rev. 1.3, 1.4
2003-03-24 08:03:40 +00:00
jdolecek f0b60803a5 fix pasto in smb_t2_request() - t2_flags use SMBT2_RESTART, not SMBR_RESTART 2003-03-24 07:51:04 +00:00
jdolecek 41b5582182 iod_pingtimo is unused, #if 0
iod_sleeptimo is set to same value always, so use the value directly
and #if 0 iod_sleeptimo

add one smb_iod_wakeup() in smb_iod_sendrq()
XXX unfortunately iod thread still must wakeup periodically to check
XXX for arriving replies - command latency might be improved if this could
XXX be avoided
2003-03-24 07:49:48 +00:00
jdolecek 850f5b36ec Add unicode related definition for future use. Descibe Samba bug.
From Darwin via FreeBSD rev. 1.4
2003-03-24 07:40:50 +00:00
jdolecek 037635c879 spelling fixes.
From FreeBSD rev. 1.4

Add unicode related definition for future use.
From Darwin via FreeBSD rev. 1.5
2003-03-24 07:38:54 +00:00
jdolecek 5cc8e19b22 drop trailing $ added to FreeBSD RCS Id in last rev by mistake 2003-03-24 07:36:36 +00:00
jdolecek 0b6415076c Remove redundant checks for iovcnt > 1. This should be handled properly
in the subr_mchain.
From Darwin via FreeBSD smb_smb.c rev. 1.5

g/c bogus 'olduio' save/restore, it's not needed
2003-03-24 07:24:02 +00:00
jdolecek 5e1aff13f2 Pullup FreeBSD rev. 1.3 of this file - support for iovcnt greater than
1 in mb_put_uio(), mb_get_uio()
2003-03-24 07:09:34 +00:00
jdolecek 568fd88386 struct smb_rq diet - g/c unused structure members, and move some stuff
around to not waste space with alignment padding
2003-03-23 16:57:51 +00:00
jdolecek b05cd2b635 translate ERRDOS/ERRnofiles to ENOENT in smb_maperror(), and simplify
handling in smbfs_smb_search() appropriately - avoids using
sr_errclass&sr_serror too
2003-03-23 16:55:54 +00:00
jdolecek 4e2b57cec2 don't use rqp->{sr_errclass|sr_serror} - use the translated error
number instead
g/c SMB_DIALECT_MAX, it's not used
2003-03-23 16:51:52 +00:00
jdolecek 4a53d44e24 md_get_uint16le() doesn't like NULL target; change to md_get_uint16() 2003-03-23 16:46:41 +00:00
jdolecek 0e82a29d7a remove unused struct members from struct smbioc_rq 2003-03-23 12:17:49 +00:00
jdolecek 3eecb88b32 smb_rq_reply():
* no need to use dummy variables for md_get_*(), just use NULL
* don't bother storing rpflags/rpflags2, it's not used anywhere
* g/c local variable rperror
2003-03-23 11:43:09 +00:00
jdolecek aee3251066 use 'NetBSD' for client OS string 2003-03-23 10:52:03 +00:00
jdolecek 14e421e6b0 constify smb_share_typename() 2003-03-23 10:38:14 +00:00
jdolecek fa1e2856c7 use simpleq instead of tailq for iod_rqlist - simpleq is enough
for our needs here
2003-03-23 10:32:05 +00:00
jdolecek f6f096034a Compute the request timeout time in smb_iod_sendrq() when the request is
sent out, use mono_time instead microtime(), and simplify computation
in smb_iod_sendall(). Also count the timout once, not twice as previous code.

#if 0 iod->iod_lastrqsent, it was write-only
2003-03-23 10:01:31 +00:00
jdolecek 3a7bb2ccf1 smb_rq_new(): use MB_MZERO instead of MB_MSYSTEM+dummy tzero[] 2003-03-23 08:30:37 +00:00
jdolecek 9b7005c79d g/c some non-NetBSD code 2003-03-23 08:28:06 +00:00
kristerw 3a7b34238b The implementation of the try/catch functionality uses two gcc extensions
that our lint does not understand.

One of these extensions (local labels) is needed only when using multiple
try/catch blocks within a function, and the comment before these macros
say that they should be used only once per function so that the implementaton
may be portable.

The other extension (taking the address of a label) is not needed at all.

Remove the use of the extensions.
2003-03-15 02:54:24 +00:00
kristerw 6c096545e5 ISO C requires a statement after a label. 2003-03-15 02:11:43 +00:00
jdolecek ede214240b #if 0 or g/c unused stuff
pointed out by Krister Walfridsson
2003-03-03 21:16:02 +00:00
jdolecek 8984cf4564 add couple more SMB constants and explanation texts 2003-03-02 18:55:48 +00:00
jdolecek d67d6bee01 M_TRYWAIT -> M_WAIT
MGET() -> m_get()
MCLGET() -> m_clget()
c_caddr_t -> const char *
2003-02-26 21:50:15 +00:00
jdolecek 4f88b74062 improve tsleep() wmesgs 2003-02-26 19:31:33 +00:00
jdolecek 11c209aa83 prefix tsleep() wmesg with 'smb', rather than '90'
drop #ifndef __NetBSD__ msleep() code, it only obfuscates the code
2003-02-26 19:30:51 +00:00
jdolecek 2c8e39ef8f need to include <sys/mbuf.h> for M_SONAME 2003-02-26 11:12:28 +00:00
matt 65e5548a17 Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.
2003-02-26 06:31:08 +00:00
jdolecek e1ea74dfac add __KERNEL_RCSID 2003-02-25 09:12:11 +00:00
jdolecek c672cc0379 make sure sr_bcount, sr_rqtid and sr_rquid are wrote in alignment-safe way
problem pointed out by Martin Husemann

while here, turn some checks/SMBERROR()s to #ifdef DIAGNOSTIC panic()s
2003-02-24 21:13:13 +00:00
jdolecek 695a1f63b5 const-poison a bit 2003-02-24 19:32:16 +00:00
jdolecek 9a9493a698 make M_SMBRQ static 2003-02-24 19:31:45 +00:00
briggs 9a152e34ad Define smb_co_lockstatus iff DEBUG || DIAGNOSTIC. 2003-02-24 16:12:08 +00:00
jdolecek 31a056fdaf clarify locking requirements for smb_{share,vc,co}_{rele,put}() - the lock
must be held on entry
drain the lock in smb_co_gone(), so that it's done always
turn some SMBERROR()s to #ifdef DIAGNOSTIC/DEBUG panics
2003-02-24 09:55:37 +00:00
jdolecek ebc50c199c simplify nbssn_rselect() some more 2003-02-21 21:12:24 +00:00
jdolecek aaaa0b09ac rewrite nbssn_rselect() to resemple sys_select() more (as was the
intent); besides being reable now, this fixes (several!) bugs in
timeout calculation, which caused nbssn_rselect() to return
prematurely

put the timeout in separate variable declared on top, so that it's clear
where the value comes from

don't adjust timeout in smb_nbst_connect() - this made the timeout
too short if connect happened to be fast
(XXX perhaps reevaluate this later and put back in some other form)

bump NB_SNDQ/NB_RCVQ to 64k, and actually use the defines to set
snd/rcv buffer sizes

use #define for the snd/rcv timeo

some whitespace/KNF fixes
2003-02-21 20:12:05 +00:00
jdolecek 85f22d966f simlify smb_proc_intr() - p_siglist never contains signals from
p_sigmask or p_sigignore, so no point explicitly removing them

also kill some compatibility macros/defines and use the real thing directly,
it's more readable that way
2003-02-21 19:55:14 +00:00
jdolecek 7002819777 smb_rq_enqueue(): use classic plain interruptible sleep instead
of noniterruptible sleep + smb_proc_intr()
2003-02-21 19:52:58 +00:00
martin 6b7ecffb54 Change a few int -> size_t to make it compile on archs where they are not
the same.
2003-02-19 12:01:37 +00:00
jdolecek 1cacc8d1a4 always include support for password encryption
const-poison smb_crypt.c some
2003-02-19 08:33:08 +00:00
jdolecek 09caa6e970 no opt_smb.h 2003-02-19 08:13:46 +00:00
jdolecek 6b01f028b8 move netsmb-specific entries to netsmb/files.netsmb
g/c options SMB and opt_smb.h
rename the pseudo device to nsmb, and use needs-flag instead needs-count,
 adjust nsmbattach() appropriately
replace SMB_CHECKMINOR() with explicit code in smb_dev.c, to improve readability
2003-02-18 12:18:28 +00:00
jdolecek 7fa45bf7b7 disable debug printf mistakely enabled in previous commit 2003-02-18 11:21:01 +00:00
jdolecek c77076376f smb_rq_bend(): s/htoles/htole16/
smb_rq_reply(): don't bother saving error from md_get_* call when it's ignored
2003-02-18 10:20:50 +00:00
jdolecek fde501ab94 use explicit width macros from <sys/endian.h>, do not define&use
letohs/letohl/letohq and such
2003-02-18 10:18:52 +00:00
jdolecek fce485df80 constify smb_emptypass (it doesn't have any effect, cost for form) 2003-02-18 10:16:49 +00:00
jdolecek 12ce0f9377 replace some magic error number with descriptive defines; meaning of the numbers
found in Samba/Linux smbfs
2003-02-18 10:09:28 +00:00
jdolecek f47f2d7164 pull iconv.h from FreeBSD, update the stub iconv routines to match
this is to provide some stuff used by mount_smbfs / libsmb
2003-02-16 19:50:48 +00:00
jdolecek 3f9fb02e0c don't define FB_CURRENT here 2003-02-16 19:48:10 +00:00
jdolecek 5404a6b6a8 make compile - P_SELECT changed to lwp-specific L_SELECT; use curlwp
as the lwp, hopefully this is actually correct
2003-02-15 23:26:57 +00:00
jdolecek d5e1078f05 adapt to addition of malloc types 2003-02-15 23:02:30 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
perry 4f27ab21b8 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:30:55 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
jdolecek b144c497d2 sanity changes for NetBSD:
* return ENODEV for write/read methods
* use seltrue for poll method

the old semantics still applies for !NetBSD
2002-10-11 21:35:42 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
lukem 06de426449 SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field).  whilst it's O(n),
  this mirrors the functionality of SLIST_REMOVE() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
  this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
  singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
2002-06-01 23:50:52 +00:00
deberg 5d6d9530b6 big-endian macros 2002-05-16 20:37:12 +00:00
deberg b4fb0f417f comment out includes for now 2002-01-09 21:10:04 +00:00
deberg 9c0b4c4a97 use SMBDATA for devtbl 2002-01-08 19:52:16 +00:00
deberg 2d6f0a12d0 add public domain license for stubs 2002-01-05 20:29:38 +00:00
deberg 83a9e0488b sync w/ existing headers 2002-01-04 02:57:51 +00:00
deberg f3b1291f2e resolve conflicts 2002-01-04 02:39:37 +00:00
deberg 16208c1279 now that this is in freebsd, import vendor copy as base. 2002-01-04 02:24:57 +00:00
lukem 4f2ad95259 add RCSIDs 2001-11-13 00:56:55 +00:00