applied new iattr interface and changed some internal functions
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Thu, 19 Feb 2004 22:29:20 +0000 (22:29 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Thu, 19 Feb 2004 22:29:20 +0000 (22:29 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@957 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/src/chxid.c
util-vserver/src/fstool.c
util-vserver/src/fstool.h
util-vserver/src/lsxid.c
util-vserver/src/setattr.c
util-vserver/src/showattr.c

index 2e86b2b..f6bd807 100644 (file)
@@ -67,12 +67,9 @@ showVersion()
 }
 
 bool
-handleFile(char const *name, char const * display_name,
-          struct stat const *exp_st)
+handleFile(char const *name, char const * display_name)
 {
-  int  rc = vc_set_iattr_compat(name, exp_st->st_dev, exp_st->st_ino,
-                                global_args->ctx, 0, VC_IATTR_XID,
-                                &exp_st->st_mode);
+  int  rc = vc_set_iattr(name, global_args->ctx, 0, VC_IATTR_XID);
   
   if (rc==-1) {
     perror(display_name);
index 7ae7a1d..d732bc3 100644 (file)
@@ -96,7 +96,7 @@ iterateFilesystem(char const *path)
 
   // show current directory entry first
   if (lstat(".", &cur_st)==-1) perror("lstat()");
-  else err += handleFile(".", path, &cur_st) ? 0 : 1;
+  else err += handleFile(".", path) ? 0 : 1;
 
   // strip trailing '/'
   while (path_len>0 && path[path_len-1]=='/') --path_len;
@@ -122,7 +122,7 @@ iterateFilesystem(char const *path)
     
     {
       CONCAT_PATHS(path, path_len, ent->d_name);
-      err += handleFile(ent->d_name, new_path, &st) ? 0 : 1;
+      err += handleFile(ent->d_name, new_path) ? 0 : 1;
     }
   }
 
@@ -183,7 +183,7 @@ processFile(char const *path)
     return iterateFilesystem(path);
   }
   else
-    return handleFile(path, path, &st);
+    return handleFile(path, path) ? 0 : 1;
 }
 
 int main(int argc, char *argv[])
index 953c3e7..74c4d24 100644 (file)
@@ -65,7 +65,7 @@ extern struct Arguments const *               global_args;
 
 bool   checkForRace(int fd, char const * name, struct stat const *exp_st);
 void   fixupParams(struct Arguments *, int argc);
-bool   handleFile(char const *d_name, char const *full_name, struct stat const *);
+bool   handleFile(char const *d_name, char const *full_name);
 void   showHelp(int fd, char const *cmd, int res);
 void   showVersion();
 xid_t  resolveCtx(char const *str);
index d6157b6..bfcb47d 100644 (file)
@@ -124,21 +124,19 @@ lookupContext(xid_t xid)
 }
 
 static xid_t
-getFileContext(char const *name, struct stat const *exp_st)
+getFileContext(char const *name)
 {
   xid_t                res;
   uint32_t     mask = VC_IATTR_XID;
   
-  if (vc_get_iattr_compat(name, exp_st->st_dev, exp_st->st_ino,
-                         &res, 0, &mask, &exp_st->st_mode)==-1)
-    perror("vc_get_iattr_compat()");
+  if (vc_get_iattr(name, &res, 0, &mask)==-1)
+    perror("vc_get_iattr()");
 
   return (mask&VC_IATTR_XID) ? res : VC_NOCTX;
 }
 
 bool
-handleFile(char const *name, char const *display_name,
-          struct stat const *exp_st)
+handleFile(char const *name, char const *display_name)
 {
   xid_t                ctx = 0;
   char         buf[MAX(sizeof(ctx)*3+1, 20)];
@@ -147,7 +145,7 @@ handleFile(char const *name, char const *display_name,
   memset(buf, ' ', sizeof buf);
 
 #if 1
-  ctx = getFileContext(name, exp_st);
+  ctx = getFileContext(name);
 #else
 #  warning Compiling in debug-code
   ctx = random() % 10 + 49213;
index b7665a6..bb603b8 100644 (file)
@@ -92,14 +92,12 @@ fixupParams(struct Arguments * args, int argc)
 }
 
 bool
-handleFile(char const *name, char const * display_name,
-          struct stat const *exp_st)
+handleFile(char const *name, char const * display_name)
 {
-  int rc = vc_set_iattr_compat(name, exp_st->st_dev, exp_st->st_ino,
-                              0,
-                              global_args->set_mask & ~global_args->del_mask,
-                              global_args->set_mask |  global_args->del_mask,
-                              &exp_st->st_mode);
+  int rc = vc_set_iattr(name,
+                       0,
+                       global_args->set_mask & ~global_args->del_mask,
+                       global_args->set_mask |  global_args->del_mask);
 
   if (rc==-1) {
     perror(display_name);
index 2062c12..91cb638 100644 (file)
@@ -80,14 +80,13 @@ fixupParams(struct Arguments UNUSED * args, int UNUSED argc)
 }
 
 static bool
-getFlags(char const *name, struct stat const *exp_st, uint32_t *flags, uint32_t *mask)
+getFlags(char const *name, uint32_t *flags, uint32_t *mask)
 {
   xid_t                xid;
   *mask = ~0;
   
-  if (vc_get_iattr_compat(name, exp_st->st_dev, exp_st->st_ino,
-                         &xid, flags, mask, &exp_st->st_mode)==-1) {
-    perror("vc_get_iattr_compat()");
+  if (vc_get_iattr(name, &xid, flags, mask)==-1) {
+    perror("vc_get_iattr()");
     return false;
   }
 
@@ -95,8 +94,7 @@ getFlags(char const *name, struct stat const *exp_st, uint32_t *flags, uint32_t
 }
 
 bool
-handleFile(char const *name, char const *display_name,
-          struct stat const *exp_st)
+handleFile(char const *name, char const *display_name)
 {
   bool                 res = true;
   char                 buf[40];
@@ -106,7 +104,7 @@ handleFile(char const *name, char const *display_name,
 
   memset(buf, ' ', sizeof buf);
 
-  if (getFlags(name, exp_st, &flags, &mask)) {
+  if (getFlags(name, &flags, &mask)) {
       //                                   1       1       0       0
       //                            fedcba9876543210fedcba9876543210
     static char const  MARKER[33] = ".......x......ib.............hwa";