ref: ddd9dca27120f88ef25139ec9fee2cf59af32db8
parent: 6388170f199f4ec4a2b9005c0f6cf8c15c4efab0
author: Michael Forney <[email protected]>
date: Tue Mar 1 16:26:35 EST 2022
pack: use nil name to pack directory scan prefix
--- a/fs.c
+++ b/fs.c
@@ -1214,8 +1214,7 @@
if((s = mallocz(sizeof(Scan), 1)) == nil)
return Enomem;
- pfx[0] = Kent;
- PBIT64(pfx+1, f->qpath);
+ packdkey(pfx, sizeof(pfx), f->qpath, nil);
if((e = btscan(f->mnt->root, s, pfx, sizeof(pfx))) != nil)
goto Out;
done = 0;
@@ -1403,8 +1402,7 @@
if((s = mallocz(sizeof(Scan), 1)) == nil)
return Enomem;
- pfx[0] = Kent;
- PBIT64(pfx+1, f->qpath);
+ packdkey(pfx, sizeof(pfx), f->qpath, nil);
if((e = btscan(f->mnt->root, s, pfx, sizeof(pfx))) != nil){
btdone(s);
free(s);
--- a/pack.c
+++ b/pack.c
@@ -159,7 +159,8 @@
ep = p + sz;
p = pack8(&err, p, ep, Kent);
p = pack64(&err, p, ep, up);
- p = packstr(&err, p, ep, name);
+ if(name != nil)
+ p = packstr(&err, p, ep, name);
if(err)
return nil;
return p;