Index: trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13261)
+++ trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13269)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.38 2007-05-04 23:36:46 jhoblitt Exp $
+# $Id: Server.pm,v 1.39 2007-05-05 01:41:29 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -208,11 +208,11 @@
     my $filename = $key;
     # mange '/'s into ':'
-    $key =~ s|/|:|g;
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
@@ -361,10 +361,13 @@
     }
 
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    my $filename = $key;
+    # mange '/'s into ':'
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
Index: trunk/Nebulous/lib/Nebulous/Util.pm
===================================================================
--- trunk/Nebulous/lib/Nebulous/Util.pm	(revision 13261)
+++ trunk/Nebulous/lib/Nebulous/Util.pm	(revision 13269)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Util.pm,v 1.4 2007-04-23 20:45:08 jhoblitt Exp $
+# $Id: Util.pm,v 1.5 2007-05-05 01:41:29 jhoblitt Exp $
 
 package Nebulous::Util;
@@ -12,7 +12,8 @@
 use base qw( Exporter );
 
+use File::ExtAttr qw( setfattr );
 use Log::Log4perl qw( :levels );
+use URI::file;
 use URI;
-use URI::file;
 
 my @symbols = qw(
@@ -79,24 +80,23 @@
 }
 
-sub _create_empty_file {
-    my $path = shift;
+sub _create_empty_file
+{
+    my ($path, $key) = @_;
 
     # perl's open() can't do an O_CREAT | O_EXCL
-    if ( -e $path ) {
-        die "file $path already exists";
-    }
+    die "file $path already exists" if (-e $path);
 
     my $fh;
-    unless ( open( $fh, '>', $path ) ) {
-        die "can not open $path: $!";
-    } 
+    die "can not open $path: $!"
+        unless (open($fh, '>', $path));
 
-    unless ( close( $fh ) ) {
-        die "can not close $path: $!";
-    }
+    die "can not close $path: $!"
+        unless (close($fh));
 
-    unless ( chmod 0664, $path ) {
-        die "can not chmod $path: $!";
-    }
+    die "can not chmod $path: $!"
+        unless (chmod 0664, $path);
+
+    die "can not set xattr on $path: $!"
+        unless (setfattr($path, 'nebulous_key', $key));
 
     return $path;
