1 /* $Id$
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
8  */
9 #ifndef _ASM_IA64_SN_LABELCL_H
10 #define _ASM_IA64_SN_LABELCL_H
11 
12 #define LABELCL_MAGIC 0x4857434c	/* 'HWLC' */
13 #define LABEL_LENGTH_MAX 256		/* Includes NULL char */
14 #define INFO_DESC_PRIVATE (-1)      	/* default */
15 #define INFO_DESC_EXPORT  0       	/* export info itself */
16 
17 /*
18  * Internal Error codes.
19  */
20 typedef enum labelcl_error_e {  LABELCL_SUCCESS,          /* 0 */
21                                 LABELCL_DUP,              /* 1 */
22                                 LABELCL_NOT_FOUND,        /* 2 */
23                                 LABELCL_BAD_PARAM,        /* 3 */
24                                 LABELCL_HIT_LIMIT,        /* 4 */
25                                 LABELCL_CANNOT_ALLOC,     /* 5 */
26                                 LABELCL_ILLEGAL_REQUEST,  /* 6 */
27                                 LABELCL_IN_USE            /* 7 */
28                                 } labelcl_error_t;
29 
30 
31 /*
32  * Description of a label entry.
33  */
34 typedef struct label_info_s {
35         char			*name;
36         arb_info_desc_t		desc;
37         arbitrary_info_t	info;
38 } label_info_t;
39 
40 /*
41  * Definition of the data structure that provides the link to
42  * the hwgraph fastinfo and the label entries associated with a
43  * particular devfs entry.
44  */
45 typedef struct labelcl_info_s {
46 	unsigned long	hwcl_magic;
47 	unsigned long	num_labels;
48 	void		*label_list;
49 	arbitrary_info_t IDX_list[HWGRAPH_NUM_INDEX_INFO];
50 } labelcl_info_t;
51 
52 /*
53  * Definitions for the string table that holds the actual names
54  * of the labels.
55  */
56 struct string_table_item {
57         struct string_table_item        *next;
58         char                            string[1];
59 };
60 
61 struct string_table {
62         struct string_table_item        *string_table_head;
63         long                            string_table_generation;
64 };
65 
66 
67 #define STRTBL_BASIC_SIZE ((size_t)(((struct string_table_item *)0)->string))
68 #define STRTBL_ITEM_SIZE(str_length) (STRTBL_BASIC_SIZE + (str_length) + 1)
69 
70 #define STRTBL_ALLOC(str_length) \
71         ((struct string_table_item *)kmalloc(STRTBL_ITEM_SIZE(str_length), GFP_KERNEL))
72 
73 #define STRTBL_FREE(ptr) kfree(ptr)
74 
75 
76 extern labelcl_info_t *labelcl_info_create(void);
77 extern int labelcl_info_destroy(labelcl_info_t *);
78 extern int labelcl_info_add_LBL(vertex_hdl_t, char *, arb_info_desc_t, arbitrary_info_t);
79 extern int labelcl_info_remove_LBL(vertex_hdl_t, char *, arb_info_desc_t *, arbitrary_info_t *);
80 extern int labelcl_info_replace_LBL(vertex_hdl_t, char *, arb_info_desc_t,
81                         arbitrary_info_t, arb_info_desc_t *, arbitrary_info_t *);
82 extern int labelcl_info_get_LBL(vertex_hdl_t, char *, arb_info_desc_t *,
83                       arbitrary_info_t *);
84 extern int labelcl_info_get_next_LBL(vertex_hdl_t, char *, arb_info_desc_t *,
85                            arbitrary_info_t *, labelcl_info_place_t *);
86 extern int labelcl_info_replace_IDX(vertex_hdl_t, int, arbitrary_info_t,
87 			arbitrary_info_t *);
88 extern int labelcl_info_connectpt_set(vertex_hdl_t, vertex_hdl_t);
89 extern int labelcl_info_get_IDX(vertex_hdl_t, int, arbitrary_info_t *);
90 extern struct devfs_handle_t device_info_connectpt_get(vertex_hdl_t);
91 
92 #endif /* _ASM_IA64_SN_LABELCL_H */
93