fixup_tdescs.c (178529) | fixup_tdescs.c (178546) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 38 unchanged lines hidden (view full) --- 47 * by file. The following two routines know how to recognize and repair foo_t * 48 * and foo_t ** bugs in a specific set of cases. There is no general way to 49 * solve this problem without a fix to the compiler. In general, cases should 50 * only be added to these routines to fix merging problems in genunix. 51 */ 52static void 53fix_ptrptr_to_struct(tdata_t *td) 54{ | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 38 unchanged lines hidden (view full) --- 47 * by file. The following two routines know how to recognize and repair foo_t * 48 * and foo_t ** bugs in a specific set of cases. There is no general way to 49 * solve this problem without a fix to the compiler. In general, cases should 50 * only be added to these routines to fix merging problems in genunix. 51 */ 52static void 53fix_ptrptr_to_struct(tdata_t *td) 54{ |
55 char *strs[2] = { "as", "fdbuffer" }; 56 char *mems[2] = { "a_objectdir", "fd_shadow" }; 57 char *acts[2] = { "vnode", "page" }; 58 char *tgts[2] = { "vnode_t", "page_t" }; | 55 const char *strs[2] = { "as", "fdbuffer" }; 56 const char *mems[2] = { "a_objectdir", "fd_shadow" }; 57 const char *acts[2] = { "vnode", "page" }; 58 const char *tgts[2] = { "vnode_t", "page_t" }; |
59 tdesc_t *str; 60 tdesc_t *act, *tgt; 61 tdesc_t *p1, *p2; 62 mlist_t *ml; 63 int i; 64 | 59 tdesc_t *str; 60 tdesc_t *act, *tgt; 61 tdesc_t *p1, *p2; 62 mlist_t *ml; 63 int i; 64 |
65 for (i = 0; i < sizeof (strs) / sizeof (strs[0]); i++) { | 65 for (i = 0; i < (int) (sizeof (strs) / sizeof (strs[0])); i++) { |
66 if (!(str = lookupname(strs[i])) || str->t_type != STRUCT) 67 continue; 68 69 for (ml = str->t_members; ml; ml = ml->ml_next) { 70 if (streq(ml->ml_name, mems[i])) 71 break; 72 } 73 if (!ml) --- 27 unchanged lines hidden (view full) --- 101 debug(3, "Fixed %s->%s => ptrptr struct %s bug\n", 102 strs[i], mems[i], acts[i]); 103 } 104} 105 106static void 107fix_ptr_to_struct(tdata_t *td) 108{ | 66 if (!(str = lookupname(strs[i])) || str->t_type != STRUCT) 67 continue; 68 69 for (ml = str->t_members; ml; ml = ml->ml_next) { 70 if (streq(ml->ml_name, mems[i])) 71 break; 72 } 73 if (!ml) --- 27 unchanged lines hidden (view full) --- 101 debug(3, "Fixed %s->%s => ptrptr struct %s bug\n", 102 strs[i], mems[i], acts[i]); 103 } 104} 105 106static void 107fix_ptr_to_struct(tdata_t *td) 108{ |
109 char *strs[2] = { "vmem", "id_space" }; 110 char *mems[2] = { NULL, "is_vmem" }; | 109 const char *strs[2] = { "vmem", "id_space" }; 110 const char *mems[2] = { NULL, "is_vmem" }; |
111 tdesc_t *ptr = NULL; 112 tdesc_t *str, *vmt; 113 mlist_t *ml; 114 int i; 115 116 if ((vmt = lookupname("vmem_t")) == NULL || vmt->t_type != TYPEDEF) 117 return; 118 | 111 tdesc_t *ptr = NULL; 112 tdesc_t *str, *vmt; 113 mlist_t *ml; 114 int i; 115 116 if ((vmt = lookupname("vmem_t")) == NULL || vmt->t_type != TYPEDEF) 117 return; 118 |
119 for (i = 0; i < sizeof (strs) / sizeof (strs[0]); i++) { | 119 for (i = 0; i < (int) (sizeof (strs) / sizeof (strs[0])); i++) { |
120 if (!(str = lookupname(strs[i])) || str->t_type != STRUCT) 121 continue; 122 123 for (ml = str->t_members; ml; ml = ml->ml_next) { 124 if (mems[i] && !streq(ml->ml_name, mems[i])) 125 continue; 126 127 if (ml->ml_type->t_type != POINTER || --- 30 unchanged lines hidden (view full) --- 158} 159 160struct match { 161 tdesc_t *m_ret; 162 const char *m_name; 163}; 164 165static int | 120 if (!(str = lookupname(strs[i])) || str->t_type != STRUCT) 121 continue; 122 123 for (ml = str->t_members; ml; ml = ml->ml_next) { 124 if (mems[i] && !streq(ml->ml_name, mems[i])) 125 continue; 126 127 if (ml->ml_type->t_type != POINTER || --- 30 unchanged lines hidden (view full) --- 158} 159 160struct match { 161 tdesc_t *m_ret; 162 const char *m_name; 163}; 164 165static int |
166matching_iidesc(iidesc_t *iidesc, struct match *match) | 166matching_iidesc(void *arg1, void *arg2) |
167{ | 167{ |
168 iidesc_t *iidesc = arg1; 169 struct match *match = arg2; |
|
168 if (!streq(iidesc->ii_name, match->m_name)) 169 return (0); 170 171 if (iidesc->ii_type != II_TYPE && iidesc->ii_type != II_SOU) 172 return (0); 173 174 match->m_ret = iidesc->ii_dtype; 175 return (-1); 176} 177 178static tdesc_t * | 170 if (!streq(iidesc->ii_name, match->m_name)) 171 return (0); 172 173 if (iidesc->ii_type != II_TYPE && iidesc->ii_type != II_SOU) 174 return (0); 175 176 match->m_ret = iidesc->ii_dtype; 177 return (-1); 178} 179 180static tdesc_t * |
179lookup_tdesc(tdata_t *td, const char *name) | 181lookup_tdesc(tdata_t *td, char const *name) |
180{ 181 struct match match = { NULL, name }; | 182{ 183 struct match match = { NULL, name }; |
182 iter_iidescs_by_name(td, name, (int (*)())matching_iidesc, &match); | 184 iter_iidescs_by_name(td, name, matching_iidesc, &match); |
183 return (match.m_ret); 184} 185 186/* 187 * The cpu structure grows, with the addition of a machcpu member, if 188 * _MACHDEP is defined. This means that, for example, the cpu structure 189 * in unix is different from the cpu structure in genunix. As one might 190 * expect, this causes merges to fail. Since everyone indirectly contains --- 87 unchanged lines hidden --- | 185 return (match.m_ret); 186} 187 188/* 189 * The cpu structure grows, with the addition of a machcpu member, if 190 * _MACHDEP is defined. This means that, for example, the cpu structure 191 * in unix is different from the cpu structure in genunix. As one might 192 * expect, this causes merges to fail. Since everyone indirectly contains --- 87 unchanged lines hidden --- |