History log of /openbsd-current/sys/nfs/nfsm_subs.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.48 30-Apr-2024 miod

Convert all the NFS macros (in nfsm_subs.h) into inline functions with the
appropriate extra arguments.

This (hopefully) completes the unmessyfication work started by thib@ a long,
long time ago (in a galaxy far away).

The conversion logic has been:
- nfsm_dissect has been turned into an rvalue expression, leaving the
cast operation up to its caller.
- macros which had three different exit paths (return, goto nfsmout or
fallthrough) have been split so that no macros have more than two exit paths.
- then they have been modified to return a value, which lets the caller
figure out what exit path is needed.
- local variables abused by the macros are now local variables of the new
inline functions.

This single commit is the sum of 25 intermediate diffs, which have all been
carefully reviewed by (at least) jsg@ and semarie@.

Tested with v2 and v3 servers and clients.

ok jsg@ semarie@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.47 18-Jan-2019 bluhm

Check for negative length in NFS strings. This affects both, the
client and server.
OK beck@


Revision tags: OPENBSD_6_4_BASE
# 1.46 09-Jul-2018 krw

branches: 1.46.2;
Nuke unused define 'nfsm_writereply()'.

ok beck@ deraadt@ guenther@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 29-Aug-2015 deraadt

branches: 1.45.6;
fix ugly indents; no harmful macros harmed


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.44 18-Dec-2014 tedu

delete a whole mess of unnecessary caddr_t casts


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 10-Aug-2009 blambert

The only caller of NFSMSIZ got changed yesterday, so remove it.

High five from thib@


# 1.42 09-Aug-2009 thib

set the mrq pointer (request) in the nfsm_reply() macro, as we can return from it.
This can cause us to follow garbage in the nfsd loop, causing two kinds of hell.

problem noticed by nicm@. OK blambert@.


# 1.41 04-Aug-2009 thib

group all of the on-stack variables that are uses by the nfsm_macros
to keep the data munging "state" into an nfsm_info structure. Each
function now has this structure on its stack, and it and its members
are now passed around so that the macros/functions can work there magic.

this will make removing the nfsm_* macros way easier.

Idea/code picked up from DragonflyBSD.

Tested by krw@, jacekm@ and myself.

OK blambert@.


# 1.40 30-Jul-2009 thib

make sure we only ever try to read out post-op attributes
or wcc data if we have a proper reply.

found the hard way by ariane@, tested by ariane@.

OK blambert@


# 1.39 20-Jul-2009 thib

(struct foo *)0 -> NULL, every where I could find it.

OK blambert@


Revision tags: OPENBSD_4_6_BASE
# 1.38 06-Jun-2009 thib

turdshine previous


# 1.37 05-Jun-2009 jasper

- make this a lot more readable; no binary change

ok thib@


# 1.36 04-Jun-2009 blambert

Demacro nfsm_lookup for great justice.

Thanks to ckuethe for saving much typing with a drive-by perl script.

ok thib@


# 1.35 13-Apr-2009 blambert

Convert macros to functions to reduce kernel memory usage.

In snaps for a while (way too long, according to deraadt@)


# 1.34 30-Mar-2009 blambert

Convert a sizeable macro to a much-leaner function. Saves (IIRC) 5k on i386.

In snaps for a while.


Revision tags: OPENBSD_4_5_BASE
# 1.33 24-Jan-2009 thib

Use a timespec instead of a time_t for the clients nfsnode
mtime, gives us better granularity, helps with cache consistency.

Idea lifted from NetBSD.

OK blambert@


# 1.32 24-Dec-2008 thib

Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since
its used only once and nuke its definition.

Stolen from blambert's bag'o'diffs.

OK blambert@.


Revision tags: OPENBSD_4_4_BASE
# 1.31 15-Jun-2008 thib

unroll the NFSMADV() macro and nuke it

ok blambert@


# 1.30 14-Jun-2008 blambert

Replace nfsm_build/bcopy with nfsm_{buf,str}tombuf functions in
filehandle -> mbuf write macros.

Removes `magic' variable cp which was used only in these macros,
and should lead to marginally better mbuf packing as well.

`slap it in' thib@


# 1.29 13-Jun-2008 blambert

Kill one-liner macro which obfuscated mbuf pointer assignment.

Rescue nfsm_reqhead macro name and rename nfsm_reqh.

End of one-liners from nfsm_subs.h.

ok thib@


# 1.28 13-Jun-2008 blambert

Replace one-line macro which only obfuscated the fact that
the function it was named after took 4 arguments instead of 2.

"get it in; get it in; get it in" thib@


# 1.27 12-Jun-2008 blambert

Remove now-vestigial bpos pointer from NFS. For building outgoing
NFS mbufs, mbufs now contain all their internal buffer state internally,
the way god intended.

ok thib@

testing johan@ (and possibly merdely@; this diff's been around for a bit...)


# 1.26 27-May-2008 blambert

Remove bloated and nasty nfsm_clget macro; while here, replace some
handrolled loops with nfsm_strtombuf and nfsm_buftombuf.

ok deraadt@ via thib@; ok 'nfs buddy' thib@
testing johan@, merdely@; thanks


# 1.25 14-Apr-2008 blambert

Rework NFS mbuf write routines:

nfsm_uiotombuf():
- no meaningful return, function becomes void
- replace frankensteined uiomove/MGET with actual call to uiomove

nfsm_strtmbuf():
- no meaningful return, becomes void
- rename and reorder parameters to be consistent with other functions
- becomes wrapper to nfsm_uiotombuf

nfsm_buftombuf():
- new function; unused but slated for future use
- wrapper to nfsm_uiotombuf

As a bonus, making these functions void removes much unneeded code and
garbage collects `magic' variable t2 which was only used (invisibly)
by the macros from nfsm_subs.h

Preps the way for removing much more NFS goo...

testing by myself, thib@ and merdely@
ok thib@


Revision tags: OPENBSD_4_3_BASE
# 1.24 06-Jan-2008 blambert

More NFS-related kernel shrinkage...

When you use a macro ~200 times, it tends to bloat your code, so make a
function out of it.

Shaves ~8.5 kB from my kernel.

ok thib@, "looks good" krw@

In snaps for 1+ week with no negative reports.


# 1.23 13-Dec-2007 blambert

convert massive (expanded to 150+ lines) nfsm_v3attr macro to a function

shaves an insane (~8K) amount from an i386 kernel

ok thib@


# 1.22 07-Nov-2007 thib

more low hanging fruit; Expand the nfsm_srvwcc_data() macro
and nuke it's definition.

OK krw@, blamers@


# 1.21 06-Nov-2007 thib

Expand the nfsm_srvfillattr() macro and
nuke it's definition.

OK krw@, blambert@


# 1.20 30-Oct-2007 thib

remove an unused macro, NFSMINOFF;

ok beck@, blambert@
"Kill it. Kill it dead." krw@


# 1.19 28-Oct-2007 thib

Remove the "frev" argument from nfs_rephead(); and clean up the "frev"
variables, that are declared all over, since they are passed via macros
to nfs_rephead(); which doesn't do anything with it.

OK krw@


# 1.18 26-Sep-2007 blambert

nfsm_uiotom macro does nothing but hide error-handling code; replace
inline in the one place that it's called

ok thib@, weingart@
"I don't see why not" fgsch@


# 1.17 11-Sep-2007 blambert

Replace nfsm_reqdone and nfsm_srvdone macros inline. No binary change.

ok thib@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.16 02-Apr-2006 otto

When setting timestamps TOSERVER having write permissions is adaquate;
problem experienced by Han Boetes; fix with "nfs4" rick at snowhite
dot cis dot uoguelph dot ca. ok pedro@ tedu@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.15 24-Jun-2004 tholo

This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.

It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.

ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@


# 1.14 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall
time, and used to get that from time.tv_secs or mono_time.tv_secs now get
this from separate time_t globals time_second and time_uptime.

ok art@ niklas@ nordin@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.13 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.12 03-Jul-2002 nate

Remove unused function parameter 'cache' from nfs_rephead
ok costa@


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE SMP_BASE UBC_BASE
# 1.11 05-Jan-2000 millert

branches: 1.11.2; 1.11.12;
In the NFSMSIZ macro, don't assume that m_ext.ext_size == MCLBYTES.
From NetBSD


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE kame_19991208
# 1.10 06-Feb-1999 millert

Use bitwise operations to extract high and low words from the quad
in txdr_hyper. This should be more portable than casting to an array
of ints and pulling out the two 32-bit words (this produced incorrect
results on alpha for the high word for filesystems < 4gig). As a side
effect, txdr_hyper now takes a u_quad_t as its first arg, not u_quad_t *.


# 1.9 10-Jan-1999 millert

Fix for creating files on a Solaris 7 server with NFSv3 (the request was
slightly garbled but older servers seemed to understand it); dfr@freebsd.org


Revision tags: OPENBSD_2_4_BASE
# 1.8 19-Aug-1998 csapuntz

Change fxdr_hyper to return a u_quad_t. This minimizes the evil clobbering
of lvalues that ANSI abhors.

And it fixes df on NFS version 3 mounts on Sparcs.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 24-Feb-1997 niklas

OpenBSD tag


Revision tags: OPENBSD_2_0_BASE
# 1.6 21-Apr-1996 deraadt

partial sync with netbsd 960418, more to come


# 1.5 17-Apr-1996 mickey

Minor cleanups. Checked against Lite2.
(NetBSD's was really just a Lite2's, but w/ 64bit support)


# 1.4 31-Mar-1996 mickey

From NetBSD: NFSv3 import (tomorrow's Net's kernel)
Open's patches kept in. i'll possibly take a look at Lite2 soon,
is there smth usefull ?..


# 1.3 29-Feb-1996 niklas

From NetBSD: merge with 960217 (still NFSv2)


# 1.2 21-Dec-1995 deraadt

from cgd; handle 64-bit pointers and longs


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.47 18-Jan-2019 bluhm

Check for negative length in NFS strings. This affects both, the
client and server.
OK beck@


Revision tags: OPENBSD_6_4_BASE
# 1.46 09-Jul-2018 krw

Nuke unused define 'nfsm_writereply()'.

ok beck@ deraadt@ guenther@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 29-Aug-2015 deraadt

fix ugly indents; no harmful macros harmed


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.44 18-Dec-2014 tedu

delete a whole mess of unnecessary caddr_t casts


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 10-Aug-2009 blambert

The only caller of NFSMSIZ got changed yesterday, so remove it.

High five from thib@


# 1.42 09-Aug-2009 thib

set the mrq pointer (request) in the nfsm_reply() macro, as we can return from it.
This can cause us to follow garbage in the nfsd loop, causing two kinds of hell.

problem noticed by nicm@. OK blambert@.


# 1.41 04-Aug-2009 thib

group all of the on-stack variables that are uses by the nfsm_macros
to keep the data munging "state" into an nfsm_info structure. Each
function now has this structure on its stack, and it and its members
are now passed around so that the macros/functions can work there magic.

this will make removing the nfsm_* macros way easier.

Idea/code picked up from DragonflyBSD.

Tested by krw@, jacekm@ and myself.

OK blambert@.


# 1.40 30-Jul-2009 thib

make sure we only ever try to read out post-op attributes
or wcc data if we have a proper reply.

found the hard way by ariane@, tested by ariane@.

OK blambert@


# 1.39 20-Jul-2009 thib

(struct foo *)0 -> NULL, every where I could find it.

OK blambert@


Revision tags: OPENBSD_4_6_BASE
# 1.38 06-Jun-2009 thib

turdshine previous


# 1.37 05-Jun-2009 jasper

- make this a lot more readable; no binary change

ok thib@


# 1.36 04-Jun-2009 blambert

Demacro nfsm_lookup for great justice.

Thanks to ckuethe for saving much typing with a drive-by perl script.

ok thib@


# 1.35 13-Apr-2009 blambert

Convert macros to functions to reduce kernel memory usage.

In snaps for a while (way too long, according to deraadt@)


# 1.34 30-Mar-2009 blambert

Convert a sizeable macro to a much-leaner function. Saves (IIRC) 5k on i386.

In snaps for a while.


Revision tags: OPENBSD_4_5_BASE
# 1.33 24-Jan-2009 thib

Use a timespec instead of a time_t for the clients nfsnode
mtime, gives us better granularity, helps with cache consistency.

Idea lifted from NetBSD.

OK blambert@


# 1.32 24-Dec-2008 thib

Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since
its used only once and nuke its definition.

Stolen from blambert's bag'o'diffs.

OK blambert@.


Revision tags: OPENBSD_4_4_BASE
# 1.31 15-Jun-2008 thib

unroll the NFSMADV() macro and nuke it

ok blambert@


# 1.30 14-Jun-2008 blambert

Replace nfsm_build/bcopy with nfsm_{buf,str}tombuf functions in
filehandle -> mbuf write macros.

Removes `magic' variable cp which was used only in these macros,
and should lead to marginally better mbuf packing as well.

`slap it in' thib@


# 1.29 13-Jun-2008 blambert

Kill one-liner macro which obfuscated mbuf pointer assignment.

Rescue nfsm_reqhead macro name and rename nfsm_reqh.

End of one-liners from nfsm_subs.h.

ok thib@


# 1.28 13-Jun-2008 blambert

Replace one-line macro which only obfuscated the fact that
the function it was named after took 4 arguments instead of 2.

"get it in; get it in; get it in" thib@


# 1.27 12-Jun-2008 blambert

Remove now-vestigial bpos pointer from NFS. For building outgoing
NFS mbufs, mbufs now contain all their internal buffer state internally,
the way god intended.

ok thib@

testing johan@ (and possibly merdely@; this diff's been around for a bit...)


# 1.26 27-May-2008 blambert

Remove bloated and nasty nfsm_clget macro; while here, replace some
handrolled loops with nfsm_strtombuf and nfsm_buftombuf.

ok deraadt@ via thib@; ok 'nfs buddy' thib@
testing johan@, merdely@; thanks


# 1.25 14-Apr-2008 blambert

Rework NFS mbuf write routines:

nfsm_uiotombuf():
- no meaningful return, function becomes void
- replace frankensteined uiomove/MGET with actual call to uiomove

nfsm_strtmbuf():
- no meaningful return, becomes void
- rename and reorder parameters to be consistent with other functions
- becomes wrapper to nfsm_uiotombuf

nfsm_buftombuf():
- new function; unused but slated for future use
- wrapper to nfsm_uiotombuf

As a bonus, making these functions void removes much unneeded code and
garbage collects `magic' variable t2 which was only used (invisibly)
by the macros from nfsm_subs.h

Preps the way for removing much more NFS goo...

testing by myself, thib@ and merdely@
ok thib@


Revision tags: OPENBSD_4_3_BASE
# 1.24 06-Jan-2008 blambert

More NFS-related kernel shrinkage...

When you use a macro ~200 times, it tends to bloat your code, so make a
function out of it.

Shaves ~8.5 kB from my kernel.

ok thib@, "looks good" krw@

In snaps for 1+ week with no negative reports.


# 1.23 13-Dec-2007 blambert

convert massive (expanded to 150+ lines) nfsm_v3attr macro to a function

shaves an insane (~8K) amount from an i386 kernel

ok thib@


# 1.22 07-Nov-2007 thib

more low hanging fruit; Expand the nfsm_srvwcc_data() macro
and nuke it's definition.

OK krw@, blamers@


# 1.21 06-Nov-2007 thib

Expand the nfsm_srvfillattr() macro and
nuke it's definition.

OK krw@, blambert@


# 1.20 30-Oct-2007 thib

remove an unused macro, NFSMINOFF;

ok beck@, blambert@
"Kill it. Kill it dead." krw@


# 1.19 28-Oct-2007 thib

Remove the "frev" argument from nfs_rephead(); and clean up the "frev"
variables, that are declared all over, since they are passed via macros
to nfs_rephead(); which doesn't do anything with it.

OK krw@


# 1.18 26-Sep-2007 blambert

nfsm_uiotom macro does nothing but hide error-handling code; replace
inline in the one place that it's called

ok thib@, weingart@
"I don't see why not" fgsch@


# 1.17 11-Sep-2007 blambert

Replace nfsm_reqdone and nfsm_srvdone macros inline. No binary change.

ok thib@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.16 02-Apr-2006 otto

When setting timestamps TOSERVER having write permissions is adaquate;
problem experienced by Han Boetes; fix with "nfs4" rick at snowhite
dot cis dot uoguelph dot ca. ok pedro@ tedu@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.15 24-Jun-2004 tholo

This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.

It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.

ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@


# 1.14 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall
time, and used to get that from time.tv_secs or mono_time.tv_secs now get
this from separate time_t globals time_second and time_uptime.

ok art@ niklas@ nordin@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.13 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.12 03-Jul-2002 nate

Remove unused function parameter 'cache' from nfs_rephead
ok costa@


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE SMP_BASE UBC_BASE
# 1.11 05-Jan-2000 millert

branches: 1.11.2; 1.11.12;
In the NFSMSIZ macro, don't assume that m_ext.ext_size == MCLBYTES.
From NetBSD


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE kame_19991208
# 1.10 06-Feb-1999 millert

Use bitwise operations to extract high and low words from the quad
in txdr_hyper. This should be more portable than casting to an array
of ints and pulling out the two 32-bit words (this produced incorrect
results on alpha for the high word for filesystems < 4gig). As a side
effect, txdr_hyper now takes a u_quad_t as its first arg, not u_quad_t *.


# 1.9 10-Jan-1999 millert

Fix for creating files on a Solaris 7 server with NFSv3 (the request was
slightly garbled but older servers seemed to understand it); dfr@freebsd.org


Revision tags: OPENBSD_2_4_BASE
# 1.8 19-Aug-1998 csapuntz

Change fxdr_hyper to return a u_quad_t. This minimizes the evil clobbering
of lvalues that ANSI abhors.

And it fixes df on NFS version 3 mounts on Sparcs.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 24-Feb-1997 niklas

OpenBSD tag


Revision tags: OPENBSD_2_0_BASE
# 1.6 21-Apr-1996 deraadt

partial sync with netbsd 960418, more to come


# 1.5 17-Apr-1996 mickey

Minor cleanups. Checked against Lite2.
(NetBSD's was really just a Lite2's, but w/ 64bit support)


# 1.4 31-Mar-1996 mickey

From NetBSD: NFSv3 import (tomorrow's Net's kernel)
Open's patches kept in. i'll possibly take a look at Lite2 soon,
is there smth usefull ?..


# 1.3 29-Feb-1996 niklas

From NetBSD: merge with 960217 (still NFSv2)


# 1.2 21-Dec-1995 deraadt

from cgd; handle 64-bit pointers and longs


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.46 09-Jul-2018 krw

Nuke unused define 'nfsm_writereply()'.

ok beck@ deraadt@ guenther@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 29-Aug-2015 deraadt

fix ugly indents; no harmful macros harmed


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.44 18-Dec-2014 tedu

delete a whole mess of unnecessary caddr_t casts


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 10-Aug-2009 blambert

The only caller of NFSMSIZ got changed yesterday, so remove it.

High five from thib@


# 1.42 09-Aug-2009 thib

set the mrq pointer (request) in the nfsm_reply() macro, as we can return from it.
This can cause us to follow garbage in the nfsd loop, causing two kinds of hell.

problem noticed by nicm@. OK blambert@.


# 1.41 04-Aug-2009 thib

group all of the on-stack variables that are uses by the nfsm_macros
to keep the data munging "state" into an nfsm_info structure. Each
function now has this structure on its stack, and it and its members
are now passed around so that the macros/functions can work there magic.

this will make removing the nfsm_* macros way easier.

Idea/code picked up from DragonflyBSD.

Tested by krw@, jacekm@ and myself.

OK blambert@.


# 1.40 30-Jul-2009 thib

make sure we only ever try to read out post-op attributes
or wcc data if we have a proper reply.

found the hard way by ariane@, tested by ariane@.

OK blambert@


# 1.39 20-Jul-2009 thib

(struct foo *)0 -> NULL, every where I could find it.

OK blambert@


Revision tags: OPENBSD_4_6_BASE
# 1.38 06-Jun-2009 thib

turdshine previous


# 1.37 05-Jun-2009 jasper

- make this a lot more readable; no binary change

ok thib@


# 1.36 04-Jun-2009 blambert

Demacro nfsm_lookup for great justice.

Thanks to ckuethe for saving much typing with a drive-by perl script.

ok thib@


# 1.35 13-Apr-2009 blambert

Convert macros to functions to reduce kernel memory usage.

In snaps for a while (way too long, according to deraadt@)


# 1.34 30-Mar-2009 blambert

Convert a sizeable macro to a much-leaner function. Saves (IIRC) 5k on i386.

In snaps for a while.


Revision tags: OPENBSD_4_5_BASE
# 1.33 24-Jan-2009 thib

Use a timespec instead of a time_t for the clients nfsnode
mtime, gives us better granularity, helps with cache consistency.

Idea lifted from NetBSD.

OK blambert@


# 1.32 24-Dec-2008 thib

Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since
its used only once and nuke its definition.

Stolen from blambert's bag'o'diffs.

OK blambert@.


Revision tags: OPENBSD_4_4_BASE
# 1.31 15-Jun-2008 thib

unroll the NFSMADV() macro and nuke it

ok blambert@


# 1.30 14-Jun-2008 blambert

Replace nfsm_build/bcopy with nfsm_{buf,str}tombuf functions in
filehandle -> mbuf write macros.

Removes `magic' variable cp which was used only in these macros,
and should lead to marginally better mbuf packing as well.

`slap it in' thib@


# 1.29 13-Jun-2008 blambert

Kill one-liner macro which obfuscated mbuf pointer assignment.

Rescue nfsm_reqhead macro name and rename nfsm_reqh.

End of one-liners from nfsm_subs.h.

ok thib@


# 1.28 13-Jun-2008 blambert

Replace one-line macro which only obfuscated the fact that
the function it was named after took 4 arguments instead of 2.

"get it in; get it in; get it in" thib@


# 1.27 12-Jun-2008 blambert

Remove now-vestigial bpos pointer from NFS. For building outgoing
NFS mbufs, mbufs now contain all their internal buffer state internally,
the way god intended.

ok thib@

testing johan@ (and possibly merdely@; this diff's been around for a bit...)


# 1.26 27-May-2008 blambert

Remove bloated and nasty nfsm_clget macro; while here, replace some
handrolled loops with nfsm_strtombuf and nfsm_buftombuf.

ok deraadt@ via thib@; ok 'nfs buddy' thib@
testing johan@, merdely@; thanks


# 1.25 14-Apr-2008 blambert

Rework NFS mbuf write routines:

nfsm_uiotombuf():
- no meaningful return, function becomes void
- replace frankensteined uiomove/MGET with actual call to uiomove

nfsm_strtmbuf():
- no meaningful return, becomes void
- rename and reorder parameters to be consistent with other functions
- becomes wrapper to nfsm_uiotombuf

nfsm_buftombuf():
- new function; unused but slated for future use
- wrapper to nfsm_uiotombuf

As a bonus, making these functions void removes much unneeded code and
garbage collects `magic' variable t2 which was only used (invisibly)
by the macros from nfsm_subs.h

Preps the way for removing much more NFS goo...

testing by myself, thib@ and merdely@
ok thib@


Revision tags: OPENBSD_4_3_BASE
# 1.24 06-Jan-2008 blambert

More NFS-related kernel shrinkage...

When you use a macro ~200 times, it tends to bloat your code, so make a
function out of it.

Shaves ~8.5 kB from my kernel.

ok thib@, "looks good" krw@

In snaps for 1+ week with no negative reports.


# 1.23 13-Dec-2007 blambert

convert massive (expanded to 150+ lines) nfsm_v3attr macro to a function

shaves an insane (~8K) amount from an i386 kernel

ok thib@


# 1.22 07-Nov-2007 thib

more low hanging fruit; Expand the nfsm_srvwcc_data() macro
and nuke it's definition.

OK krw@, blamers@


# 1.21 06-Nov-2007 thib

Expand the nfsm_srvfillattr() macro and
nuke it's definition.

OK krw@, blambert@


# 1.20 30-Oct-2007 thib

remove an unused macro, NFSMINOFF;

ok beck@, blambert@
"Kill it. Kill it dead." krw@


# 1.19 28-Oct-2007 thib

Remove the "frev" argument from nfs_rephead(); and clean up the "frev"
variables, that are declared all over, since they are passed via macros
to nfs_rephead(); which doesn't do anything with it.

OK krw@


# 1.18 26-Sep-2007 blambert

nfsm_uiotom macro does nothing but hide error-handling code; replace
inline in the one place that it's called

ok thib@, weingart@
"I don't see why not" fgsch@


# 1.17 11-Sep-2007 blambert

Replace nfsm_reqdone and nfsm_srvdone macros inline. No binary change.

ok thib@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.16 02-Apr-2006 otto

When setting timestamps TOSERVER having write permissions is adaquate;
problem experienced by Han Boetes; fix with "nfs4" rick at snowhite
dot cis dot uoguelph dot ca. ok pedro@ tedu@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.15 24-Jun-2004 tholo

This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.

It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.

ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@


# 1.14 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall
time, and used to get that from time.tv_secs or mono_time.tv_secs now get
this from separate time_t globals time_second and time_uptime.

ok art@ niklas@ nordin@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.13 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.12 03-Jul-2002 nate

Remove unused function parameter 'cache' from nfs_rephead
ok costa@


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE SMP_BASE UBC_BASE
# 1.11 05-Jan-2000 millert

branches: 1.11.2; 1.11.12;
In the NFSMSIZ macro, don't assume that m_ext.ext_size == MCLBYTES.
From NetBSD


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE kame_19991208
# 1.10 06-Feb-1999 millert

Use bitwise operations to extract high and low words from the quad
in txdr_hyper. This should be more portable than casting to an array
of ints and pulling out the two 32-bit words (this produced incorrect
results on alpha for the high word for filesystems < 4gig). As a side
effect, txdr_hyper now takes a u_quad_t as its first arg, not u_quad_t *.


# 1.9 10-Jan-1999 millert

Fix for creating files on a Solaris 7 server with NFSv3 (the request was
slightly garbled but older servers seemed to understand it); dfr@freebsd.org


Revision tags: OPENBSD_2_4_BASE
# 1.8 19-Aug-1998 csapuntz

Change fxdr_hyper to return a u_quad_t. This minimizes the evil clobbering
of lvalues that ANSI abhors.

And it fixes df on NFS version 3 mounts on Sparcs.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 24-Feb-1997 niklas

OpenBSD tag


Revision tags: OPENBSD_2_0_BASE
# 1.6 21-Apr-1996 deraadt

partial sync with netbsd 960418, more to come


# 1.5 17-Apr-1996 mickey

Minor cleanups. Checked against Lite2.
(NetBSD's was really just a Lite2's, but w/ 64bit support)


# 1.4 31-Mar-1996 mickey

From NetBSD: NFSv3 import (tomorrow's Net's kernel)
Open's patches kept in. i'll possibly take a look at Lite2 soon,
is there smth usefull ?..


# 1.3 29-Feb-1996 niklas

From NetBSD: merge with 960217 (still NFSv2)


# 1.2 21-Dec-1995 deraadt

from cgd; handle 64-bit pointers and longs


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.45 29-Aug-2015 deraadt

fix ugly indents; no harmful macros harmed


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.44 18-Dec-2014 tedu

delete a whole mess of unnecessary caddr_t casts


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 10-Aug-2009 blambert

The only caller of NFSMSIZ got changed yesterday, so remove it.

High five from thib@


# 1.42 09-Aug-2009 thib

set the mrq pointer (request) in the nfsm_reply() macro, as we can return from it.
This can cause us to follow garbage in the nfsd loop, causing two kinds of hell.

problem noticed by nicm@. OK blambert@.


# 1.41 04-Aug-2009 thib

group all of the on-stack variables that are uses by the nfsm_macros
to keep the data munging "state" into an nfsm_info structure. Each
function now has this structure on its stack, and it and its members
are now passed around so that the macros/functions can work there magic.

this will make removing the nfsm_* macros way easier.

Idea/code picked up from DragonflyBSD.

Tested by krw@, jacekm@ and myself.

OK blambert@.


# 1.40 30-Jul-2009 thib

make sure we only ever try to read out post-op attributes
or wcc data if we have a proper reply.

found the hard way by ariane@, tested by ariane@.

OK blambert@


# 1.39 20-Jul-2009 thib

(struct foo *)0 -> NULL, every where I could find it.

OK blambert@


Revision tags: OPENBSD_4_6_BASE
# 1.38 06-Jun-2009 thib

turdshine previous


# 1.37 05-Jun-2009 jasper

- make this a lot more readable; no binary change

ok thib@


# 1.36 04-Jun-2009 blambert

Demacro nfsm_lookup for great justice.

Thanks to ckuethe for saving much typing with a drive-by perl script.

ok thib@


# 1.35 13-Apr-2009 blambert

Convert macros to functions to reduce kernel memory usage.

In snaps for a while (way too long, according to deraadt@)


# 1.34 30-Mar-2009 blambert

Convert a sizeable macro to a much-leaner function. Saves (IIRC) 5k on i386.

In snaps for a while.


Revision tags: OPENBSD_4_5_BASE
# 1.33 24-Jan-2009 thib

Use a timespec instead of a time_t for the clients nfsnode
mtime, gives us better granularity, helps with cache consistency.

Idea lifted from NetBSD.

OK blambert@


# 1.32 24-Dec-2008 thib

Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since
its used only once and nuke its definition.

Stolen from blambert's bag'o'diffs.

OK blambert@.


Revision tags: OPENBSD_4_4_BASE
# 1.31 15-Jun-2008 thib

unroll the NFSMADV() macro and nuke it

ok blambert@


# 1.30 14-Jun-2008 blambert

Replace nfsm_build/bcopy with nfsm_{buf,str}tombuf functions in
filehandle -> mbuf write macros.

Removes `magic' variable cp which was used only in these macros,
and should lead to marginally better mbuf packing as well.

`slap it in' thib@


# 1.29 13-Jun-2008 blambert

Kill one-liner macro which obfuscated mbuf pointer assignment.

Rescue nfsm_reqhead macro name and rename nfsm_reqh.

End of one-liners from nfsm_subs.h.

ok thib@


# 1.28 13-Jun-2008 blambert

Replace one-line macro which only obfuscated the fact that
the function it was named after took 4 arguments instead of 2.

"get it in; get it in; get it in" thib@


# 1.27 12-Jun-2008 blambert

Remove now-vestigial bpos pointer from NFS. For building outgoing
NFS mbufs, mbufs now contain all their internal buffer state internally,
the way god intended.

ok thib@

testing johan@ (and possibly merdely@; this diff's been around for a bit...)


# 1.26 27-May-2008 blambert

Remove bloated and nasty nfsm_clget macro; while here, replace some
handrolled loops with nfsm_strtombuf and nfsm_buftombuf.

ok deraadt@ via thib@; ok 'nfs buddy' thib@
testing johan@, merdely@; thanks


# 1.25 14-Apr-2008 blambert

Rework NFS mbuf write routines:

nfsm_uiotombuf():
- no meaningful return, function becomes void
- replace frankensteined uiomove/MGET with actual call to uiomove

nfsm_strtmbuf():
- no meaningful return, becomes void
- rename and reorder parameters to be consistent with other functions
- becomes wrapper to nfsm_uiotombuf

nfsm_buftombuf():
- new function; unused but slated for future use
- wrapper to nfsm_uiotombuf

As a bonus, making these functions void removes much unneeded code and
garbage collects `magic' variable t2 which was only used (invisibly)
by the macros from nfsm_subs.h

Preps the way for removing much more NFS goo...

testing by myself, thib@ and merdely@
ok thib@


Revision tags: OPENBSD_4_3_BASE
# 1.24 06-Jan-2008 blambert

More NFS-related kernel shrinkage...

When you use a macro ~200 times, it tends to bloat your code, so make a
function out of it.

Shaves ~8.5 kB from my kernel.

ok thib@, "looks good" krw@

In snaps for 1+ week with no negative reports.


# 1.23 13-Dec-2007 blambert

convert massive (expanded to 150+ lines) nfsm_v3attr macro to a function

shaves an insane (~8K) amount from an i386 kernel

ok thib@


# 1.22 07-Nov-2007 thib

more low hanging fruit; Expand the nfsm_srvwcc_data() macro
and nuke it's definition.

OK krw@, blamers@


# 1.21 06-Nov-2007 thib

Expand the nfsm_srvfillattr() macro and
nuke it's definition.

OK krw@, blambert@


# 1.20 30-Oct-2007 thib

remove an unused macro, NFSMINOFF;

ok beck@, blambert@
"Kill it. Kill it dead." krw@


# 1.19 28-Oct-2007 thib

Remove the "frev" argument from nfs_rephead(); and clean up the "frev"
variables, that are declared all over, since they are passed via macros
to nfs_rephead(); which doesn't do anything with it.

OK krw@


# 1.18 26-Sep-2007 blambert

nfsm_uiotom macro does nothing but hide error-handling code; replace
inline in the one place that it's called

ok thib@, weingart@
"I don't see why not" fgsch@


# 1.17 11-Sep-2007 blambert

Replace nfsm_reqdone and nfsm_srvdone macros inline. No binary change.

ok thib@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.16 02-Apr-2006 otto

When setting timestamps TOSERVER having write permissions is adaquate;
problem experienced by Han Boetes; fix with "nfs4" rick at snowhite
dot cis dot uoguelph dot ca. ok pedro@ tedu@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.15 24-Jun-2004 tholo

This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.

It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.

ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@


# 1.14 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall
time, and used to get that from time.tv_secs or mono_time.tv_secs now get
this from separate time_t globals time_second and time_uptime.

ok art@ niklas@ nordin@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.13 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE UBC_SYNC_A UBC_SYNC_B
# 1.12 03-Jul-2002 nate

Remove unused function parameter 'cache' from nfs_rephead
ok costa@


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE SMP_BASE UBC_BASE
# 1.11 05-Jan-2000 millert

branches: 1.11.2; 1.11.12;
In the NFSMSIZ macro, don't assume that m_ext.ext_size == MCLBYTES.
From NetBSD


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE kame_19991208
# 1.10 06-Feb-1999 millert

Use bitwise operations to extract high and low words from the quad
in txdr_hyper. This should be more portable than casting to an array
of ints and pulling out the two 32-bit words (this produced incorrect
results on alpha for the high word for filesystems < 4gig). As a side
effect, txdr_hyper now takes a u_quad_t as its first arg, not u_quad_t *.


# 1.9 10-Jan-1999 millert

Fix for creating files on a Solaris 7 server with NFSv3 (the request was
slightly garbled but older servers seemed to understand it); dfr@freebsd.org


Revision tags: OPENBSD_2_4_BASE
# 1.8 19-Aug-1998 csapuntz

Change fxdr_hyper to return a u_quad_t. This minimizes the evil clobbering
of lvalues that ANSI abhors.

And it fixes df on NFS version 3 mounts on Sparcs.


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.7 24-Feb-1997 niklas

OpenBSD tag


Revision tags: OPENBSD_2_0_BASE
# 1.6 21-Apr-1996 deraadt

partial sync with netbsd 960418, more to come


# 1.5 17-Apr-1996 mickey

Minor cleanups. Checked against Lite2.
(NetBSD's was really just a Lite2's, but w/ 64bit support)


# 1.4 31-Mar-1996 mickey

From NetBSD: NFSv3 import (tomorrow's Net's kernel)
Open's patches kept in. i'll possibly take a look at Lite2 soon,
is there smth usefull ?..


# 1.3 29-Feb-1996 niklas

From NetBSD: merge with 960217 (still NFSv2)


# 1.2 21-Dec-1995 deraadt

from cgd; handle 64-bit pointers and longs


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision