3 # Make VNODE structure from INODE structure
5 # Created By: Derek Atkins <warlord@MIT.EDU>
8 $linux_header_dir="/usr/src/linux";
9 $outdir="./src/afs/LINUX";
11 $sepline="/* LINUX VNODE INCLUDED BELOW -- DO NOT MODIFY */\n";
13 # makeVfs (fs.h, vfs.hin, vfs.out)
15 my ($in,$base,$out) = @_;
18 open (IN, "$in") || die "Cannot open $in for reading";
19 open (BASE, "$base" ) || die "Cannot open base file $base";
20 open (OUT, ">$out") || die "Cannot open tempfile $out";
30 print OUT $sepline if !$seplinefound;
35 # Look for 'struct inode' definition
37 next unless m/^struct\s+inode\s*\{/;
43 # Look for 'union {' -- print otherwise
45 if (m/^\s*union\s*\{/) {
47 print OUT "#ifdef notdef\n";
53 # Look for the end of the union -- ignore otherwise
56 next unless (m/^\s+\}\s*u;/);
58 print OUT "#endif /* notdef */\n";
62 # Look for end brace -- print until we find it
65 if (m/^\s*\};/) { $state++ }
69 while (<BASE>) { print OUT; }
77 print "usage: $0 [-i linux_header_dir] [-o output_dir] [-h]\n";
83 return $arg if ($arg && $arg ne "");
87 while ($_ = shift @ARGV) {
88 if (m/^-i/) { $linux_header_dir = testArg(shift @ARGV); next; }
89 if (m/^-o/) { $outdir = testArg(shift @ARGV); next; }
93 $linux_fs_h="$linux_header_dir/include/linux/fs.h";
94 $vfs_h="$outdir/osi_vfs.h";
95 $vfs_hin="$outdir/osi_vfs.hin";
97 makeVfs ($linux_fs_h, $vfs_hin, "$vfs_h.new");
99 system ("cmp", "-s", $vfs_h, "$vfs_h.new");
100 $exit_value = $? >> 8;
101 $signal_num = $? & 127;
102 $core_dump = $? & 128;
104 if ($exit_value == 0 || $signal_num > 0) {
106 print "nothing to do... $vfs_h not changed.\n"
109 rename ("$vfs_h.new", $vfs_h);
110 print "wrote $vfs_h\n";