History

devfs-posix: use stat->st_dev<<32 | stat->st_ino for qid.path

cinap_lenrek committed 10 years ago

Commit 0a8a66a1 parent 47ee1001 file · +6 −22Browse files

Unified · Split

kern/devfs-posix.c+6−22
@@ -40,7 +40,7 @@ struct Ufsinfo · 39 unmodified lines
4040
4141 char *base = "/";
4242
43−static Qid fsqid(char*, struct stat *);
43+static Qid fsqid(struct stat *);
4444 static void fspath(Chan*, char*, char*);
4545 static ulong fsdirread(Chan*, uchar*, int, ulong);
4646 static int fsomode(int);
@@ -130,7 +130,7 @@ fswalk1(Chan *c, char *name) · 83 unmodified lines
130130 uif->uid = stbuf.st_uid;
131131 uif->gid = stbuf.st_gid;
132132
133− c->qid = fsqid(path, &stbuf);
133+ c->qid = fsqid(&stbuf);
134134
135135 return 1;
136136 }
@@ -302,7 +302,7 @@ fscreate(Chan *c, char *name, int mode, ulong perm) · 165 unmodified lines
302302
303303 if(stat(path, &stbuf) < 0)
304304 error(strerror(errno));
305− c->qid = fsqid(path, &stbuf);
305+ c->qid = fsqid(&stbuf);
306306 c->offset = 0;
307307 c->flag |= COPEN;
308308 c->mode = openmode(mode);
@@ -458,31 +458,15 @@ fswstat(Chan *c, uchar *buf, int n) · 149 unmodified lines
458458 }
459459
460460 static Qid
461−fsqid(char *p, struct stat *st)
461+fsqid(struct stat *st)
462462 {
463463 Qid q;
464− int dev;
465− ulong h;
466− static int nqdev;
467− static uchar *qdev;
468−
469− if(qdev == 0)
470− qdev = mallocz(65536U, 1);
471464
472465 q.type = 0;
473466 if((st->st_mode&S_IFMT) == S_IFDIR)
474467 q.type = QTDIR;
475468
476− dev = st->st_dev & 0xFFFFUL;
477− if(qdev[dev] == 0)
478− qdev[dev] = ++nqdev;
479−
480− h = 0;
481− while(*p != '\0')
482− h += *p++ * 13;
483−
484− q.path = (vlong)qdev[dev]<<32;
485− q.path |= h;
469+ q.path = (uvlong)st->st_dev<<32 | st->st_ino;
486470 q.vers = st->st_mtime;
487471
488472 return q;
@@ -579,7 +563,7 @@ fsdirread(Chan *c, uchar *va, int count, ulong offset) · 90 unmodified lines
579563 d.uid = "unknown";
580564 d.gid = "unknown";
581565 d.muid = "unknown";
582− d.qid = fsqid(path, &stbuf);
566+ d.qid = fsqid(&stbuf);
583567 d.mode = (d.qid.type<<24)|(stbuf.st_mode&0777);
584568 d.atime = stbuf.st_atime;
585569 d.mtime = stbuf.st_mtime;

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