1 /* Part of libvboxfs - (c) 2012, D.C. van Moolenbroek */
6 * Store a local path name in the given path object, performing any necessary
7 * conversions. The path object is expected to be used read-only, so the size
8 * of the path object is set as small as possible. If 'name' is NULL, the path
9 * will be initialized to the empty string.
12 vboxfs_set_path(vboxfs_path_t
*path
, char *name
)
18 /* FIXME: missing UTF-8 conversion */
20 if (len
>= sizeof(path
->data
))
23 strcpy(path
->data
, name
);
32 * Retrieve the path name from the given path object. Make sure the name fits
33 * in the given name buffer first. The given size must include room for a
34 * terminating null character.
37 vboxfs_get_path(vboxfs_path_t
*path
, char *name
, size_t size
)
40 /* FIXME: missing UTF-8 conversion */
42 if (path
->len
>= size
)
45 assert(path
->data
[path
->len
] == 0);
47 strcpy(name
, path
->data
);
53 * Return the byte size of a previously initialized path object.
56 vboxfs_get_path_size(vboxfs_path_t
*path
)
59 return offsetof(vboxfs_path_t
, data
) + path
->size
;