libsmbios_c library
memory.h
Go to the documentation of this file.
1// vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2/*
3 * Copyright (C) 2005 Dell Inc.
4 * by Michael Brown <Michael_E_Brown@dell.com>
5 * Licensed under the Open Software License version 2.1
6 *
7 * Alternatively, you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License,
10 * or (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 */
17
18#ifndef C_OBJ_MEMORY_H
19#define C_OBJ_MEMORY_H
20
21// include smbios_c/compat.h first
22#include "smbios_c/compat.h"
23#include "smbios_c/types.h"
24
26
27#define MEMORY_DEFAULTS 0x0000
28#define MEMORY_GET_SINGLETON 0x0001
29#define MEMORY_GET_NEW 0x0002
30#define MEMORY_UNIT_TEST_MODE 0x0004
31#define MEMORY_NO_ERR_CLEAR 0x0008
32
33struct memory_access_obj;
34
35// construct
36LIBSMBIOS_C_DLL_SPEC struct memory_access_obj *memory_obj_factory(int flags, ...);
37
38// destruct
39LIBSMBIOS_C_DLL_SPEC void memory_obj_free(struct memory_access_obj *);
40
41LIBSMBIOS_C_DLL_SPEC int memory_obj_read(const struct memory_access_obj *, void *buffer, u64 offset, size_t length);
42LIBSMBIOS_C_DLL_SPEC int memory_obj_write(const struct memory_access_obj *, void *buffer, u64 offset, size_t length);
43
44// format error string
45LIBSMBIOS_C_DLL_SPEC const char *memory_obj_strerror(const struct memory_access_obj *m);
46
47// helper
48LIBSMBIOS_C_DLL_SPEC s64 memory_obj_search(const struct memory_access_obj *, const char *pat, size_t patlen, u64 start, u64 end, u64 stride);
49
50// Following calls must be properly nested in equal pairs
51LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_leave_open(struct memory_access_obj *);
52LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_close(struct memory_access_obj *);
53
54// ask if close flag is set
55LIBSMBIOS_C_DLL_SPEC bool memory_obj_should_close(const struct memory_access_obj *);
56
58
59#endif /* MEMORY_H */
#define LIBSMBIOS_C_DLL_SPEC
Definition compat.h:48
#define EXTERN_C_BEGIN
Definition compat.h:55
#define EXTERN_C_END
Definition compat.h:56
LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_leave_open(struct memory_access_obj *)
LIBSMBIOS_C_DLL_SPEC void memory_obj_free(struct memory_access_obj *)
LIBSMBIOS_C_DLL_SPEC bool memory_obj_should_close(const struct memory_access_obj *)
LIBSMBIOS_C_DLL_SPEC const char * memory_obj_strerror(const struct memory_access_obj *m)
LIBSMBIOS_C_DLL_SPEC s64 memory_obj_search(const struct memory_access_obj *, const char *pat, size_t patlen, u64 start, u64 end, u64 stride)
LIBSMBIOS_C_DLL_SPEC int memory_obj_read(const struct memory_access_obj *, void *buffer, u64 offset, size_t length)
LIBSMBIOS_C_DLL_SPEC int memory_obj_write(const struct memory_access_obj *, void *buffer, u64 offset, size_t length)
LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_close(struct memory_access_obj *)
LIBSMBIOS_C_DLL_SPEC struct memory_access_obj * memory_obj_factory(int flags,...)