space for device specific storage in FILE struct is now allocated in __alloc_handle
int ret = 0;
int tmp_addrlen = 0x1c;
int fd, dev;
- __handle *handle;
u32 *cmdbuf = getThreadCommandBuffer();
u8 tmpaddr[0x1c];
u32 saved_threadstorage[2];
return -1;
}
- fd = __alloc_handle(sizeof(__handle) + sizeof(Handle));
- if(fd < 0) {
- errno = ENOMEM;
- return -1;
- }
-
- handle = __get_handle(fd);
- handle->device = dev;
- handle->fileStruct = ((void *)handle) + sizeof(__handle);
+ fd = __alloc_handle(dev);
+ if(fd < 0) return fd;
memset(tmpaddr, 0, 0x1c);
return -1;
}
else
+ {
+ __handle *handle = __get_handle(fd);
*(Handle*)handle->fileStruct = ret;
+ }
return fd;
}
return -1;
}
- fd = __alloc_handle(sizeof(__handle) + sizeof(Handle));
- if(fd < 0) {
- errno = ENOMEM;
- return -1;
- }
+ fd = __alloc_handle(dev);
+ if(fd < 0) return fd;
handle = __get_handle(fd);
handle->device = dev;