linux/fs/char_dev.c
<<
3.on2[]/spa8" 2[]/form" 2[]a 3.on2[ href="../linux+v3.7.5/fs/char_dev.c">3.on2[]img src="../.static/gfx/right.png" alt=">>">3.]/spa8" 3.]spa8 class="lxr_search">3.on3.on2[]input typon hidden" namon navtarget" 3.on2[]input typon text" namon search" idn search">3.on2[]butt.19typon submit">Search3.on2[Prefs 2[]/a>3.]/spa8" on2[ []/div" on2[ []form ac.1.8="ajax+*" method="post" onsubmit="return false;">3.]input typon hidden" namon ajax_lookup" idn ajax_lookup" 3on2[ []/form" 3on2[ []div class="headingbott.m"> ]div idn file_contents""
[ [1]/a>]spa8 class="comment">/*]/spa8"
[ [2]/a>]spa8 class="comment"> *  linux/fs/char_dev.c]/spa8"
[ [3]/a>]spa8 class="comment"> *]/spa8"
[ [4]/a>]spa8 class="comment"> *  Copyright (C) 1991, 1992  Linus Tor[ [5]/a>]spa8 class="comment"> */]/spa8"
[ [6]/a>3[ [7]/a>#include <linux/init.h]/a>>3[ [8]/a>#include <linux/fs.h]/a>>3[ [9]/a>#include <linux/kdev_t.h]/a>>3[ 3.18a>#include <linux/slab.h]/a>>3[ 1118a>#include <linux/string.h]/a>>3[ 12]/a>3[ 1318a>#include <linux/major.h]/a>>3[ 1418a>#include <linux/errno.h]/a>>3[ 1518a>#include <linux/module.h]/a>>3[ 1618a>#include <linux/seq_file.h]/a>>3[ 17]/a>3[ 18]/a>#include <linux/kobject.h]/a>>3[ 19]/a>#include <linux/kobj_map.h]/a>>3[ 2.18a>#include <linux/cdev.h]/a>>3[ 2118a>#include <linux/mutex.h]/a>>3[ 2218a>#include <linux/backing-dev.h]/a>>3[ 2318a>#include <linux/tty.h]/a>>3[ 24]/a>3[ 2518a>#include "internal.h]/a>"3[ 26]/a>3[ 27]/a>]spa8 class="comment">/*]/spa8"
[ 28]/a>]spa8 class="comment"> * capabilities for /dev/mem, /dev/kmem and similar directly mappable charac.er]/spa8"
[ 29]/a>]spa8 class="comment"> * devices]/spa8"
[ 30]/a>]spa8 class="comment"> * - permits shared-mmap for read, write and/or exec]/spa8"
[ 31]/a>]spa8 class="comment"> * - does not permit private mmap in NOMMU mode (can't do COW)]/spa8"
[ 32]/a>]spa8 class="comment"> * - no readahead or I/O queue unplugging required]/spa8"
[ 33]/a>]spa8 class="comment"> */]/spa8"
[ 34]/a>struct[]a href="+code=backing_dev_info" class="sref">backing_dev_info]/a>[]a href="+code=directly_mappable_cdev_bdi" class="sref">directly_mappable_cdev_bdi]/a>[= {
[ 3518a>        .]a href="+code=namo" class="sref">namo]/a>[= ]spa8 class="string">"char"[ 3618a>        .]a href="+code=capabilities" class="sref">capabilities18a>   = (
[ 37]/a>#ifdef[]a href="+code=CONFIG_MMU" class="sref">CONFIG_MMU]/a>3[ 3818a>                ]spa8 class="comment">/* permit private copies of the data to be taken */]/spa8"
[ 3918a>                ]a href="+code=BDI_CAP_MAP_COPY" class="sref">BDI_CAP_MAP_COPY18a> |
[ 4.18a>#endif
[ 4118a>                ]spa8 class="comment">/* permit direct mmap, for read, write or exec */]/spa8"
[ 4218a>                ]a href="+code=BDI_CAP_MAP_DIRECT" class="sref">BDI_CAP_MAP_DIRECT18a> |
[ 4318a>                ]a href="+code=BDI_CAP_READ_MAP" class="sref">BDI_CAP_READ_MAP18a> | ]a href="+code=BDI_CAP_WRITE_MAP" class="sref">BDI_CAP_WRITE_MAP18a> | ]a href="+code=BDI_CAP_EXEC_MAP" class="sref">BDI_CAP_EXEC_MAP18a> |
[ 4418a>                ]spa8 class="comment">/* no writeback happens */]/spa8"
[ 4518a>                ]a href="+code=BDI_CAP_NO_ACCT_AND_WRITEBACK" class="sref">BDI_CAP_NO_ACCT_AND_WRITEBACK18a>),
[ 4618a>};3[ 47]/a>3[ 48]/a>static struct[]a href="+code=kobj_map" class="sref">kobj_map18a> *]a href="+code=cdev_map" class="sref">cdev_map18a>;3[ 49]/a>3[ 50]/a>static ]a href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEX]/a>(]a href="+code=chrdevs_lock" class="sref">chrdevs_lock18a>);3[ 51]/a>3[ 52]/a>static struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a> {
[ 5318a>        struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a> *]a href="+code=next" class="sref">next18a>;3[ 5418a>        unsigned int[]a href="+code=major" class="sref">major18a>;3[ 5518a>        unsigned int[]a href="+code=baseminor" class="sref">baseminor18a>;3[ 5618a>        int[]a href="+code=minorct" class="sref">minorct18a>;3[ 5718a>        char[]a href="+code=namo" class="sref">namo]/a>[64];3[ 5818a>        struct[]a href="+code=cdev" class="sref">cdev18a> *]a href="+code=cdev" class="sref">cdev18a>;              ]spa8 class="comment">/* will die */]/spa8"
[ 59]/a>} *]a href="+code=chrdevs" class="sref">chrdevs]/a>[]a href="+code=CHRDEV_MAJOR_HASH_SIZE" class="sref">CHRDEV_MAJOR_HASH_SIZE]/a>];3[ 60]/a>3[ 61]/a>]spa8 class="comment">/* index in the above */]/spa8"
[ 62]/a>static ]a href="+code=inline" class="sref">inline18a> int[]a href="+code=major_to_index" class="sref">major_to_index]/a>(unsigned ]a href="+code=major" class="sref">major18a>)
[ 6318a>{
[ 6418a>        return ]a href="+code=major" class="sref">major18a> %[]a href="+code=CHRDEV_MAJOR_HASH_SIZE" class="sref">CHRDEV_MAJOR_HASH_SIZE]/a>;3[ 6518a>}3[ 66]/a>3[ 67]/a>#ifdef[]a href="+code=CONFIG_PROC_FS" class="sref">CONFIG_PROC_FS]/a>3[ 68]/a>3[ 69]/a>void ]a href="+code=chrdev_show" class="sref">chrdev_show]/a>(struct[]a href="+code=seq_file" class="sref">seq_file18a> *]a href="+code=f" class="sref">f18a>,[]a href="+code=off_t" class="sref">off_t]/a>[]a href="+code=offset" class="sref">offset18a>)
[ 7018a>{
[ 7118a>        struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a> *]a href="+code=cd" class="sref">cd]/a>;3[ 72]/a>3[ 7318a>        if (]a href="+code=offset" class="sref">offset18a> <[]a href="+code=CHRDEV_MAJOR_HASH_SIZE" class="sref">CHRDEV_MAJOR_HASH_SIZE]/a>) {
[ 7418a>                ]a href="+code=mutex_lock" class="sref">mutex_lock]/a>(&]a href="+code=chrdevs_lock" class="sref">chrdevs_lock18a>);3[ 7518a>                for (]a href="+code=cd" class="sref">cd]/a>[= ]a href="+code=chrdevs" class="sref">chrdevs]/a>[]a href="+code=offset" class="sref">offset18a>];[]a href="+code=cd" class="sref">cd]/a>;[]a href="+code=cd" class="sref">cd]/a>[= ]a href="+code=cd" class="sref">cd]/a>->]a href="+code=next" class="sref">next18a>)
[ 7618a>                        ]a href="+code=seq_printf" class="sref">seq_printf]/a>(]a href="+code=f" class="sref">f18a>,[]spa8 class="string">"%3d %s\n"cd]/a>->]a href="+code=major" class="sref">major18a>, ]a href="+code=cd" class="sref">cd]/a>->]a href="+code=namo" class="sref">namo]/a>);3[ 7718a>                ]a href="+code=mutex_unlock" class="sref">mutex_unlock]/a>(&]a href="+code=chrdevs_lock" class="sref">chrdevs_lock18a>);3[ 7818a>        }3[ 7918a>}3[ 80]/a>3[ 8118a>#endif ]spa8 class="comment">/* CONFIG_PROC_FS */]/spa8"
[ 82]/a>3[ 83]/a>]spa8 class="comment">/*]/spa8"
[ 84]/a>]spa8 class="comment"> * Register a single major with a specified minor range.]/spa8"
[ 85]/a>]spa8 class="comment"> *]/spa8"
[ 86]/a>]spa8 class="comment"> * If major == 0 this func.1.8s will dynamically allocate a major and return]/spa8"
[ 87]/a>]spa8 class="comment"> * its number.]/spa8"
[ 88]/a>]spa8 class="comment"> *]/spa8"
[ 89]/a>]spa8 class="comment"> * If major > 0 this func.1.8 will attempt to reserve the passed range of]/spa8"
[ 90]/a>]spa8 class="comment"> * minors and will return zero .8 success.]/spa8"
[ 91]/a>]spa8 class="comment"> *]/spa8"
[ 92]/a>]spa8 class="comment"> * Returns a -ve errno .8 failure.]/spa8"
[ 93]/a>]spa8 class="comment"> */]/spa8"
[ 94]/a>static struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a> *
[ 95]/a>]a href="+code=__register_chrdev_region" class="sref">__register_chrdev_region]/a>(unsigned int[]a href="+code=major" class="sref">major18a>, unsigned int[]a href="+code=baseminor" class="sref">baseminor18a>,
[ 9618a>                           int[]a href="+code=minorct" class="sref">minorct18a>, c.8st char[*]a href="+code=namo" class="sref">namo]/a>)
[ 9718a>{
[ 9818a>        struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a> *]a href="+code=cd" class="sref">cd]/a>, **]a href="+code=cp" class="sref">cp18a>;3[ 9918a>        int[]a href="+code=ret" class="sref">ret18a> = 0;3[10018a>        int[]a href="+code=i" class="sref">i18a>;3[101]/a>3[10218a>        ]a href="+code=cd" class="sref">cd]/a>[= ]a href="+code=kzalloc" class="sref">kzalloc]/a>(sizeof(struct[]a href="+code=char_device_struct" class="sref">char_device_struct18a>), ]a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL18a>);3[10318a>        if (]a href="+code=cd" class="sref">cd]/a>[== ]a href="+code=NULL" class="sref">NULL]/a>)
[10418a>                return ]a href="+code=ERR_PTR" class="sref">ERR_PTR]/a>(-]a href="+code=ENOMEM" class="sref">ENOMEM18a>);3[105]/a>3[10618a>        ]a href="+code=mutex_lock" class="sref">mutex_lock]/a>(&]a href="+code=chrdevs_lock" class="sref">chrdevs_lock18a>);3[107]/a>3[10818a>        ]spa8 class="comment">/* temporary */]/spa8"
[10918a>        if (]a href="+code=major" class="sref">major18a> == 0) {
[11018a>                for (]a href="+code=i" class="sref">i18a>[= ]a href="+code=ARRAY_SIZE" class="sref">ARRAY_SIZE]/a>(]a href="+code=chrdevs" class="sref">chrdevs]/a>)-1;[]a href="+code=i" class="sref">i18a>[> 0;[]a href="+code=i" class="sref">i18a>--) {
[11118a>                        if (]a href="+code=chrdevs" class="sref">chrdevs]/a>[]a href="+code=i" class="sref">i18a>][== ]a href="+code=NULL" class="sref">NULL]/a>)
[11218a>                                break;3[11318a>                }3[114]/a>3[11518a>                if (]a href="+code=i" class="sref">i18a>[== 0) {
[11618a>                        ]a href="+code=ret" class="sref">ret18a> = -]a href="+code=EBUSY" class="sref">EBUSY18a>;3[11718a>                        goto[]a href="+code=out" class="sref">out18a>;3[11818a>                }3[116dev.c#L119" idn L119" class="line" namon L1oAP_6]/a>3linux/c1dev.h12) {
linux/mu1tex.h12a>>3linux/backing-1dev.h12ak;3f18a>,[]spa8 class="string">"%3d %s\n"3linux/1tty.h124k;3f18a>,[]spa8 class="string">"%3d %s\n&qhref="+code=major" class="sref">major116dev.c#L119" idn5" class="line" namon L55">[ 5518a>        unsigned int[]a href1L24" idn 1L24" class="line" namon 1L24">125k;3f18a>,[]spa8 class="string">"%3d %s\n&quine" namon L96">[ 9618a>        116dev.c#L119" idn " idn L56" class="line" namon L56">[ 5618a>        int[]a 1/internal1.h" class="fref">interna1l.h]/12/a>3[ oflcpyclass="sref">i18a>[= ]/a>->]a href="+code=major" class="sref">major18a>, ]a href="+code]a href="+code=ch">major18a>, ]a href="+code]aclass=" class="sref">cd]/a>->]a href="+code=major" class="sref">major18a>, ]a href="+code=ock]/a>(&]a href="+code=L26" idn 1L26" class="line" namon 1L26">12>);3[ 127]/a>]spa8 class="comme1nt">/128a>3[11018a>    atic ]a href="+code=inline" class="sref">inline1dev.c#L119" idn L119" class="line" namon L1oock]/a>(&]a href="+code=L"line" naar directly mappable cha1rac.e12p18a>;3 * d1evice13) {
 *]a href="L11[10618a>        ]a href="+c namon L111">[11118a>                        if (]a href="+code=;[]a href="+code=ch_struct18a> *]a href="+"sref">f18a>,[]sp_struct18a> *]a href="L11[1061(]a href="+code=ch_struct18a> *]a href=")"+code=cd" class="sref">cd]/a>[= ]a href="+code=cd" class="sref">cd]/a>-&1shared-mm1ap for read, write and/o1r exe13) {
 *]a href=")"+code=cd" class="sridn L64" class="line" namon L64g">[ 7318a>        idn L64" class="line" namon L6|> | ]a href="+code=BDI_CAP1e mmap in1 NOMMU mode (can't d1o COW13a>)
 *]a href=")"+code=cd" class="sridn L64" class="line" namon L6hrdevs" class="sreidn L64" class="line" namon L64106141061 | ]a href="+code=BDI_CAP1e12" idn L112" class="line" namon L1ev.h13ak;3 *]a href=")"+code=cd" class="srhref="+code=major" class="sref">major1+cod16dev.c#L119" idn5" class="line" namon L55">[ 5518a>  )6|> | ]a href="+code=BDI_CAP1e"line" na3]/a>]spa8 class="commen1t"> *13a>)
 *]a href=")"+code=cd" class="srhref="+code=major" class="sref">major1+ (]a href="+code=ch_struct18a> *]a href=")"+code=cd" class="sriine" namon L96">[ 9618a>        14g">[ 7318a>        5" class="line" namon L55">[ 5518a>  )))) | ]a href="+code=BDI_CAP1e24" idn 1f">directly_mappable_cde1v_bdi13/a>3[ ]spa8 cl1ass="string">"char&1quot;13518a>}3capabilit1ies1813a>;3[4]/a>]spa8 s. s="line" namon L108">[10818a>       "+code=CO1NFIG_MMU" class="sref">C1ONFIG1MMU]/a>3[11518a>                if ivate cop1ies of the data to be ta1ken *1]/spa8"
ld_4]/ef="L11(]a href="+code=ch_struct18a> *]a href=")"+code=cd" class="srhref="+code=major" class="sref">majore <BDI_CAP_M1AP_CO14) {
 *]a href=")"+code=cd" class="srhref="+code=major" class="sref">major1+ (]a href="+code=ch_struct18a> *]a href=")"+code=cd" class="sriine" namon L96">[ 9618a>        1- 1e <[1 4.181>#endif
[ 5518a>        unsigned int[]a href1direct mm1ap, for read, write or e1xec *1]/spa8"
[ 5518a>  1+ e=cd" class="sriine" namon L96">[ 9618a>        1- 1e <BDI_CAP_MAP1_DIRE1T18a>  <linux/majo"> *1P18a> |
[10818a>       ss="comme1nt">/* no writeback happ1ens *1]/spa8"
ld_4]/ef="L4106141061 c#L115" idn L11new_4a"+code=inline" cnew_4a"ajor1+lod16dev.c#L119" idnold_4a"+code=inline" cold_4a"ef="">[11518a>                if ass="sref1">BDI_CAP_NO_ACCT_AND_WR1ITEBA14) {
[11618a>                        ]a href="+code=ret" class="sref">ret18a> = -6" idn L416" class="line" namon L416">[ 14a>;3[11718a>                        gL47" idn 1L47" class="line" namon 1L47">14a>;31cdev_1ap18a>;315) {
[10818a>       =chrdevs_1lock" class="sref">chrde1vs_lo15) {
ld_4]/ef="">[11518a>                if L51" idn 1L51" class="line" namon 1L51">15a>)
[11618a>                        ]a href="+code=ret" class="sref">ret18a> = -_struct" 1class="sref">char_device1_stru15ak;3[11718a>                        g> *]a hre1f="+code=next" class="sr1ef">n1518a> |
ma1or18a>;3b1asemi15518a>}3mino1ct18a>;3cd]/a>->]a href="+code=major" class="sref"f">cd]/a>[= ]a href="+code116sref">char_device_struct18a> *]a href="+code=cd" class="sref">cd]1a href="+1code=namo" class="sref">1namo]1a>[64];3cd]/a>;[]a href=+code=cd" class="sref">cd]1af="+code1class="comment">/* will 1die *15918a>;3cdn L77" class="line" namon L77">[ 7718a>                ]a href="+code=mutex_unlock" class="sref">mutex_unlock]/a>(&]a href="+code1IZE" clas1s="sref">CHRDEV_MAJOR_HA1SH_SI16) {
cd]/a>;[]a href=+code=cd" class="sref">cd]1L60" idn 1L60" class="line" namon 1L60">1 60]/a>n L117" class="line" namon L117">[11718:code=cd" class="sref">cd]1L51" idn 1ment">/* index in the ab1ove *16/a>3[ 7718a>                ]a href="+code=mutex_unlock" class="sref">mutex_unlock]/a>(&]a href="+code1Istruct" 1"+code=major" class="sre1f">ma16ak;3f18a>,[]skfreajor18a>, ]a hrekfreaclass="sref">i18a>[= ]/a>->]a href="+codock]/a>(&]a href="+code1I *]a hre163" class="line" namon L163">[16318a>{
[10418a> 16" idn L116" class="line" namon L116">[ock]/a>(&]a href="+code1I]a href=1ss="sref">CHRDEV_MAJOR_H1ASH_S1ZE]/a>;3[16518a>}31 66]/a"
[ 94]/a>static struct[]a href="+code=char_device1ONFIG_PRO1C_FS" class="sref">CONFI1G_PRO1_FS]/achar_dev.c#L94"_[ 7r_dev.c#L95" idn L95" class="line" namo 7r_dev.c#L95" idn L95" 18a> 8a> int[]a href="+code=major_to_index" class="sref">mev_region]/dev.c#L119" idn5" class="line" namon L55">[ 5518a>  ,96" idn L96" class="line" namon L96">[ 9618a>        ) | ]a href="+code=BDI_CAP1L68" idn 1L68" class="line" namon 1L68">1 68]/a[11518a>                if a href="+1code=offset" class="sref1">off17) {
[ 9818a>        struct[]a href="+code=char_device_struct" clas6"+code=cd" class=f">chrdevs]/a>[]a href="+cos="sref">char_device_struct18a> *]a href="+code=cd" class="sref">cd]170" idn L170" class="line" namon L170">[17018a>{
[11018a>    atic ]a href="+code=inline" class="sref">inline1dev.c#L119" idn L119" class="line" namon L1oock]/a>(&]a href="+code=t18a> *]a1 href="+code=cd" class="1sref"1cd]/a>;317ak;3f18a>,[]s106" idn L106" class="line" namon L106">[10618a>        ]a href="+code=mutex_lock" class="sref">mutex_lock]/a>(&]a href="+code=ZE" class1="sref">CHRDEV_MAJOR_HAS1H_SIZ1]/a>) {
 *]a href="L11[10618a>        ]a href="+c namon L111">[11118a>                        if (]a href="+code=;[]a href="+code=ch_struct18a> *]a href="+"sref">f18a>,[]sp_struct18a> *]a href="L11[1061(]a href="+code=ch_struct18a> *]a href=")"+code=cd" class="sref">cd]/a>[= ]a href="+code=cd" class="sref">cd]/a>-&1=chrdevs_1lock" class="sref">chrde1vs_lo1k18a>);3 *]a href=")"+code=cd" class="sridn L64" class="line" namon L6hrdevs" class="sreidn L64" class="line" namon L64106141061 | ]a href="+code=BDI_CAP1gt;]a hre1f="+code=next" class="sr1ef">n1xt18a>)
 *]a href=")"+code=cd" class="srhref="+code=major" class="sref">major1hrdevs" class="srehref="+code=major" class="sref">major1+106141061 | ]a href="+code=BDI_CAP1gfile.h" cllass="fref">linux/seq_fil66">1o]/a>);3 *]a href=")"+code=cd" class="sruine" namon L96">[ 9618a>        1116dev.c#L119" idn " idn L56" class="line" namon L5=cd" class="sref">cd]/a>-&1=NFIG_PRO1lock" class="sref">chrde1vs_lo17a>;3[L78" clas1s="line" namon L78">[ 78118a> 17a8"
 *]a href=")>[11518a>                if 79" idn L179" class="line" namon L179">[18) {
char_device_struct18a> *]a href="+code=cd" class="sref">cd]1L80" idn 1L80" class="line" namon 1L80">18) {
 *]a href="6"+code=cd" class="sref">cd]/a>;[]a href="+code=cd" class="sref">cd]/a>[= ]a href="+code+code=cd" class="sref">cd]1L18a> *]a1"comment">/* CONFIG_PROC1_FS *18/a>318ak;3f18a>,[]s106" i" class="line" namon L77">[ 7718a>                ]a href="+code=mutex_unlock" class="sref">mutex_unlock]/a>(&]a href="+code1n L83">[ 183]/a>]spa8 class="comme1nt">/18318a>{
cd]/a>;[]a href=+code=cd" class="sref">cd]1gle major1 with a specified minor 1range18E]/a>;3[ 185]/a>]spa8 class="comme1nt"> 18518a>}3]spa8 1class="comment"> * its n1umber1]/spa8"
 * If#L29" i" idn Ldn L29" class="line" namon L29">[1n L88">[ 188]/a>]spa8 class="comme1nt"> 1]/spa8"
]nt"> * If#L29" i" idn Ld; mustidna hren L29" class="line" namon L29">[1 attempt 1to reserve the passed ra1nge o1]/spa8"
[ 87]1minors an1d will return zero .8 su1ccess1]/spa8"
]spa8 class="comment"> * - no rea1n L91">[ 191]/a>]spa8 class="comme1nt"> 1]/spa8"
[ 87]1m82" idn 1eturns a -ve errno .8 fa1ilure1]/spa8"
[ 87]1m L83">[ 13]/a>]spa8 class="commen1t"> *19/spa8"
, annegative#errdn L64"="line" namon L92">[ 92]/a>]spa8 class="comm1_struct" 1class="sref">char_device1_stru19ds]/spa8"
b1asemi1or18a>f="fs/char_dev.c#L99"dev.c#L95" idn L95" class="line" nar_dev.c#L95" idn L95" 18a> s/char_dev.c#L9 idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.c#L9fromcd]/a>[= ]a hrefromf">mev_region]/dev.c#L119" idncountref">cd]/a>;[]a ountf">mev                 int[]a href="+code=minorct" class="sref">minorct18a>, c.8st cha1r[*]a hre1f="+code=namo" class="sr1ef">n1mo]/a>)
[19718a>{
[ 9818a>        struct[]a href="+code=char_device_struct" clast;linux/kobject"> 19918a>;3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.c#L9t" class="line" ntoef="6"+code=cd" class=fromcd]/a>[= ]a hrefromf">m1+ e=cd" class="srcountref">cd]/a>;[]a ountf">mlinux/kobj_mage o2= 0;3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.c#L9/ne" namon L117"nf">meve=cd" class="sref">cd]/a>[= ]a href="+code+code=cd" class="sref">cd]2    int[]2 href="+code=i" class="s2ef">i28a>;3[102]/a>3m6"+code=cd" class=fromcd]/a>[= ]a hrefromf">m1 c#L115" idn L11nne" namon L117"nf">m673">[ 7318a>        t" class="line" ntoef="1 c#L115" idn L11nne" namon L117"nf">m6"+code=cd" class=ef">cd]/a>[= ]a href="+code=>[11518a>                if2ode=GFP_K2RNEL" class="sref">GFP_K2RNEL12018a> |
cd]/a>[= ]a href="+code116ar_dev.c#L43" iMKDEVcd]/a>[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne" namon L117"nf">m)+1, 0ock]/a>(&]a href="+code2= ]a href2"+code=NULL" class="sref2>NULL2/a>)
cd]/a>[= ]a href="+code14g">[ 7318a>        t" class="line" ntoef="ef">minorct18a>, c.8st cha2href="+co2e=ENOMEM" class="sref">E2OMEM120/a>3cd]/a>[= ]a href="+code116ar_dev.c#L43" it" class="line" ntoef="1f">minorct18a>, c.8st cha2hinternal." class="line" namon L102">[1020t18a>)
[ 95]/a>]a href="+cos/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne" namon L117"nf">m)eve=cd" class="srMIN8acd]/a>[= ]a hreMIN8a18a> s/char_dev.c#L9nne" namon L117"nf">m)ef">minorct18a>, c.8st cha2h26" idn Lck" class="sref">chrdevs2lock120a>;3cd]/a>[= ]a href="+code1-{s/char_dev.c#L9/ne" namon L117"nf">meve=cd" class="sre="+code=minorct" class="sre1f">minorct18a>, c.8st cha2h L27">[ 2" class="line" namon L102">[1020a>;3[= ]a hreIS_ERaclass="sref">i18a>[= ]/a>->]a href="+codoef">minorct18a>, c.8st cha2hnd similass="comment">/* temporar2 */]/20/spa8"
[= ]a hrefe" ef="1f">minorct18a>, c.8st cha2="+code=m2jor" class="sref">major12a> ==20) {
2-) {
[ 9918a>        int2= ]a href2"+code=NULL" class="sref2>NULL2/a>)
[= ]a hrefe" ef=":code=cd" class="sref">cd]211218a>  2                        2    b21ak;3f18a>,[]st" class="line" ntoef="6"+code=cd" class=/ne" namon L117"nf">mn L99">[ 9918a>        int2= ]a href2mon L113">[11318a>      2     21/a>) {
m6"+code=cd" class=fromcd]/a>[= ]a hrefromf">m1 c#L115" idn L11nne" namon L117"nf">m673">[ 7318a>        t" class="line" ntoef="1 c#L115" idn L11nne" namon L117"nf">m6"+code=cd" class=ef">cd]/a>[= ]a href="+code=>[11518a>                i 2 ref="+co2" class="line" namon L112">[112]/a>3cd]/a>[= ]a href="+code116ar_dev.c#L43" iMKDEVcd]/a>[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne" namon L117"nf">m)+1, 0ock]/a>(&]a href="+code2(]a href=2+code=i" class="sref">i12a>[==20) {
i18a>[=_[ 7r_dev.c#L95" idn L95" class="line" namo 7r_dev.c#L95" idn L95" 18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne" namon L117"nf">m)eve=cd" class="srMIN8acd]/a>[= ]a hreMIN8a18a> s/char_dev.c#L9nne" namon L117"nf">m)e_ar_dev.c#L43" i"f">cd]/a>[= ]a href="+code1-{s/char_dev.c#L9/ne" namon L117"nf">m=ock]/a>(&]a href="+code2]a href="2code=EBUSY" class="sref"2EBUSY28a>;3[ 2f="+code=out" class="sre2">out28a>;3[= ]a hrePTR_ERaclass="sref">i18a>[= ]/a>->]a href="+codock]/a>(&]a href="+code2]nd similamon L118">[11818a>      2     21     }3}3linux/c2dev.h2260]/a>3linux/mu2tex.h22/spa8"
 * If#     L29" i" idn Ldn L29" class="line" namon L29">[2ev.h" cla2ss="fref">linux/backing-2dev.h22/spa8"
[2e ]a href2y.h" class="fref">linux/2tty.h22/spa8"
m:dfirsti[ 3818a 32]ev.c]nt"> * If#4]/a>] idn Ldn L29" class="line" namon L29">[2eref="+co2L24" class="line" namon 2L24">22ds]/spa8"
 * - no rea2/internal2.h" class="fref">interna2l.h]/22/spa8"
29" i"dn driverspa8 class="comment"> * - no rea2/a href="2L26" class="line" namon 2L26">22/spa8"
 * - no rea2/ L27">[ 227]/a>]spa8 class="comme2nt">/22/spa8"
 * If#     L29" i" idn Ld.  T61"" idn  idn L90" clben L29" class="line" namon L29">[2L"line" n2ar directly mappable cha2rac.e22/spa8"
[ 86]/a,ment"> * Ifc]n(alongne" naass=firsti4]/a>] idn L)n L29" class="line" namon L29">[2 29]/a>]s2pa8 class="comment"> * d2evice23/spa8"
[ 92]/a>]spa8 class="comm2shared-mm2ap for read, write and/o2r exe23/spa8"
)
->]a href+codeL95" idn L95" 18a> s/char_dev.c#L9 idn>cd]/a>[= ]a hre idn>18a>{]a href="+code=cd   struct[]a hrefd+code=ev_region]/dev.c#L119" idn5" class="line" namon L55">[ 5518a>  ,9_region]/dev.c#L119" idncountref">cd]/a>;[]a ountf">meidn L5" class="line" namo2ev.h" cla2112" class="line" namon 21ev.h23ak;3minorct18a>, c.8st cha2e"line" n23]/a>]spa8 class="commen2t"> *23a>)
<[11518a>                i 2e24" idn 2f">directly_mappable_cde2v_bdi23/a>3[ 9818a>        struct[]a href="+code=char_device_struct" clast;"char&2quot;23/a>3[ 95]/a>]a href="+co0e_ar_dev.c#L43" i5" class="line" namon L55">[ 5518a>  ,9dev.c#L119" idncountref">cd]/a>;[]a ountf">meve=cd" class="sre="+code=minorct" class="sre1f">minorct18a>, c.8st cha2abilities2" class="sref">capabilit2ies1823a>;3[= ]a hreIS_ERaclass="sref">i18a>[= ]/a>->]a href="+codoef">minorct18a>, c.8st cha2"+code=CO2NFIG_MMU" class="sref">C2ONFIG23a>;3[= ]a hrePTR_ERaclass="sref">i18a>[= ]/a>->]a href="+codock]/a>(&]a href="+code2ivate cop2ies of the data to be ta2ken *2]/spa8"
[= ]a hreMKDEV18a> s/char_dev.c#L9pa8 class="string">"%3d %s\n"cd]/a>->]a href="+code=major" class="sref5" class="line" namon L55">[ 5518a>  )ck]/a>(&]a href="+code2x29]/a>]s2" class="sref">BDI_CAP_M2AP_CO24) {
[ 9918a>        int2xhared-mm2lass="line" namon L40">[2 4.182>#endi}3BDI_CAP_MAP2_DIRE2482]/a>3 * - no rea2xx/major.2"" class="fref">linux/ma2o"> *24/spa8"
[ 95]/a>() - cre clasnt"> dev.c# an="+c occupy2">[ant"> * If#4]/a>dn L29" class="line" namon L29">[2ss="comme2nt">/* no writeback happ2ens *24ds]/spa8"
[ 8>]spa8 cref="L29" class="line" namon L29">[2s]spa8 cl2">BDI_CAP_NO_ACCT_AND_WR2ITEBA24/spa8"
m:dfirsti[ 3818a 32]ev.c]nt"> * If#4]/a>] idn Ldn L29" class="line" namon L29">[26" idn L426" class="line" namon L426">[ 24/spa8"
 * - no rea2L47" idn 2L47" class="line" namon 2L47">24/spa8"
[ 381isnt"> * If#L29" idn L29" class="line" namon L29">[26vate cop2=cdev_map" class="sref">2cdev_24/spa8"
[2L49" idn 2L49" class="line" namon 2L49">25/spa8"
[2Lhared-mm2lock" class="sref">chrde2vs_lo25/spa8"
[ 86]/a>]spa8 class="comment"> * If major == 0 this func.1.8s will 2L51" idn 2L51" class="line" namon 2L51">25/spa8"
[ 87]2_struct" 2class="sref">char_device2_stru25/spa8"
[ 87]2> *]a hre2f="+code=next" class="sr2ef">n25/spa8"
[ 89]/a>]spa8 cla L29" i"e" naass=givef major == 0 this func.1.8s will 2Ls="comme2"+code=major" class="sre2f">ma25ds]/spa8"
[ 90]/a>]spa8 class="comment"> * 2[ss="sref2aseminor" class="sref">b2asemi25/spa8"
 * 2[" idn L42de=minorct" class="sref"2>mino25/spa8"
[ 92]/a>]spa8 class="comm2a href="+2code=namo" class="sref">2namo]25/spa8"
/* will 2die *25/spa8"
[ 381isnL29" i ha7" o81i">[/a>do"e" naass= "co>[ 3818a>29" i"if major == 0 this func.1.8s will 2IZE" clas2s="sref">CHRDEV_MAJOR_HA2SH_SI26/spa8"
26/spa8"
ha7"[n/a>one typ* If#L29" id#L8'7"[k[/a>us" c.g.aass= "co major > 0 this func.1.8 will2L51" idn 2ment">/* index in the ab2ove *26/spa8"
[ 92]/a>]spa8 class="comm2Istruct" 2"+code=major" class="sre2f">ma26/spa8"
[26318a>f="fs/char_dev.c#L9mon L95">[ 95]/a>class="line" namon L95">[ 95]/a>18a> de=__register_chrdev_region" class="sref">__register_chrdev_region]/a>(unsigned int[]a href="+code=major" class="sref">major18a>, unsigned int[]a href2I]a href=2ss="sref">CHRDEV_MAJOR_H2ASH_S26/a>3cd]/a>;[]a ountf">mev                 int[]a href="+code=minorct" class="sr18a>, unsigned int[]a href2Iss="sref265" class="line" namon L265">[26) {
[= ]a hrefil*_Iperane" nruct[]a href="+code=cfopscd]/a>[= ]a hrefops="sref">minorct18a>, c.8st cha2L66" idn 2L66" class="line" namon 2L66">26o]/a>)
CONFI2G_PRO26718a>{
[ 9818a>        struct[]a href="+code=char_device_struct" clast;26918a>{
class="line" nacd+code=1]a href="+code=chaa>class="line" nacd+code=t;off27) {
  f="fs/char_dev.c#L98" fil*_     n1lass="sref">maL55">[ 5518a>  )))) | ]a href="+code=BDI_122H2ASH_S26/a>3 <s0 this func.1.8 will2L51" idn 2ment">/* inclasdeot0tCgister_chrdev_region]/a>(u this func.1.8 will22c6]a href="+code=mutev_region" class="srl22c6]a href="0a>]a href="+co0e_ar_dev.c#L43" i5" class="line" namon L55">[ 5518a>  ,9dev.c#L119" idncountref">cdef="+code2cd" class="1sref"1cd]/a>23minorct18a>, c.8st cha2abilities2" class="sref">capabilit2ies1823a>;3[= ]a hreIL111">[11218a>                    2   if27cd" class="sref">cd]/a>[== ]a 2ss="sref"2cd]/a>-&1=chrdevs_1lock"2class27>                i 2e24" idn 2lass="sref">CONFI2G_PRO267" class="line" namo518a href="fs/char_dev.mo518a hrecapab#L100"IS_ERacd]/a>[= ]a hreILnorct" clre1f="+code=next" class=2sr1ef27" class="line" na!    i 2e24" idn 2lass="sref">CONFI2G_PRO26dev.c#L119" idncountref">cden L265">[de=BDI_CAP1gfile.h" clla2s="fr2f">linux/seq_fil66">1o if L51" idn 1L51" clas2ss="sref">CONFIlas2s/char_dev.c#L98" i/a>class="lin" class="18a> *]a href=")"+code=c2" cla27lass="line" namon L416">[ 14a>2n L5=cd" 2lass="sref">cd]/a>-&1=NF2G_PRO28> 19918a>;3CONFI2G_PRO26ies of the data to b*25/sss="sref">CONFIl25/sRO267" class="line" naa>;[]a ountf">mev          ies of the data to b*25/sss="sref">CONFIl25/sRO26ar_dev.c#L98" i/a>class="li8a> 17a8"2 *]a hre class="sre 2lass="sref">CONFI2G_PRO26ies of the data to b*;[]a ountf">mev         7" class="line" naa>;[]a ountf">mev          ar_dev.c#L98" i/a>class="li8de/linux/ href="+code=cd" class="2ref">28sref2">off27) {
/* inclakobject_set_idn capab" class="sref">cd]/a>2lass="sref">CONFI2G_PRO26ies of the data to bkobj2ment">/* inclakobjs func.n/a>one typ*ev.ing">"H_S7;s"L8'nc.1.8 will2L51" idn 2ment">/* inclasdeot0tCgister_chrdev_region]/a>(u t">18) {
<2 href="fs/char_]a href="2code=28e1xec *1]/spa8"
CONFI2G_PRO26i" class="sref">i1G23a>;3[= ]a hrePTR_ERaclass="sref">i18a>[= ]/a>->]a href="+codock]/a>(&]ae ta2ken *2]/spa8"
 <s0 this fugister_chrdev_region]/a>(u t"111">[112ss="line" namon L77">[ 7218a> 285 class="line" nat;cdx_unlock"2class="sref">mutex_unloc2]/a>(28t[]a href2I]a href=2s if L51" idn 1L51" class="line" namon 1L51">15a>)
/18318a>2
maj2ref">cd]12le major1 with a specifi2d min28jor18a>, ]a href="+code]acla" PTR_ERacd]/a>[= ]a hrePTR_ERaclass="sref" 2lass="sref">CONFI2G_PRO267" class="line" namo51ar_dev.c#L98" idn L98" class="line" namon L98">[ 9ly alloca2e a major and 1retur1]/s2a8"
<28lass="line" namon L416">[ 14a>2#L95" idn2L95" () - r_dev.c# ant">2* If#29ss="sref">cd]1af="+code1class="comm*]a href=")"+code=cd" class="s? 0 :href="+code]acla" PTR_ERacd]/a>[= ]a hrePTR_ERaclass="sref""dev.c#L118" idn L118" classux/mutex.1h" class="fref">l2/spa8"
mutex_unlock]/a>2d ra1nge 21]/spa8"
off27) {
cd]/a>2lass="sref">CONFI2G_PRO26ies of the data to bkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u t8"
CONFIlas2s/chss="sref">mutex_unlock]/a>2dIG_PROC12a1n L91">[ 191]/a>]spa8 2lass=29/char_dev.c#Lt;[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne"" PTR_ERacd]/a>[= ]a hrePTR_ERaclass="sref">i18a>[= ]/a>->]a href="+codock]/a>(&]ae ta2ken *2]/spa8"
 <s0 this fuggister_chrdev_region]/a>(u t8111">[112rrno .8 fa1ilure1]/spa8"2cd]1af="+code1class="commude/linux/k2L68" idn 2L68ister_chrdev_region]/a>(u t8_unlock"2s="commen1t"> *19/spa8"
2a hre2="fs/c" class="sref">cd]/a>->]"line" na2_dev.c#L95" idn L95" 18a2 s/ch29"+code=major" class="sref">maj2n>18a>{s/2har_dev.c#L9fromcd]/a>[=2]a hr29lass="sref">b2asemi25/spa8"
[ 9918a>   "+code=na2o" class="sr1ef">n1mo]/a2)
mino25/spa8"
[= ]a hreMt18a18a>[2 ]a hf="+css="comme1nt"> 18518a>}3linux/3objec30har_dev.c#L88" idn L88" class=L91" class="line" namo1/="comme1n]spa8 cl8"
[= ]a href="fs/char_dev.c#1dynamical3x1kobbjec3.ref="fs/char_dev.c#@fro3"incl30irstidn L61"des/a>]nt"> * If#L29" i" idn Ld; mustidnt"> 18518a>}3[= ]a href="fs/char_dev.c#1dynamical3x2kobbjec3.]/spa8"
 18518a>}3<,a href="fs/char_dev.c#1dynamical3x4kobbjec3.1n L91">[ 191]/a>]spa8 318a> 3051" idn 2L51" class="line" namstarti8 class=L91"  i"dn dsisn ]cshould ef=misnL2beidn Lref"whoa href="fs/char_dev.c#1dynamical3x5kobbjec3.rno .8 fa1ilure1]/spa8"3n L1130v.c7" class="line" namon L87">9" idn Ldidnos8518a>}326/sp3ef="+code34g">[ 7318a>        t" c3ass="309]/a>]spa8 cla L29" i"e" naas#L8'7"[k[/a>us" c.g.aass= "co3har_dev.c3L95" idn L95" class="lin3" nam3n L95"voi (can't d2o Ca>[= ]a hreMKDEV18a> s/char_dev.c#L9et1cd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne"dass="comm1_struct" 1class="sref">char_device1_stru19ds]/spa8"
c3>m)ef">mi3orct18a>, c.8st cha2h26"3idn L3k" cla="sref265" class="line" na3117"nf">m3ve=cd" class="sre="+code3minor30ef="fs/char_dev.c#L197" idn L197" class="line" namon L197">[19718a>{
[ 9818a>        struct[]a href="+code=char_device_struct" clast;[= ]3 hreI31> 19918a>;3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.c#L9t" class="line" ntoef="6"+code=cd" class=fromcd]/a>[= ]a hrefromf">m1+ e=cd" class="src3="+codoef3>minorct18a>, c.8st cha23nd si31line" nacd+code=t;c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.c#L9/ne" namon L117"nf">meve=cd" class="sref">cd]/a>[= ]a href="+code+code=cd" class="sref">cd]2    int[]2 href="+code=i" class="s2ef">i28a>;3[1 21/a>) {
major12a3 ==20) {
[= ]a hrefromf">m1 c#L115" idn L11nne" namon L117"nf">m673">[ 7318a>        t" class="line" ntoef="1 c#L115" idn L11nne" namon L117"nf">m6"+code=cd" class=ef">cd]/a>[= ]a href="+code=>[11518a>                if2ode=GF3de=NULL" 3lass="sref2>NULL2/a>)
cd]/a>[= ]a href="+code116ar_dev.c#L43" iMKDEVcd]/a>[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a h37/ne" nam3n L117"nf">m6"+code=cd" 3lass=3romcd]/a>[= ]a hrefrom hrefromf">m1 c#L115" idn L11nne" namon L117"nf">m673">[ 7318a>     ref="fs/char_dev.har_dev.c#L100"ne">cd]/a>[= ]a h3co2" clas3="line" namon L112">[1123/a>3<3 href="fs/char_ar_dev.c#L43" i"f">cd]/a>[= ]a href="+code116ar_dev.c#L43" iMKDEVcd]/a>[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne" namon L117"nf">m)+1, 0ock]/a>(&]a href="+code2(]a href=2+code=i" class="sref">i12a>[n L117"nf">m)+1,"fs/char_s/char_dev.c#L9kfreajor18a>, ]a hrekfreaclass="sref">i18a>[=_[ 7r_dev.c#L95" idn L95" class="line" namo 7r_dev.c#L95" idn L95" 18a> s/char_dev.c#L9e318acd]/a>3= ]a hreMt18a18a> s/char3dev.c3L9nne" namon L117"nf">m)eve=cd" class="s3MIN8acd]/3>[= ]a hreMIN8a18a> s/ch3r_dev3c#L9nn117"nf">m)eve=cd" class="s3M17"nf">m3"2code=EBUSY" class="sre3"2EBU31lass="line" namon L416">[ 14a>3r_dev.c#L3  L27">[ 2f="+code=out" 3lass=32har_dev.c#L88" idn L88" cla
[ 9918a>  3ar_dev.c#364" PTR_ERacd]/a>[= ]a h3ePTR_3Raclass="sref">i18a>[= ]/a>-/charcd]/a>[= ]a hreMtL95[= ]csn L29stroyor e2xe href="dev.c#Lon L99">[ 9918a>  3a"fs/chhh3nd similamon L118">[11813a>   3  2     21     }3[ 9918a>  3amajor12a3ref">linux/c2dev.h2260]/3>3/* no writeback happ2ens *24ds]/spa8"
 * If#     L29" i" idn class="line" namon L29">[2s]spa8 clar_dee2xec_de *24d]/a>k happ2ens *24ds]/spa8"
[26" idn L426" class="line" na3a href="f3/char_dev.c#@="sref">m:d3irsti3 3818a 32]ev.c]nt"> * If#4]/a>">[26" idn L426" class="line" na3a8acd]/a>3a href="fs/char_de @coun3:lass3 idn L If#4]/a>] idn Ld[ 32]/a Ud]/a>[= ]csn L29stroyolinee2xec *24d]/a>; L29">18a>L29scribdevby">[26" idn L426" class="line" na3aIN8acd]/3l2.h" class="fref">inter3a2l.h3/22/spa8"
[26" idn L426" class="line" na3a17"nf">m3e" namon 2L26">22/spa8"
3a hre3="fs/char_dev.cspa8 class="commar_dev.c#L2direct mmdid0" class="line" namon 2L60">26/sp3t"> * If#3    L29" i" idn Ld.  T613" idn3 idn L90" clben L29" class="li#L8'7"[k[/a>us" c.g.aass= "co3_dev.c#ch3senL86">[ 86]/a,ment"> *3Ifc]n3alongnvoi (can't d2o Carcd]/a>[= ]a hreMthar_dev.c#L9et18acd]/a>[= ]a hreMtchar_amon L92">[ 92]/a>]spa8 class="comm2Istruct" 2"+code=major" class="sre2f">ma26/spa8"
[2 29]/a3]s2pa8 class="comment"> 3 d2ev33mon L117"new_4]/ajor1+lod16de5]/a>class="line" namon L95">[ 95]/a>18a> de=__register_chrdev_region" class="sref">__register_chrdev_region]/a>(udev.c#L9et18acd]/a>[= ]a h3a href+co3eL95" idn L95" 18a> s/ch3r_dev3c#L9 i{
[ 5518a>  ,9_regi3n]/de33f="fs/char_de_dev.c#L98" fil*_Iperane" ncd]/a>[= ]a hrefil*_Iperane" nruct[]a href="+code=cfopscd]/a>[= ]a hrefops="sref">minorct18a>, c.8st cha2L66" idn 2L3ountf">me3dn L5" class="line" namo3ev.h"33cd" class="sref">cd]/a>[== ]a 3/a>]spa8 3lass="commen2t"> *23a>)
3[11513a>                i 2e24" idn 2f">directly_mappable_cde2v_bdi23/a>3[= ]a hreMKDEV18a> s/char_dev.c#L9et18acd]/a>[= ]a hreMt18a18a> s/char_dev.c#L9nne">i18a>[= ]/a>->]a href="+codock]/a>(&]ae ta2ken *2]/spa8"
 <s0 this fug8a>, c.8st cha2L66" idn 2L3o8acd]/a>3cd" class=har_dev.c#L95"3idn L35" class="line" namon L95">[ 95]/ 2f">directly_mappable_cc#L44" idn L44" clNew driv" PTR_ERacd]/a>[= ]a hrePTR_ERaclass="sref" 2lass="sref">CONFI2G_PRO26dev.c#L9et18acd]/a>[= ]a h3aIN8acd]/3untf">meve=cd" class="sr3="+co3e=minorct" class="sre1ERaclass="sref" 2la>[=>minorct18a>, c. 2la>[=> s/char_dev.c#L9nne"" PTR_ERacd]/a>[= ]a hrePTR_ERaclass="sref" 2lass="sref">CONFI2G_PRO26d8a>, c.8st cha2L66" idn 2L3o17"nf">m3="sref">i18a>[= ]/a>->3]a hr33ef="fs/char_dev.c#L197" idn ">/* index in the ab1ove *16/a>3[ 7718a3=116ar_de3.c#L43" iMKDEVcd]/a>[= ]3 hreM3DEV18a117"nf">m)eve=cd" class="s3#37;3d %s\n"3ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a3= href+co3a href="+code2x29]/a>]s23 clas34e1xec *1]/spa8"
[2 4.6" idn L116" class="line" namkobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a hrla>gre1f">ma16ak;3gre*16/aev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
[= ]a h3I_CAP_MAP3_DIRE2482]/a>3[ 95]/a>3) - cre clasnt"> dev.c# 3n="+c34>            ev.c#L2ONFIG_PRO2C_FS"60" id>[= ]/a>->]a 0" idRO26718a>{
CONFIl25/sRO267" class="line" na        if 79" ipRO26ies of the data to b*25/sss="sref">CONFIl25/sRO26ar_dev.c#L98" i/a>class="l3fs/char_d3 @="+co:"" idn L29" i" i3n Lna347            ev.c#L2ONFIG_PRO2C_FS"kobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a kobj2ment">/* inclakobjs fuar_dev.c#L98" i/a>class="l3fIN8acd]/3/char_dev.c#@="sref">m:d3irsti3 3818ar_dev.c#L98" i/a>class="l3f17"nf">m3 24/spa8"
{
CONFIl25/sRO267c#L44" idn !    i 2e24" idntry_ 0" id>gre1f">ma16ak;3gre*16/a>3CONFIl25/sRO269dev.c#L119" idncountref">c347">24/sp38"
chr1af="+code1class="comm" idn 1L68" class="line" naar_dev.c#L98" i/a>class="l326vate co32=cdev_map" class="sref"32cdev35truct18a> *]a hre class="srekobj2ment">/* inclakobjs fu7" class="line" nakobject_gre1f">ma16ak;3cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 3line" nam3n 2L49">25/spa8"
/* inclakobjs fugster_chrdev_region]/a>(u 3l href+co3pa8"
m1 c#L115" i 0" id>p"+code=mutex_unlo 0" id>p"+*16/a>3CONFIl25/sRO269ister_chrdev_region]/a>(u 3l    int23ajor == 0 this func.1.8s3will 35/char_dev.c#L1L82" idn 1L82" class=kobj2ment">/* inclakobjs fuar_dev.c#L98" i/a>class="l3r_device23stru25/spa8"
[35mp;]a href="+code1n L83">[ 1833 will 2Ls3"comme2"+code=major" cla3s="sr35 L95"voi (can't d2o Chrla>p"+code=mutex_unlohrla>p"+*16/aev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
[= ]a h3 class="c3mment"> * 2[ss="sref2ase3inor"35" cla="sref265" class="line" na3 class="c3mment"> * 2[" idn L42de=3inorc35="sruine" namon L8a>{
2namo]25/spa8"
chrev.c#L2ONFIG_PRO2C_FS"60" id>[= ]/a>->]a 0" idRO26718a>{
CONFIl25/sRO267" class="line" na        if 79" ipRO26ies of the data to b*25/sss="sref">CONFIl25/sRO26ar_dev.c#L98" i/a>class="l3 i ha7" o31i">[/a>do"e" naass= "co3[ 38136truct18a> *]a href=")class="line" nakobject_p"+code=mutex_unlokobject_p"+capab" class="sref">cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 3 track>[ 3818a>ifferr_d own Ld[If#329" i36mon L117"new_4]/ajor1f">m1 c#L115" i 0" id>p"+code=mutex_unlo 0" id>p"+*16/a>3CONFIl25/sRO269ister_chrdev_region]/a>(u 38"
[= ]a        ]a href="+code=mut3major >3 0 this func.1.8 will2L53" idn32ment"        ]a href="+code=mut3m_device23"line" namon L263">[26313a>f="36cd" class="sref">cd]/a>[== ]a 3major" cl3ss="sref">major18a>, uns3gned 363818a 32]ev.c]nt"> * If#4]//>">[26" idn L426" class="line" na3inorct" c3ass="sr18a>, unsigned in3[]a h36idn L If#4]/a>] idn Ld[ 32]/a Cisn d every tim" clss="ac= ]cspecial[ 32]/_de pen_CAP_NO_ACCT_AND_WR2ITEBA24/spa8"
3on L265">326) {
us" c.g.aass= "co36" class=3line" namon 2L66">26o]/a3)
[hreMt1 penrefil*_Iperane" nreMt1 pen*16/aev.c#L2ONFIG_PRO2C_FS"in_FSrefil*_Iperane"in_FSRO26718a>{
3{
[= ]a h3818a>    3   struct[]a href="+code3char_3evice_{
CONFI2G_PRO26718a>{
(u 3ude/linux3k2a href="+2code=offset"3class3"sref2">off27)ev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
class="l3his func.3.8 will22c6]a href="+cod3=mute3_region" class=ar_dev.c#L8"fs/curn +code=mutex_unlorenf">m673L9pa8 class="string">"3ef="+code3cd" class="1sref"1cd]/a>33"3e_device2318a>                    3   if37omcd]/a>[= ]adev.c#L8"fs/curspin>ref="+code+code=cd"spin>ref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a3ss="sref"3cd]/a>-&1=chrdevs_1lock"3class37>                i 2e24" idn        if 79" ipRO267" class="line" nain_FSrefil*_Iperane"in_FSRO26ies of the data to bi_ class="sref">CONFIi_ cla" naar_dev.c#L98" i/a>class="l3hnorct" c3re1f="+code=next" class=3sr1ef37" class="line" na!    i 2e24" idn        if 79" ipRO26d {
3de=BDI_CAP1gfile.h" clla3s="fr3f">linux/seq_fil66">1oev.c#L2ONFIG_PRO2C_FS"kobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a kobj2ment">/* inclakobjs fuar_dev.c#L98" i/a>class="l3n" class=318a> *]a href=")"+code=c3" cla37" class="sre1f">minor=ar_dev.c#L8"fs/curidxss="sref">CONFIidxs fuar_dev.c#L98" i/a>class="l3n L5=cd" 3lass="sref">cd]/a>-&1=NF3G_PRO38ock" class="sref">chrdev.c#L8"fs/curspin>unref="+code+code=cd"spin>unref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a38a> 17a8"3 *]a href=")class="line" nakobj2ment">/* inclakobjs fu7" class="line" nakobj>reoku        if 79" ikobj>reoku *16/a>3ma "+co0"new_4a"+code=inin_FSrefil*_Iperane"in_FSRO26ies of the data to bi_reMthar_dev.c#L9et1i_reMt"+co0"" class="sref">cd]/aidxss="sref">CONFIidxs fus="line" namon L77">[ 7718a38de/linux3 href="+code=cd" class="3ref">38mon L117"new_4]/ajor1on L!    i 2e24" idnkobj2ment">/* inclakobjs fugster_chrdev_region]/a>(u 3">18) {
<3 href="fs/char_]a href="3code=38#L9 idn>cd]/a>[= ]a hre idn>11L82" ilass="line" namon XIO2ment">/* inclan XIOs fuar_dev.c#L98" i/a>class="l3nf="+code3FS *18/a>3{
 <s0 nta hrr_of*16/a>3/* inclakobjs funcev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO260"new_4a"+code=inkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 3"111">[113ss="line" namon L77">[ 7318a> 38omcd]/a>[= ]a hrefromdev.c#L8"fs/curspin>ref="+code+code=cd"spin>ref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a3x_unlock"3class="sref">mutex_unloc3]/a>(38t[]a href2I]a href=2s 32]ev.c]nt"> * If#4]//> Check i_ cla aga hl nacase somebodL2beat uus" c.g.aass= "co3/a>]spa8 3lass="comme1nt">/18318a>3
] idn Ld[ 32]///////////////////we droppLdidne ref=.ev#L8'7"[k[/a>us" c.g.aass= "co3ref">cd]13le major1 with a specifi3d min38=minorct" class="sre1ERaclass="sref"        if 79" ipRO267" class="line" nain_FSrefil*_Iperane"in_FSRO26ies of the data to bi_ class="sref">CONFIi_ cla" naar_dev.c#L98" i/a>class="l3ly alloca3e a major and 1retur1]/s3a8"
<38" class="sre1f">minor= na!    i 2e24" idn        if 79" ipRO26d {
3* If#39ock" class="sref">chrss="sre1ERaclass="sref"in_FSrefil*_Iperane"in_FSRO26ies of the data to bi_ class="sref">CONFIi_ cla" na7" class="line" na        if 79" ipRO26" idn L102" class="lw[=_[ 7r_dev.c#L95wRO26ar_dev.c#L98" i/a>class="l3/spa8"
 *]a href=")ss="sre1ERaclass="sref"list8adcd]/ain_FSrefil*_Iperane"in_FSRO26ies of the data to bi_mon L29ss="sref">CONFIi_mon L29">co0"" class="sref">cd]/a        if 79" ipRO26ies of the data to blista href="dev.harlistclass="line" namon L77">[ 7718a3d ra1nge 31]/spa8"
{
class="l38"
gre1f">ma16ak;3gre*16/a    i 2e24" idn        if 79" ipRO26dgster_chrdev_region]/a>(u 3dIG_PROC13a1n L91">[ 191]/a>]spa8 3lass=39f="fs/char_dess="sre1+lod16de8a>{
m673lass="line" namon XIO2ment">/* inclan XIOs fuar_dev.c#L98" i/a>class="l38111">[113rrno .8 fa1ilure1]/spa8"3cd]} else " na!    i 2e24" idn 2la>gre1f">ma16ak;3gre*16/a    i 2e24" idn        if 79" ipRO26dgster_chrdev_region]/a>(u 3d_unlock"3s="commen1t"> *19/spa8"
3a hre39href="fs/char_ar_dev.c#L43" i"f">cd]n +code=mutex_unlorenf">m673lass="line" namon XIO2ment">/* inclan XIOs fuar_dev.c#L98" i/a>class="l38a>]spa8 3_dev.c#L95" idn L95" 18a3 s/ch39" class="linedev.c#L8"fs/curspin>unref="+code+code=cd"spin>unref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a3n>18a>{s/3har_dev.c#L9fromcd]/a>[=3]a hr39jor18a>, ]a href="+code]acla" la>p"+code=mutex_unlohrla>p"+*16/a8a>{
[ 7718a3ny alloca3o" class="sr1ef">n1mo]/a3)
{
mgster_chrdev_region]/a>(u 4x/kobbjec4.h" cclass="fref">linux/4objec40ock" class="sref">chr1af="+code1class="commn +code=mutex_unlorenf">m="line" namon L77">[ 7718a4x1kobbjec4.ref="fs/char_dev.c#@fro4"incl40line" nacd+code=t;off27) {
m673lass="line" namon XIO2ment">/* inclan XIOs fuar_dev.c#L98" i/a>class="l4x3kobbjec4."fs/char_dev.c @count:l4lass=40char_dev.c#L2 0;[]a hr2f="+c3gre1f">ma16ak;3gre*16/a    i 2e24" idn        if 79" ipRO26ies of the data to b*;[]a ountf">mev         s="line" namon L77">[ 7718a4x4kobbjec4.1n L91">[ 191]/a>]spa8 418a> 404"sruine" namon L!    i 2e24" idn3(u 4x5kobbjec4.rno .8 fa1ilure1]/spa8"4n L1140omcd]/a>[= ]a hrefrom if L51" idn 1L51" clas_" la>p"+code=mutex_unlolas_" la>p"+s fuar_dev.c#L98" i/a>class="l4x6kobbjec4.="commen1t"> *19/spa8"
4ass="40mp;]a href="+code1n L83">[ 1834har_dev.c4L95" idn L95" class="lin4" nam40" class="line" namon L95">[ 95]/3m)ef">mi4orct18a>, c.8st cha2h26"4idn L40=minorct" class="sre1ERaclass="sref"n +code=mutex_unlorenf">m673mon L95">[ 95]/3[ 95]/in_FSrefil*_Iperane"in_FSRO26,R8a>{
class="l4x9)ef">mi4o" class="sr1ef">n1mo]/a4minor40" class="sre1f">minor= na8a>{
mgster_chrdev_region]/a>(u 4ev.har_de4.c#L100"IS_ERacd]/a>[= ]4 hreI41ock" class="sref">chrss="sre1 if L51" idn 1L51" clas_" la>p"+code=mutex_unlolas_" la>p"+s fuar_dev.c#L98" i/a>class="l4="+codoef4>minorct18a>, c.8st cha24nd si41truct18a> *]a        ]a href="+code=mut4="fs/chhh4hhhhh17" idn L117" class4ne" c41line" namon L55">[ 5518a>  )ck4>major12a4 ==20) {
[= ]a_dev.c#L9pa8 class="string">"4de=NULL" 4lass="sref2>NULL2/a>)
"47/ne" nam4n L117"nf">m6"+code=cd" 4lass=4romcd]/51" idn 1L51" clas_" la>p"+code=mutex_unlolas_" la>p"+s fuss="sref">mutex_unlock]/a>4co2" clas4="line" namon L112">[1124/a>3<41>                i 2e24" idn 2la>p"+code=mutex_unlohrla>p"+*16/a8a>{
"4dar_dev.c4= ]a hreMt18a18a> s/char4dev.c4L9nne" namon L1af="+code1class="commn +code=mutex_unlorenf">m="line" namon L77">[ 7718a4MIN8acd]/4>[= ]a hreMIN8a18a> s/ch4r_dev4c#L9nn117"nf">m)eve=cd" class="s4M17"nf">m4"2code=EBUSY" class="sre4"2EBU41lass="line" namon L416">[ 14a>4r_dev.c#L4  L27">[ 2f="+code=out" 4lass=42har_dvoi (can't d2o Chr_forgre1f">ma16ak;3{
(u 4ar_dev.c#464" PTR_ERacd]/a>[= ]a h4ePTR_4Raclas{
[11814a>   42sref2">off27) {
ref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a4amajor12a4ref">linux/c2dev.h2260]/4>3cd]/ain_FSrefil*_Iperane"in_FSRO26ies of the data to bi_mon L29ss="sref">CONFIi_mon L29">cos="line" namon L77">[ 7718a4ae=NULL" 4c#+codeL95" idn L95" () 4 r_de42/char_dev.c#Lt;CONFIi_ cla" na7" class="line" na" idn 1L68" class="line" naar_dev.c#L98" i/a>class="l4//ne" nam4r_dev.c @ L2: output par4ki.c#42omcd]/a>[= ]adev.c#L8"fs/curspin>unref="+code+code=cd"spin>unref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a4a href="f4/char_dev.c#@="sref">m:d4irsti42"fs/c" class="sref">cd]/a>->4a8acd]/a>4a href="fs/char_de @coun4:lass42"+code=major" class="sref">maj4aIN8acd]/4l2.h" class="fref">inter4a2l.h4/22/sp6" idn voi (can't d2o Chrla>p"rgrcode=mutex_unlohrla>p"rgr*16/aev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
(u 4a17"nf">m4e" namon 2L26">22/spa8"
4a hre4="fs/c{
 * If#4    L29" i" idn Ld.  T614" idn43> 19918a>;3ref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a4_dev.c#ch4senL86">[ 86]/a,ment"> *4Ifc]n43truct18a> *]awhcd]/ahalaar_dev.c#L98" idn L98" ies of the data to blista href="dev.harlistclassd {
[2 29]/a4]s2pa8 class="comment"> 4 d2ev43mon L117"new_4]/ajor1ev.c#L2ONFIG_PRO2C_FS"in_FSrefil*_Iperane"in_FSRO26718a>{
[ 7718a4_major12a4eL95" idn L95" 18a> s/ch4r_dev43omcd]/a>[= ]a hrefromf">m1 c#L115" iin_FSrefil*_Iperane"in_FSRO267" class="line" naconta hrr_ofmon L77"> <s0 nta hrr_of*16/a>3[=_[ 7r_dev.c#L95" idn ncev.c#L2ONFIG_PRO2C_FS"in_FSrefil*_Iperane"in_FSRO26,R8a>{
CONFIi_mon L29">cos="line" namon L77">[ 7718a4line" nam4n L55">[ 5518a>  ,9_regi4n]/de43f="fs/char_dess="sre18a>{
cd]/ain_FSrefil*_Iperane"in_FSRO26ies of the data to bi_mon L29ss="sref">CONFIi_mon L29">cos="line" namon L77">[ 7718a4ountf">me4dn L5" class="line" namo4ev.h"43omcd]/a>[= ]a hrefromdev.c#L8"fs/curin_FSrefil*_Iperane"in_FSRO26ies of the data to bi_ class="sref">CONFIi_ cla" na7" class="line" na" idn 1L68" class="line" naar_dev.c#L98" i/a>class="l4/a>]spa8 4lass="commen2t"> *23a>)
4[11514a>            " class="sref">cd]/a>->4o8acd]/a>4cd" class=har_dev.c#L95"4idn L43" class="linedev.c#L8"fs/curspin>unref="+code+code=cd"spin>unref=capab" class="sref">cd]/ahala>ref="+code+code=cd" ala>ref=class="line" namon L77">[ 7718a4aIN8acd]/4untf">meve=cd" class="sr4="+co43#L9nn117"nf">m)eve=cd" class="s4o17"nf">m4="sref">i18a>[= ]/a>->4]a hr43lass="line" namon L416">[ 14a>4=116ar_de4.c#L43" iMKDEVcd]/a>[= ]4 hreM44har_dev.c#L88" idn L88" cla
us" c.g.aass= "co4#37;3d /s\n"i18a>[= ]/a>-/chDummy default[ 32]-(unsigned :idn Lrelyoli/a>; L_devo29">[26" idn L426" class="line" na4a href="+4ode=major" class="sref5"4class44r_dev.cn L29" class="line" namos 0 nta hidn Lrpehidnatidn n[ 32l;onamo1/special[ 32]..0" class="line" namon 2L60">26/sp4     int24hared-mm2lass="line" nam4n L4044c# ant"> * If#     L29" i" id#L8'7"[k[/a>us" c.g.aass= "co4I_CAP_MAP4_DIRE2482]/a>3CHRDEV_MAJOR_H2ASH_S26/a>3mev  defa hr_a>;[" na7" {
[ 95]/a>4) - cre clasnt"> dev.c# 4n="+c44>            .8a>{
{
m:d4irsti4 3818a}="line" namon L77">[ 7718a4f17"nf">m4 24/spa8"
[ 14a>447">24/sp48"
[= ]a exact_matchcode=mutex_unloexact_match*16/a>3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.class="sref">CONFIG_PRO260"=ar_18a>{
{
CONFIGata98" gster_chrdev_region]/a>(u 426vate co42=cdev_map" class="sref"42cdev45aclas{
25/spa8"
off27)ev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
CONFIGata98" ="line" namon L77">[ 7718a4l href+co4pa8"
cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fu="line" namon L77">[ 7718a4l    int24ajor == 0 this func.1.8s4will 45ment"        ]a href="+code=mut4r_device24stru25/spa8"
cd]/a>[== ]a 4If @="+co4L89" class="line" namon 489">[45mp;]a6" idn ="line" namon L95">exact_ref="+code+code=cd"exact_ref=*16/a>3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.class="sref">CONFIG_PRO260"voi (18a>{
CONFIGata98" gster_chrdev_region]/a>(u 42s/char_d4"comme2"+code=major" cla4s="sr45f2Iss="sref265" class="line" na4 class="c4mment"> * 2[ss="sref2ase4inor"45   f="fs/char_dev.c#L98" fil*_Iperanclass="sref">CONFI2G_PRO26718a>{
CONFIGata98" ="line" namon L77">[ 7718a4l17"nf">m4mment"> * 2[" idn L42de=4inorc45="sruine" nam1af="+code1class="comm 2la>gre1f">ma16ak;3gre*16/a    i 2e24" idn        if 79" ipRO26ds? 0 :h-1="line" namon L77">[ 7718a4 class="s4ef">2namo]25/spa8"
m)eve=cd" class="s4 i ha7" o41i">[/a>do"e" naass= "co4[ 38146line" nacd+code=t;[ 9918a>  48"
[ 9918a>  48    int24 0 this func.1.8 will2L54" idn46c# ant"> * If#     L29" i" idn p:olinee2xec_dev.curen>cd]lineor.2"" href="dev.c#Lon L99">[ 9918a>  48_device24"line" namon L263">[26314a>f="46r_dfirstif="gion]/ idn Ln L29" 918class="line"dr.2"" class=n>cd]which; L_devr.2"" ss="esped iba RO'7"[k[/a>us" c.g.aass= "co4major" cl4ss="sref">major18a>, uns4gned 463818a 32]ev.c]nt"> * If#4]/idn class="line" namon L2f">Cecutive29">[2s]spa8 clcorrespedd/a>;toamoi in[26" idn L426" class="line" na4inorct" c4ass="sr18a>, unsigned in4[]a h46idn L If#4]/a>] idn Ld[ 32]/a         or.2"" href="dev.c#Lon L99">[ 9918a>  48class="c426) {
[ 9918a>  4817"nf">m4line" namon 2L66">26o]/a4)
[26" idn L426" class="line" na4818a>    4   struct[]a href="+code4char_47har_dev.c#L88" idn L88" class=live2i88"diately.  A negative2err[2s" id ss="ef="+devonafailure0" class="line" namon 2L60">26/sp4ne" nacd+4ode=1]a href="+code=chaa4class47aclass="sref">i18a>[= ]/a>-/c#L8'7"[k[/a>us" c.g.aass= "co4ude/linux4k2a href="+2code=offset"4class4"sref2="line" namon L95">[d518adCONFI2G_PRO26718a>{
{
c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.class="sref">CONFIG_PRO260"/char_dev.c#L5" idn L5" class="line" namo1="+code=b1adev.c#L119" idncountref">c4his func.4.8 will22c6]a href="+cod4=mute47#L9 i{
43err[2"+code+code=cd"err[298" ="line" namon L77">[ 7718a4e_device2418a>                    4   if47cd" class="sref">cd]/a>[== ]a 4ss="sref"4cd]/a>-&1=chrdevs_1lock"4class47>                i 2e24" idn        if 79" ipRO26ies of the data to bclass="sref">CONFIG_PRO26" idn L102" class=dlass="sref">CONFIG_PRO26="line" namon L77">[ 7718a4enorct" c4re1f="+code=next" class=4sr1ef47" class="linedev.c#L8"fs/cur        if 79" ipRO26ies of the data to bclass="line" namo1="+code=b1a7" class="line" naco"+code=char_device_struct" clast;4de=BDI_CAP1gfile.h" clla4s="fr473818ar_dev.c#L98" i/a>class="l4n" class=418a> *]a href=")"+code=c4" cla47ef="fs/char_dev.c#L197" idn err[2"+code+code=cd"err[298" 7" class="line" nakobj>ma        if 79" ikobj>ma *16/a>3ma "+co0"new_4a"+code=inclass="sref">CONFIG_PRO260"class="line" naco"+code=char_device_struct" 0"class="line" na" idn 1L68" class="line" naass="line" namon2I *]a hre4n L5=cd" 4lass="sref">cd]/a>-&1=NF4G_PRO48ock" class="sref">chra hrefromdev.c#L8"fs/curexact_matchcode=mutex_unloexact_match*16/0"class="line" naexact_ref="+code+code=cd"exact_ref=*16/0"class="line" na        if 79" ipRO26d9pa8 class="string">"48a> 17a8"4 *]a" nat;c48de/linux4 href="+code=cd" class="4ref">48mon L117"new_4]/ajor11af="+code1class="commude[2"+code+code=cd"err[298" ="line" namon L77">[ 7718a4">18) {
<4 href="fs/char_]a href="4code=48e1xec *1]/spa8"
3ma16ak;3cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fu.8a>{
"48_device24ss="line" namon L77">[ 7418a> 48cd" class="sref">cd]/a>[== ]a 4x_unlock"4class="sref">mutex_unloc4]/a>(48t[]a href2I]a_dev.c#L9pa8 class="string">"4/a>]spa8 4lass="comme1nt">/18318a>4
m)eve=cd" class="s4ref">cd]14le major1 with a specifi4d min483818ar_dev.c#L98" i/a>class="l4ly alloca4e a major and 1retur1]/s4a8"
<48ef="f6" idn voi (can't d2o Chrla>unma        if 79" ihala>unma *16/a>3c idn>cd]/a>[= ]a hre idn>18a>{s/char_dev.class="sref">CONFIG_PRO260"/char_dev.c#L5" idn L5" class="line" namo1="+code=b1adev.c#L119" idncountref">c4#L95" idn4L95" () - r_dev.c# ant">4* If#49vice_{
unma        if 79" ikobj>unma *16/a>3ma "+co0"new_4a"+code=inclass="sref">CONFIG_PRO260"class="line" naco"+code=char_device_struct" d9pa8 class="string">"4d ra1nge 41]/spa8"
m)eve=cd" class="s48"
[ 191]/a>]spa8 4lass=49c# ant"> * If#     L29" i" 
[ 9918a>  48111">[114rrno .8 fa1ilure1]/spa8"4[=>[2 ]a hmoveor e2xe fromamo1/system href="dev.c#Lon L99">[ 9918a>  4d_unlock"4s="commen1t"> *19/spa8"
4a hre493818a 32]ev.c]nt"> * If#4]/idn p:olinee2xec_dev.curento2bei hmoveCAP_NO_ACCT_AND_WR2ITEBA24/spa8"
48a>]spa8 4_dev.c#L95" idn L95" 18a4 s/ch49idn L If#4]/a>] idn Ld[ 32]/aAP_NO_ACCT_AND_WR2ITEBA24/spa8"
48ef">cd]14har_dev.c#L9fromcd]/a>[=4]a hr4922/spa8"
n1mo]/a4)
26/sp5x/kobbjec5.h" cclass="fref">linux/5objec50idn L90" clben L29" class="li#L8'7"[k[/a>us" c.g.aass= "co5x1kobbjec5.ref="fs/char_dev.c#@fro5"incl50longnvoi (can't d2o C 2la>[=>minorct18a>, c. 2la>[=> s/chev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
[= ]a h5x2kobbjec5.]/spa8"
unma *16/a>3CONFIG_PRO260"class="line" na        if 79" ipRO26ies of the data to bclass="line" namo1="+code=b1ad9pa8 class="string">"5x4kobbjec5.1n L91">[ 191]/a>]spa8 518a> 50/char_dev.c#Lt;cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 5x5kobbjec5.rno .8 fa1ilure1]/spa8"5n L1150             ]a href="+code=mut5x6kobbjec5.="commen1t"> *19/spa8"
5ass="50mp;]a href="+code1n L83">[ 1835har_dev.c5L95" idn L95" class="lin5" nam50"+code=major" class="sref">maj5>m)ef">mi5orct18a>, c.8st cha2h26"5idn L5022/sp6" idn voi (can't d2o Chrla>default_releasrcode=mutex_unlohrla>default_releasr s/chev.c#L2ONFIG_PRO2C_FS"kobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a kobj2ment">/* inclakobjs fudev.c#L9et18acd]/a>[= ]a h5x9)ef">mi5o" class="sr1ef">n1mo]/a5minor50"fs/c{
[= ]5 hreI51ock" class="s_dev.c#L98" fil*_Iperanclass="sref">CONFI2G_PRO26718a>{
 <s0 nta hrr_of*16/a>3/* inclakobjs funcev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO260"new_4a"+code=inkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 5="+codoef5>minorct18a>, c.8st cha25nd si51truct18a> *]aev.c#L2ONFIG_PRO2C_FS"kobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a pare+code=char_devicepare+cRO267" class="line" nakobj2ment">/* inclakobjs fuies of the data to bpare+code=char_devicepare+cRO26ister_chrdev_region]/a>(u 5=2kobbjec5hhhhh17" idn L117" class5ne" c51line" namon L55">[ 5518a>  )ck5>major12a5 ==20) {
p"rgr*16/aclass="line" na        if 79" ipRO26d9pa8 class="string">"5de=NULL" 5lass="sref2>NULL2/a>)
{
"57/ne" nam5n L117"nf">m6"+code=cd" 5lass=51             ]a href="+code=mut5co2" clas5="line" namon L112">[1125/a>3<51mp;]a href="+code1n L83">[ 1835dar_dev.c5= ]a hreMt18a18a> s/char5dev.c5L9nne"6" idn voi (can't d2o Chrla>dy s/ic_releasrcode=mutex_unlohrla>dy s/ic_releasr s/chev.c#L2ONFIG_PRO2C_FS"kobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a kobj2ment">/* inclakobjs fudev.c#L9et18acd]/a>[= ]a h5MIN8acd]/5>[= ]a hreMIN8a18a> s/ch5r_dev51" cla="sref265" class="line" na5M17"nf">m5"2code=EBUSY" class="sre5"2EBU519ck" class="s_dev.c#L98" fil*_Iperanclass="sref">CONFI2G_PRO26718a>{
 <s0 nta hrr_of*16/a>3/* inclakobjs funcev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO260"new_4a"+code=inkobj2ment">/* inclakobjs fugister_chrdev_region]/a>(u 5r_dev.c#L5  L27">[ 2f="+code=out" 5lass=52ock" class="s_dev.c#L98" fil*_Iperakobjectcode=mutex_unlokobjectode=cfopscd]/a>[= ]a pare+code=char_devicepare+cRO267" class="line" nakobj2ment">/* inclakobjs fuies of the data to bpare+code=char_devicepare+cRO26ister_chrdev_region]/a>(u 5ar_dev.c#564" PTR_ERacd]/a>[= ]a h5ePTR_52line" nacd+code=t;[11815a>   52sref2">off27) {
p"rgr*16/aclass="line" na        if 79" ipRO26d9pa8 class="string">"5amajor12a5ref">linux/c2dev.h2260]/5>3/* index in the ab1ove *16/a>3"5ae=NULL" 5c#+codeL95" idn L95" () 5 r_de52/char_dev.c#Lt;{
"5//ne" nam5r_dev.c @ L2: output par5ki.c#52             ]a href="+code=mut5a href="f5/char_dev.c#@="sref">m:d5irsti52mp;]a href="+code1n L83">[ 1835a8acd]/a>5a href="fs/char_de @coun5:lass529nne"6" idn _dev.c#L98" fil*_Iperakobj_typ index in the ab1obj_typ idn>18a>{s/char_dev.ktyp _hrla>defaultindex in the ab1typ _hrla>defaultRO267" ="sref265" class="line" na5aIN8acd]/5l2.h" class="fref">inter5a2l.h52   f="fs/char.8a>{
default_releasrcode=mutex_unlohrla>default_releasr s/cass="line" namon2I *]a hre5a17"nf">m5e" namon 2L26">22/spa8"
5a hre5="fs/c}="line" namon L77">[ 7718a5t"> * If#5    L29" i" idn Ld.  T615" idn53> 199"line" namon L77">[ 7718a5tr_dev.c#5senL86">[ 86]/a,ment"> *5Ifc]n53truct6" idn _dev.c#L98" fil*_Iperakobj_typ index in the ab1obj_typ idn>18a>{s/char_dev.ktyp _hrla>dy s/icindex in the ab1typ _hrla>dy s/icRO267" ="sref265" class="line" na5>[2 29]/a5]s2pa8 class="comment"> 5 d2ev53mon L117"new_.8a>{
dy s/ic_releasrcode=mutex_unlohrla>dy s/ic_releasr s/cass="line" namon2I *]a hre5_major12a5eL95" idn L95" 18a> s/ch5r_dev53omcd]}="line" namon L77">[ 7718a5te=NULL" 5n L55">[ 5518a>  ,9_regi5n]/de53f="fspa8 class="string">"5ountf">me5dn L5" class="line" namo5ev.h"53r_dfirstif="gion]/ idn Ln L
[ 9918a>  5/a>]spa8 5lass="commen2t"> *23a>)
5[1151533818a 32]ev.c]nt"> * If#4]/idn_d518alloc[2 ]aallocateor e2xe _dev.cureAP_NO_ACCT_AND_WR2ITEBA24/spa8"
5o8acd]/a>5cd" class=har_dev.c#L95"5idn L53idn L If#4]/a>] idn Ld[ 32]/aAP_NO_ACCT_AND_WR2ITEBA24/spa8"
5aIN8acd]/5untf">meve=cd" class="sr5="+co5322/spa8"
26/sp5o17"nf">m5="sref">i18a>[= ]/a>->5]a hr53"fs/char_dev.cspa8 class="com#L8'7"[k[/a>us" c.g.aass= "co5=116ar_de5.c#L43" iMKDEVcd]/a>[= ]5 hreM54ock" 6".c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
off27)ev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
CONFI2G_PRO26)0"new_4a"+code=inGFP_KERNEdn 1L68" class="GFP_KERNEdRO26d9pa8 class="string">"5amajor12a5a href="+code2x29]/a>]s25 clas54region" class=n L8a>{
{
cd]/a        if 79" ipRO26ies of the data to blista href="dev.harlistclass="line" namon L77">[ 7718a5I_CAP_MAP5_DIRE2482]/a>3cd]/a        if 79" ipRO26ies of the data to bkobj2ment">/* inclakobjs fu0"" class="sref">cd]/aktyp _hrla>dy s/icindex in the ab1typ _hrla>dy s/icRO26s="line" namon L77">[ 7718a5Ia>]spa8 5) - cre clasnt"> dev.c# 5n="+c54>                    ]a href="+code=mut5fs/char_d5 @="+co:"" idn L29" i" i5n Lna549nne" namon L1af="+code1class="comm        if 79" ipRO26ister_chrdev_region]/a>(u 5fIN8acd]/5/char_dev.c#@="sref">m:d5irsti54#L9nn117"nf">m)eve=cd" class="s5f17"nf">m5 24/spa8"
[ 14a>547">24/sp58"
i18a>[= ]/a>-/chhrla>init[2 ]ainitializeor e2xe _dev.cureAP_NO_ACCT_AND_WR2ITEBA24/spa8"
5line" nam5n 2L49">25/spa8"
;[class="l/a>(unsigned n>cd]li_devr.2""AP_NO_ACCT_AND_WR2ITEBA24/spa8"
5l    int25ajor == 0 this func.1.8s5will 55c# ant"> * If#     L29" i" idAP_NO_ACCT_AND_WR2ITEBA24/spa8"
5l_CAP_MAP5stru25/spa8"
;@a>;[, mak/a>;it  hadyl8"
ad< toamo1AP_NO_ACCT_AND_WR2ITEBA24/spa8"
5la>]spa8 5L89" class="line" namon 589">[553818a 32]ev.c]nt"> * If#4]/idnsystem withm_d518ad<[20" class="line" namon 2L60">26/sp52s/char_d5"comme2"+code=major" cla5s="sr55idn L If#4]/a>] idn Ld[ 32]/a#L8'7"[k[/a>us" c.g.aass= "co5 class="c5mment"> * 2[ss="sref2ase5inor"55   f=voi (can't d2o Chrla>inita href="dev.harhrla>init s/chev.c#L2ONFIG_PRO2C_FS" class="sref">CONFI2G_PRO26718a>{
CONFI2G_PRO260"f">CHRDEV_MAJOR_H2ASH_S26/a>3;[]a ountf">mev  a>;[" nadev.c#L9et18acd]/a>[= ]a h5l17"nf">m5mment"> * 2[" idn L42de=5inorc55"fs/c{
2namo]25/spa8"
ma16ak;3{
CONFI2G_PRO260"0, eizeof718a>{
(u 5 i ha7" o51i">[/a>do"e" naass= "co5[ 38156truct18a> *]a hre class="sreINIT_LIST_HEAD       if 79" iINIT_LIST_HEADcapab" class="sref">cd]/ahalaar_dev.c#L98" idn L98" ies of the data to blista href="dev.harlistclassister_chrdev_region]/a>(u 5 ine" nam5818a>ifferr_d own Ld[If#529" i56sref2">off27) {
cd]/ahalaar_dev.c#L98" idn L98" ies of the data to bkobj2ment">/* inclakobjs fu0"" class="sref">cd]/aktyp _hrla>defaultindex in the ab1typ _hrla>defaultRO26sister_chrdev_region]/a>(u 5 major12a5="fs/char_dev.c your mod5ls= "56char_dev.c#L2 0;[]a hr2f="+chrlaar_dev.c#L98" idn L98" ies of the data to b*;[]a ountf">mev         7" class="line" na    ]a ountf">mev  a>;[" naister_chrdev_region]/a>(u 5     int25 0 this func.1.8 will2L5 idn Ld.  T614" 35v  a>;[" naister_chrdev_region]/s/char_/dn Ld.  ]4 hreM44har_dev.c#L88" idn L88" o b*;[]a ountf">mev    _ref="+(ar_dev.v.c#L88" idn L88" o b*;[]a ountf"f="+44aclass="sref">i18a>[= ]/a>-68" class="GFP_KERNEdROkobj2meass=" pare+code=char_devicepare+cbase_probc_releasr s/cassbase_probc"sref">CONFI2G_PRO26d>18a>{s/char_dev.class="sref">CONFIG_PRO260"=ar_18a>{
{
CONFIGata98" gster_chrdev_region]/a>(u 426vate co42=cdev_map" clas5gned in4[5a h46idn L If#4]/a>] idn5Ld[ 356" na4 class="c4mment"> * 2[ss="5/char_d4v5c# 4622/spa8"
mgstequest_modu8a>{
>[=P_N">"t"> -major-%d-%d"= "co5 n 1L68" class="GFMAJOR>{
CONFI2G_PRO26d>1_18a>{
CONFI2G_PRO26d>1_18a>{
{
 * 2[ss="s="+code4c5ar_47har_dev.c#L88" idn 588" c57L8"fs/curspin>unref="+code+code=cd"stequest_modu8a>{
>[=P_N">"t"> -major-%d"= "co5 n 1L68" class="GFMAJOR>{
CONFI2G_PRO26d>1_18a>{
i18a>5= ]/a57eINIT_LIST_HE   if 79" ipRO26ister_ar_dev.c#L98" i/a>class="l4/a>]spa8 4lass="commen2t">5offset"4c5ass4"sref2="line" namon 595">[57s="s48"
[ 191]/51cd]/a>435a h474"sruine" namo"line5 namo5 L95">ita href="dev.harhrl__initcapab" class="s_]/ahalaarrefil*_Iperane" nreMt1 t s/chev.c#L2ONFIG_PreMt1 t s/>[= ]a h5#37;3d 9s\n"cd5/a>[=5 ]a 4s class="c4mment"> * 2[ss="5_1lock"4c5ass47>                i 5e24" 5dn        if 79" ipRO26ies of>ma "+co0"new_4a"+code=inclass="sre      if 79" ikobj>ma *16/_initcapab" class="sref"*16/_init"sref">CONFI2G_PRO26base_probc_releasr s/cassbase_probc"sre_hrla>defaultindex in PreMt1sf=class="line" namon reMt1sf=cla>(u 5 major12a5="fs/char_dev.c y class=4s51ef47" class="linedev.c#58"fs/5ur        if 79" ipRO26ies ofbdi_initcapab" class="sbdi_initlaar_dev.c#L98" idn L98" di426"ly*16/pablrdev_rebdi_18a>{
(u 5 major12a5="fs/char_dev.c y char_d4v5"fr473818ar_dev.c#L98" i5a>cla57s="s5f17"nf">m5 24/spa8"
547">24/sp58"
c5ra hr5818a5tr_dev.c#5senL86">[ 86]/a,mref="+c4d5=ch48truct18a> *]a" nat;5a hre58/chhrla>init[2 ]ainitializese Let modu8as="lhref="deva>[uffass= "co5 class="c5mment"> * 2[ss="sclass="4r5f">48mon L117"new_4]/ajo511af=5+code1#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26reg]/aer_PreMt1 reg]o*16/ass="line" nreg]/aer_PreMt1 reg]o*>(u 5 major12a5="fs/char_dev.c y href="4c5de=48e1xec *1]/spa8"
cEXPORT_SYMBOd"sref">CONFI2G_PRO26unreg]/aer_PreMt1 reg]o*16/ass="line" nunreg]/aer_PreMt1 reg]o*>(u 5 major12a5="fs/char_dev.c y cd]/a>435f="48/char_dev.c#Lt;cEXPORT_SYMBOd"sref">CONFI2G_PRO26IG_PR_PreMt1 reg]o*16/ass="line" nIG_PR_PreMt1 reg]o*>(u 5 major12a5="fs/char_dev.c y       4 5a> 48cd" class="sref">cd5/a>[=5 ]a 4x#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26a>init s/chev.c#L2ONFIG_PRO2C_FS" cla5 major12a5="fs/char_dev.c y 1lock"4c5a>(48t[]a href2I]a_dev.c5L9pa85class=#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26a>iniloccapabvoi dev.c#L9et18acd]/a>[= 5 major12a5="fs/char_dev.c y class=4s5a h48idn L117"nf">m)eve=5d" cl5]//////L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26a>inis/chev.c#L2ONFIG_PRO2C_FS" cla5 major12a5="fs/char_dev.c y char_d4v5min483818ar_dev.c#L98" i5a>cla5s="l4l#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26a>inilpab_dev.c#L98" fil*_Iperancla5 major12a5="fs/char_dev.c y code=c4"5"
<48ef="f6" idn voi (ca5'5 d2o C#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26__reg]/aer_PreMt1capab" class="s_]reg]/aer_PreMt1ncla5 major12a5="fs/char_dev.c y# ant">4*5If#49vice_{
cEXPORT_SYMBOd"sref">CONFI2G_PRO26__unreg]/aer_PreMt1capab" class="s_]unreg]/aer_PreMt1ncla5 major12a5="fs/char_dev.c y#ef="+c4d5ass49truct18a> *]a hre c5ass="5rekobj#L98" idn L98" EXPORT_SYMBOdev.c#L98" i/a>cEXPORT_SYMBOd"sref">CONFI2G_PRO26di426"ly*16/pablrdev_rebdi_18a>{
(u 5 major12a5="fs/char_dev.c y"fs/cha4_5ev.49mon L117"nf">m)eve=5d" cl5ss="s4


Tmo1/riginal LXR software>;itdevrajor12a5=http://source2C_FS.net/prore+cs/lxr">LXR nitiuFS"y"sre_hR2ITEexperiialial vers]o*>;itajor12a5=mailto:lxr@17"ux.no">lxr@17"ux.no"sre.
lxr.17"ux.no kindly hosk/a>;itajor12a5=http://www.redpill-17"pro.no">Redpill L7"pro AS"sre_hprovida8 clcL7"uxa>3[ 7 since 1995.