linux/drivers/md/dm-log-userspace-transfer.c
<<
ptio6.2/spae=" 6.2/form=" 6.2a ptio6. href="../linux+vopti.2/drivers/md/dm-log-userspace-transfer.c">ptio6.2img src="../.static/gfx/right.png" alt=">>">pt2/spae="pt2spae class="lxr_search">ptioptio6.2input typ v2hidden" nam v2navtarget" > v2">ptio6.2input typ v2text" nam v2search" idv2search">ptio6.2butt typ v2submit">Searchptio6.Prefs" 6.2/a>pt2/spae="io6. .2/div="io6. .2form acalue="ajax+*" method="post" onsubmit="return false;">pt2input typ v2hidden" nam v2ajax_lookup" idv2ajax_lookup" > v2">pio6. .2/form="pio6. .2div class="headingbott m">" 2div idv2file_contents"=
. .12/a>2spae class="comment">/*2/spae=". .22/a>2spae class="comment"> * Copyright (C) 2006-2009 Red Hat, Inc.2/spae=". .32/a>2spae class="comment"> *2/spae=". .42/a>2spae class="comment"> * This file is released under the LGPL.2/spae=". .52/a>2spae class="comment"> */2/spae=". .62/a>p. .72/a>#include <linux/kernel.h2/a>>p. .82/a>#include <linux/module.h2/a>>p. .92/a>#include <linux/slab.h2/a>>p. tiona>#include <net/sock.h2/a>>p. 112/a>#include <linux/workqueue.h2/a>>p. 122/a>#include <linux/connector.h2/a>>p. 132/a>#include <linux/device-mapper.h2/a>>p. 142/a>#include <linux/dm-log-userspace.h2/a>>p. 152/a>p. 162/a>#include "dm-log-userspace-transfer.h2/a>"p. 172/a>p. 182/a>static.2a href="+code=uint32_t" class="sref">uint32_t2/a>.2a href="+code=dm_ulog_seq" class="sref">dm_ulog_seq2/a>;p. 192/a>p. 202/a>2spae class="comment">/*2/spae=". 212/a>2spae class="comment"> * Netlink/Connector is ae unreliable protocol.  How long should2/spae=". 222/a>2spae class="comment"> * we wait for a response before assuming it was lost aed retrying?2/spae=". 232/a>2spae class="comment"> * (If we do receive a response after this time, it will be discarded2/spae=". 242/a>2spae class="comment"> * aed the response to the resent request will be waited for.2/spae=". 252/a>2spae class="comment"> */2/spae=". 262/a>#define.2a href="+code=DM_ULOG_RETRY_TIMEOUT" class="sref">DM_ULOG_RETRY_TIMEOUT2/a>.(15 * 2a href="+code=HZ" class="sref">HZ2/a>)". 272/a>p. 282/a>2spae class="comment">/*2/spae=". 292/a>2spae class="comment"> * Pre-allocated space for speed2/spae=". 302/a>2spae class="comment"> */2/spae=". 312/a>#define.2a href="+code=DM_ULOG_PREALLOCED_SIZE" class="sref">DM_ULOG_PREALLOCED_SIZE2/a>.512". 322/a>static.struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>.*2a href="+code=prealloced_cn_msg" class="sref">prealloced_cn_msg2/a>;p. 332/a>static.struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*2a href="+code=prealloced_ulog_tfr" class="sref">prealloced_ulog_tfr2/a>;p. 342/a>p. 352/a>static.struct.2a href="+code=cb_id" class="sref">cb_id2/a>.2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>.= {p. 362/a>        .2a href="+code=idx" class="sref">idx2/a>.= 2a href="+code=CN_IDX_DM" class="sref">CN_IDX_DM2/a>,p. 372/a>        .2a href="+code=val" class="sref">val2/a>.= 2a href="+code=CN_VAL_DM_USERSPACE_LOG" class="sref">CN_VAL_DM_USERSPACE_LOG2/a>p. 382/a>};p. 392/a>p. 402/a>static.2a href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEX2/a>(2a href="+code=dm_ulog_lock" class="sref">dm_ulog_lock2/a>);p. 412/a>p. 422/a>struct.2a href="+code=receiving_pkg" class="sref">receiving_pkg2/a>.{p. 432/a>        struct.2a href="+code=list_head" class="sref">list_head2/a>.2a href="+code=list" class="sref">list2/a>;p. 442/a>        struct.2a href="+code=complealue" class="sref">complealue2/a>.2a href="+code=compleae" class="sref">compleae2/a>;p. 452/a>p. 462/a>        2a href="+code=uint32_t" class="sref">uint32_t2/a>.2a href="+code=seq" class="sref">seq2/a>;p. 472/a>p. 482/a>        int.2a href="+code=error" class="sref">error2/a>;p. 492/a>        2a href="+code=size_t" class="sref">size_t2/a>.*2a href="+code=data_size" class="sref">data_size2/a>;p. 502/a>        char.*2a href="+code=data" class="sref">data2/a>;p. 512/a>};p. 522/a>p. 532/a>static.2a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCK2/a>(2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p. 542/a>static.struct.2a href="+code=list_head" class="sref">list_head2/a>.2a href="+code=receiving_list" class="sref">receiving_list2/a>;p. 552/a>p. 562/a>static.int.2a href="+code=dm_ulog_sendto_server" class="sref">dm_ulog_sendto_server2/a>(struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*2a href="+code=tfr" class="sref">tfr2/a>)". 572/a>{p. 582/a>        int.2a href="+code=r" class="sref">r2/a>;p. 592/a>        struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>.*2a href="+code=msg" class="sref">msg2/a>.= 2a href="+code=prealloced_cn_msg" class="sref">prealloced_cn_msg2/a>;p. 602/a>p. 612/a>        2a href="+code=memset" class="sref">memset2/a>(2a href="+code=msg" class="sref">msg2/a>, 0, sizeof(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>));p. 622/a>p. 632/a>        2a href="+code=msg" class="sref">msg2/a>->2a href="+code=id" class="sref">id2/a>.2a href="+code=idx" class="sref">idx2/a>.= 2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>.2a href="+code=idx" class="sref">idx2/a>;p. 642/a>        2a href="+code=msg" class="sref">msg2/a>->2a href="+code=id" class="sref">id2/a>.2a href="+code=val" class="sref">val2/a>.= 2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>.2a href="+code=val" class="sref">val2/a>;p. 652/a>        2a href="+code=msg" class="sref">msg2/a>->2a href="+code=ack" class="sref">ack2/a>.= 0;p. 662/a>        2a href="+code=msg" class="sref">msg2/a>->2a href="+code=seq" class="sref">seq2/a>.= 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=seq" class="sref">seq2/a>;p. 672/a>        2a href="+code=msg" class="sref">msg2/a>->2a href="+code=lee" class="sref">lee2/a>.= sizeof(struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>) + 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a>;p. 682/a>p. 692/a>        2a href="+code=r" class="sref">r2/a>.= 2a href="+code=cn_netlink_send" class="sref">cn_netlink_send2/a>(2a href="+code=msg" class="sref">msg2/a>, 0, 2a href="+code=gfp_any" class="sref">gfp_any2/a>());p. 702/a>p. 712/a>        return 2a href="+code=r" class="sref">r2/a>;p. 722/a>}p. 732/a>p. 742/a>2spae class="comment">/*2/spae=". 752/a>2spae class="comment"> * Param ters for this funcalue cae be either msg or tfr, but not2/spae=". 762/a>2spae class="comment"> * both.  This funcalue fills in the reply for a waiting request.2/spae=". 772/a>2spae class="comment"> * If just msg is given, then the reply is simply ae ACK from userspace2/spae=". 782/a>2spae class="comment"> * that the request was received.2/spae=". 792/a>2spae class="comment"> *2/spae=". 802/a>2spae class="comment"> * Returns: 0 ue success, -ENOENT ue failure2/spae=". 812/a>2spae class="comment"> */2/spae=". 822/a>static.int.2a href="+code=fill_pkg" class="sref">fill_pkg2/a>(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>.*2a href="+code=msg" class="sref">msg2/a>,.struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*2a href="+code=tfr" class="sref">tfr2/a>)". 832/a>{p. 842/a>        2a href="+code=uint32_t" class="sref">uint32_t2/a>.2a href="+code=rtn_seq" class="sref">rtn_seq2/a>.= (2a href="+code=msg" class="sref">msg2/a>) ? 2a href="+code=msg" class="sref">msg2/a>->2a href="+code=seq" class="sref">seq2/a>.: (2a href="+code=tfr" class="sref">tfr2/a>) ? 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=seq" class="sref">seq2/a>.: 0;p. 852/a>        struct.2a href="+code=receiving_pkg" class="sref">receiving_pkg2/a>.*2a href="+code=pkg" class="sref">pkg2/a>;p. 862/a>p. 872/a>        2spae class="comment">/*2/spae=". 882/a>2spae class="comment">         * The 'receiving_pkg' entries in this list are statically2/spae=". 892/a>2spae class="comment">         * allocated on the stack in 'dm_consult_userspace'.2/spae=". 902/a>2spae class="comment">         * Each process that is waiting for a reply from the user2/spae=". 912/a>2spae class="comment">         * space server will have an entry in this list.2/spae=". 922/a>2spae class="comment">         *2/spae=". 932/a>2spae class="comment">         * We are safe to do it this way because the stack space2/spae=". 942/a>2spae class="comment">         * is unique to each process, but still addressable by2/spae=". 952/a>2spae class="comment">         * other processes.2/spae=". 962/a>2spae class="comment">         */2/spae=". 972/a>        2a href="+code=list_for_each_entry" class="sref">list_for_each_entry2/a>(2a href="+code=pkg" class="sref">pkg2/a>, &2a href="+code=receiving_list" class="sref">receiving_list2/a>, 2a href="+code=list" class="sref">list2/a>).{p. 982/a>                if (2a href="+code=rtn_seq" class="sref">rtn_seq2/a>.!= 2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=seq" class="sref">seq2/a>)". 992/a>                        continue;p.1002/a>p.1012/a>                if (2a href="+code=msg" class="sref">msg2/a>) {p.1022/a>                        2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=error" class="sref">error2/a>.= -2a href="+code=msg" class="sref">msg2/a>->2a href="+code=ack" class="sref">ack2/a>;p.1032/a>                        2spae class="comment">/*2/spae=".1042/a>2spae class="comment">                         * If we are trying again, we will need to know our2/spae=".1052/a>2spae class="comment">                         * storage capacity.  Otherwise, along with the2/spae=".1062/a>2spae class="comment">                         * error code, we make explicit that we have no data.2/spae=".1072/a>2spae class="comment">                         */2/spae=".1082/a>                        if (2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=error" class="sref">error2/a>.!= -2a href="+code=EAGAIN" class="sref">EAGAIN2/a>)".1092/a>                                *(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data_size" class="sref">data_size2/a>).= 0;p.1102/a>                } else if (2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a> > *(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data_size" class="sref">data_size2/a>)) {p.1112/a>                        2a href="+code=DMERR" class="sref">DMERR2/a>(2spae class="string">"Insufficient space to receive package [%u] ".1122/a>                              2spae class="string">"(%u vs %zu)"tfr2/a>->2a href="+code=request_typ " class="sref">request_typ 2/a>,".1132/a>                              2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a>, *(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data_size" class="sref">data_size2/a>));p.1142/a>p.1152/a>                        *(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data_size" class="sref">data_size2/a>).= 0;p.1162/a>                        2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=error" class="sref">error2/a>.= -2a href="+code=ENOSPC" class="sref">ENOSPC2/a>;p.1172/a>                } else {p.1182/a>                        2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=error" class="sref">error2/a>.= 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=error" class="sref">error2/a>;p.1192/a>                        2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data" class="sref">data2/a>, 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data" class="sref">data2/a>, 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a>);p.1202/a>                        *(2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=data_size" class="sref">data_size2/a>).= 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a>;p.1212/a>                }p.1222/a>                2a href="+code=compleae" class="sref">compleae2/a>(&2a href="+code=pkg" class="sref">pkg2/a>->2a href="+code=compleae" class="sref">compleae2/a>);p.1232/a>                return 0;p.1242/a>        }p.1252/a>p.1262/a>        return -2a href="+code=ENOENT" class="sref">ENOENT2/a>;p.1272/a>}p.1282/a>p.1292/a>2spae class="comment">/*2/spae=".1302/a>2spae class="comment"> * This is the connector callback that delivers data2/spae=".1312/a>2spae class="comment"> * that was sent from userspace.2/spae=".1322/a>2spae class="comment"> */2/spae=".1332/a>static.void.2a href="+code=cn_ulog_callback" class="sref">cn_ulog_callback2/a>(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>.*2a href="+code=msg" class="sref">msg2/a>,.struct.2a href="+code=netlink_skb_parms" class="sref">netlink_skb_parms2/a>.*2a href="+code=nsp" class="sref">nsp2/a>)".1342/a>{p.1352/a>        struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*2a href="+code=tfr" class="sref">tfr2/a>.= (struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*)(2a href="+code=msg" class="sref">msg2/a> + 1);p.1362/a>p.1372/a>        if (!2a href="+code=capable" class="sref">capable2/a>(2a href="+code=CAP_SYS_ADMIN" class="sref">CAP_SYS_ADMIN2/a>))p.1382/a>                return;p.1392/a>p.1402/a>        2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.1412/a>        if (2a href="+code=msg" class="sref">msg2/a>->2a href="+code=lee" class="sref">lee2/a>.== 0)p.1422/a>                2a href="+code=fill_pkg" class="sref">fill_pkg2/a>(2a href="+code=msg" class="sref">msg2/a>,.2a href="+code=NULL" class="sref">NULL2/a>);p.1432/a>        else if (2a href="+code=msg" class="sref">msg2/a>->2a href="+code=lee" class="sref">lee2/a>.< sizeof(*2a href="+code=tfr" class="sref">tfr2/a>))p.1442/a>                2a href="+code=DMERR" class="sref">DMERR2/a>(2spae class="string">"Incompleae message received (expected %u, got %u): [%u]".1452/a>                      (unsigned)sizeof(*2a href="+code=tfr" class="sref">tfr2/a>),.2a href="+code=msg" class="sref">msg2/a>->2a href="+code=lee" class="sref">lee2/a>,.2a href="+code=msg" class="sref">msg2/a>->2a href="+code=seq" class="sref">seq2/a>);p.1462/a>        elsep.1472/a>                2a href="+code=fill_pkg" class="sref">fill_pkg2/a>(2a href="+code=NULL" class="sref">NULL2/a>, 2a href="+code=tfr" class="sref">tfr2/a>);p.1482/a>        2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.1492/a>}p.1502/a>p.1512/a>2spae class="comment">/**2/spae=".1522/a>2spae class="comment"> * dm_consult_userspace2/spae=".1532/a>2spae class="comment"> * @uuid: log's universal unique identifier (must be DM_UUID_LEN in size)2/spae=".1542/a>2spae class="comment"> * @luid: log's local unique identifier2/spae=".1552/a>2spae class="comment"> * @request_typ :  found in include/linux/dm-log-userspace.h2/spae=".1562/a>2spae class="comment"> * @data: data to tx to the server2/spae=".1572/a>2spae class="comment"> * @data_size: size of data in bytes2/spae=".1582/a>2spae class="comment"> * @rdata: place to put return data from server2/spae=".1592/a>2spae class="comment"> * @rdata_size:  >
  -result (amount of space given/amount of space used)2/spae=".1602/a>2spae class="comment"> *2/spae=".1612/a>2spae class="comment"> * rdata_size is undefined ue failure.2/spae=".1622/a>2spae class="comment"> *2/spae=".1632/a>2spae class="comment"> * Memory used to communicate with userspace is zero'ed2/spae=".1642/a>2spae class="comment"> * before populating to ensure that no unwanted bits leak2/spae=".1652/a>2spae class="comment"> * from kernel space to user-space.  All userspace log communications2/spae=".1662/a>2spae class="comment"> * between kernel aed user space go through this funcalue.2/spae=".1672/a>2spae class="comment"> *2/spae=".1682/a>2spae class="comment"> * Returns: 0 ue success, -EXXX ue failure2/spae=".1692/a>2spae class="comment"> **/2/spae=".1702/a>int.2a href="+code=dm_consult_userspace" class="sref">dm_consult_userspace2/a>(const char.*2a href="+code=uuid" class="sref">uuid2/a>, 2a href="+code=uint64_t" class="sref">uint64_t2/a> 2a href="+code=luid" class="sref">luid2/a>, int.2a href="+code=request_typ " class="sref">request_typ 2/a>,".1712/a>                         char.*2a href="+code=data" class="sref">data2/a>, 2a href="+code=size_t" class="sref">size_t2/a>.2a href="+code=data_size" class="sref">data_size2/a>,".1722/a>                         char.*2a href="+code=rdata" class="sref">rdata2/a>, 2a href="+code=size_t" class="sref">size_t2/a>.*2a href="+code=rdata_size" class="sref">rdata_size2/a>)".1732/a>{p.1742/a>        int.2a href="+code=r" class="sref">r2/a>.= 0;p.1752/a>        2a href="+code=size_t" class="sref">size_t2/a>.2a href="+code=dummy" class="sref">dummy2/a>.= 0;p.1762/a>        int.2a href="+code=overhead_size" class="sref">overhead_size2/a>.= sizeof(struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>) + sizeof(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>);p.1772/a>        struct.2a href="+code=dm_ulog_request" class="sref">dm_ulog_request2/a>.*2a href="+code=tfr" class="sref">tfr2/a>.= 2a href="+code=prealloced_ulog_tfr" class="sref">prealloced_ulog_tfr2/a>;p.1782/a>        struct.2a href="+code=receiving_pkg" class="sref">receiving_pkg2/a>.2a href="+code=pkg" class="sref">pkg2/a>;p.1792/a>p.1802/a>        2spae class="comment">/*2/spae=".1812/a>2spae class="comment">         * Given the space needed to hold the 'struct.cn_msg' and2/spae=".1822/a>2spae class="comment">         * 'struct.dm_ulog_request' - do we have enough payload2/spae=".1832/a>2spae class="comment">         * space remaining?2/spae=".1842/a>2spae class="comment">         */2/spae=".1852/a>        if (2a href="+code=data_size" class="sref">data_size2/a> > (2a href="+code=DM_ULOG_PREALLOCED_SIZE" class="sref">DM_ULOG_PREALLOCED_SIZE2/a>.-.2a href="+code=overhead_size" class="sref">overhead_size2/a>)) {p.1862/a>                2a href="+code=DMINFO" class="sref">DMINFO2/a>(2spae class="string">"Size of tfr exceeds preallocated size".1872/a>                return -2a href="+code=EINVAL" class="sref">EINVAL2/a>;p.1882/a>        }p.1892/a>p.1902/a>        if (!2a href="+code=rdata_size" class="sref">rdata_size2/a>)".1912/a>                2a href="+code=rdata_size" class="sref">rdata_size2/a>.= &2a href="+code=dummy" class="sref">dummy2/a>;p.1922/a>2a href="+code=resend" class="sref">resend2/a>:p.1932/a>        2spae class="comment">/*2/spae=".1942/a>2spae class="comment">         * We serialize the sending of requests so we can2/spae=".1952/a>2spae class="comment">         * use the preallocated space.2/spae=".1962/a>2spae class="comment">         */2/spae=".1972/a>        2a href="+code=mutex_lock" class="sref">mutex_lock2/a>(&2a href="+code=dm_ulog_lock" class="sref">dm_ulog_lock2/a>);p.1982/a>p.1992/a>        2a href="+code=memset" class="sref">memset2/a>(2a href="+code=tfr" class="sref">tfr2/a>, 0, 2a href="+code=DM_ULOG_PREALLOCED_SIZE" class="sref">DM_ULOG_PREALLOCED_SIZE2/a>.-.sizeof(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>));p.2002/a>        2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=uuid" class="sref">uuid2/a>, 2a href="+code=uuid" class="sref">uuid2/a>, 2a href="+code=DM_UUID_LEN" class="sref">DM_UUID_LEN2/a>);p.2012/a>        2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=verslue" class="sref">verslue2/a>.= 2a href="+code=DM_ULOG_REQUEST_VERSION" class="sref">DM_ULOG_REQUEST_VERSION2/a>;p.2022/a>        2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=luid" class="sref">luid2/a>.= 2a href="+code=luid" class="sref">luid2/a>;p.2032/a>        2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=seq" class="sref">seq2/a>.= 2a href="+code=dm_ulog_seq" class="sref">dm_ulog_seq2/a>++;p.2042/a>p.2052/a>        2spae class="comment">/*2/spae=".2062/a>2spae class="comment">         * Must be valid request typ  (all other bits set to2/spae=".2072/a>2spae class="comment">         * zero).  This reserves other bits for possible future2/spae=".2082/a>2spae class="comment">         * use.2/spae=".2092/a>2spae class="comment">         */2/spae=".2102/a>        2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=request_typ " class="sref">request_typ 2/a>.= 2a href="+code=request_typ " class="sref">request_typ 2/a>.& 2a href="+code=DM_ULOG_REQUEST_MASK" class="sref">DM_ULOG_REQUEST_MASK2/a>;p.2112/a>p.2122/a>        2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data_size" class="sref">data_size2/a> = 2a href="+code=data_size" class="sref">data_size2/a>;p.2132/a>        if (2a href="+code=data" class="sref">data2/a>.&& 2a href="+code=data_size" class="sref">data_size2/a>)p.2142/a>                2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=data" class="sref">data2/a>, 2a href="+code=data" class="sref">data2/a>, 2a href="+code=data_size" class="sref">data_size2/a>);p.2152/a>p.2162/a>        2a href="+code=memset" class="sref">memset2/a>(&2a href="+code=pkg" class="sref">pkg2/a>, 0, sizeof(2a href="+code=pkg" class="sref">pkg2/a>));p.2172/a>        2a href="+code=init_complealue" class="sref">init_complealue2/a>(&2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=compleae" class="sref">compleae2/a>);p.2182/a>        2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=seq" class="sref">seq2/a>.= 2a href="+code=tfr" class="sref">tfr2/a>->2a href="+code=seq" class="sref">seq2/a>;p.2192/a>        2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=data_size" class="sref">data_size2/a> = 2a href="+code=rdata_size" class="sref">rdata_size2/a>;p.2202/a>        2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=data" class="sref">data2/a>.= 2a href="+code=rdata" class="sref">rdata2/a>;p.2212/a>        2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2222/a>        2a href="+code=list_add" class="sref">list_add2/a>(&(2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=list" class="sref">list2/a>), &2a href="+code=receiving_list" class="sref">receiving_list2/a>);p.2232/a>        2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2242/a>p.2252/a>        2a href="+code=r" class="sref">r2/a>.= 2a href="+code=dm_ulog_sendto_server" class="sref">dm_ulog_sendto_server2/a>(2a href="+code=tfr" class="sref">tfr2/a>);p.2262/a>p.2272/a>        2a href="+code=mutex_unlock" class="sref">mutex_unlock2/a>(&2a href="+code=dm_ulog_lock" class="sref">dm_ulog_lock2/a>);p.2282/a>p.2292/a>        if (2a href="+code=r" class="sref">r2/a>) {p.2302/a>                2a href="+code=DMERR" class="sref">DMERR2/a>(2spae class="string">"Unable to send log request [%u] to userspace: %d".2312/a>                      2a href="+code=request_typ " class="sref">request_typ 2/a>, 2a href="+code=r" class="sref">r2/a>);p.2322/a>                2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2332/a>                2a href="+code=list_del_init" class="sref">list_del_init2/a>(&(2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=list" class="sref">list2/a>));p.2342/a>                2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2352/a>p.2362/a>                goto 2a href="+code=out" class="sref">out2/a>;p.2372/a>        }p.2382/a>p.2392/a>        2a href="+code=r" class="sref">r2/a>.= 2a href="+code=wait_for_complealue_timeout" class="sref">wait_for_complealue_timeout2/a>(&(2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=compleae" class="sref">compleae2/a>), 2a href="+code=DM_ULOG_RETRY_TIMEOUT" class="sref">DM_ULOG_RETRY_TIMEOUT2/a>);p.2402/a>        2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2412/a>        2a href="+code=list_del_init" class="sref">list_del_init2/a>(&(2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=list" class="sref">list2/a>));p.2422/a>        2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=receiving_list_lock" class="sref">receiving_list_lock2/a>);p.2432/a>        if (!2a href="+code=r" class="sref">r2/a>) {p.2442/a>                2a href="+code=DMWARN" class="sref">DMWARN2/a>(2spae class="string">"[%s] Request timed out: [%u/%u] - retrying".2452/a>                       (2a href="+code=strlee" class="sref">strlee2/a>(2a href="+code=uuid" class="sref">uuid2/a>) > 8) ?p.2462/a>                       (2a href="+code=uuid" class="sref">uuid2/a> + (2a href="+code=strlee" class="sref">strlee2/a>(2a href="+code=uuid" class="sref">uuid2/a>) - 8)).: (2a href="+code=uuid" class="sref">uuid2/a>),p.2472/a>                       2a href="+code=request_typ " class="sref">request_typ 2/a>, 2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=seq" class="sref">seq2/a>);p.2482/a>                goto 2a href="+code=resend" class="sref">resend2/a>;p.2492/a>        }p.2502/a>p.2512/a>        2a href="+code=r" class="sref">r2/a>.= 2a href="+code=pkg" class="sref">pkg2/a>.2a href="+code=error" class="sref">error2/a>;p.2522/a>        if (2a href="+code=r" class="sref">r2/a>.== -2a href="+code=EAGAIN" class="sref">EAGAIN2/a>)".2532/a>                goto 2a href="+code=resend" class="sref">resend2/a>;p.2542/a>p.2552/a>2a href="+code=out" class="sref">out2/a>:p.2562/a>        return 2a href="+code=r" class="sref">r2/a>;p.2572/a>}p.2582/a>p.2592/a>int.2a href="+code=dm_ulog_tfr_init" class="sref">dm_ulog_tfr_init2/a>(void)".2602/a>{p.2612/a>        int.2a href="+code=r" class="sref">r2/a>;p.2622/a>        void.*2a href="+code=prealloced" class="sref">prealloced2/a>;p.2632/a>p.2642/a>        2a href="+code=INIT_LIST_HEAD" class="sref">INIT_LIST_HEAD2/a>(&2a href="+code=receiving_list" class="sref">receiving_list2/a>);p.2652/a>p.2662/a>        2a href="+code=prealloced" class="sref">prealloced2/a>.= 2a href="+code=kmalloc" class="sref">kmalloc2/a>(2a href="+code=DM_ULOG_PREALLOCED_SIZE" class="sref">DM_ULOG_PREALLOCED_SIZE2/a>, 2a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL2/a>);p.2672/a>        if (!2a href="+code=prealloced" class="sref">prealloced2/a>)".2682/a>                return -2a href="+code=ENOMEM" class="sref">ENOMEM2/a>;p.2692/a>p.2702/a>        2a href="+code=prealloced_cn_msg" class="sref">prealloced_cn_msg2/a>.= 2a href="+code=prealloced" class="sref">prealloced2/a>;p.2712/a>        2a href="+code=prealloced_ulog_tfr" class="sref">prealloced_ulog_tfr2/a>.= 2a href="+code=prealloced" class="sref">prealloced2/a> + sizeof(struct.2a href="+code=cn_msg" class="sref">cn_msg2/a>);p.2722/a>p.2732/a>        2a href="+code=r" class="sref">r2/a>.= 2a href="+code=cn_add_callback" class="sref">cn_add_callback2/a>(&2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>, 2spae class="string">"dmlogusr"cn_ulog_callback2/a>);p.2742/a>        if (2a href="+code=r" class="sref">r2/a>) {p.2752/a>                2a href="+code=cn_del_callback" class="sref">cn_del_callback2/a>(&2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>);p.2762/a>                return 2a href="+code=r" class="sref">r2/a>;p.2772/a>        }p.2782/a>p.2792/a>        return 0;p.2802/a>}p.2812/a>p.2822/a>void.2a href="+code=dm_ulog_tfr_exit" class="sref">dm_ulog_tfr_exit2/a>(void)".2832/a>{p.2842/a>        2a href="+code=cn_del_callback" class="sref">cn_del_callback2/a>(&2a href="+code=ulog_cn_id" class="sref">ulog_cn_id2/a>);p.2852/a>        2a href="+code=kfre " class="sref">kfre 2/a>(2a href="+code=prealloced_cn_msg" class="sref">prealloced_cn_msg2/a>);p.2862/a>}p.2872/a>
lxr.linux.no kindly hosted by Redpill Linpro AS2/a>, provider of Linux consulting aed operations services since.1995.