1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>blkdev_get_by_dev</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Filesystems API"><link rel="up" href="other_functions.html" title="Other Functions"><link rel="prev" href="API-blkdev-get-by-path.html" title="blkdev_get_by_path"><link rel="next" href="API-lookup-bdev.html" title="lookup_bdev"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">blkdev_get_by_dev</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-blkdev-get-by-path.html">Prev</a> </td><th width="60%" align="center">Other Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-lookup-bdev.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-blkdev-get-by-dev"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>blkdev_get_by_dev — 2 open a block device by device number 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">struct block_device * <b class="fsfunc">blkdev_get_by_dev </b>(</code></td><td>dev_t <var class="pdparam">dev</var>, </td></tr><tr><td> </td><td>fmode_t <var class="pdparam">mode</var>, </td></tr><tr><td> </td><td>void * <var class="pdparam">holder</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1102966228"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>dev</code></em></span></dt><dd><p> 4 device number of block device to open 5 </p></dd><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p> 6 FMODE_* mask 7 </p></dd><dt><span class="term"><em class="parameter"><code>holder</code></em></span></dt><dd><p> 8 exclusive holder identifier 9 </p></dd></dl></div></div><div class="refsect1"><a name="idp1102969892"></a><h2>Description</h2><p> 10 Open the blockdevice described by device number <em class="parameter"><code>dev</code></em>. <em class="parameter"><code>mode</code></em> and 11 <em class="parameter"><code>holder</code></em> are identical to <code class="function">blkdev_get</code>. 12 </p><p> 13 14 Use it ONLY if you really do not have anything better - i.e. when 15 you are behind a truly sucky interface and all you are given is a 16 device number. _Never_ to be used for internal purposes. If you 17 ever need it - reconsider your API. 18 </p><p> 19 20 On success, the returned block_device has reference count of one. 21</p></div><div class="refsect1"><a name="idp1102972556"></a><h2>CONTEXT</h2><p> 22 Might sleep. 23</p></div><div class="refsect1"><a name="idp1102973172"></a><h2>RETURNS</h2><p> 24 Pointer to block_device on success, ERR_PTR(-errno) on failure. 25</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-blkdev-get-by-path.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="other_functions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-lookup-bdev.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">blkdev_get_by_path</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">lookup_bdev</span></td></tr></table></div></body></html> 26