1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00
freebsd/sys/nwfs
Bosko Milekic 9ed346bab0 Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
..
nwfs_io.c Get rid from the legacy __P() macro. Remove 'register' keywords. 2000-10-02 09:29:59 +00:00
nwfs_ioctl.c Remove unneeded #include <sys/proc.h> lines. 2000-10-29 13:57:19 +00:00
nwfs_mount.h Try to obtain timezone offset from an environment of mount program. 2000-04-05 10:44:04 +00:00
nwfs_node.c Change and clean the mutex lock interface. 2001-02-09 06:11:45 +00:00
nwfs_node.h Protect hash data with lock manager instead of home grown one. 2000-10-02 09:49:04 +00:00
nwfs_subr.c Get rid from the legacy __P() macro. Remove 'register' keywords. 2000-10-02 09:29:59 +00:00
nwfs_subr.h Try to obtain timezone offset from an environment of mount program. 2000-04-05 10:44:04 +00:00
nwfs_vfsops.c Mechanical change to use <sys/queue.h> macro API instead of 2001-02-04 13:13:25 +00:00
nwfs_vnops.c Change and clean the mutex lock interface. 2001-02-09 06:11:45 +00:00
nwfs.h