Changeset 2703

Show
Ignore:
Timestamp:
03/15/08 17:05:49 (8 months ago)
Author:
dhozac
Message:

Add some examples.
Disallow combinations that make no sense.
Allow defaults to be set.

Files:

Legend:

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

    r2615 r2703  
    6666            "    --flags <flags>     Set the specified flags\n" 
    6767            "    --open              Allow opening of the device\n" 
    68             "    --create            If SECURE_MKNOD is given, allow mknod(2)\n" 
     68            "    --create            If CAP_MKNOD is given, allow mknod(2)\n" 
    6969            "    --device <dev>      Device to apply the command to\n" 
    7070            "    --remap             Remap the device to the target\n" 
    7171            "    --target <dev>      Target for --remap\n" 
     72            "\n" 
     73            "EXAMPLES\n" 
     74            "  Remap /dev/hda1 to /dev/vroot1 for xid 42\n" 
     75            "    vdevmap --xid 42 --set --open --device /dev/hda1 --target /dev/vroot1 --remap\n" 
     76            "  Let xid 42 create all device nodes\n" 
     77            "    vdevmap --xid 42 --set --open --create --target /dev/null\n" 
     78            "    vdevmap --xid 42 --set --open --create --target /dev/root\n" 
     79            "  Let xid 43 create just /dev/null\n" 
     80            "    vdevmap --xid 43 --set --open --create --device /dev/null\n" 
    7281            "\n" 
    7382            "Please report bugs to " PACKAGE_BUGREPORT "\n"); 
     
    137146  if (do_remap)         flags |= VC_DATTR_REMAP; 
    138147 
    139   if (target && !do_remap) 
    140     WRITE_MSG(2, "Target specified without --remap; try '--help' for more information\n"); 
     148  if (!target && do_remap) 
     149    WRITE_MSG(2, "Remapping specified without a target; try '--help' for more information\n"); 
    141150  else if (xid==VC_NOCTX) 
    142151    WRITE_MSG(2, "No xid specified; try '--help' for more information\n"); 
    143152  else if (optind!=argc) 
    144153    WRITE_MSG(2, "Unused argument(s); try '--help' for more information\n"); 
     154  else if (!device && !target) 
     155    WRITE_MSG(2, "Device and target are missing; try '--help' for more information\n"); 
    145156  else if (set && vc_set_mapping(xid, device, target, flags)==-1) 
    146157      perror("vc_set_mapping()");