1. work around the 32-bit assumptions of the Dentry structure in a way that preserves existing kfs images, and also lets them work on 64-bit machines. it's not nice, but a proper fix is going to be quite extensive. 2. fid is 32-bits in 9p2000, and using a short has caused strange crashes in long-running, and heavily used kfses. Notes: Sun Feb 23 01:35:16 EST 2014 geoff kfs is obsolete. Reference: /n/sources/patch/sorry/kfs-64-bit-fix Date: Mon Oct 21 06:43:33 CES 2013 Signed-off-by: quanstro@quanstro.net Reviewed-by: geoff --- /sys/src/cmd/disk/kfs/portdat.h Mon Oct 21 06:40:03 2013 +++ /sys/src/cmd/disk/kfs/portdat.h Mon Oct 21 06:40:01 2013 @@ -39,7 +39,16 @@ long version; }; +/* + * oh rats! this structure deeply assumes a 32-bit machine. + * to make this work for 64-bit, without breaking old kfs + * images, some dirty tricks are necessary. first we have to + * pack the structure, but that packs too well, the short + * "badplanning" fills in the traditional hole. + */ + /* DONT TOUCH, this is the disk structure */ +#pragma pack on struct Dentry { char name[NAMELEN]; @@ -53,6 +62,7 @@ #define DREAD 0x4 #define DWRITE 0x2 #define DEXEC 0x1 + short badplanning; Qid9p1 qid; long size; long dblock[NDBLOCK]; @@ -61,6 +71,7 @@ long atime; long mtime; }; +#pragma pack off /* DONT TOUCH, this is the disk structure */ struct Tag @@ -150,7 +161,7 @@ long addr; long slot; long lastra; /* read ahead address */ - short fid; + ulong fid; short uid; char open; #define FREAD 1