From owner-freebsd-hackers@freebsd.org Wed Jul 29 23:31:11 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3062D9AE693 for ; Wed, 29 Jul 2015 23:31:11 +0000 (UTC) (envelope-from rdarbha@juniper.net) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0121.outbound.protection.outlook.com [65.55.169.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD085E00 for ; Wed, 29 Jul 2015 23:31:10 +0000 (UTC) (envelope-from rdarbha@juniper.net) Received: from DM2PR0501MB1150.namprd05.prod.outlook.com (10.160.245.152) by DM2PR0501MB1551.namprd05.prod.outlook.com (10.160.133.141) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 29 Jul 2015 23:31:03 +0000 Received: from DM2PR0501MB1150.namprd05.prod.outlook.com ([10.160.245.152]) by DM2PR0501MB1150.namprd05.prod.outlook.com ([10.160.245.152]) with mapi id 15.01.0225.018; Wed, 29 Jul 2015 23:31:03 +0000 From: Raviprakash Darbha To: "freebsd-hackers@freebsd.org" CC: Steve Kiernan , Simon Gerraty Subject: getting a disk structure given a device name Thread-Topic: getting a disk structure given a device name Thread-Index: AQHQylaiWAQweQ0eCEqSdk6fBJ7DWQ== Date: Wed, 29 Jul 2015 23:31:03 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: freebsd.org; dkim=none (message not signed) header.d=none; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [66.129.239.10] x-microsoft-exchange-diagnostics: 1; DM2PR0501MB1551; 5:wF2iDCaGwBH30s6SQoosK1dr8+yVk6xpZfzV+2YE0SHl5CVzwehJLdm/Ca7f0EFrvDFtQq1N2/NASiP0TBqnFQ9ZaacftvHfVncbThJd6znRnEHlZ5HWsLGe6z16SdH3yViEV/vjrWofVhdItQDA9w==; 24:23GyzkbDZsfkNeGOVMxT/9Rym/g/jJRSgGrq1OGIo/NZtLGY6gIclui/k0Vxxs7wE0TdXkpOEM7yYOS9Dq8amh7g2sSkROX+afsHJNqGNnU=; 20:veOHozo55TMR9r7hD1DaDvG2ArrD9HWUzG4zEAw1CKTNHAQh2m/UXIafL+TiT34+vSllvEBIYpVwYHUKdBiOOA== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0501MB1551; dm2pr0501mb1551: X-MS-Exchange-Organization-RulesExecuted x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:DM2PR0501MB1551; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0501MB1551; x-forefront-prvs: 0652EA5565 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(53754006)(86362001)(82746002)(87936001)(66066001)(110136002)(107886002)(19580395003)(2351001)(62966003)(450100001)(50986999)(2501003)(46102003)(2900100001)(77156002)(83716003)(5001960100002)(122556002)(102836002)(92566002)(40100003)(77096005)(36756003)(189998001)(33656002)(2656002)(229853001)(54356999)(5002640100001)(106116001)(99286002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0501MB1551; H:DM2PR0501MB1150.namprd05.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2015 23:31:03.3038 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0501MB1551 X-Mailman-Approved-At: Wed, 29 Jul 2015 23:39:08 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:31:11 -0000 Hello All=20 I am trying to write a filter driver for the ata block on freebsd 6.2 to si= mulate failed reads and writes. For this i would like to know if there is a= call to convert a given device path (ex /dev/ad0) to a disk structure (ad= p->disk) which has the strategy function so that i could modify that and po= int it to my filter.=20 There is a similar function in linux kernel blk_get_by_path and would like = to know if there is something similar on freebsd too. The other option is to write a function to traverse through the list of de= vs and return the disk which has the disk->d_name as the given device path.= This is a bit laborious but not sure if thats the only option.=20 Any help is appreciated.=20 Thanks Ravi=20 =