libsysprof-analyze: add scaffolding for translate API

This commit is contained in:
Christian Hergert
2023-05-18 15:44:20 -07:00
parent 978bfc5680
commit 685f9e8bab
2 changed files with 27 additions and 2 deletions

View File

@ -39,7 +39,5 @@ void sysprof_mount_namespace_add_mount (SysprofMountNamespa
SysprofMount *mount);
char **sysprof_mount_namespace_translate (SysprofMountNamespace *self,
const char *path);
GMappedFile *sysprof_mount_namespace_open (SysprofMountNamespace *self,
const char *path);
G_END_DECLS

View File

@ -146,3 +146,30 @@ sysprof_mount_namespace_add_mount (SysprofMountNamespace *self,
g_ptr_array_add (self->mounts, mount);
}
/**
* sysprof_mount_namespace_translate:
* @self: a #SysprofMountNamespace
* @file: the path within the mount namespace to translate
*
* Attempts to translate a path within the mount namespace into a
* path available in our current mount namespace.
*
* As overlays are involved, multiple paths may be returned which
* could contain the target file. You should check these starting
* from the first element in the resulting array to the last.
*
* Returns: (transfer full) (nullable): a UTF-8 encoded string array
* if successful; otherwise %NULL and @error is set.
*/
char **
sysprof_mount_namespace_translate (SysprofMountNamespace *self,
const char *file)
{
g_return_val_if_fail (SYSPROF_IS_MOUNT_NAMESPACE (self), NULL);
g_return_val_if_fail (file != NULL, NULL);
/* TODO: */
return NULL;
}