labelcl.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:3k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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 Silicon Graphics, Inc.
  8.  * Copyright (C) 2000 by Colin Ngam
  9.  */
  10. #ifndef _ASM_SN_LABELCL_H
  11. #define _ASM_SN_LABELCL_H
  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.  * Internal Error codes.
  18.  */
  19. typedef enum labelcl_error_e {  LABELCL_SUCCESS,          /* 0 */
  20.                                 LABELCL_DUP,              /* 1 */
  21.                                 LABELCL_NOT_FOUND,        /* 2 */
  22.                                 LABELCL_BAD_PARAM,        /* 3 */
  23.                                 LABELCL_HIT_LIMIT,        /* 4 */
  24.                                 LABELCL_CANNOT_ALLOC,     /* 5 */
  25.                                 LABELCL_ILLEGAL_REQUEST,  /* 6 */
  26.                                 LABELCL_IN_USE            /* 7 */
  27.                                 } labelcl_error_t;
  28. /*
  29.  * Description of a label entry.
  30.  */
  31. typedef struct label_info_s {
  32.         char *name;
  33.         arb_info_desc_t desc;
  34.         arbitrary_info_t info;
  35. } label_info_t;
  36. /*
  37.  * Definition of the data structure that provides the link to 
  38.  * the hwgraph fastinfo and the label entries associated with a 
  39.  * particular devfs entry.
  40.  */
  41. typedef struct labelcl_info_s {
  42. unsigned long hwcl_magic;
  43. unsigned long num_labels;
  44. void *label_list;
  45. arbitrary_info_t IDX_list[HWGRAPH_NUM_INDEX_INFO];
  46. } labelcl_info_t;
  47. /*
  48.  * Definitions for the string table that holds the actual names 
  49.  * of the labels.
  50.  */
  51. struct string_table_item {
  52.         struct string_table_item        *next;
  53.         char                            string[1];
  54. };
  55. struct string_table {
  56.         struct string_table_item        *string_table_head;
  57.         long                            string_table_generation;
  58. };
  59. #define STRTBL_BASIC_SIZE ((size_t)(((struct string_table_item *)0)->string))
  60. #define STRTBL_ITEM_SIZE(str_length) (STRTBL_BASIC_SIZE + (str_length) + 1)
  61. #define STRTBL_ALLOC(str_length) 
  62.         ((struct string_table_item *)kmalloc(STRTBL_ITEM_SIZE(str_length), GFP_KERNEL))
  63. #define STRTBL_FREE(ptr) kfree(ptr)
  64. extern labelcl_info_t *labelcl_info_create(void);
  65. extern int labelcl_info_destroy(labelcl_info_t *);
  66. extern int labelcl_info_add_LBL(struct devfs_entry *, char *, arb_info_desc_t, arbitrary_info_t);
  67. extern int labelcl_info_remove_LBL(struct devfs_entry *, char *, arb_info_desc_t *, arbitrary_info_t *);
  68. extern int labelcl_info_replace_LBL(struct devfs_entry *, char *, arb_info_desc_t,
  69.                         arbitrary_info_t, arb_info_desc_t *, arbitrary_info_t *);
  70. extern int labelcl_info_get_LBL(struct devfs_entry *, char *, arb_info_desc_t *,
  71.                       arbitrary_info_t *);
  72. extern int labelcl_info_get_next_LBL(struct devfs_entry *, char *, arb_info_desc_t *,
  73.                            arbitrary_info_t *, labelcl_info_place_t *);
  74. extern int labelcl_info_replace_IDX(struct devfs_entry *, int, arbitrary_info_t, 
  75. arbitrary_info_t *);
  76. extern int labelcl_info_connectpt_set(struct devfs_entry *, struct devfs_entry *);
  77. extern int labelcl_info_get_IDX(struct devfs_entry *, int, arbitrary_info_t *);
  78. extern struct devfs_entry *device_info_connectpt_get(struct devfs_entry *);
  79. #endif /* _ASM_SN_LABELCL_H */