master
forever-learner 2 years ago
parent 5c511e5d91
commit 8e2f60b4e7

@ -110,14 +110,14 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
struct linux_dirent *initmp,*temp;
char *foruse;
if(!(temp=(struct linux_dirent *)malloc(count+64)))
return NULL;
return -1;
initmp=temp;
int size=sizeof(long)+sizeof(off_t)+sizeof(unsigned short);
if (!(block = filenode->i_zone[0]))
return NULL;
return -1;
if (!(bh = bread(filenode->i_dev,block)))
return NULL;
return -1;
de = (struct dir_entry *) bh->b_data;
entries=filenode->i_size/(sizeof(struct dir_entry));
i=0;
@ -132,13 +132,13 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
i += DIR_ENTRIES_PER_BLOCK;
continue;
}
pos+=((struct dir_entry *) bh->b_data-(de-1))*sizdir;
pos+=((char*) bh->b_data-(char*)(de-1));
de = (struct dir_entry *) bh->b_data;
}
temp->d_ino=de->inode;
temp->d_off=pos;
strcpy(temp->d_name,de->name);
temp->d_reclen=size+sizeof(de->name);
temp->d_reclen=size+strlen(de->name)+1;
nread+=temp->d_reclen;
foruse=(char*)temp;
foruse+=temp->d_reclen;
@ -151,7 +151,7 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
{
errno=ERANGE;
return -1;
}
}//printk("%d",nread);
i=nread;
char *p1=dirp;
char *p2=initmp;

Binary file not shown.
Loading…
Cancel
Save