예제 #1
0
int display_nfs4_owner(state_owner_t *powner, char *str)
{
  char         * strtmp = str;

  strtmp += sprintf(strtmp, "%s %p:",
                    state_owner_type_to_str(powner->so_type),
                    powner);

  strtmp += sprintf(strtmp, " clientid={%"PRIx64"} owner=",
                    powner->so_owner.so_nfs4_owner.so_clientid);

  strtmp += DisplayOpaqueValue(powner->so_owner_val,
                               powner->so_owner_len,
                               strtmp);

  strtmp += sprintf(strtmp, " confirmed=%u counter=%u seqid=%u refcount=%d",
                    powner->so_owner.so_nfs4_owner.so_confirmed,
                    powner->so_owner.so_nfs4_owner.so_counter,
                    powner->so_owner.so_nfs4_owner.so_seqid,
                    powner->so_refcount);

  if(powner->so_owner.so_nfs4_owner.so_related_owner != NULL)
    {
      strtmp += sprintf(strtmp, " related_owner={");
      strtmp += display_nfs4_owner(powner->so_owner.so_nfs4_owner.so_related_owner, strtmp);
      strtmp += sprintf(strtmp, "}");
    }

  return strtmp - str;
}
예제 #2
0
/**
 * @brief Display NFSv4 owner
 *
 * @param[in]  owner The state owner
 * @param[out] str   Output string
 *
 * @return The length of the output string.
 */
int display_nfs4_owner(state_owner_t *owner, char *str)
{
  char *strtmp = str;

  strtmp += sprintf(strtmp, "%s %p:",
                    state_owner_type_to_str(owner->so_type),
                    owner);

  strtmp += sprintf(strtmp, " clientid={");
  strtmp += display_client_id_rec(owner->so_owner.so_nfs4_owner.so_clientrec, strtmp);
  strtmp += sprintf(strtmp, "} owner=");

  strtmp += DisplayOpaqueValue(owner->so_owner_val,
                               owner->so_owner_len,
                               strtmp);

  strtmp += sprintf(strtmp, " confirmed=%u seqid=%u",
                    owner->so_owner.so_nfs4_owner.so_confirmed,
                    owner->so_owner.so_nfs4_owner.so_seqid);

  if(owner->so_owner.so_nfs4_owner.so_related_owner != NULL)
    {
      strtmp += sprintf(strtmp, " related_owner={");
      strtmp += display_nfs4_owner(owner->so_owner.so_nfs4_owner.so_related_owner, strtmp);
      strtmp += sprintf(strtmp, "}");
    }

  strtmp += sprintf(strtmp, " refcount=%d",
                    atomic_fetch_int32_t(&owner->so_refcount));

  return strtmp - str;
}
예제 #3
0
int display_nfs4_owner(state_owner_t *powner, char *str)
{
  char strtmp[NFS4_OPAQUE_LIMIT * 2 + 1];
  unsigned int i = 0;

  for(i = 0; i < powner->so_owner_len; i++)
    sprintf(&(strtmp[i * 2]),
            "%02x",
            (unsigned char)powner->so_owner_val[i]);

  return sprintf(str, 
                 "%s %p: clientid=%llu owner=(%u:%s) confirmed=%u counter=%u seqid=%u refcount=%d",
                 state_owner_type_to_str(powner->so_type),
                 powner,
                 (unsigned long long)powner->so_owner.so_nfs4_owner.so_clientid,
                 powner->so_owner_len, strtmp,
                 powner->so_owner.so_nfs4_owner.so_confirmed,
                 powner->so_owner.so_nfs4_owner.so_counter,
                 powner->so_owner.so_nfs4_owner.so_seqid,
                 powner->so_refcount);
}
예제 #4
0
/**
 * @brief Display NFSv4 owner
 *
 * @param[in]  owner The state owner
 * @param[out] str   Output string
 *
 * @return the bytes remaining in the buffer.
 */
int display_nfs4_owner(struct display_buffer *dspbuf, state_owner_t *owner)
{
	int b_left;

	if (owner == NULL)
		return display_cat(dspbuf, "<NULL>");

	b_left = display_printf(dspbuf,  "%s %p:",
				state_owner_type_to_str(owner->so_type),
				owner);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, " clientid={");

	if (b_left <= 0)
		return b_left;

	b_left = display_client_id_rec(dspbuf, owner->so_owner.so_nfs4_owner
						.so_clientrec);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, "} owner=");

	if (b_left <= 0)
		return b_left;

	b_left = display_opaque_value(dspbuf,
				      owner->so_owner_val,
				      owner->so_owner_len);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, " confirmed=%u seqid=%u",
		    owner->so_owner.so_nfs4_owner.so_confirmed,
		    owner->so_owner.so_nfs4_owner.so_seqid);

	if (b_left <= 0)
		return b_left;

	if (owner->so_owner.so_nfs4_owner.so_related_owner != NULL) {
		b_left = display_printf(dspbuf, " related_owner={");

		if (b_left <= 0)
			return b_left;

		b_left =
		    display_nfs4_owner(dspbuf, owner->so_owner
					       .so_nfs4_owner.so_related_owner);

		if (b_left <= 0)
			return b_left;

		b_left = display_printf(dspbuf, "}");

		if (b_left <= 0)
			return b_left;
	}

	return display_printf(dspbuf, " refcount=%d",
		    atomic_fetch_int32_t(&owner->so_refcount));
}
예제 #5
0
/**
 * @brief Display NFSv4 owner
 *
 * @param[in]  owner The state owner
 * @param[out] str   Output string
 *
 * @return the bytes remaining in the buffer.
 */
int display_nfs4_owner(struct display_buffer *dspbuf, state_owner_t *owner)
{
	int b_left;
	time_t texpire;
	struct state_nfs4_owner_t *nfs4_owner = &owner->so_owner.so_nfs4_owner;

	if (owner == NULL)
		return display_cat(dspbuf, "<NULL>");

	b_left = display_printf(dspbuf,  "%s %p:",
				state_owner_type_to_str(owner->so_type),
				owner);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, " clientid={");

	if (b_left <= 0)
		return b_left;

	b_left = display_client_id_rec(dspbuf, nfs4_owner->so_clientrec);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, "} owner=");

	if (b_left <= 0)
		return b_left;

	b_left = display_opaque_value(dspbuf,
				      owner->so_owner_val,
				      owner->so_owner_len);

	if (b_left <= 0)
		return b_left;

	b_left = display_printf(dspbuf, " confirmed=%u seqid=%u",
				nfs4_owner->so_confirmed,
				nfs4_owner->so_seqid);

	if (b_left <= 0)
		return b_left;

	if (nfs4_owner->so_related_owner != NULL) {
		b_left = display_printf(dspbuf, " related_owner={");

		if (b_left <= 0)
			return b_left;

		b_left =
		    display_nfs4_owner(dspbuf, nfs4_owner->so_related_owner);

		if (b_left <= 0)
			return b_left;

		b_left = display_printf(dspbuf, "}");

		if (b_left <= 0)
			return b_left;
	}

	texpire = atomic_fetch_time_t(&nfs4_owner->so_cache_expire);

	if (texpire != 0) {
		b_left = display_printf(dspbuf,
					" cached(expires in %d secs)",
					texpire - time(NULL));

		if (b_left <= 0)
			return b_left;
	}

	return display_printf(dspbuf, " refcount=%d",
		    atomic_fetch_int32_t(&owner->so_refcount));
}