Exemple #1
0
int mtfs_branch_valid_flag(struct inode *inode, mtfs_bindex_t bindex, __u32 valid_flags)
{
	int is_valid = 1;
	__u32 mtfs_flag = 0;
	int ret = 0;
	MENTRY();

	if (mtfs_i2branch(inode, bindex) == NULL) {
		is_valid = 0;
		MDEBUG("branch[%d] is null, return invalid\n", bindex);
		goto out;
	}
	
	if (valid_flags == MTFS_BRANCH_VALID) {
		is_valid = 1;
		MDEBUG("branch[%d] is not null, return valid\n", bindex);
		goto out;
	}

	ret = mtfs_branch_getflag(inode, bindex, &mtfs_flag);
	if (ret) {
		MERROR("failed to get branch flag, ret = %d\n", ret);
		is_valid = 0;
		goto out;
	}

	if ((valid_flags & MTFS_DATA_VALID) != 0 &&
	    (mtfs_flag & MTFS_FLAG_DATABAD) != 0) {
		MDEBUG("data of branch[%d] is not valid\n", bindex); 
		is_valid = 0;
	}

out:
	MRETURN(is_valid);
}
Exemple #2
0
void block_queue::print() const
{
  boost::unique_lock<boost::recursive_mutex> lock(mutex);
  MDEBUG("Block queue has " << blocks.size() << " spans");
  for (const auto &span: blocks)
    MDEBUG("  " << span.start_block_height << " - " << (span.start_block_height+span.nblocks-1) << " (" << span.nblocks << ") - " << (is_blockchain_placeholder(span) ? "blockchain" : span.blocks.empty() ? "scheduled" : "filled    ") << "  " << span.connection_id << " (" << ((unsigned)(span.rate*10/1024.f))/10.f << " kB/s)");
}
Exemple #3
0
/*
 - caltdissect - dissect match for alternation node
 ^ static int caltdissect(struct vars *, struct subre *, chr *, chr *);
 */
static int			/* regexec return code */
caltdissect(
    struct vars *v,
    struct subre *t,
    chr *begin,		/* beginning of relevant substring */
    chr *end)		/* end of same */
{
    struct dfa *d;
    int er;

    /* We loop, rather than tail-recurse, to handle a chain of alternatives */
    while (t != NULL) {
	assert(t->op == '|');
	assert(t->left != NULL && t->left->cnfa.nstates > 0);

	MDEBUG(("calt n%d\n", t->id));

	d = getsubdfa(v, t->left);
	NOERR();
	if (longest(v, d, begin, end, (int *) NULL) == end) {
	    MDEBUG(("calt matched\n"));
	    er = cdissect(v, t->left, begin, end);
	    if (er != REG_NOMATCH) {
		return er;
	    }
	}

	t = t->right;
    }

    return REG_NOMATCH;
}
Exemple #4
0
std::pair<uint64_t, uint64_t> block_queue::reserve_span(uint64_t first_block_height, uint64_t last_block_height, uint64_t max_blocks, const boost::uuids::uuid &connection_id, const std::list<crypto::hash> &block_hashes, boost::posix_time::ptime time)
{
  boost::unique_lock<boost::recursive_mutex> lock(mutex);

  if (last_block_height < first_block_height || max_blocks == 0)
  {
    MDEBUG("reserve_span: early out: first_block_height " << first_block_height << ", last_block_height " << last_block_height << ", max_blocks " << max_blocks);
    return std::make_pair(0, 0);
  }

  uint64_t span_start_height = last_block_height - block_hashes.size() + 1;
  std::list<crypto::hash>::const_iterator i = block_hashes.begin();
  while (i != block_hashes.end() && requested(*i))
  {
    ++i;
    ++span_start_height;
  }
  uint64_t span_length = 0;
  std::list<crypto::hash> hashes;
  while (i != block_hashes.end() && span_length < max_blocks)
  {
    hashes.push_back(*i);
    ++i;
    ++span_length;
  }
  if (span_length == 0)
    return std::make_pair(0, 0);
  MDEBUG("Reserving span " << span_start_height << " - " << (span_start_height + span_length - 1) << " for " << connection_id);
  add_blocks(span_start_height, span_length, connection_id, time);
  set_span_hashes(span_start_height, connection_id, hashes);
  return std::make_pair(span_start_height, span_length);
}
Exemple #5
0
/*
 * altdissect - determine alternative subexpression matches (uncomplicated)
 */
static int						/* regexec return code */
altdissect(struct vars * v,
           struct subre * t,
           chr *begin,			/* beginning of relevant substring */
           chr *end)			/* end of same */
{
    struct dfa *d;
    int			i;

    assert(t != NULL);
    assert(t->op == '|');

    for (i = 0; t != NULL; t = t->right, i++)
    {
        MDEBUG(("trying %dth\n", i));
        assert(t->left != NULL && t->left->cnfa.nstates > 0);
        d = newdfa(v, &t->left->cnfa, &v->g->cmap, &v->dfa1);
        if (ISERR())
            return v->err;
        if (longest(v, d, begin, end, (int *) NULL) == end)
        {
            MDEBUG(("success\n"));
            freedfa(d);
            return dissect(v, t->left, begin, end);
        }
        freedfa(d);
    }
    return REG_ASSERT;			/* none of them matched?!? */
}
Exemple #6
0
/*
 - complicatedAlternationDissect - determine alternative subexpression matches (w.
 - complications)
 ^ static int complicatedAlternationDissect(struct vars *, struct subre *, chr *, chr *);
 */
static int			/* regexec return code */
complicatedAlternationDissect(
    struct vars *const v,
    struct subre *t,
    chr *const begin,		/* beginning of relevant substring */
    chr *const end)		/* end of same */
{
    int er;
#define	UNTRIED	0		/* not yet tried at all */
#define	TRYING	1		/* top matched, trying submatches */
#define	TRIED	2		/* top didn't match or submatches exhausted */

#ifndef COMPILER_DOES_TAILCALL_OPTIMIZATION
    if (0) {
    doRight:
	t = t->right;
    }
#endif
    if (t == NULL) {
	return REG_NOMATCH;
    }
    assert(t->op == '|');
    if (v->mem[t->retry] == TRIED) {
	goto doRight;
    }

    MDEBUG(("cAlt n%d\n", t->retry));
    assert(t->left != NULL);

    if (v->mem[t->retry] == UNTRIED) {
	struct dfa *d = newDFA(v, &t->left->cnfa, &v->g->cmap, DOMALLOC);

	if (ISERR()) {
	    return v->err;
	}
	if (longest(v, d, begin, end, NULL) != end) {
	    freeDFA(d);
	    v->mem[t->retry] = TRIED;
	    goto doRight;
	}
	freeDFA(d);
	MDEBUG(("cAlt matched\n"));
	v->mem[t->retry] = TRYING;
    }

    er = complicatedDissect(v, t->left, begin, end);
    if (er != REG_NOMATCH) {
	return er;
    }

    v->mem[t->retry] = TRIED;
#ifndef COMPILER_DOES_TAILCALL_OPTIMIZATION
    goto doRight;
#else
  doRight:
    return complicatedAlternationDissect(v, t->right, begin, end);
#endif
}
Exemple #7
0
void Loading::cancel_btn_clicked()
{
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_UIBase,DLevel6) << "Loading::cancel_btn_clicked";
    MDEBUG(DModule_UIBase,DLevel3) << "<Disconnect Server># Cancel Button Clicked To Quit Connect Server #";
#endif
    cancel_btn_->setEnabled(false);
    emit QuitConnectServer();
}
/*Method to execute sql statements like SELECT and return Cursor
Inputs:
query- string containing sql query
qlength - length of query (for binary data). if 0 then assume null terminated.
Output: NULL cursor on error
*/
DBCursor *DBConnection_SQLITE::sqlQuery(char *query, DBString *args, int numargs, int p_rows)
{
	DBCursor_SQLITE *ret = 0;
	unsigned int qlength;
	char *newquery = (char *)query;

#ifndef NDEBUG
	MDEBUG0("SQLite::sqlQuery\n");
	MDEBUG("Numargs=[%d]\n", numargs);
	MDEBUG("Query=[%s]\n", query);
	
	for(int i = 0; i < numargs; i++) {
		MDEBUG("Args[%d]=[%s]\n", i);
	}
#endif
	
	if (!isConnected)
		return NULL;

	//if null terminated (qlength = 0) then calculate length of query
	qlength = strlen(query);
	//execute query and check for error

	if(numargs) {
		int newsize;
		newquery = BindVariables(query, qlength, args, numargs, newsize);
		qlength = newsize;
	}

	try {
		ret = new DBCursor_SQLITE(mDB);
		Dataset *ds = ret->getDataset();

		ds->query(newquery);
		//try to open cursor..on error delete invalid cursor object and exit with error
		if(!ret->open((DBConnection *)this)) {
			delete ret;
			ret = 0;
			mIsError = true;
			setErrorStr("Unable to open query");
		} else
			addCursor(ret); //add to cursor list

	} catch(DbErrors &e) {
		MDEBUG0("\n\n --- CAUGHT ERROR --- \n");
		mIsError = true;
		setErrorStr(e.getMsg());
		delete ret;
		ret = 0;
	}

	if (numargs)
		delete newquery;

	return ret;
}
Exemple #9
0
uint32_t analyse (FILE *fmatched, const char *file)
{
      int rule_id = -1, test_id = -1;

      if (!rule)
	  {   // Initial rule
          MDEBUG(("%s\n", file));
          if (!rule.load (file, RULE_MAX_REPEAT, true))
          {
              MDEBUG (("\tFailed to reference tune %s\n", file));
              return 0;
          }
          MDEBUG (("\tInitial rule base $%04x, length %d, matches %d\n", rule.base(), rule.length(), rule.ids()));
		  //rule.md5_add ();
		  return 1;
	  }

      // Now try for a match with tune two. 
      if (!test.load (file, -1, true))
      {
          MDEBUG (("%s\n\tFailed to load, skipping\n", file));
          return 0;
      }

      fprintf (stderr, "%s\n", file);

      int end = test.ids() - RULE_MATCH;
      if (end < 0)
      {
          MDEBUG (("\tInput file not long enough to match against\n", file));
          return 0;
      }

      for (int id = 0; id < end; id++)
      {
          rule_id = rule.find (test, id, RULE_MATCH);
          if (rule_id < 0)
              continue;
          test_id = id;
          break;
      }

      if (rule_id < 0)
      {
          MDEBUG (("\tNo match found\n"));
          return 0;
      }
      else
      {
          MDEBUG (("\tMatch rule id %d ($%04x) with test id %d ($%04x)\n", rule_id, rule.addr(rule_id), test_id, test.addr(test_id)));
      }

      if (!rule.combine (test, test_id, rule_id, RULE_MIN_MATCH))
          MDEBUG (("\tMatches less that minimum threshold, tune ignored\n"));
      else
          MDEBUG (("\tRule base $%04x, length %d, matches %d\n", rule.base(), rule.length(), rule.ids()));
      test.md5_add ();
      fprintf (fmatched, "%s %d %s @ %04x\n", test.md5_get(), rule.player_id(), file, test.addr(test_id));
      return 1;
}
Exemple #10
0
/**
 * Initialize the physical page allocator.
 *
 * This takes RAM information from the multiboot header 
 * and then sets up some data structures to manage this RAM.
 */
void init_page_allocator()
{
	/* set all bits to busy .. we will clear bits which actually
	   point to usable RAM */
	for (unsigned x = 0; x < UINT_CNT; x++)
		free_bm[x] = (unsigned)~0;

	unsigned node_cnt;
	const ram_map_t *s = get_rammap_ptr(&node_cnt);
	printk("RAM address map received from multiboot:\n");
	for (unsigned i = 0; i < node_cnt; i++) {
		printk("%d: Start: 0x%8x End:0x%8x :: Size = ",
		       i, s[i].saddr, s[i].saddr + s[i].len - 1);
		print_human_readable_size(s[i].len);
	}

	printk("Area occupied by Ganoid:\n");
	printk("Start: 0x%8x\n", GANOID_AREA_START);
	printk("End  : 0x%8x\n", GANOID_AREA_END);

	/* set the bits which are already occupied. */
	for (unsigned i = 0; i < node_cnt; i++) {
		unsigned next_block_addr = s[i].saddr + s[i].len;
		if (s[i].saddr <= GANOID_AREA_START &&
		    GANOID_AREA_END < next_block_addr) {
			/* kernel is inside current RAM area */
			MDEBUG("This area has ganoid\n");

			/* free pages upto kernel start */
			if (s[i].saddr != GANOID_AREA_START)
				fp_clearbit_range(GET_PAGENO(s[i].saddr),
						  GET_PAGENO(GANOID_AREA_START -
							     1));

			if (next_block_addr != GANOID_AREA_END) {
				MDEBUG("SEQ 0: %x %x\n", GANOID_AREA_END +
				       PAGE_SIZE, next_block_addr - 1);
				fp_clearbit_range(GET_PAGENO(GANOID_AREA_END +
							     PAGE_SIZE),
						  GET_PAGENO(next_block_addr -
							     1));
			}
		} else {
			MDEBUG("\nFull free range: %x to %x\n",
			       s[i].saddr, next_block_addr - 1);
			fp_clearbit_range(GET_PAGENO(s[i].saddr),
					  GET_PAGENO(next_block_addr - 1));
		}
	}

#ifdef CONFIG_PAGE_ALLOC_DEBUG
	dump_free_info();
#endif /* CONFIG_PAGE_ALLOC_DEBUG */
}
int MCommandSenderThread::ChatWithServer(const std::string &data)
{
    CURLcode res;
    int ret = 0;
    CURL *curl = curl_easy_init();
    if (curl == NULL)
    {
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_Communication,DLevel3) <<"<Curl Error> curl_easy_init failed***** ";
#endif
        return MISEIS_CURLE_INIT_FAILED;
    }

//  curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
    curl_easy_setopt(curl, CURLOPT_URL, str_ip_.toLatin1().data());
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
//  curl_easy_setopt(curl, CURLOPT_TIMEOUT, CURL_TIMEOUT);
    curl_easy_setopt(curl, CURLOPT_POST, 1L);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, CURL_CONNECT_TIMEOUT);
//  curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
    struct curl_slist *chunk = NULL;
    chunk = curl_slist_append(chunk, "Expect:");
    res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);

    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
    curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, Progress);
    curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this);

    res = curl_easy_perform(curl);

    if (res != CURLE_OK)
    {
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_Communication,DLevel3) <<"<Curl Error>***** "<<curl_easy_strerror(res)<<" *****";
#endif
        MISEISERROR("<Curl Error>***** %s *****", curl_easy_strerror(res));

        if (cancel_cmd_ != COMMAND_CANCEL_READY)
        {
            ret =  MISIES_CURLE_COULDNT_CONNECT;
        }
        else
        {
            ret = MISEIS_CURLE_USER_CANCEL;
        }
    }

    curl_easy_cleanup(curl);
    return ret;
}
Exemple #12
0
static int ext_support_init(void)
{
	int ret = 0;

	MDEBUG("registering mtfs async juntion for ext2\n");

	ret = junction_register(&mtfs_ext2_junction);
	if (ret) {
		MERROR("failed to register junction for ext2, ret = %d\n", ret);
		goto out;
	}

	ret = junction_register(&mtfs_ext3_junction);
	if (ret) {
		MERROR("failed to register junction for ext3, ret = %d\n", ret);
		goto out_unregister_ext2;
	}

	ret = junction_register(&mtfs_ext4_junction);
	if (ret) {
		MERROR("failed to register junction for ext4, ret = %d\n", ret);
		goto out_unregister_ext3;
	}
	goto out;

out_unregister_ext3:
	junction_unregister(&mtfs_ext3_junction);	
out_unregister_ext2:
	junction_unregister(&mtfs_ext2_junction);
out:
	return ret;
}
Exemple #13
0
static int masync_replica_ext_init(void)
{
	int ret = 0;

	MDEBUG("registering async_replica junction for ext2/ext3/ext4\n");

	ret = junction_register(&mtfs_ext2_junction);
	if (ret) {
		MERROR("failed to register async_replica junction for ext2: error %d\n",
		       ret);
		goto out;
	}

	ret = junction_register(&mtfs_ext3_junction);
	if (ret) {
		MERROR("failed to register async_replica junction for ext3: error %d\n",
		       ret);
		goto out_unregister_ext2;
	}
	goto out;

out_unregister_ext2:
	junction_unregister(&mtfs_ext2_junction);
out:
	return ret;
}
Exemple #14
0
void Loading::mouseMoveEvent(QMouseEvent *event)
{
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_UIBase,DLevel6) << "Loading::mouseMoveEvent";
#endif
   move(event->globalPos() - this->dPos);
}
Exemple #15
0
/*
 - complicatedDissect - determine subexpression matches (with complications)
 * The retry memory stores the offset of the trial midpoint from begin, plus 1
 * so that 0 uniquely means "clean slate".
 ^ static int complicatedDissect(struct vars *, struct subre *, chr *, chr *);
 */
static inline int		/* regexec return code */
complicatedDissect(
    struct vars *const v,
    struct subre *const t,
    chr *const begin,		/* beginning of relevant substring */
    chr *const end)		/* end of same */
{
    assert(t != NULL);
    MDEBUG(("complicatedDissect %ld-%ld %c\n", LOFF(begin), LOFF(end), t->op));

    switch (t->op) {
    case '=':			/* terminal node */
	assert(t->left == NULL && t->right == NULL);
	return REG_OKAY;	/* no action, parent did the work */
    case '|':			/* alternation */
	assert(t->left != NULL);
	return complicatedAlternationDissect(v, t, begin, end);
    case 'b':			/* back ref -- shouldn't be calling us! */
	assert(t->left == NULL && t->right == NULL);
	return complicatedBackrefDissect(v, t, begin, end);
    case '.':			/* concatenation */
	assert(t->left != NULL && t->right != NULL);
	return complicatedConcatenationDissect(v, t, begin, end);
    case '(':			/* capturing */
	assert(t->left != NULL && t->right == NULL);
	assert(t->subno > 0);
	return complicatedCapturingDissect(v, t, begin, end);
    default:
	return REG_ASSERT;
    }
}
Exemple #16
0
/*
 - caltdissect - determine alternative subexpression matches (w. complications)
 ^ static int caltdissect(struct vars *, struct subre *, chr *, chr *);
 */
static int			/* regexec return code */
caltdissect(
    struct vars *v,
    struct subre *t,
    chr *begin,			/* beginning of relevant substring */
    chr *end)			/* end of same */
{
    struct dfa *d;
    int er;
#define	UNTRIED	0		/* not yet tried at all */
#define	TRYING	1		/* top matched, trying submatches */
#define	TRIED	2		/* top didn't match or submatches exhausted */

    if (t == NULL) {
	return REG_NOMATCH;
    }
    assert(t->op == '|');
    if (v->mem[t->retry] == TRIED) {
	return caltdissect(v, t->right, begin, end);
    }

    MDEBUG(("calt n%d\n", t->retry));
    assert(t->left != NULL);

    if (v->mem[t->retry] == UNTRIED) {
	d = newdfa(v, &t->left->cnfa, &v->g->cmap, DOMALLOC);
	if (ISERR()) {
	    return v->err;
	}
	if (longest(v, d, begin, end, NULL) != end) {
	    freedfa(d);
	    v->mem[t->retry] = TRIED;
	    return caltdissect(v, t->right, begin, end);
	}
	freedfa(d);
	MDEBUG(("calt matched\n"));
	v->mem[t->retry] = TRYING;
    }

    er = cdissect(v, t->left, begin, end);
    if (er != REG_NOMATCH) {
	return er;
    }

    v->mem[t->retry] = TRIED;
    return caltdissect(v, t->right, begin, end);
}
Exemple #17
0
/* returns negative on error; 0 if success; 1 if success & log destroyed */
int mlog_cancel_rec(struct mlog_handle *loghandle, int index)
{
	struct mlog_log_hdr *mlh = loghandle->mgh_hdr;
	int ret = 0;
	MENTRY();

	MDEBUG("Canceling %d in log %llx\n",
	       index, loghandle->mgh_id.mgl_oid);

	if (index == 0) {
		MERROR("Can't cancel index 0 which is header\n");
		ret = -EINVAL;
		goto out;
	}

	if (!ext2_clear_bit(index, mlh->mlh_bitmap)) {
		MDEBUG("Catalog index %u already clear?\n", index);
		ret = -ENOENT;
		goto out;
	}

	mlh->mlh_count--;

	if ((mlh->mlh_flags & MLOG_F_ZAP_WHEN_EMPTY) &&
	    (mlh->mlh_count == 1) &&
	    (loghandle->mgh_last_idx == (MLOG_BITMAP_BYTES * 8) - 1)) {
		ret = mlog_destroy(loghandle);
		if (ret) {
			MERROR("Failure destroying log after last cancel: %d\n",
			       ret);
			ext2_set_bit(index, mlh->mlh_bitmap);
			mlh->mlh_count++;
		} else {
			ret = 1;
		}
		goto out;
	}

	ret = mlog_write_rec(loghandle, &mlh->mlh_hdr, NULL, 0, NULL, 0);
	if (ret) {
		MERROR("Failure re-writing header %d\n", ret);
		ext2_set_bit(index, mlh->mlh_bitmap);
		mlh->mlh_count++;
	}
out:
	MRETURN(ret);
}
Exemple #18
0
static void ext_support_exit(void)
{
	MDEBUG("unregistering mtfs sync juntion for ext2/ext3/ext4\n");

	junction_unregister(&mtfs_ext4_junction);
	junction_unregister(&mtfs_ext3_junction);
	junction_unregister(&mtfs_ext2_junction);
}
int MCommandSenderThread::ConvertDataToCommand(const std::string &data, MCommand &cmd)
{
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_Communication,DLevel3) <<"MCommandSenderThread::ConvertDataToCommand";
#endif
    JsonDecoder::ParseStringToMCommand(data,cmd);
    return 0;
}
int MCommandSenderThread::ConvertCommandToData(const MCommand& cmd, std::string &data)
{
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_Communication,DLevel3) << "MCommandSenderThread::ConvertCommandToData";
#endif
    JsonEncoder::GenMCommandToString(cmd,data);
    return 0;
}
Exemple #21
0
/* Here we want the physical address of the memory.
 * This is used when initializing the contents of the
 * area and marking the pages as reserved.
 */
static inline unsigned long kvirt_to_pa(unsigned long va) 
{
        unsigned long kva, ret;

        kva = uvirt_to_kva(pgd_offset_k(va), va);
	ret = __pa(kva);
        MDEBUG(printk("kv2pa(%lx-->%lx)", adr, ret));
        return ret;
}
Exemple #22
0
static inline unsigned long kvirt_to_bus(unsigned long va) 
{
        unsigned long kva, ret;

        kva = uvirt_to_kva(pgd_offset_k(va), va);
	ret = virt_to_bus((void *)kva);
        MDEBUG(printk("kv2b(%lx-->%lx)", adr, ret));
        return ret;
}
Exemple #23
0
/**
 * @todo Optimize
 */
static void fp_clearbit_range(unsigned start_bit, unsigned end_bit)
{
	MDEBUG("%s: %d:%x %d:%x\n", __FUNCTION__,
	       start_bit, PAGENO_TO_ADDR(start_bit), end_bit,
	       PAGENO_TO_ADDR(end_bit));
	unsigned bit = start_bit;
	for (; bit <= end_bit; bit++)
		fp_clearbit(bit);
}
Exemple #24
0
static void ext_support_exit(void)
{
	MDEBUG("unregistering mtfs lowerfs for ext\n");
	mlowerfs_unregister(&lowerfs_ext2);
	mlowerfs_unregister(&lowerfs_ext3);
	mlowerfs_unregister(&lowerfs_ext4);
	MASSERT(_mlowerfs_ext3_bread_owner);
	mtfs_symbol_put(_mlowerfs_ext3_bread_owner);
}
Exemple #25
0
static inline unsigned long uvirt_to_pa(unsigned long adr) 
{
        unsigned long kva, ret;

        kva = uvirt_to_kva(pgd_offset(current->mm, adr), adr);
	ret = virt_to_phys((void *)kva);
        MDEBUG(printk("uv2b(%lx-->%lx)", adr, ret));
        return ret;
}
Exemple #26
0
void Loading::mousePressEvent(QMouseEvent *event)
{
#ifdef MDEBUG_ENABLE
    MDEBUG(DModule_UIBase,DLevel6) << "Loading::mousePressEvent";
#endif
   windowPos = pos();
   mousePos = event->globalPos();
   dPos = mousePos - windowPos;
 }
void ZmqServer::serve()
{

  while (1)
  {
    try
    {
      zmq::message_t message;

      if (!rep_socket)
      {
        throw std::runtime_error("ZMQ RPC server reply socket is null");
      }
      while (rep_socket->recv(&message))
      {
        std::string message_string(reinterpret_cast<const char *>(message.data()), message.size());

        MDEBUG(std::string("Received RPC request: \"") + message_string + "\"");

        std::string response = handler.handle(message_string);

        zmq::message_t reply(response.size());
        memcpy((void *) reply.data(), response.c_str(), response.size());

        rep_socket->send(reply);
        MDEBUG(std::string("Sent RPC reply: \"") + response + "\"");

      }
    }
    catch (const boost::thread_interrupted& e)
    {
      MDEBUG("ZMQ Server thread interrupted.");
    }
    catch (const zmq::error_t& e)
    {
      MERROR(std::string("ZMQ error: ") + e.what());
    }
    boost::this_thread::interruption_point();
  }
}
Exemple #28
0
static int mlog_vfs_read_header(struct mlog_handle *handle)
{
	struct mtfs_lowerfs *lowerfs = NULL;
	int ret = 0;
	MENTRY();

	MASSERT(sizeof(*handle->mgh_hdr) == MLOG_CHUNK_SIZE);

	lowerfs = handle->mgh_ctxt->moc_lowerfs;

	if (i_size_read(handle->mgh_file->f_dentry->d_inode) == 0) {
		MDEBUG("not reading header from 0-byte log\n");
		ret = MLOG_EEMPTY;
		goto out;
	}

	ret = mlog_vfs_read_blob(lowerfs, handle->mgh_file,
				 handle->mgh_hdr,
				 MLOG_CHUNK_SIZE, 0);
	if (ret) {
		MERROR("error reading log header from %.*s\n",
		       handle->mgh_file->f_dentry->d_name.len,
		       handle->mgh_file->f_dentry->d_name.name);
	} else {
		struct mlog_rec_hdr *mlh_hdr = &handle->mgh_hdr->mlh_hdr;

		if (MLOG_REC_HDR_NEEDS_SWABBING(mlh_hdr)) {
			mlog_swab_hdr(handle->mgh_hdr);
		}

		if (mlh_hdr->mrh_type != MLOG_HDR_MAGIC) {
			MERROR("bad log %.*s header magic: %#x (expected %#x)\n",
			       handle->mgh_file->f_dentry->d_name.len,
			       handle->mgh_file->f_dentry->d_name.name,
			       mlh_hdr->mrh_type, MLOG_HDR_MAGIC);
			ret = -EIO;
		} else if (mlh_hdr->mrh_len != MLOG_CHUNK_SIZE) {
			MERROR("incorrectly sized log %.*s header: %#x "
			       "(expected %#x)\n",
			       handle->mgh_file->f_dentry->d_name.len,
			       handle->mgh_file->f_dentry->d_name.name,
			       mlh_hdr->mrh_len, MLOG_CHUNK_SIZE);
			ret = -EIO;
		}
	}

	handle->mgh_last_idx = handle->mgh_hdr->mlh_tail.mrt_index;
	handle->mgh_file->f_pos = i_size_read(handle->mgh_file->f_dentry->d_inode);

out:
	MRETURN(ret);
}
Exemple #29
0
static int lowerfs_tmpfs_init(void)
{
	int ret = 0;

	MDEBUG("mtfs lowerfs support for tmpfs\n");

	ret = mlowerfs_register(&lowerfs_tmpfs);
	if (ret) {
		MERROR("failed to register lowerfs operation: error %d\n", ret);
	}	

	return ret;
}
void DBConnection_SQLITE::setErrorStr(const char *msg)
{
	MDEBUG("\nsetErrorStr(%s)\n", msg);

	if(mErrorStr != 0) {
		free(mErrorStr);
		mErrorStr = 0;
	}

	if(msg) {
		mErrorStr = strdup(msg);
	}
}