History

fix reads of big directories

Benjamin Scher Purcell committed 11 years ago

Commit 03e5da91 parent c45ff902 files · +11 −5Browse files

Unified · Split

2 files
  1. 9p.c +9 −4
  2. 9pfs.c +2 −1
9p.c+9−4
@@ -431,15 +431,20 @@ int · 430 unmodified lines
431_9pdirread(int fd, FFid *f, Dir **d)431_9pdirread(int fd, FFid *f, Dir **d)
432{432{
433 FDir *fdir;433 FDir *fdir;
434 uchar buf[DIRMAX];434 uchar buf[DIRMAX], *b;
435 u32int ts, n;435 u32int ts, n;
436 436
437 dprint("_9pdirread\n");437 dprint("_9pdirread\n");
438 n = f->iounit;438 n = f->iounit;
439 ts = _9pread(fd, f, buf, n);439 b = buf;
440 if(ts <= 0)440 while((ts = _9pread(fd, f, b, n)) > 0){
441 b += ts;
442 if(b - buf > DIRMAX - n)
443 break;
444 }
445 if(ts < 0)
441 return ts;446 return ts;
442 ts = dirpackage(buf, ts, d);447 ts = dirpackage(buf, b - buf, d);
443 dprint("_9pdirread about to lookupdir with path %s\n", f->path);448 dprint("_9pdirread about to lookupdir with path %s\n", f->path);
444 if((fdir = lookupdir(f->path, PUT)) != NULL){449 if((fdir = lookupdir(f->path, PUT)) != NULL){
445 fdir->dirs = *d;450 fdir->dirs = *d;
9pfs.c+2−1
@@ -330,7 +330,8 @@ fsreaddir(const char *path, void *data, fuse_fill_dir_t ffd, · 329 unmodified lines
330 330
331 ffd(data, ".", NULL, 0);331 ffd(data, ".", NULL, 0);
332 ffd(data, "..", NULL, 0);332 ffd(data, "..", NULL, 0);
333 n = _9pdirread(srvfd, (FFid*)ffi->fh, &d);333 if((n = _9pdirread(srvfd, (FFid*)ffi->fh, &d)) < 0)
334 return -EIO;
334 dprint("fsreaddir returned from _9pdirread ndirs is %d\n", n);335 dprint("fsreaddir returned from _9pdirread ndirs is %d\n", n);
335 for(e = d; e < d + n; e++){336 for(e = d; e < d + n; e++){
336 s.st_ino = e->qid.path;337 s.st_ino = e->qid.path;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t