Changeset 2024 for Whitix

Show
Ignore:
Timestamp:
04/02/09 21:26:47 (3 years ago)
Author:
mwhitworth
Message:

Move readFunc and writeFunc to entry.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/fs/icfs/info.c

    r1943 r2024  
    2828        DWORD copied; 
    2929         
    30         copied=MIN(size-*position, (DWORD)strlen(iEnt->sVal)-*position); 
    31          
    32         memcpy(data, iEnt->sVal+*position, copied); 
     30        copied=MIN(size-*position, (DWORD)strlen(*iEnt->sVal)-*position); 
     31         
     32        memcpy(data, (*iEnt->sVal)+*position, copied); 
    3333         
    3434        *position+=copied; 
     
    5454        int ret; 
    5555 
    56         if (iEnt->readFunc == NULL) 
     56        if (iEnt->entry.readFunc == NULL) 
    5757                return -EPERM; 
    5858 
    59         ret = iEnt->readFunc(data, size, *position); 
     59        ret = iEnt->entry.readFunc(data, size, *position); 
    6060 
    6161        if (ret >= 0) 
     
    140140SYMBOL_EXPORT(IcFsAddIntEntry); 
    141141 
    142 struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, char* name, char* str, DWORD permissions) 
     142struct IcFsEntry* IcFsAddStrEntry(struct KeFsEntry* dir, char* name, char** str, DWORD permissions) 
    143143{ 
    144144        struct KeFsEntry* entry; 
     
    203203        newEnt = IcEntryAlloc(); 
    204204        newEnt->type = ICFS_TYPE_FUNC; 
    205         newEnt->readFunc = readFunc; 
    206         newEnt->writeFunc = writeFunc; 
     205        newEnt->entry.readFunc = readFunc; 
     206        newEnt->entry.writeFunc = writeFunc; 
    207207         
    208208        entry->file = newEnt; 
     
    247247 
    248248/* Process an array of IC attributes and add them to a particular directory. */ 
    249 int IcAddAttributes(struct KeObject* object, struct IcAttribute* attributes) 
     249int IcAddAttributes(struct KeObject* object, struct IcAttribute* attributes, int objOffset) 
    250250{ 
    251251        char* base; 
    252         int objOffset; 
    253          
    254         if (!object->parent || !object->parent->type || !object->dir) 
     252                 
     253        if (!object->parent || !object->dir) 
    255254                return -EFAULT; 
    256                  
    257         objOffset = object->parent->type->offset; 
    258                  
    259         if (objOffset < 0) 
    260         { 
    261                 KePrint(KERN_DEBUG "icfs: invalid object offset in type.\n"); 
    262                 return -EFAULT; 
    263         } 
    264          
    265         base = ((char*)object - objOffset); 
     255         
     256        base = ((char*)object) - objOffset; 
    266257         
    267258        /* Go through the array and register each element.*/ 
     
    284275                                 
    285276                        case ICFS_TYPE_STR: 
    286                                 IcFsAddStrEntry(object->dir, attributes->name, *(char**)(base+attributes->offset), 
    287                                         permissions); 
     277                        { 
     278                                char** p = (char**)(base+attributes->offset); 
     279                                IcFsAddStrEntry(object->dir, attributes->name, p, permissions); 
     280                                break; 
     281                        } 
     282                                 
     283                        case ICFS_TYPE_FUNC: 
     284                                IcFsAddFuncEntry(object->dir, attributes->name, attributes->readFunc, 
     285                                        attributes->writeFunc); 
    288286                                break; 
    289287