Skip to content

Commit

Permalink
Randomize inode numbers if they are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly _Vi Shukela committed Jan 5, 2011
1 parent bc9f53a commit 09300ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
9 changes: 6 additions & 3 deletions storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 09300ec

Please sign in to comment.