Changeset 1090 for Whitix

Show
Ignore:
Timestamp:
10/05/08 00:00:39 (2 months ago)
Author:
mwhitworth
Message:

Write KeObjectDetach function (or beginning of).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/lib/keobject.c

    r1068 r1090  
    3535SYMBOL_EXPORT(KeObjectInit); 
    3636 
     37void KeObjectDetach(struct KeObject* object) 
     38{ 
     39        if (object->dir) 
     40                IcFsRemoveDir(object->dir); 
     41         
     42        if (object->parent) 
     43                ListRemove(&object->next); 
     44                 
     45        MemFree(object->name); 
     46} 
     47 
     48SYMBOL_EXPORT(KeObjectDetach); 
     49 
    3750void KeObjectFree(struct KeObject* object) 
    3851{ 
    39         KePrint("KeObjFree\n"); 
     52        if (object->refs < 0) 
     53        { 
     54                ThrArchPrintCurrStack(); 
     55                cli(); hlt(); 
     56        } 
     57         
     58        KeObjectDetach(object); 
    4059} 
    4160 
     
    104123        /* Create a directory in IcFs, using the object's parent directory as the 
    105124         * parent directory. 
    106          */  
     125         */ 
     126          
    107127         object->dir=IcFsCreateDir(KeObjGetParentDir(object), object->name); 
    108128          
     
    112132         /* Populate the configuration directory. */ 
    113133         KeObjectPopulate(object); 
    114                  
     134          
     135         /* FIXME: Move! */ 
    115136         /* Add the new object to the parent's list of KeObjects. */ 
    116137         KeSetAdd(object->parent, object); 
     
    144165        curr = NULL; 
    145166 
    146 out:     
     167out: 
    147168        SpinUnlock(&set->lock); 
    148169        return curr;