1f08c3bdfSopenharmony_ci/* 2f08c3bdfSopenharmony_ci * memtoy: segment.h - memory segments interface 3f08c3bdfSopenharmony_ci */ 4f08c3bdfSopenharmony_ci/* 5f08c3bdfSopenharmony_ci * Copyright (c) 2005 Hewlett-Packard, Inc 6f08c3bdfSopenharmony_ci * All rights reserved. 7f08c3bdfSopenharmony_ci */ 8f08c3bdfSopenharmony_ci 9f08c3bdfSopenharmony_ci/* 10f08c3bdfSopenharmony_ci * This program is free software; you can redistribute it and/or modify 11f08c3bdfSopenharmony_ci * it under the terms of the GNU General Public License as published by 12f08c3bdfSopenharmony_ci * the Free Software Foundation; either version 2 of the License, or 13f08c3bdfSopenharmony_ci * (at your option) any later version. 14f08c3bdfSopenharmony_ci * 15f08c3bdfSopenharmony_ci * This program is distributed in the hope that it will be useful, 16f08c3bdfSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 17f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18f08c3bdfSopenharmony_ci * GNU General Public License for more details. 19f08c3bdfSopenharmony_ci * 20f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License 21f08c3bdfSopenharmony_ci * along with this program; if not, write to the Free Software 22f08c3bdfSopenharmony_ci * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23f08c3bdfSopenharmony_ci */ 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci#ifndef _MEMTOY_SEGMENT_H_ 26f08c3bdfSopenharmony_ci#define _MEMTOY_SEGMENT_H_ 27f08c3bdfSopenharmony_ci 28f08c3bdfSopenharmony_ci/* 29f08c3bdfSopenharmony_ci * a "memory segment" known to memtoy 30f08c3bdfSopenharmony_ci */ 31f08c3bdfSopenharmony_citypedef enum { 32f08c3bdfSopenharmony_ci SEGT_NONE=0, /* unused segment */ 33f08c3bdfSopenharmony_ci SEGT_ANON=1, /* anonymous -- MAP_ANON */ 34f08c3bdfSopenharmony_ci SEGT_FILE=2, 35f08c3bdfSopenharmony_ci SEGT_SHM=3, 36f08c3bdfSopenharmony_ci SEGT_NTYPES 37f08c3bdfSopenharmony_ci} seg_type_t; 38f08c3bdfSopenharmony_ci 39f08c3bdfSopenharmony_cistruct segment; 40f08c3bdfSopenharmony_citypedef struct segment segment_t; 41f08c3bdfSopenharmony_ci 42f08c3bdfSopenharmony_ci/* 43f08c3bdfSopenharmony_ci * range: optional (offset, length) arguments 44f08c3bdfSopenharmony_ci */ 45f08c3bdfSopenharmony_citypedef struct range { 46f08c3bdfSopenharmony_ci off_t offset; 47f08c3bdfSopenharmony_ci size_t length; 48f08c3bdfSopenharmony_ci} range_t; 49f08c3bdfSopenharmony_ci 50f08c3bdfSopenharmony_cistruct global_context; 51f08c3bdfSopenharmony_ci 52f08c3bdfSopenharmony_ciextern void segment_init(struct global_context *); 53f08c3bdfSopenharmony_ciextern void segment_cleanup(struct global_context *); 54f08c3bdfSopenharmony_ci 55f08c3bdfSopenharmony_ciextern int segment_register(seg_type_t, char*, range_t*, int); 56f08c3bdfSopenharmony_ciextern int segment_show(char*); 57f08c3bdfSopenharmony_ciextern int segment_remove(char*); 58f08c3bdfSopenharmony_ciextern int segment_map(char*, range_t*, int); 59f08c3bdfSopenharmony_ciextern int segment_unmap(char*); 60f08c3bdfSopenharmony_ciextern int segment_touch(char*, range_t*, int); 61f08c3bdfSopenharmony_ciextern int segment_mbind(char*, range_t*, int, nodemask_t*, int); 62f08c3bdfSopenharmony_ciextern int segment_location(char*, range_t*); 63f08c3bdfSopenharmony_ci 64f08c3bdfSopenharmony_ci#endif 65