Changeset 2473

Show
Ignore:
Timestamp:
01/25/07 10:51:43 (2 years ago)
Author:
dhozac
Message:

Add option to chxid to skip unified files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/chxid.c

    r1670 r2473  
    3939}; 
    4040 
    41 char const              CMDLINE_OPTIONS_SHORT[] = "Rc:x"; 
     41char const              CMDLINE_OPTIONS_SHORT[] = "Rc:xU"; 
    4242 
    4343void 
     
    4747  WRITE_STR(fd, cmd); 
    4848  WRITE_MSG(fd, 
    49             " -c <ctx|vserver> [-Rx] [--] <file>+\n\n" 
     49            " -c <ctx|vserver> [-RxU] [--] <file>+\n\n" 
    5050            " Options:\n" 
    5151            "   -R  ...  recurse through directories\n" 
    5252            "   -c  ...  assign the given context/vserver to the file(s)\n" 
    53             "   -x  ...  do not cross filesystems\n\n" 
     53            "   -x  ...  do not cross filesystems\n" 
     54            "   -U  ...  skip unified files\n\n" 
    5455            "Please report bugs to " PACKAGE_BUGREPORT "\n"); 
    5556  exit(res); 
     
    6768} 
    6869 
     70static inline bool 
     71isUnified(char const *filename) 
     72{ 
     73  uint_least32_t const  V = VC_IATTR_IUNLINK|VC_IATTR_IMMUTABLE; 
     74 
     75  uint_least32_t        flags; 
     76  uint_least32_t        mask = V; 
     77 
     78  if (vc_get_iattr(filename, 0, &flags, &mask)==-1 || (mask & V) != V) 
     79    return false; 
     80 
     81  return (flags & V)==V  ? true : false; 
     82} 
     83 
    6984bool 
    7085handleFile(char const *name, char const * display_name) 
    7186{ 
    72   int   rc = vc_set_iattr(name, global_args->ctx, 0, VC_IATTR_XID); 
     87  if (!global_args->no_unified || !isUnified(name)) { 
     88    int rc = vc_set_iattr(name, global_args->ctx, 0, VC_IATTR_XID); 
    7389   
    74   if (rc==-1) { 
    75     perror(display_name); 
    76     return false; 
     90    if (rc==-1) { 
     91      perror(display_name); 
     92      return false; 
     93    } 
    7794  } 
    7895 
  • trunk/src/fstool.c

    r2431 r2473  
    183183    .do_unset           =  false, 
    184184    .local_fs           =  false, 
    185     .set_mask           = 0, 
    186     .del_mask           = 0 
     185    .set_mask           =  0, 
     186    .del_mask           =  0, 
     187    .no_unified         =  false, 
    187188  }; 
    188189 
     
    218219      case 'c'                  :  args.ctx_str        = optarg;        break; 
    219220      case 'x'                  :  args.local_fs       = true;          break; 
     221      case 'U'                  :  args.no_unified     = true;          break; 
    220222      default           : 
    221223        WRITE_MSG(2, "Try '"); 
  • trunk/src/fstool.h

    r2431 r2473  
    5656    bool                do_unset; 
    5757    bool                local_fs; 
     58    bool                no_unified; 
    5859 
    5960    uint32_t            set_mask;