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/sdevice.c

    r1033 r1055  
    1717 */ 
    1818 
    19 #include <sdevice.h> 
     19#include <devices/class.h> 
     20#include <devices/sdevice.h> 
    2021#include <module.h> 
    2122#include <llist.h> 
     
    2930#include <print.h> 
    3031#include <fs/config.h> 
     32#include <fs/devfs.h> 
    3133 
    3234LIST_HEAD(sDeviceList); 
     
    3537 
    3638struct KeSubsystem storage; 
    37 struct KeSet storageSet; 
     39struct DevClass storageClass; 
    3840 
    3941int StorageDeviceInit(struct StorageDevice* dev, DevId devId) 
     
    4143        dev->softBlockSize=dev->blockSize;       
    4244         
    43         return KeDeviceInit(&dev->device, &storageSet, devId, dev); 
     45        return KeDeviceInit(&dev->device, &storageClass.set, devId, dev, DEVICE_BLOCK); 
    4446} 
    4547 
     
    6264int StorageDeviceAdd(struct StorageDevice* dev, const char* name, ...) 
    6365{ 
    64         struct KeObject* object; 
    65          
    66         object=KeSetFind(&storageSet, name); 
    67          
    68         if (object) 
    69                 return -EEXIST; 
    70  
    71 #if 0 
    72         if (dev->name) 
    73         { 
    74                 char buf[255]; 
    75                  
    76                 name=(char*)MemAlloc(strlen(dev->name)+1); 
    77                 strcpy(name,dev->name); 
    78                 dev->name=name; 
    79                  
    80                 /* Add to the storage directory, along with a list of basic attributes. */ 
    81                 sprintf(buf, "Devices/%s", dev->name); 
    82                  
     66        int err; 
     67        VaList args; 
     68         
     69#if 0    
    8370                ConfigDir* dir=ConfigCreateDir(NULL, buf); 
    8471                 
     
    9077#endif 
    9178 
     79        /* General storage device setup. */ 
    9280        BlockCreateHashTable(dev); 
    93          
    9481        StorageQueueInit(dev); 
    95  
    96         return KeDeviceAttach(&dev->device, name); 
     82         
     83        VaStart(args, name); 
     84        err = KeDeviceVaAttach(&dev->device, name, args); 
     85        VaEnd(args); 
     86         
     87        return err; 
    9788} 
    9889 
     
    10192int StorageSetCreate(struct KeSet* set, struct KeObjType* type, const char* name) 
    10293{ 
    103         return KeSetCreate(set, &storageSet, type, name); 
     94        return KeSetCreate(set, &storageClass.set, type, name); 
    10495} 
    10596 
     
    154145/* 
    155146 * Always hold a spinlock when dealing with the list, because an irq can alter the list 
    156  * at the end of it's request, causing havoc with ListEmpty etc. 
     147 * at the end of its request, causing havoc with ListEmpty etc. 
    157148 */ 
    158149 
     
    247238        root = StorageParseCommandLine(commandLine); 
    248239         
    249         object = KeSetFind(&storageSet, root); 
     240        object = KeSetFind(&storageClass.set, root); 
    250241         
    251242        if (!object) 
     
    259250int StorageInit() 
    260251{ 
    261         return KeSetCreate(&storageSet, NULL, NULL, "Storage"); 
    262 } 
     252        return DevClassCreate(&storageClass, NULL, "Storage"); 
     253}