Lines Matching defs:instance
55 struct hw_instance *instance)
57 hw_abort (hw, "no instance finish method");
72 struct hw_instance **instance = &me->instances;
73 while (*instance != NULL)
75 struct hw_instance *old_instance = *instance;
77 instance = &me->instances;
84 hw_instance_delete (struct hw_instance *instance)
87 hw_abort (hw_instance_hw (instance), "not implemented");
89 struct hw *me = hw_instance_hw (instance);
90 if (instance->to_instance_delete == NULL)
92 instance->method->delete (instance);
93 if (instance->args != NULL)
94 free (instance->args);
95 if (instance->path != NULL)
96 free (instance->path);
97 if (instance->child == NULL)
101 while (*curr != instance)
106 *curr = instance->next;
110 /* check it isn't in the instance list */
114 ASSERT (curr != instance);
118 ASSERT (instance->child->parent == instance);
119 instance->child->parent = NULL;
121 cap_remove (me->ihandles, instance);
122 free (instance);
128 panic_hw_instance_read (struct hw_instance *instance,
132 hw_abort (hw_instance_hw (instance), "no read method");
139 panic_hw_instance_write (struct hw_instance *instance,
143 hw_abort (hw_instance_hw (instance), "no write method");
149 panic_hw_instance_seek (struct hw_instance *instance,
153 hw_abort (hw_instance_hw (instance), "no seek method");
159 hw_instance_call_method (struct hw_instance *instance,
167 hw_abort (hw_instance_hw (instance), "not implemented");
170 struct hw *me = instance->owner;
171 const hw_instance_methods *method = instance->method->methods;
180 return method->method (instance,
192 #define set_hw_instance_read(instance, method)\
193 ((instance)->to_instance_read = (method))
195 #define set_hw_instance_write(instance, method)\
196 ((instance)->to_instance_write = (method))
198 #define set_hw_instance_seek(instance, method)\
199 ((instance)->to_instance_seek = (method))
220 struct hw_instance *instance = ZALLOC (struct hw_instance);
221 /*instance->unit*/
222 /* link this instance into the devices list */
223 instance->hw_of_instance = me;
224 instance->parent_of_instance = NULL;
225 /* link this instance into the front of the devices instance list */
226 instance->sibling_of_instance = me->instances_of_hw->instances;
227 me->instances_of_hw->instances = instance;
231 parent->child_of_instance = instance;
232 instance->parent_of_instance = parent;
234 instance->args_of_instance = hw_strdup (me, args);
235 instance->path_of_instance = hw_strdup (me, path);
236 set_hw_instance_read (instance, panic_hw_instance_read);
237 set_hw_instance_write (instance, panic_hw_instance_write);
238 set_hw_instance_seek (instance, panic_hw_instance_seek);
239 hw_handle_add_ihandle (me, instance);
240 me->instances_of_hw->to_finish (me, instance);
241 return instance;
253 struct hw_instance *instance = ZALLOC (struct hw_instance);
254 /*instance->unit*/
255 /* link this instance into the devices list */
259 instance->hw_of_instance = me;
260 instance->parent_of_instance = NULL;
261 /* link this instance into the front of the devices instance list */
262 instance->sibling_of_instance = me->instances_of_hw->instances;
263 me->instances_of_hw->instances = instance;
269 parent->child_of_instance = instance;
270 instance->owner = parent->owner;
271 instance->parent_of_instance = parent;
272 /* in the devices instance list replace the parent instance with
274 instance->next = parent->next;
276 previous = &instance->owner->instances;
282 *previous = instance;
284 instance->data = data;
285 instance->args = (args == NULL ? NULL : (char *) strdup (args));
286 instance->path = (path == NULL ? NULL : (char *) strdup (path));
287 cap_add (instance->owner->ihandles, instance);
288 return instance;