OS Manuals

llapi_fid_parse(3)

llapi_fid_parse - parse ASCII FID string into binary lu_fid

LLAPI_FID_PARSE(3) Lustre Library Functions LLAPI_FID_PARSE(3)

llapi_fid_parse - parse ASCII FID string into binary lu_fid

#include <lustre/lustreapi.h>
int llapi_fid_parse(const char *fidstr, struct lu_fid *fid,
                    char **endptr);

llapi_fid_parse() converts an ASCII FID string into a binary struct lu_fid for use in other interfaces such as llapi_layout_get_by_fid(). fidstr should contain three numbers in the form fid_seq:fid_oid:fid_ver and may optionally be enclosed in square braces []. It will skip any leading whitespace before the FID.

If endptr is not NULL, llapi_fid_parse() stores the address of the first invalid character in *endptr, or the character immediately following the end of the parsed FID.

llapi_fid_parse() returns:

0
on success,
<0
a negative errno on failure and sets errno.

fidstr is NULL or does not contain a valid FID format.
fidstr contains numeric values that exceed valid values for a component.

#include <lustre/lustreapi.h>
int main(int argc, char *argv[])
{

char fidstr = "[0x200000004:0x2:0x0] [0x200000400:0x345:0x0]";
struct lu_fid fid1, fid2;
char *end;
int rc;
fidstr = argv[1];
rc = llapi_fid_parse(fidstr, &fid1, &end);
if (rc < 0) {
fprintf(stderr, "invalid first FID '%s': %s\n",
fidstr, strerror(-rc));
return -1;
}
fidstr = end;
rc = llapi_fid_parse(fidstr, &fid2, &end);
if (rc < 0) {
fprintf(stderr, "invalid second FID '%s': %s\n",
fidstr, strerror(-rc));
return -1;
}
printf("fid1=" DFID " fid2="DFID"\n", PFID(&fid1), PFID(&fid2));
return 0; }

llapi_fid_parse() is part of the lustre(7) user application interface library since release 2.14.0

llapi_path2parent(3), lustre(7), lustreapi(7)

2024-08-23 Lustre User API

lustre 2.17.60-r0 · enterprise-packages · ingested 2026-10-22