/* Definitions for global (but not static) attributes
 *
 * To use this file, provide a definition for the ATTR() macro:
 *
 *   ATTR(dir, key, id, type, ctype)
 *
 * @param dir    Directory identifier (without the dir_ prefix).
 * @param key    Key name (a constant C string).
 * @param id     C identifier.
 * @param type   Attribute type (kdump_attr_type).
 * @param ctype  Suggested C type for the attribute.
 *
 * The variadic argument can be used to pass additional @c attr_template
 * initialization.
 *
 * A typical stanza is:
 * #define ATTR(dir, key, field, type, ctype, ...) \
 *   // use macro arguments to construct whatever you need
 * #include "global-attr.def"
 * #undef ATTR
 */

/* base hierarchy */
ATTR(root, "", dir_root, directory, struct attr_data *)
ATTR(root, "arch", dir_arch, directory, struct attr_data *)
ATTR(root, "cache", dir_cache, directory, struct attr_data *)
ATTR(root, "cpu", dir_cpu, directory, struct attr_data *)
ATTR(root, "file", dir_file, directory, struct attr_data *)
ATTR(root, "memory", dir_memory, directory, struct attr_data *)

/* arch */
ATTR(arch, "pteval_size", pteval_size, number, size_t)

/* address translation */
ATTR(root, "addrxlat", dir_addrxlat, directory, struct attr_data *)
ATTR(addrxlat, "default", dir_xlat_default, directory, struct attr_data *)
ATTR(addrxlat, "force", dir_xlat_force, directory, struct attr_data *)
ATTR(addrxlat, "ostype", ostype, string, const char *, .ops = &ostype_ops)

/* cache */
ATTR(cache, "size", cache_size, number, unsigned, .ops = &cache_size_ops)
ATTR(cache, "hits", cache_hits, number, unsigned long)
ATTR(cache, "misses", cache_misses, number, unsigned long)

/* format name */
ATTR(file, "format", file_format, string, const char *)
ATTR(file, "description", file_description, string, const char *)

/* file-level cache statistics */
ATTR(file, "mmap_cache", dir_file_mmap_cache, directory, struct attr_data *)
ATTR(file_mmap_cache, "hits", mmap_cache_hits, number, unsigned long)
ATTR(file_mmap_cache, "misses", mmap_cache_misses, number, unsigned long)
ATTR(file, "read_cache", dir_file_read_cache, directory, struct attr_data *)
ATTR(file_read_cache, "hits", read_cache_hits, number, unsigned long)
ATTR(file_read_cache, "misses", read_cache_misses, number, unsigned long)

/* file descriptor set */
ATTR(file, "set", dir_file_set, directory, struct attr_data *)

/* dump file descriptor (for compatibility) */
ATTR(file, "fd", file_fd, number, int, .ops = &file_fd_ops)

/* mmap policy */
ATTR(file, "mmap_policy", file_mmap_policy, number, kdump_mmap_policy_t)

/* Linux */
ATTR(root, "linux", dir_linux, directory, struct attr_data *)
ATTR(linux, "version_code", linux_version_code, number, unsigned,
	.ops = &linux_version_code_ops)

/* utsname */
ATTR(linux, "uts", dir_linux_uts, directory, struct attr_data *)
ATTR(linux_uts, "sysname", linux_uts_sysname, string, const char *)
ATTR(linux_uts, "nodename", linux_uts_nodename, string, const char *)
ATTR(linux_uts, "release", linux_uts_release, string, const char *,
	.ops = &linux_ver_ops)
ATTR(linux_uts, "version", linux_uts_version, string, const char *)
ATTR(linux_uts, "machine", linux_uts_machine, string, const char *,
     .ops = &uts_machine_ops)
ATTR(linux_uts, "domainname", linux_uts_domainname, string, const char *)

/* Linux vmcoreinfo */
ATTR(linux, "vmcoreinfo", dir_linux_vmcoreinfo, directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "lines", linux_vmcoreinfo_lines,
     directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "raw", linux_vmcoreinfo_raw, blob, kdump_blob_t *,
	.ops = &vmcoreinfo_raw_ops)
ATTR(linux_vmcoreinfo, "LENGTH", linux_length, directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "NUMBER", linux_number, directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "OFFSET", linux_offset, directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "SIZE", linux_size, directory, struct attr_data *)
ATTR(linux_vmcoreinfo, "SYMBOL", linux_symbol, directory, struct attr_data *)

/* memory page map */
ATTR(memory, "pagemap", memory_pagemap, bitmap, kdump_bmp_t *)

/* Xen */
ATTR(root, "xen", dir_xen, directory, struct attr_data *)
ATTR(xen, "p2m_mfn", xen_p2m_mfn, address, kdump_pfn_t, .ops = &dirty_xlat_ops)
ATTR(xen, "phys_start", xen_phys_start, address, kdump_paddr, .ops = &xen_dirty_xlat_ops)
ATTR(xen, "version", dir_xen_version, directory, struct attr_data *)
ATTR(xen_version, "major", xen_ver_major, number, unsigned long,
	.ops = &xen_ver_ops)
ATTR(xen_version, "minor", xen_ver_minor, number, unsigned long,
	.ops = &xen_ver_ops)
ATTR(xen_version, "extra", xen_ver_extra, string, const char *)
ATTR(xen_version, "extra_addr", xen_ver_extra_addr, address, kdump_vaddr_t)
ATTR(xen, "version_code", xen_version_code, number, unsigned,
	.ops = &xen_version_code_ops)

/* Xen vmcoreinfo */
ATTR(xen, "vmcoreinfo", dir_xen_vmcoreinfo, directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "lines", xen_vmcoreinfo_lines,
     directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "raw", xen_vmcoreinfo_raw, blob, kdump_addr_t *,
	.ops = &vmcoreinfo_raw_ops)
ATTR(xen_vmcoreinfo, "LENGTH", xen_length, directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "NUMBER", xen_number, directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "OFFSET", xen_offset, directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "SIZE", xen_size, directory, struct attr_data *)
ATTR(xen_vmcoreinfo, "SYMBOL", xen_symbol, directory, struct attr_data *)
