Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Oct 2010 00:27:44 +0000
From:      Paul B Mahol <onemda@gmail.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: ndis: fix ugly code
Message-ID:  <AANLkTimWn1q9RJMdXsu44kmwEeTVWEQ%2B1O%2BrT%2BM0puWn@mail.gmail.com>
In-Reply-To: <4CAB9212.4010203@freebsd.org>
References:  <AANLkTinpUmhczHu1mmtuO1BaibSpT1xUG0PY-Km8wHvL@mail.gmail.com> <4CAB9212.4010203@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--001636284556a0a0e90491e7d894
Content-Type: text/plain; charset=ISO-8859-1

On 10/5/10, Julian Elischer <julian@freebsd.org> wrote:
>   On 10/5/10 1:19 PM, Paul B Mahol wrote:
>> Hi,
>>
>> If clang did not complain, I would probbaly never spot it.
>>
>> Patch attached.
>
> personally I think you could use kproc_kthread_add so that a single
> NDIS process had three threads.

Patch attached. Now we have single "ndis" kernel process with own threads.

--001636284556a0a0e90491e7d894
Content-Type: text/plain; charset=US-ASCII; name="diff.txt"
Content-Disposition: attachment; filename="diff.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: file0

ZGlmZiAtLWdpdCBhL3N5cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMgYi9zeXMvY29tcGF0
L25kaXMvc3Vicl9udG9za3JubC5jCmluZGV4IDcxNGZjZDguLmVhZmJiN2MgMTAwNjQ0Ci0tLSBh
L3N5cy9jb21wYXQvbmRpcy9zdWJyX250b3Nrcm5sLmMKKysrIGIvc3lzL2NvbXBhdC9uZGlzL3N1
YnJfbnRvc2tybmwuYwpAQCAtMjU0LDYgKzI1NCw3IEBAIHN0YXRpYyBpbnQzMl90IEtlRGVsYXlF
eGVjdXRpb25UaHJlYWQodWludDhfdCwgdWludDhfdCwgaW50NjRfdCAqKTsKIHN0YXRpYyBpbnQz
Ml90IEtlU2V0UHJpb3JpdHlUa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IG5vdHJlYWNoZWQgKi8KIH0KIApAQCAtMzc0MCw3ICsz
NzQ0LDcgQEAgbnRvc2tybmxfZHBjX3RocmVhZChhcmcpCiAjaWYgX19GcmVlQlNEX3ZlcnNpb24g
PCA1MDIxMTMKIAltdHhfbG9jaygmR2lhbnQpOwogI2VuZGlmCi0Ja3Byb2NfZXhpdCgwKTsKKwlr
dGhyZWFkX2V4aXQoKTsKIAlyZXR1cm47IC8qIG5vdHJlYWNoZWQgKi8KIH0KIAo=
--001636284556a0a0e90491e7d894--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimWn1q9RJMdXsu44kmwEeTVWEQ%2B1O%2BrT%2BM0puWn>