Writing Device Drivers

gld_register() Function

int gld_register(dev_info_t * dip, char * name, gld_mac_info_t * macinfo);

gld_register() is called from the device driver's attach(9E) routine and is used to link the GLD-based device driver with the GLD framework. Before calling gld_register(), the device driver's attach(9E) routine must first use gld_mac_alloc() to allocate a gld_mac_info(9S) structure, and initialize several of its structure elements. See gld_mac_info(9S) for more information. A successful call to gld_register() performs the following actions:

The device interface name passed to gld_register() must exactly match the name of the driver module as it exists in the file system.

The driver's attach(9E) routine should return DDI_SUCCESS if gld_register() succeeds. If gld_register() does not return DDI_SUCCESS, the attach(9E) routine should deallocate any resources it allocated before calling gld_register(), and then return DDI_FAILURE.