Permalink
Browse files

Randomize inode numbers if they are missing

  • Loading branch information...
1 parent bc9f53a commit 09300eccb68c978b9d6c99c7a1fbf98b6f982a4d Vitaly _Vi Shukela committed Jan 5, 2011
Showing with 7 additions and 4 deletions.
  1. +1 −1 Makefile
  2. +6 −3 storage.c
View
@@ -1,5 +1,5 @@
ccgfs-storage.exe: *.c *.h
- i586-mingw32msvc-gcc packet.c xl.c xl_errno.c storage.c -o ccgfs-storage.exe -lws2_32
+ i586-mingw32msvc-gcc packet.c xl.c xl_errno.c storage.c -o ccgfs-storage.exe -lws2_32 -liberty
ccgfs-storage: *.c *.h
gcc -g3 packet.c xl.c xl_errno.c storage.c -o ccgfs-storage
View
@@ -117,8 +117,12 @@ static struct lo_packet *getattr_copy_stor(const struct stat *sb)
unsigned long long int fake_st_blksize=1024;
unsigned long long int fake_st_blocks=sb->st_size/1024+1;
+ long long int ino = sb->st_ino;
+ if(ino==0) {
+ ino = random() + 1;
+ }
- pkt_push_64(rp, sb->st_ino);
+ pkt_push_64(rp, ino);
pkt_push_32(rp, sb->st_mode);
pkt_push_32(rp, sb->st_nlink);
pkt_push_32(rp, sb->st_uid);
@@ -348,8 +352,7 @@ static int localfs_readdir(int fd, struct lo_packet *rq)
PV_64 + PV_32 + PV_STRING);
long long int d_ino = dentry->d_ino;
if(d_ino==0) {
- /* hack */
- d_ino = 1;
+ d_ino = random() + 1;
}
pkt_push_64(rp, d_ino);
pkt_push_32(rp, 0);

0 comments on commit 09300ec

Please sign in to comment.