Example #1
0
int compare_nlm_client(state_nlm_client_t *pclient1,
                       state_nlm_client_t *pclient2)
{
  if(isFullDebug(COMPONENT_STATE) && isDebug(COMPONENT_HASHTABLE))
    {
      char str1[HASHTABLE_DISPLAY_STRLEN];
      char str2[HASHTABLE_DISPLAY_STRLEN];

      display_nlm_client(pclient1, str1);
      display_nlm_client(pclient2, str2);
      LogFullDebug(COMPONENT_STATE,
                   "{%s} vs {%s}", str1, str2);
    }

  if(pclient1 == NULL || pclient2 == NULL)
    return 1;

  if(pclient1 == pclient2)
    return 0;

  if(compare_nsm_client(pclient1->slc_nsm_client, pclient2->slc_nsm_client) != 0)
    return 1;

  if(pclient1->slc_client_type != pclient2->slc_client_type)
    return 1;

  if(pclient1->slc_nlm_caller_name_len != pclient2->slc_nlm_caller_name_len)
    return 1;

  return memcmp(pclient1->slc_nlm_caller_name,
                pclient2->slc_nlm_caller_name,
                pclient1->slc_nlm_caller_name_len);
}
Example #2
0
/**
 * @brief Compare NLM clients
 *
 * @param[in] client1 A client
 * @param[in] client2 Another client
 *
 * @retval 0 on equality.
 * @retval 1 on inequality.
 */
int compare_nlm_client(state_nlm_client_t *client1,
		       state_nlm_client_t *client2)
{
	if (isFullDebug(COMPONENT_STATE) && isDebug(COMPONENT_HASHTABLE)) {
		char str1[LOG_BUFF_LEN / 2];
		char str2[LOG_BUFF_LEN / 2];
		struct display_buffer dspbuf1 = {sizeof(str1), str1, str1};
		struct display_buffer dspbuf2 = {sizeof(str2), str2, str2};

		display_nlm_client(&dspbuf1, client1);
		display_nlm_client(&dspbuf2, client2);
		LogFullDebug(COMPONENT_STATE, "{%s} vs {%s}", str1, str2);
	}

	if (client1 == NULL || client2 == NULL)
		return 1;

	if (client1 == client2)
		return 0;

	if (compare_nsm_client(client1->slc_nsm_client, client2->slc_nsm_client)
	    != 0)
		return 1;

	if (cmp_sockaddr(&client1->slc_server_addr,
			 &client2->slc_server_addr,
			 true) == 0)
		return 1;

	if (client1->slc_client_type != client2->slc_client_type)
		return 1;

	if (client1->slc_nlm_caller_name_len !=
	    client2->slc_nlm_caller_name_len)
		return 1;

	return memcmp(client1->slc_nlm_caller_name,
		      client2->slc_nlm_caller_name,
		      client1->slc_nlm_caller_name_len);
}
Example #3
0
int compare_nsm_client_key(hash_buffer_t * buff1, hash_buffer_t * buff2)
{
  return compare_nsm_client((state_nsm_client_t *)buff1->pdata,
                            (state_nsm_client_t *)buff2->pdata);

}                               /* compare_nsm_client */
Example #4
0
/**
 * @brief Compare NSM clients in the hash table
 *
 * @param[in] buff1 A key
 * @param[in] buff2 Another key
 *
 * @retval 0 on equality.
 * @retval 1 on inequality.
 */
int compare_nsm_client_key(struct gsh_buffdesc *buff1,
			   struct gsh_buffdesc *buff2)
{
	return compare_nsm_client(buff1->addr, buff2->addr);

}