Пример #1
0
/**
 *  @brief Function to send packet
 *
 *  @param pmlan_adapter	A pointer to mlan_adapter structure
 *  @param pmbuf		A pointer to mlan_buffer structure
 *
 *  @return			MLAN_STATUS_PENDING
 */
mlan_status
mlan_send_packet(IN t_void * pmlan_adapter, IN pmlan_buffer pmbuf)
{
    mlan_status ret = MLAN_STATUS_PENDING;
    mlan_adapter *pmadapter = (mlan_adapter *) pmlan_adapter;

    ENTER();
    MASSERT(pmlan_adapter && pmbuf);

    MASSERT(pmbuf->bss_index < pmadapter->priv_num);
    pmbuf->flags = MLAN_BUF_FLAG_MOAL_TX_BUF;

    if (((pmadapter->priv[pmbuf->bss_index]->port_ctrl_mode == MTRUE) &&
         ((mlan_ntohs(*(t_u16 *) & pmbuf->pbuf[pmbuf->data_offset +
                                               MLAN_ETHER_PKT_TYPE_OFFSET]) ==
           MLAN_ETHER_PKT_TYPE_EAPOL)
          ||
          (mlan_ntohs
           (*(t_u16 *) & pmbuf->
            pbuf[pmbuf->data_offset + MLAN_ETHER_PKT_TYPE_OFFSET]) ==
           MLAN_ETHER_PKT_TYPE_WAPI)
         ))
        || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA)

        ) {
        PRINTM(MINFO, "mlan_send_pkt(): enq(bybass_txq)\n");
        wlan_add_buf_bypass_txqueue(pmadapter, pmbuf);
    } else {
        /* Transmit the packet */
        wlan_wmm_add_buf_txqueue(pmadapter, pmbuf);
    }

    LEAVE();
    return ret;
}
Пример #2
0
static void *mlowerfs_ext3_start(struct inode *inode, int op)
{
	int nblocks = EXT3_SINGLEDATA_TRANS_BLOCKS;
	//journal_t *journal = NULL;
	void *handle = NULL;
	MENTRY();

        if (current->journal_info) {
                goto journal_start;
        }

	/* Increase block number according to operation type */

journal_start:
	MASSERT(nblocks > 0);
	handle = _mlowerfs_ext3_journal_start(inode, nblocks);
	if (!IS_ERR(handle)) {
		MASSERT(current->journal_info == handle);
	} else {
		MERROR("error starting handle for op %u (%u credits): rc %ld\n",
		       op, nblocks, PTR_ERR(handle));
	}

	MRETURN(handle);
}
Пример #3
0
void SPostProcess::DrawRBO(bool redraw)
{
    if (p_prog->IsReady)
    {
        MASSERT(!d_RBO);
        MASSERT(!d_resultRBO);
        d_resultRBO->Bind(redraw);
        Draw();
    }
}
Пример #4
0
int mtfs_branch_getflag(struct inode *inode, mtfs_bindex_t bindex, __u32 *mtfs_flag)
{
	struct inode *hidden_inode = mtfs_i2branch(inode, bindex);
	struct mtfs_lowerfs *lowerfs = mtfs_i2blowerfs(inode, bindex);
	int ret = 0;
	MENTRY();

	MASSERT(hidden_inode);
	MASSERT(lowerfs);

	ret = mlowerfs_getflag(lowerfs, hidden_inode, mtfs_flag);
	MRETURN(ret);
}
Пример #5
0
static int ext_support_init(void)
{
	int ret = 0;
	unsigned long address = 0;

	MDEBUG("registering mtfs lowerfs for ext\n");
	ret = mtfs_symbol_get("ext3", "ext3_bread", &address, &_mlowerfs_ext3_bread_owner);
	if (ret) {
		MERROR("failed to get address of symbple ext3_bread, ret = %d\n", ret);
		goto out;
	}
	MASSERT(_mlowerfs_ext3_bread_owner != NULL);
	_mlowerfs_ext3_bread_pointer = (_mlowerfs_ext3_bread_t)address;

	ret = mtfs_symbol_get("ext3", "ext3_iget", &address, &_mlowerfs_ext3_iget_owner);
	if (ret) {
		MERROR("failed to get address of symbple ext3_bread, ret = %d\n", ret);
		goto out_ext3_bread_put;
	}
	MASSERT(_mlowerfs_ext3_iget_owner != NULL);
	_mlowerfs_ext3_iget_pointer = (_mlowerfs_ext3_iget_t)address;

	ret = mlowerfs_register(&lowerfs_ext2);
	if (ret) {
		MERROR("failed to register lowerfs for ext2, ret = %d\n", ret);
		goto out_ext3_iget_put;
	}

	ret = mlowerfs_register(&lowerfs_ext3);
	if (ret) {
		MERROR("failed to register lowerfs for ext3, ret = %d\n", ret);
		goto out_unregister_ext2;
	}

	ret = mlowerfs_register(&lowerfs_ext4);
	if (ret) {
		MERROR("failed to register lowerfs for ext4, ret = %d\n", ret);
		goto out_unregister_ext3;
	}
	goto out;
out_unregister_ext3:
	mlowerfs_unregister(&lowerfs_ext3);
out_unregister_ext2:
	mlowerfs_unregister(&lowerfs_ext2);
out_ext3_iget_put:
	mtfs_symbol_put(_mlowerfs_ext3_iget_owner);
out_ext3_bread_put:
	mtfs_symbol_put(_mlowerfs_ext3_bread_owner);
out:
	return ret;
}
Пример #6
0
int mtfs_branch_invalidate_flag(struct inode *inode, mtfs_bindex_t bindex, __u32 valid_flags)
{
	struct inode *hidden_inode = mtfs_i2branch(inode, bindex);
	struct mtfs_lowerfs *lowerfs = NULL;
	int ret = 0;
	MENTRY();

	MASSERT(hidden_inode);
	lowerfs = mtfs_i2blowerfs(inode, bindex);
	MASSERT(lowerfs);

	ret = mlowerfs_invalidate(lowerfs, hidden_inode, valid_flags);
	MRETURN(ret);
}
Пример #7
0
const Hashtable<const String *, AbstractReflectSessionRef> &
ServerComponent ::
GetSessions() const
{
   MASSERT(_owner, "Can not call GetSessions() while not attached to the server");
   return _owner->GetSessions(); 
}
Пример #8
0
status_t
ServerComponent ::
RemoveAcceptFactory(uint16 port, const IPAddress & optInterfaceIP)
{
   MASSERT(_owner, "Can not call RemoveAcceptFactory() while not attached to the server");
   return _owner->RemoveAcceptFactory(port, optInterfaceIP);
}
Пример #9
0
Message & 
ServerComponent ::
GetCentralState() const 
{
   MASSERT(_owner, "Can not call GetCentralState() while not attached to the server");
   return _owner->GetCentralState();
}
Пример #10
0
bool
AbstractReflectSession ::
DisconnectSession()
{
   MASSERT(IsAttachedToServer(), "Can not call DisconnectSession() while not attached to the server");
   return GetOwner()->DisconnectSession(this);
}
Пример #11
0
status_t
ServerComponent ::
PutAcceptFactory(uint16 port, const ReflectSessionFactoryRef & factoryRef, const IPAddress & optInterfaceIP, uint16 * optRetPort)
{
   MASSERT(_owner, "Can not call PutAcceptFactory() while not attached to the server");
   return _owner->PutAcceptFactory(port, factoryRef, optInterfaceIP, optRetPort);
}
Пример #12
0
ReflectSessionFactoryRef 
ServerComponent ::
GetFactory(uint16 port) const
{
   MASSERT(_owner, "Can not call GetFactory() while not attached to the server");
   return _owner->GetFactory(port);
}
Пример #13
0
status_t
ServerComponent ::
AddNewDormantConnectSession(const AbstractReflectSessionRef & ref, const IPAddress & ip, uint16 port, uint64 autoReconnectDelay, uint64 maxAsyncConnectPeriod)
{
   MASSERT(_owner, "Can not call AddNewDormantConnectSession() while not attached to the server");
   return _owner->AddNewDormantConnectSession(ref, ip, port, autoReconnectDelay, maxAsyncConnectPeriod);
}
Пример #14
0
bool Net::send(node_t *src, node_id_t dst, 
               std::unique_ptr<net_msg_t> msg) {
   auto inqit = inqs.find(dst);
   MASSERT(inqs.count(src->get_nid()) > 0, "src unregisterd to network");
   if( inqit == inqs.end() ) {
      // Can happen when you send to dead node
      l::og(l::DEBUG, "send: No inq for node %s\n", id_str(dst));
      msg = nullptr;
      return false;
   }
   // "NIC" fills in pkt_num and source of message
   // NB: Clients can copy messages before sending them, so best to
   //  assign number here rather than at message creation
   msg->pkt_num = net_msg_t::_pkt_num++;
   msg->sent_tick = now();
   msg->src = src->get_nid();
   stat.tot_msg_send++;
   stat.sends[src->get_nid()]++;
   // Just log recv
   //l::og(l::DEBUG, 
   //       "%s %s to %s S(%03lld)\n", 
   //       src->id_str(), msg->descr, id_str(dst), msg->pkt_num);
   inqit->second->push_back(std::move(msg));
   return true;
}
Пример #15
0
uint16
AbstractReflectSession ::
GetPort() const 
{
   MASSERT(IsAttachedToServer(), "Can not call GetPort() while not attached to the server");
   return _ipAddressAndPort.GetPort();
}
Пример #16
0
const IPAddress &
AbstractReflectSession ::
GetLocalInterfaceAddress() const 
{
   MASSERT(IsAttachedToServer(), "Can not call LocalInterfaceAddress() while not attached to the server");
   return _ipAddressAndPort.GetIPAddress();
}
Пример #17
0
void paxserver::do_fake_init_vc() {
   node_id_t pr = nid;
   view_t v;
   v.backups.insert(pr);
   for (const auto id : net->get_serv_ids(nid)) {
      v.backups.insert((node_id_t)id);
      if (pr < id) {
         pr = id;
      }
   }
   v.backups.erase(pr);
   MASSERT(v.backups.size() >= 2,
           "For fault tolerance, paxos generally runs"
           "at least 3 servers");
   v.primary = pr;
   v.vid.counter = 1;
   v.vid.manager = pr;

   vc_state.mode = vc_state_t::ACTIVE;
   vc_mgr = {};
   vc_state.view = v;
   vc_state.accepted_view = nullptr;
   if (nid == pr) {
      ts = 1ULL;
      viewstamp_t last_vs_old_view  = paxlog.latest_exec();
      vc_state.latest_seen = last_vs_old_view;
      vc_state.proposed_vid = v.vid;
      LOG(l::DBG_VC, "Initial view " << v << "\n");
   } else {
      viewstamp_t new_vs;
      new_vs.vid = vc_state.view.vid;
      new_vs.ts = 0ULL;
      paxlog.set_latest_exec(new_vs);
   }
}
Пример #18
0
status_t 
AbstractReflectSession ::
AddOutgoingMessage(const MessageRef & ref) 
{
   MASSERT(IsAttachedToServer(), "Can not call AddOutgoingMessage() while not attached to the server");
   return (_gateway()) ? _gateway()->AddOutgoingMessage(ref) : B_ERROR;
}
Пример #19
0
static int mlowerfs_ext3_commit_async(struct inode *inode, void *h,
                               void **wait_handle)
{
	unsigned long tid = 0;
	transaction_t *transaction = NULL;
	handle_t *handle = h;
	journal_t *journal = NULL;
	int ret = 0;
	MENTRY();

	MASSERT(current->journal_info == handle);

	transaction = handle->h_transaction;
	journal = transaction->t_journal;
	tid = transaction->t_tid;
	/* we don't want to be blocked */
	handle->h_sync = 0;
	ret = _mlowerfs_ext3_journal_stop(handle);
	if (ret) {
		MERROR("error while stopping transaction: %d\n", ret);
		goto out;
	}
	log_start_commit(journal, tid);

	*wait_handle = (void *) tid;
out:
	MRETURN(ret);
}
Пример #20
0
static int mlowerfs_ext3_extend(struct inode *inode, unsigned int nblocks, void *h)
{
	handle_t *handle = h;
	int ret = 0;
	MENTRY();

	/* fsfilt_extend called with nblocks = 0 for testing in special cases */
	if (nblocks == 0) {
		handle->h_buffer_credits = 0;
		MWARN("setting credits of handle %p to zero by request\n", h);
	}

	if (handle->h_buffer_credits > nblocks) {
		ret = 0;
		goto out;
	}

	if (_mlowerfs_ext3_journal_extend(handle, nblocks) == 0) {
		ret = 0;
		goto out;
	}

	MASSERT(inode->i_sb->s_op->dirty_inode);
	inode->i_sb->s_op->dirty_inode(inode);
	ret = _lowerfs_ext3_journal_restart(handle, nblocks);

out:
	MRETURN(ret);
}
Пример #21
0
AbstractReflectSessionRef 
ServerComponent ::
GetSession(const String & id) const
{
   MASSERT(_owner, "Can not call GetSession() while not attached to the server");
   return _owner->GetSession(id);
}
Пример #22
0
const String &
AbstractReflectSession ::
GetHostName() const 
{
   MASSERT(IsAttachedToServer(), "Can not call GetHostName() while not attached to the server");
   return _hostName;
}
Пример #23
0
const Hashtable<IPAddressAndPort, ReflectSessionFactoryRef> &
ServerComponent ::
GetFactories() const 
{
   MASSERT(_owner, "Can not call GetFactories() while not attached to the server");
   return _owner->GetFactories(); 
}
Пример #24
0
uint64
ServerComponent ::
GetServerSessionID() const
{
   MASSERT(_owner, "Can not call GetServerSessionID() while not attached to the server");
   return _owner->GetServerSessionID();
}
Пример #25
0
status_t
ServerComponent ::
AddNewSession(const AbstractReflectSessionRef & ref, const ConstSocketRef & socket)
{
   MASSERT(_owner, "Can not call AddNewSession() while not attached to the server");
   return _owner->AddNewSession(ref, socket);
}
Пример #26
0
uint64 
ServerComponent ::
GetNumUsedBytes() const
{
   MASSERT(_owner, "Can not call GetNumUsedBytes() while not attached to the server");
   return _owner->GetNumUsedBytes();
}
Пример #27
0
void SPostProcess::Clean()


{
    MASSERT(!d_resultRBO);
    d_resultRBO->Clean();
}
Пример #28
0
status_t
AbstractReflectSession ::
ReplaceSession(const AbstractReflectSessionRef & replaceMeWithThis)
{
   MASSERT(IsAttachedToServer(), "Can not call ReplaceSession() while not attached to the server");
   return GetOwner()->ReplaceSession(replaceMeWithThis, this);
}
Пример #29
0
/**
 *  @brief Packet send completion handling
 *
 *  @param pmadapter		A pointer to mlan_adapter structure
 *  @param pmbuf		A pointer to mlan_buffer structure
 *  @param status		Callback status
 *
 *  @return			MLAN_STATUS_SUCCESS
 */
mlan_status
wlan_write_data_complete(IN pmlan_adapter pmadapter,
			 IN pmlan_buffer pmbuf, IN mlan_status status)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	pmlan_callbacks pcb;

	ENTER();

	MASSERT(pmadapter && pmbuf);

	pcb = &pmadapter->callbacks;

	if (pmbuf->flags & MLAN_BUF_FLAG_TCP_ACK) {
		pmbuf->flags &= ~MLAN_BUF_FLAG_TCP_ACK;
		pcb->moal_tcp_ack_tx_ind(pmadapter->pmoal_handle, pmbuf);
	}

	if ((pmbuf->buf_type == MLAN_BUF_TYPE_DATA) ||
	    (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA)) {
		PRINTM(MINFO, "wlan_write_data_complete: DATA %p\n", pmbuf);
		if (pmbuf->flags & MLAN_BUF_FLAG_MOAL_TX_BUF) {
			/* pmbuf was allocated by MOAL */
			pcb->moal_send_packet_complete(pmadapter->pmoal_handle,
						       pmbuf, status);
		} else {
			/* pmbuf was allocated by MLAN */
			wlan_free_mlan_buffer(pmadapter, pmbuf);
		}
	}

	LEAVE();
	return ret;
}
Пример #30
0
void
ServerComponent ::
EndServer()
{
   MASSERT(_owner, "Can not call EndServer() while not attached to the server");
   _owner->EndServer();
}