示例#1
0
bool
AppendOnlyBlockDirectory_addCol_InsertEntry(
	AppendOnlyBlockDirectory *blockDirectory,
	int columnGroupNo,
	int64 firstRowNum,
	int64 fileOffset,
	int64 rowCount)
{
	if (rowCount == 0)
		return false;

	if (blockDirectory->blkdirRel == NULL ||
		blockDirectory->blkdirIdx == NULL)
		return false;

	/*
	 * columnGroupNo is attribute number of the new column.  We need
	 * to map it to the right index in the minipage array.
	 */
	int numExistingCols = blockDirectory->aoRel->rd_att->natts -
			blockDirectory->numColumnGroups;

	Assert((numExistingCols >= 0) && (numExistingCols - 1 < columnGroupNo));
	MinipagePerColumnGroup *minipageInfo =
		&blockDirectory->minipages[columnGroupNo-numExistingCols];
	return insert_new_entry(blockDirectory, columnGroupNo, firstRowNum,
							fileOffset,	rowCount, minipageInfo);
}
示例#2
0
void func_interp::insert_entry(expr * const * args, expr * r) {
    reset_interp_cache();
    func_entry * entry = get_entry(args); 
    if (entry != 0) {
        entry->set_result(m_manager, r);
        return;
    }
    insert_new_entry(args, r);
}
示例#3
0
/* If successful, return 0.  Otherwise, return -1 with errno set.     */
int atomic_log_array(char *s, int len) {
   list *new_entry;

   if (fd < 0) {
      errno = EINVAL;
      return -1;
   }
   new_entry = insert_new_entry(len, 0);
   if (new_entry == NULL)
      return -1;
   (void)memcpy(new_entry->entry, s, len);
   return 0;
}
示例#4
0
/*
 * AppendOnlyBlockDirectory_InsertEntry
 *
 * Insert an entry to the block directory. This entry is appended to the 
 * in-memory minipage. If the minipage is full, it is written to the block
 * directory relation on disk. After that, the new entry is added to the
 * new in-memory minipage.
 *
 * To reduce the size of a block directory, this function ignores new entries
 * when the range between the offset value of the latest existing entry and
 * the offset of the new entry is smaller than gp_blockdirectory_entry_min_range
 * (if it is set). Otherwise, the latest existing entry is updated with new
 * rowCount value, and the given new entry is appended to the in-memory minipage.
 *
 * If the block directory for the appendonly relation does not exist,
 * this function simply returns.
 *
 * If rowCount is 0, simple return false.
 */
bool
AppendOnlyBlockDirectory_InsertEntry(
	AppendOnlyBlockDirectory *blockDirectory,
	int columnGroupNo,
	int64 firstRowNum,
	int64 fileOffset,
	int64 rowCount)
{
	MinipagePerColumnGroup *minipageInfo =
		&blockDirectory->minipages[columnGroupNo];

	return insert_new_entry(blockDirectory, columnGroupNo, firstRowNum,
							fileOffset, rowCount, minipageInfo);
}
示例#5
0
/* If successful, return 0.  Otherwise, return -1 with errno set.     */
int atomic_log_printf(char *fmt, ...) {
   va_list ap;
   char ch;
   int len;
   list *new_entry;

   if (fd < 0) {
      errno = EINVAL;
      return -1;
   }
   va_start(ap, fmt);
   len = vsnprintf(&ch, 1, fmt, ap);
   new_entry = insert_new_entry(len, 1);
   if (new_entry == NULL)
      return -1;
   vsprintf(new_entry->entry, fmt, ap);
   return 0;
}
示例#6
0
static void AddDeviceRes_Pcm(DJ_S8 s8DspModID, Acs_Dev_List_Head_t *pAcsDevList)
{
  DJ_S32  s32Num; 
  int i;
  tagDEVICE *pdev = NULL;
  DeviceID_t *pdevice = NULL;
  list *new_entry;
    
  s32Num = pAcsDevList->m_s32DeviceNum;   
  pdev = (tagDEVICE *)malloc(sizeof(tagDEVICE)*s32Num);
  if (pdev == NULL)
  {
    if (ldebug_flag)
      printstr(NULL,"pdev malloc error\n");
    return;
  } 
  memset(pdev, 0, sizeof(tagDEVICE)*s32Num);
  if (ldebug_flag)
    printstr(NULL,"memset pdev 0 AddDeviceRes_Pcm\n");
    
  pdevice = (DeviceID_t *)((unsigned char *)pAcsDevList + sizeof(Acs_Dev_List_Head_t));
  if (pdevice != NULL)
  {
    if (ldebug_flag)
      printstr(NULL,"pdevice memory address=%d, s32Num=%d\n", pdevice, s32Num);
  }
  
  for(i = 0; i < s32Num; i++)
  {   
    if (ldebug_flag)
      printstr(NULL,"add pdev[%d].mdev(%d,%d) to pcm list\n", i, pdevice[i].m_s8ModuleID, pdevice[i].m_s16ChannelID);
    pdev[i].m_dev = pdevice[i];     
  }
  
  new_entry = insert_new_entry(s32Num, s8DspModID, &g_pPcmFirst, &g_pPcmLast);
  (void)memcpy(new_entry->entry, pdev, sizeof(tagDEVICE)*s32Num);

  free(pdev);
}
示例#7
0
static void AddDeviceRes_SS7Link(DJ_S8 s8DspModID, Acs_Dev_List_Head_t *pAcsDevList)
{ 
  DJ_S32 s32Num, ss7LinkNum, s32Type;
  int i;
  tagDEVICE *pdev = NULL;
  DeviceID_t *dev = NULL;
  s32Num = pAcsDevList->m_s32DeviceNum;
  list *new_entry; 
    
  pdev = (tagDEVICE *)malloc(sizeof(tagDEVICE)*s32Num);
  if (pdev == NULL)
  {
    if (ldebug_flag)
      printstr(NULL,"pdev malloc error\n");
    return;
  } 
  
  memset(pdev, 0, sizeof(tagDEVICE)*s32Num);
  ss7LinkNum = 0;
  dev = (DeviceID_t *)((unsigned char *)pAcsDevList + sizeof(Acs_Dev_List_Head_t));
  for(i = 0; i < s32Num; i++)
  {     
    s32Type = dev[i].m_s16DeviceSub;
    
    if (s32Type == XMS_DEVSUB_SS7_LINK)
    {
      if (ldebug_flag)
        printstr(NULL,"add pdev[%d].mdev(%d,%d) to ss7link list\n", i, dev[i].m_s8ModuleID, dev[i].m_s16ChannelID);
      pdev[ss7LinkNum].m_dev = dev[i];      
      ss7LinkNum++; 
    }
  }
          
  new_entry = insert_new_entry(ss7LinkNum, s8DspModID, &g_pLinkFirst, &g_pLinkLast);
  memcpy(new_entry->entry, pdev, sizeof(tagDEVICE)*ss7LinkNum);

  free(pdev);
}