예제 #1
0
파일: wrapper.c 프로젝트: AllardJ/Tomato
int getdents64(int fd, struct dirent64 *external, unsigned int count)
{
        check_init("getdents64");
	if (smbw_fd(fd)) {
                int i;
                struct SMBW_dirent *internal;
                int ret;
                int n;
                
                /*
                 * LIMITATION: If they pass a count which is not a multiple of
                 * the size of struct dirent, they will not get a partial
                 * structure; we ignore the excess count.
                 */
                n = (count / sizeof(struct dirent64));
                
                internal = malloc(sizeof(struct SMBW_dirent) * n);
                if (internal == NULL) {
                        errno = ENOMEM;
                        return -1;
                }
		ret = smbw_getdents(fd, internal, count);
                if (ret <= 0)
                        return ret;
                
                ret = sizeof(struct dirent) * count;
                
                for (i = 0; count; i++, count--)
                        dirent64_convert(&internal[i], &external[i]);
                
                return ret;
	}
        
        return (* smbw_libc.getdents64)(fd, external, count);
}
예제 #2
0
파일: wrapped.c 프로젝트: hynnet/ralink_sdk
void *readdir64(void *dir)
{
    if (smbw_dirp(dir)) {
        static double xx[70];
        void *d;
        d = (void *)readdir(dir);
        if (!d) return NULL;
        dirent64_convert(d, xx);
        return xx;
    }
    return (void *)real_readdir64(dir);
}
예제 #3
0
파일: wrapper.c 프로젝트: AllardJ/Tomato
int readdir64_r(DIR *dir, struct dirent64 *external, struct dirent64 **result)
{
        check_init("readdir64_r");
        
	if (smbw_dirp(dir)) {
                struct SMBW_dirent internal;
                int ret = smbw_readdir_r(dir, &internal, NULL);
                if (ret == 0) {
                        dirent64_convert(&internal, external);
                        *result = external;
                }
		return ret;
	}
        
        return (* smbw_libc.readdir64_r)(dir, external, result);
}
예제 #4
0
파일: wrapper.c 프로젝트: AllardJ/Tomato
struct dirent64 *readdir64(DIR *dir)
{
        check_init("readdir64");
        
	if (smbw_dirp(dir)) {
                static struct dirent64 external;
                struct SMBW_dirent * internal = (void *)smbw_readdir(dir);
                if (internal != NULL) {
                        dirent64_convert(internal, &external);
                        return &external;
                }
                return NULL;
	}
        
        return (* smbw_libc.readdir64)(dir);
}