drgn/libdrgn/linux_kernel_object_find.inc.strswitch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
Plaintext
Raw Normal View History

// Copyright (c) Meta Platforms, Inc. and affiliates.
// SPDX-License-Identifier: LGPL-2.1-or-later
struct drgn_error *linux_kernel_object_find(const char *name, size_t name_len,
const char *filename,
enum drgn_find_object_flags flags,
void *arg, struct drgn_object *ret)
{
struct drgn_program *prog = arg;
if (!filename) {
@memswitch (name, name_len)@
@case "PAGE_SHIFT"@
if (flags & DRGN_FIND_OBJECT_CONSTANT)
return linux_kernel_get_page_shift(prog, ret);
break;
@case "PAGE_SIZE"@
if (flags & DRGN_FIND_OBJECT_CONSTANT)
return linux_kernel_get_page_size(prog, ret);
break;
@case "PAGE_MASK"@
if (flags & DRGN_FIND_OBJECT_CONSTANT)
return linux_kernel_get_page_mask(prog, ret);
break;
@case "UTS_RELEASE"@
if (flags & DRGN_FIND_OBJECT_CONSTANT)
return linux_kernel_get_uts_release(prog, ret);
break;
@case "jiffies"@
if (flags & DRGN_FIND_OBJECT_VARIABLE)
return linux_kernel_get_jiffies(prog, ret);
break;
@case "vmemmap"@
if (flags & DRGN_FIND_OBJECT_CONSTANT)
return linux_kernel_get_vmemmap(prog, ret);
break;
@endswitch@
}
return &drgn_not_found;
}