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