inode.c list traversal -- use list.h stuff

Craig Christophel (merlin@transgeek.com)
Tue, 11 Dec 2001 23:56:11 -0500


--------------Boundary-00=_NDS7XQD88AT76SZTJ5Y3
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This changes some of the list traversals in inode.c to use the list_for_each*
functions. It also adds the list_for_each*_r reverse traversal macro's in
list.h.

Comments welcome.

Craig.
--------------Boundary-00=_NDS7XQD88AT76SZTJ5Y3
Content-Type: text/x-diff;
charset="iso-8859-1";
name="inode-list-macro-use.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="inode-list-macro-use.diff"

LS0tIGxpbnV4L2ZzL2lub2RlLmMJVHVlIERlYyAxMSAxMDoyMzowOCAyMDAxCisrKyBsaW51eC5t
dC9mcy9pbm9kZS5jCVR1ZSBEZWMgMTEgMjM6NDY6MjIgMjAwMQpAQCAtMjc5LDI0ICsyNzksMjYg
QEAKIAl9CiB9CiAKKy8qCisgKiB0cnlfdG9fc3luY191bnVzZWRfbGlzdCAtIHN5bmMgdGhlIGlu
b2RlcyBvbiB0aGUgbGlzdCBpZiBpX2NvdW50IGlzIDAKKyAqIEBoZWFkOgl0aGUgJnN0cnVjdCBs
aXN0IGhlYWQgcG9pbnRlciB0byBydW4gdGhyb3VnaAorICogQG5yX2lub2RlczoJdGhlIG51bWJl
ciBvZiBpbm9kZXMgdG8gYXR0ZW1wdCB0byBzeW5jCisgKi8KKwogc3RhdGljIGlubGluZSBpbnQg
dHJ5X3RvX3N5bmNfdW51c2VkX2xpc3Qoc3RydWN0IGxpc3RfaGVhZCAqaGVhZCwgaW50IG5yX2lu
b2RlcykKIHsKLQlzdHJ1Y3QgbGlzdF9oZWFkICp0bXAgPSBoZWFkOworCXN0cnVjdCBsaXN0X2hl
YWQgKnBvcywqcHNhdmU7CiAJc3RydWN0IGlub2RlICppbm9kZTsKIAotCXdoaWxlIChucl9pbm9k
ZXMgJiYgKHRtcCA9IHRtcC0+cHJldikgIT0gaGVhZ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b3Vu
dGVyLgorICogQGhlYWQ6CXRoZSBoZWFkIG9mIHRoZSBsaXN0LgorICovCisjZGVmaW5lIGxpc3Rf
Zm9yX2VhY2hfcihwb3MsaGVhZCkgXAorCWZvciAocG9zID0gKGhlYWQpLT5wcmV2LCBwcmVmZXRj
aChwb3MtPnByZXYpOyBwb3MgIT0gKGhlYWQpOyBcCisJCXBvcyA9IHBvcy0+cHJldiwgcHJlZmV0
Y2gocG9zLT5wcmV2KSkKKworLyoqCisgKiBsaXN0X2Zvcl9lYWNoX3NhZmVfciAgIC0gICAgICAg
aXRlcmF0ZSBvdmVyIGEgbGlzdCBpbiByZXZlcnNlIHNhZmUgYWdhaW5zdCByZW1vdmFsIG9mIGxp
c3QgZW50cnkKKyAqIEBwb3M6ICAgICAgICB0aGUgJnN0cnVjdCBsaXN0X2hlYWQgdG8gdXNlIGFz
IGEgbG9vcCBjb3VudGVyLgorICogQG46ICAgICAgICAgIGFub3RoZXIgJnN0cnVjdCBsaXN0X2hl
YWQgdG8gdXNlIGFzIHRlbXBvcmFyeSBzdG9yYWdlCisgKiBAaGVhZDogICAgICAgdGhlIGhlYWQg
Zm9yIHlvdXIgbGlzdC4KKyAqLworI2RlZmluZSBsaXN0X2Zvcl9lYWNoX3NhZmVfcihwb3MsIG4s
IGhlYWQpIFwKKwlmb3IgKHBvcyA9IChoZWFkKS0+cHJldiwgbiA9IHBvcy0+cHJldjsgcG9zICE9
IChoZWFkKTsgXAorCQlwb3MgPSBuLCBuID0gcG9zLT5wcmV2KQorCiAjZW5kaWYgLyogX19LRVJO
RUxfXyB8fCBfTFZNX0hfSU5DTFVERSAqLwogCiAjZW5kaWYK

--------------Boundary-00=_NDS7XQD88AT76SZTJ5Y3--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/