libsmbios_c library
|
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 #ifndef C_OBJ_MEMORY_H 00019 #define C_OBJ_MEMORY_H 00020 00021 // include smbios_c/compat.h first 00022 #include "smbios_c/compat.h" 00023 #include "smbios_c/types.h" 00024 00025 EXTERN_C_BEGIN; 00026 00027 #define MEMORY_DEFAULTS 0x0000 00028 #define MEMORY_GET_SINGLETON 0x0001 00029 #define MEMORY_GET_NEW 0x0002 00030 #define MEMORY_UNIT_TEST_MODE 0x0004 00031 #define MEMORY_NO_ERR_CLEAR 0x0008 00032 00033 struct memory_access_obj; 00034 00035 // construct 00036 LIBSMBIOS_C_DLL_SPEC struct memory_access_obj *memory_obj_factory(int flags, ...); 00037 00038 // destruct 00039 LIBSMBIOS_C_DLL_SPEC void memory_obj_free(struct memory_access_obj *); 00040 00041 LIBSMBIOS_C_DLL_SPEC int memory_obj_read(const struct memory_access_obj *, void *buffer, u64 offset, size_t length); 00042 LIBSMBIOS_C_DLL_SPEC int memory_obj_write(const struct memory_access_obj *, void *buffer, u64 offset, size_t length); 00043 00044 // format error string 00045 LIBSMBIOS_C_DLL_SPEC const char *memory_obj_strerror(const struct memory_access_obj *m); 00046 00047 // helper 00048 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); 00049 00050 // Following calls must be properly nested in equal pairs 00051 LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_leave_open(struct memory_access_obj *); 00052 LIBSMBIOS_C_DLL_SPEC void memory_obj_suggest_close(struct memory_access_obj *); 00053 00054 // ask if close flag is set 00055 LIBSMBIOS_C_DLL_SPEC bool memory_obj_should_close(const struct memory_access_obj *); 00056 00057 EXTERN_C_END; 00058 00059 #endif /* MEMORY_H */