Changeset 2559

Show
Ignore:
Timestamp:
07/10/07 22:35:47 (1 year ago)
Author:
dhozac
Message:

Add an option to specify the xid the non-shared files should belong to.

Files:

Legend:

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

    r2494 r2559  
    4141#define ENSC_WRAPPERS_FCNTL     1 
    4242#define ENSC_WRAPPERS_DIRENT    1 
     43#define ENSC_WRAPPERS_VSERVER   1 
    4344#include <wrappers.h> 
    4445 
    4546#define CMD_HELP                0x8000 
    4647#define CMD_VERSION             0x8001 
     48#define CMD_XID                 0x8002 
    4749 
    4850struct WalkdownInfo 
     
    5557struct Arguments { 
    5658    unsigned int        verbosity; 
     59    xid_t               xid; 
    5760}; 
    5861 
     
    6669  { "help",     no_argument,       0, CMD_HELP }, 
    6770  { "version",  no_argument,       0, CMD_VERSION }, 
     71  { "xid",      required_argument, 0, CMD_XID }, 
    6872  { 0,0,0,0 } 
    6973}; 
     
    7882  WRITE_STR(fd, cmd); 
    7983  WRITE_MSG(fd, 
    80             " <source> <absolute path to destination>\n\n" 
     84            " [--xid <xid>] <source> <absolute path to destination>\n\n" 
    8185            "Please report bugs to " PACKAGE_BUGREPORT "\n"); 
    8286  exit(res); 
     
    138142    } 
    139143    else { 
    140       if (!Unify_copy(src_d_path.d, &f_stat, dst_path.d)) { 
     144      if (!Unify_copy(src_d_path.d, &f_stat, dst_path.d)) 
    141145        perror(ENSC_WRAPPERS_PREFIX "Unify_copy()"); 
    142         exit(wrapper_exit_code); 
    143       } 
    144       res = 0; 
     146      else if (vc_set_iattr(dst_path.d, global_args->xid, 0, VC_IATTR_XID) == -1) 
     147        perror(ENSC_WRAPPERS_PREFIX "vc_set_iattr()"); 
     148      else 
     149        res = 0; 
    145150    } 
    146151    if (S_ISDIR(f_stat.st_mode)) 
     
    155160  struct Arguments      args = { 
    156161    .verbosity          =  0, 
     162    .xid                = VC_NOCTX, 
    157163  }; 
    158164  uint64_t              res; 
     
    161167  global_args = &args; 
    162168  while (1) { 
    163     int         c = getopt_long(argc, argv, "+", 
     169    int         c = getopt_long(argc, argv, "+v", 
    164170                                CMDLINE_OPTIONS, 0); 
    165171    if (c==-1) break; 
     
    168174      case CMD_HELP     :  showHelp(1, argv[0], 0); 
    169175      case CMD_VERSION  :  showVersion(); 
     176      case 'v'          :  args.verbosity++; break; 
     177      case CMD_XID      :  args.xid = Evc_xidopt2xid(optarg,true); break; 
    170178      default           : 
    171179        WRITE_MSG(2, "Try '");