> Has anyone gone to the trouble of putting together a perl-based interface
> to the various cache manager calls? I'm currently performing several
> operatios by parsing the output of "fs" commands, but I'd much rather
> use a direct interface.
You can do a lot of cache manager stuff through perl's syscall()
interface; here's a small test script (probably pmax_ul43a specific):
#!/usr/local/bin/perl
$AFS_SYSCALL = 31;
$AFSCALL_PIOCTL = 20;
$AFSCALL_SETPAG = 21;
$VIOCGETAL = 0x800c5602;
$VIOCGETVOLSTAT = 0x800c5604;
$buf=pack("C2048", 0);
$vio=pack("ppss", 0, $buf, 0, 2048);
$dir="/afs/wam.umd.edu/common";
# setpag
system('tokens');
syscall($AFS_SYSCALL, $AFSCALL_SETPAG);
system('tokens');
# fs la
!syscall($AFS_SYSCALL, $AFSCALL_PIOCTL, $dir, $VIOCGETAL, $vio, 1) || die
"getacl: $!";
print "\n\nACL:\n$buf";
# volinfo
!syscall($AFS_SYSCALL, $AFSCALL_PIOCTL, $dir, $VIOCGETVOLSTAT, $vio, 1) || die
"volinfo: $!";
($min, $max, $used, $vol) = (unpack("l2 c4 l6 a*", $buf))[7,8,9,12];
print "\nvol $vol, min_quota $min, max_quota $max, used $used\n";
I was going to write a perl package for this, but never got around to
it. I just use raw syscalls whenever I want to do perl AFS stuff.
You will have to find all the magic pioctl numbers for your particular
system type. If I remember, h2ph didn't like the afs header files, so
just compile a small program that prints them out.
My origional project was to write a lean, mean, directory tree
traverser / acl munger. Perl was great for the acl hacking, but
I couldn't find a way to get the inode numbers from readdir() to
do the odd/even trick, so I gave up and wrote it in C.
-Karl Reuss