Re: [PATCH 1/19] MUTEX: Introduce simple mutex implementation

David Howells
2005-12-14T11:02:37Z

Paul Jackson <pj@sgi.com> wrote:

> The sed/perl script to make the textual change should be practical.
> Indeed, I would claim that the initial big patch -should- be done
> that way. Keep refining a sed script until manual inspection and
> trial builds of all arch's, allconfig, show that it seems to be right.
> Each time you find an error doing this, don't manually edit the
> kernel source; rather refine the script and try applying it again.

Actually, you may have a point.

If the order of patches is:

(1) Create new mutex as struct mutex/up_mutex/down_mutex, say.

(2) Make counting semaphore implementation struct semaphore/up_sem/down_sem.

(3) Convert uses of semaphores that should be completions into completions.

(4) Convert uses of semaphores that should be counting semaphores to use
up_sem/down_sem.

(5) Mass convert by script all the remaining ups and downs into up_mutex and
down_mutex.

(6) Make wrappers for up/down that map to counting semaphores with the
deprecation attribute set.

That might work, and would be a lot easier; except for the humongous patch
generated at step 5 - which could be regenerated by script. I think I can make
a simple perl script to do that.

Note that I am assuming above that down == down/down_trylock/down_interruptible
for clarity.

David