[OpenAFS-devel] Cache inconsistency in client 1.4.8 and above
Felix Frank
Felix.Frank@Desy.de
Thu, 7 May 2009 09:52:23 +0200 (CEST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--579669762-1884729168-1241682743=:30320
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> Attached is yet another version ...
Now is.
--579669762-1884729168-1241682743=:30320
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=mmap_test.c
Content-Transfer-Encoding: BASE64
Content-Description:
Content-Disposition: attachment; filename=mmap_test.c
I2luY2x1ZGUgPHN5cy9tbWFuLmg+DQojaW5jbHVkZSA8c3lzL2ZjbnRsLmg+
DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8c3RkbGliLmg+DQoj
aW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8c3RkaW8uaD4NCiNpbmNs
dWRlIDx0aW1lLmg+DQojZGVmaW5lIFRBUkdFVFNJWkUgKDEyMCA8PCAyMCkN
CiNkZWZpbmUgQ0hVTktTSVpFICgxNDYwKQ0KI2RlZmluZSBOUkNIVU5LUyAo
VEFSR0VUU0laRSAvIENIVU5LU0laRSkNCiNkZWZpbmUgU0laRSAoTlJDSFVO
S1MgKiBDSFVOS1NJWkUpDQoNCnN0YXRpYyB2b2lkIGZpbGxtZW0odm9pZCAq
c3RhcnQsIGludCBucikNCnsNCgltZW1zZXQoc3RhcnQsIG5yLCBDSFVOS1NJ
WkUpOw0KfQ0KI2RlZmluZSBwYWdlX29mZnNldChidWYsIG9mZikgKDB4ZmZm
ICYgKCh1bnNpZ25lZCkodW5zaWduZWQgbG9uZykoYnVmKSsob2ZmKSkpDQoN
CnN0YXRpYyBpbnQgZG9fd3JpdGUgPSAxLCBkb19hZHZpc2UgPSAxLCB2ZXJi
b3NlID0gMCwgbGluZWFyID0gMDsNCnN0YXRpYyBpbnQgZmlyc3RfY29ycnVw
dCA9IC0xOw0Kc3RhdGljI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