Show
Ignore:
Timestamp:
10/03/08 12:11:36 (3 months ago)
Author:
mwhitworth
Message:

Add to device layer, add class functions, add start of bus type, add to sdevice impl.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/devices/kedev/device.c

    r978 r1055  
    1717 */ 
    1818 
    19 #include <device.h> 
     19#include <devices/device.h> 
     20#include <fs/devfs.h> 
    2021#include <keobject.h> 
     22#include <module.h> 
    2123 
    2224/* Set up the structure. */ 
    23 int KeDeviceInit(struct KeDevice* device, struct KeSet* type, DevId devId, void* devPriv) 
     25int KeDeviceInit(struct KeDevice* device, struct KeSet* type, DevId devId, 
     26        void* devPriv, int devType) 
    2427{ 
    2528        KeObjectInit(&device->object, type); 
     
    2730        device->devId = devId; 
    2831        device->devPriv = devPriv; 
     32        device->type = devType; 
    2933         
    3034        return 0; 
    3135} 
    3236 
     37SYMBOL_EXPORT(KeDeviceInit); 
     38 
     39int KeDeviceVaAttach(struct KeDevice* device, const char* name, VaList args) 
     40{ 
     41        int err; 
     42         
     43        err = KeObjectVaAttach(&device->object, name, args); 
     44         
     45        if (err) 
     46                return err; 
     47                 
     48        /* Now add the device in the device filesystem. */ 
     49        return DevFsAddDevice(device, KeObjGetName(&device->object));    
     50} 
     51 
     52SYMBOL_EXPORT(KeDeviceVaAttach); 
     53 
    3354int KeDeviceAttach(struct KeDevice* device, const char* name, ...) 
    3455{ 
    3556        int err; 
     57        VaList args; 
    3658         
    3759        /* Bind the KeObject to the filesystem first. This creates a directory 
     
    3961         */ 
    4062          
    41         err = KeObjectAttach(&device->object, name); 
     63        VaStart(args, name); 
    4264         
    43         if (err) 
    44                 return err; 
    45                  
    46         /* Now add the device in the device filesystem. */ 
    47         return DevFsAddDevice(device, name); 
     65        err = KeDeviceVaAttach(device, name, args); 
     66         
     67        VaEnd(args); 
     68         
     69        return err; 
    4870} 
     71 
     72SYMBOL_EXPORT(KeDeviceAttach);