示例#1
0
/* Pass NULL to use system's error message. */
static void
gsql_save_error_message (Database *db, char *msg)
{
  unsigned char buf[256];
  unsigned char sqlstate[15];
  char odbc_error_variable[128];
  BPRINTF_BUFFER *err;

  /* Get statement errors */
  while (SQLError (db->henv, db->hdbc, db->hstmt, sqlstate, NULL,
      buf, sizeof(buf), NULL) == SQL_SUCCESS)
    {
      sprintf (odbc_error_variable, "odbc::odbc-error-message[%d]",
	       odbc_error_index);
      odbc_error_index++;

      err = bprintf_create_buffer ();
      bprintf (err, "HSTMT: SQLSTATE=%s %s\n", sqlstate, buf);
      pagefunc_set_variable (odbc_error_variable, err->buffer);
      page_debug ("ODBC: %s", err->buffer);
      bprintf_free_buffer (err);
    }

  /* Get connection errors */
  while (SQLError (db->henv, db->hdbc, SQL_NULL_HSTMT, sqlstate, NULL,
      buf, sizeof(buf), NULL) == SQL_SUCCESS)
    {
      sprintf (odbc_error_variable, "odbc::odbc-error-message[%d]",
	       odbc_error_index);
      odbc_error_index++;
      err = bprintf_create_buffer ();
      bprintf (err, "Connection: SQLSTATE=%s %s\n", sqlstate, buf);
      pagefunc_set_variable (odbc_error_variable,  err->buffer);
      page_debug ("ODBC: %s", err->buffer);
      bprintf_free_buffer (err);
    }

  /* Get environmental errors */
  while (SQLError (db->henv, SQL_NULL_HDBC, SQL_NULL_HSTMT, sqlstate, NULL,
      buf, sizeof(buf), NULL) == SQL_SUCCESS)
    {
      sprintf (odbc_error_variable, "odbc::odbc-error-message[%d]",
	       odbc_error_index);
      odbc_error_index++;
      err = bprintf_create_buffer ();
      bprintf (err, "Environment: SQLSTATE=%s %s\n", sqlstate, buf);
      pagefunc_set_variable (odbc_error_variable, err->buffer);
      page_debug ("ODBC: %s", err->buffer);
      bprintf_free_buffer (err);
    }

  if (msg != GSQL_DEFAULT_ERRMSG)
    {
      sprintf (odbc_error_variable, "odbc::odbc-error-message[%d]",
	       odbc_error_index);
      odbc_error_index++;
      page_debug ("ODBC: %s", msg);
      pagefunc_set_variable (odbc_error_variable, msg);
    }
}
static int nilfs_set_page_dirty(struct page *page)
{
	int ret = __set_page_dirty_buffers(page);

	page_debug(3, "called (page=%p)\n", page);
	if (ret) {
		struct inode *inode = page->mapping->host;
		struct nilfs_sb_info *sbi = NILFS_SB(inode->i_sb);
		unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);

		nilfs_set_file_dirty(sbi, inode, nr_dirty);
	}
	page_debug(3, "done (ret=%d, page=%p)\n", ret, page);
	return ret;
}
示例#3
0
/* <odbc::set-connect-option db fInfoType value>
   
   Performs ODBC SetInfo call. Returns true if successful. */
static void
pf_odbc_set_connect_option (PFunArgs)
{
  char *finfo = mhtml_evaluate_string (get_positional_arg (vars, 1));
  char *val = mhtml_evaluate_string (get_positional_arg (vars, 2));

  /* No errors yet! */
  gsql_clear_error_message ();

  if (database_environment_level != 0)
    {
      Database *db = get_dbref (vars);

      if ((db != (Database *)NULL) && gsql_database_connected (db))
	{
	  RETCODE status = SQL_ERROR;
	  int  numval;
	  ODBC_option opt;

	  if (find_odbc_option (finfo, &opt) != 0)
	    {
	      switch (opt.type)
		{
		case ODBC_OPT_STRING:
		  status = SQLSetConnectOption
		    (db->hdbc, opt.code, (UDWORD) val);
		  break;

		case ODBC_OPT_INT32:
		  numval = atoi (val);
		  status = SQLSetConnectOption
		    (db->hdbc, opt.code, (UDWORD) numval); 
		  break;

		case ODBC_OPT_INT16:
		  numval = 0xffff & atoi (val);
		  status = SQLSetConnectOption
		    (db->hdbc, opt.code, (UDWORD) numval); 
		  break;
		}
	    }

	  if (status == SQL_SUCCESS)
	    {
	      bprintf_insert (page, start, "true");
	      *newstart += strlen ("true");
	    }
	  else
	    gsql_save_error_message (db, GSQL_DEFAULT_ERRMSG);
	}
    }
  else
    page_debug ("<odbc::set-connect-option ...>: Not within open-database!");

  xfree (val);
  xfree (finfo);
}
示例#4
0
文件: ui.c 项目: zcgeng/ics2015
static int cmd_page(char *args){
    if(args == NULL){
        printf("Please input a number!\n");
        return 0;
    }
    char expre[32];
    sscanf(args, "%s", expre);
    swaddr_t addr = 0;
    bool success = true;
    addr = expr(expre, &success);
    if(success == false) return 0;
    lnaddr_t lnaddr = seg_translate(addr, R_SS);
    printf("lnaddr = 0x%x\n", lnaddr);
    page_debug(lnaddr);
    return 0;
}
static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
{
	struct inode *inode = page->mapping->host;
	int err;

	page_debug(3, "called (page=%p, index=%lu, wbc nonblocking %d, "
		   "wbc for_reclaim %d)\n",
		    page, page->index, wbc->nonblocking, wbc->for_reclaim);
	redirty_page_for_writepage(wbc, page);
	unlock_page(page);

	if (wbc->sync_mode == WB_SYNC_ALL) {
		err = nilfs_construct_segment(inode->i_sb);
		if (unlikely(err))
			return err;
	} else if (wbc->for_reclaim)
		nilfs_flush_segment(inode->i_sb, inode->i_ino);

	return 0;
}
void nilfs_sync_page(struct page *page)
{
	page_debug(3, "called (page=%p)\n", page);
}