Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758675AbYAHKsS (ORCPT ); Tue, 8 Jan 2008 05:48:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754688AbYAHKpL (ORCPT ); Tue, 8 Jan 2008 05:45:11 -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 S1754214AbYAHKou (ORCPT ); Tue, 8 Jan 2008 05:44:50 -0500 Message-Id: <20080108095000.273885002@nttdata.co.jp> References: <20080108094903.484613061@nttdata.co.jp> User-Agent: quilt/0.46-1 Date: Tue, 08 Jan 2008 18:49:12 +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 09/21] Domain transition functions. X-OriginalArrivalTime: 08 Jan 2008 09:50:00.0787 (UTC) FILETIME=[D5DE6A30: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: 46496 Lines: 611 --boundary-1 Content-Disposition: inline; filename="tomoyo-domain.patch" Content-Type: application/octect-stream Content-Transfer-Encoding: base64 RXZlcnkgcHJvY2VzcyBiZWxvbmdzIHRvIGEgZG9tYWluIGluIFRPTU9ZTyBMaW51eC4NCkRvbWFp biB0cmFuc2l0aW9uIG9jY3VycyB3aGVuIGV4ZWN2ZSgyKSBpcyBjYWxsZWQNCmFuZCB0aGUgZG9t YWluIGlzIGV4cHJlc3NlZCBhcyAncHJvY2VzcyBpbnZvY2F0aW9uIGhpc3RvcnknLA0Kc3VjaCBh cyAnPGtlcm5lbD4gL3NiaW4vaW5pdCAvZXRjL2luaXQuZC9yYycuDQpEb21haW4gaW5mb3JtYXRp b24gaXMgc3RvcmVkIGluIHRhc2tfc3RydWN0LT5zZWN1cml0eS4NCg0KU2lnbmVkLW9mZi1ieTog S2VudGFybyBUYWtlZGEgPHRha2VkYWtuQG50dGRhdGEuY28uanA+DQpTaWduZWQtb2ZmLWJ5OiBU ZXRzdW8gSGFuZGEgPHBlbmd1aW4ta2VybmVsQEktbG92ZS5TQUtVUkEubmUuanA+DQotLS0NCiBz ZWN1cml0eS90b21veW8vZG9tYWluLmMgfCAxMjYxICsrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrDQogMSBmaWxlIGNoYW5nZWQsIDEyNjEgaW5zZXJ0aW9ucygr KQ0KDQotLS0gL2Rldi9udWxsDQorKysgbGludXgtMi42LW1tL3NlY3VyaXR5L3RvbW95by9kb21h aW4uYw0KQEAgLTAsMCArMSwxMjYxIEBADQorLyoNCisgKiBzZWN1cml0eS90b21veW8vZG9tYWlu LmMNCisgKg0KKyAqIERvbWFpbiB0cmFuc2l0aW9uIGZ1bmN0aW9ucyBmb3IgVE9NT1lPIExpbnV4 Lg0KKyAqLw0KKw0KKyNpbmNsdWRlICJ0b21veW8uaCINCisjaW5jbHVkZSAicmVhbHBhdGguaCIN CisNCisvKioqKioqKioqKioqKioqKioqKioqKioqKiAgVkFSSUFCTEVTICAqKioqKioqKioqKioq KioqKioqKioqKioqLw0KKw0KKy8qIFRoZSBpbml0aWFsIGRvbWFpbi4gKi8NCitzdHJ1Y3QgZG9t YWluX2luZm8gS0VSTkVMX0RPTUFJTjsNCisNCisvKiBMb2NrIGZvciBhcHBlbmRpbmcgZG9tYWlu J3MgQUNMLiAqLw0KK0RFRklORV9NVVRFWChkb21haW5fYWNsX2xvY2spOw0KKw0KKy8qIERvbWFp biBjcmVhdGlvbiBsb2NrLiAqLw0KK3N0YXRpYyBERUZJTkVfTVVURVgobmV3X2RvbWFpbl9hc3Np Z25fbG9jayk7DQorDQorLyoqKioqIFRoZSBzdHJ1Y3R1cmUgZm9yIHByb2dyYW0gZmlsZXMgdG8g Z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G15X3BhdGhjbXAocHRyLT5kb21haW5uYW1lLCBsYXN0X25hbWUpKQ0KKwkJCQljb250 aW51ZTsNCisJCX0NCisJCWlmIChwdHItPnByb2dyYW0gJiYgdG15X3BhdGhjbXAocHRyLT5wcm9n cmFtLCBwcm9ncmFtKSkNCisJCQljb250aW51ZTsNCisJCWlmIChwdHItPmlzX25vdCkNCisJCQly ZXR1cm4gMDsNCisJCWZsYWcgPSAxOw0KKwl9DQorCXJldHVybiBmbGFnOw0KK30NCisNCisvKioq KioqKioqKioqKioqKioqKioqICBTWU1CT0xJQyBMSU5LRUQgUFJPR1JBTSBIQU5ETEVSICAqKioq KioqKioqKioqKioqKioqKiovDQorDQorc3RhdGljIExJU1RfSEVBRChhbGlhc19saXN0KTsNCisN CisvKiBVcGRhdGUgYWxpYXMgbGlzdC4gKi8NCitzdGF0aWMgaW50IHRteV9hZGRfYWxpYXNfZW50 cnkoY29uc3QgY2hhciAqb3JpZ2luYWxfbmFtZSwNCisJCQkgICAgICAgY29uc3QgY2hhciAqYWxp YXNlZF9uYW1lLA0KKwkJCSAgICAgICBjb25zdCBib29sIGlzX2RlbGV0ZSkNCit7DQorCXN0cnVj dCBhbGlhc19lbnRyeSAqbmV3X2VudHJ5Ow0KKwlzdHJ1Y3QgYWxpYXNfZW50cnkgKnB0cjsNCisJ c3RhdGljIERFRklORV9NVVRFWChtdXRleCk7DQorCWNvbnN0IHN0cnVjdCBwYXRoX2luZm8gKnNh dmVkX29yaWdpbmFsX25hbWU7DQorCWNvbnN0IHN0cnVjdCBwYXRoX2luZm8gKnNhdmVkX2FsaWFz ZWRfbmFtZTsNCisJaW50IGVycm9yID0gLUVOT01FTTsNCisNCisJaWYgKCF0bXlfY29ycmVjdF9w YXRoKG9yaWdpbmFsX25hbWUsIDEsIC0xLCAtMSwgX19GVU5DVElPTl9fKSB8fA0KKwkgICAgIXRt eV9jb3JyZWN0X3BhdGgoYWxpYXNlZF9uYW1lLCAxLCAtMSwgLTEsIF9fRlVOQ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0KKwkJCQljb250aW51ZTsNCisJCQlpZiAo dG15X2Vudl9wZXJtKGFyZ19wdHIsIHByb2ZpbGUsIG1vZGUpKSB7DQorCQkJCWVycm9yID0gLUVQ RVJNOw0KKwkJCQlicmVhazsNCisJCQl9DQorCQkJaWYgKCEtLWVudnBfY291bnQpIHsNCisJCQkJ ZXJyb3IgPSAwOw0KKwkJCQlicmVhazsNCisJCQl9DQorCQkJYXJnX2xlbiA9IDA7DQorCQl9DQor dW5tYXBfcGFnZToNCisJCS8qIFVubWFwLiAqLw0KKwkJa3VubWFwKHBhZ2UpOw0KKyNpZmRlZiBD T05GSUdfTU1VDQorCQlwdXRfcGFnZShwYWdlKTsNCisJCXBvcyArPSBQQUdFX1NJWkUgLSBvZmZz ZXQ7DQorI2VuZGlmDQorCQlpKys7DQorCQlvZmZzZXQgPSAwOw0KKwl9DQorb3V0Og0KKwl0bXlf ZnJlZShhcmdfcHRyKTsNCisJaWYgKGVycm9yICYmIG1vZGUgIT0gMykNCisJCWVycm9yID0gMDsN CisJcmV0dXJuIGVycm9yOw0KK30NCg0KLS0gDQo= --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/