Exemplo n.º 1
0
/* Get fid from Posix Path (path2fid wrapper) */
int Lustre_GetFidFromPath( const char *fullpath, entry_id_t * p_id )
{
    int            rc;
    rc = llapi_path2fid( fullpath, p_id );

    if ( (rc != 0) && (rc != -ENOENT) && (rc != -ESTALE) )
        DisplayLog( LVL_DEBUG, "Path2Fid", "llapi_path2fid(%s)=%d, seq=%llx,"
                    " oid=%x, ver=%x",
                    fullpath, rc, p_id->f_seq, p_id->f_oid, p_id->f_ver );

    return rc;
}
Exemplo n.º 2
0
void test3(void)
{
	int rc;
	struct llapi_layout *layout;
	struct lu_fid fid;
	char fidstr[4096];
	char path[PATH_MAX];

	snprintf(path, sizeof(path), "%s/%s", lustre_dir, T0FILE);

	rc = llapi_path2fid(path, &fid);
	ASSERTF(rc == 0, "rc = %d, errno = %d", rc, errno);
	snprintf(fidstr, sizeof(fidstr), "0x%"PRIx64":0x%x:0x%x",
		 (uint64_t)fid.f_seq, fid.f_oid, fid.f_ver);
	errno = 0;
	layout = llapi_layout_get_by_fid(path, &fid, 0);
	ASSERTF(layout != NULL, "fidstr = %s, errno = %d", fidstr, errno);

	__test1_helper(layout);
	llapi_layout_free(layout);
}
Exemplo n.º 3
0
/**
 * Get the handle for a path (posix or fid path)
 */
fsal_status_t fsal_internal_Path2Handle(fsal_op_context_t * p_context,    /* IN */
                                        fsal_path_t * p_fsalpath,       /* IN */
                                        fsal_handle_t *handle /* OUT */ )
{
  int rc;
  struct stat ino;
  lustre_fid fid;
  lustrefsal_handle_t * p_handle = (lustrefsal_handle_t *)handle;

  if(!p_context || !p_handle || !p_fsalpath)
    ReturnCode(ERR_FSAL_FAULT, 0);

  memset(p_handle, 0, sizeof(lustrefsal_handle_t));

  LogFullDebug(COMPONENT_FSAL, "Lookup handle for %s", p_fsalpath->path);

  rc = llapi_path2fid(p_fsalpath->path, &fid);

  LogFullDebug(COMPONENT_FSAL, "llapi_path2fid(%s): status=%d, fid=" DFID_NOBRACE,
                  p_fsalpath->path, rc, PFID(&fid));

  if(rc)
    ReturnCode(posix2fsal_error(-rc), -rc);

  p_handle->data.fid = fid;

  /* retrieve inode */
  rc = lstat(p_fsalpath->path, &ino);

  if(rc)
    LogFullDebug(COMPONENT_FSAL, "lstat(%s)=%d, errno=%d", p_fsalpath->path, rc,
                    errno);
  if(rc)
    ReturnCode(posix2fsal_error(errno), errno);

  p_handle->data.inode = ino.st_ino;

  ReturnCode(ERR_FSAL_NO_ERROR, 0);
}