Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757701AbYAHKqu (ORCPT ); Tue, 8 Jan 2008 05:46:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753145AbYAHKov (ORCPT ); Tue, 8 Jan 2008 05:44:51 -0500 Received: from ms0.nttdata.co.jp ([163.135.193.231]:42773 "EHLO ms0.nttdata.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753350AbYAHKoo (ORCPT ); Tue, 8 Jan 2008 05:44:44 -0500 Message-Id: <20080108095005.330663469@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:21 +0900 From: Kentaro Takeda To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Kentaro Takeda , Tetsuo Handa Subject: [TOMOYO #6 18/21] LSM adapter functions. X-OriginalArrivalTime: 08 Jan 2008 09:50:06.0787 (UTC) FILETIME=[D971F130:01C851DB] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="boundary-1" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 29822 Lines: 394 --boundary-1 Content-Disposition: inline; filename="tomoyo-hooks.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 VG8gYXZvaWQgbmFtZXNwYWNlX3NlbSBkZWFkbG9jaywgdGhpcyBwYXRjaCB1c2VzDQoiY3VycmVu dC0+bGFzdF92ZnNtb3VudCIgYXNzb2NpYXRlZCBieSB3cmFwcGVyIGZ1bmN0aW9ucy4NCg0KU2ln bmVkLW9mZi1ieTogS2VudGFybyBUYWtlZGEgPHRha2VkYWtuQG50dGRhdGEuY28uanA+DQpTaWdu ZWQtb2ZmLWJ5OiBUZXRzdW8gSGFuZGEgPHBlbmd1aW4ta2VybmVsQEktbG92ZS5TQUtVUkEubmUu anA+DQotLS0NCiBzZWN1cml0eS90b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nLCBwaWQpOw0KK30NCisjZW5kaWYNCisNCitz dGF0aWMgc3RydWN0IHNlY3VyaXR5X29wZXJhdGlvbnMgdG9tb3lvX3NlY3VyaXR5X29wcyA9IHsN CisJLnRhc2tfYWxsb2Nfc2VjdXJpdHkgICAgICAgPSB0bXlfdGFza19hbGxvY19zZWN1cml0eSwN CisJLnRhc2tfZnJlZV9zZWN1cml0eSAgICAgICAgPSB0bXlfdGFza19mcmVlX3NlY3VyaXR5LA0K KwkuYnBybV9hbGxvY19zZWN1cml0eSAgICAgICA9IHRteV9icHJtX2FsbG9jX3NlY3VyaXR5LA0K KwkuYnBybV9jaGVja19zZWN1cml0eSAgICAgICA9IHRteV9icHJtX2NoZWNrX3NlY3VyaXR5LA0K KwkuYnBybV9wb3N0X2FwcGx5X2NyZWRzICAgICA9IHRteV9icHJtX3Bvc3RfYXBwbHlfY3JlZHMs DQorCS5icHJtX2ZyZWVfc2VjdXJpdHkgICAgICAgID0gdG15X2Jwcm1fZnJlZV9zZWN1cml0eSwN CisJLnN5c2N0bCAgICAgICAgICAgICAgICAgICAgPSB0bXlfc3lzY3RsLA0KKwkuaW5vZGVfcGVy bWlzc2lvbiAgICAgICAgICA9IHRteV9pbm9kZV9wZXJtaXNzaW9uLA0KKwkuaW5vZGVfc2V0YXR0 ciAgICAgICAgICAgICA9IHRteV9pbm9kZV9zZXRhdHRyLA0KKwkuaW5vZGVfY3JlYXRlICAgICAg ICAgICAgICA9IHRteV9pbm9kZV9jcmVhdGUsDQorCS5pbm9kZV91bmxpbmsgICAgICAgICAgICAg ID0gdG15X2lub2RlX3VubGluaywNCisJLmlub2RlX21rZGlyICAgICAgICAgICAgICAgPSB0bXlf aW5vZGVfbWtkaXIsDQorCS5pbm9kZV9ybWRpciAgICAgICAgICAgICAgID0gdG15X2lub2RlX3Jt ZGlyLA0KKwkuaW5vZGVfc3ltbGluayAgICAgICAgICAgICA9IHRteV9pbm9kZV9zeW1saW5rLA0K KwkuaW5vZGVfbWtub2QgICAgICAgICAgICAgICA9IHRteV9pbm9kZV9ta25vZCwNCisJLmlub2Rl X2xpbmsgICAgICAgICAgICAgICAgPSB0bXlfaW5vZGVfbGluaywNCisJLmlub2RlX3JlbmFtZSAg ICAgICAgICAgICAgPSB0bXlfaW5vZGVfcmVuYW1lLA0KKwkuZmlsZV9mY250bCAgICAgICAgICAg ICAgICA9IHRteV9maWxlX2ZjbnRsLA0KKwkuZmlsZV9pb2N0bCAgICAgICAgICAgICAgICA9IHRt eV9maWxlX2lvY3RsLA0KKwkuc29ja2V0X2xpc3RlbiAJICAgICAgICAgICA9IHRteV9zb2NrZXRf bGlzdGVuLA0KKwkuc29ja2V0X2NyZWF0ZSAgICAgICAgICAgICA9IHRteV9zb2NrZXRfY3JlYXRl LA0KKwkuc29ja2V0X2Nvbm5lY3QgICAgICAgICAgICA9IHRteV9zb2NrZXRfY29ubmVjdCwNCisJ LnNvY2tldF9iaW5kIAkgICAgICAgICAgID0gdG15X3NvY2tldF9iaW5kLA0KKwkuc29ja2V0X3Nl bmRtc2cgICAgICAgICAgICA9IHRteV9zb2NrZXRfc2VuZG1zZywNCisJLnNiX21vdW50ICAgICAg ICAgICAgICAgICAgPSB0bXlfc2JfbW91bnQsDQorCS5zYl91bW91bnQgICAgICAgICAgICAgICAg ID0gdG15X3NiX3Vtb3VudCwNCisJLnNiX3Bpdm90cm9vdCAgICAgICAgICAgICAgPSB0bXlfc2Jf cGl2b3Ryb290LA0KKwkuc2V0dGltZSAgICAgICAgICAgICAgICAgICA9IHRteV9zZXR0aW1lLA0K KwkuY2FwYWJsZSAgICAgICAgICAgICAgICAgICA9IHRteV90YXNrX2NhcGFibGUsDQorCS5zb2Nr ZXRfcG9zdF9hY2NlcHQgICAgICAgID0gdG15X3NvY2tldF9wb3N0X2FjY2VwdCwNCisJLnNvY2tl dF9wb3N0X3JlY3ZfZGF0YWdyYW0gPSB0bXlfc29ja2V0X3Bvc3RfcmVjdl9kYXRhZ3JhbSwNCisj aWZkZWYgX19I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XJpdHkgPSBrbWVtX2NhY2hlX2FsbG9jKHRteV9j YWNoZXAsIEdGUF9LRVJORUwpOw0KKwkoKHN0cnVjdCB0bXlfc2VjdXJpdHkgKikgaW5pdF90YXNr LnNlY3VyaXR5KS0+ZG9tYWluID0gJktFUk5FTF9ET01BSU47DQorCSgoc3RydWN0IHRteV9zZWN1 cml0eSAqKSBpbml0X3Rhc2suc2VjdXJpdHkpLT5wcmV2X2RvbWFpbiA9IE5VTEw7DQorCSgoc3Ry dWN0IHRteV9zZWN1cml0eSAqKSBpbml0X3Rhc2suc2VjdXJpdHkpLT5mbGFncyA9IDA7DQorDQor CXJldHVybiAwOw0KK30NCisNCitzZWN1cml0eV9pbml0Y2FsbCh0bXlfaW5pdCk7DQoNCi0tIA0K --boundary-1-- -- 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/