direct-io.hg

changeset 12319:9b65a87f140f

[XENSTORE] Fix xenstore-ls program to connect via kernel xenbus
connection by default, like all other client utils.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Nov 09 13:25:47 2006 +0000 (2006-11-09)
parents 0b8f79563bcd
children 2a7b8d75ebf7
files tools/xenstore/xsls.c
line diff
     1.1 --- a/tools/xenstore/xsls.c	Thu Nov 09 13:18:58 2006 +0000
     1.2 +++ b/tools/xenstore/xsls.c	Thu Nov 09 13:25:47 2006 +0000
     1.3 @@ -94,14 +94,8 @@ void usage(int argc, char *argv[])
     1.4  int main(int argc, char *argv[])
     1.5  {
     1.6      struct winsize ws;
     1.7 -    int ret;
     1.8 -    int c;
     1.9 -    int show_perm = 0;
    1.10 -
    1.11 -    struct xs_handle *xsh = xs_daemon_open();
    1.12 -
    1.13 -    if (xsh == NULL)
    1.14 -        err(1, "xs_daemon_open");
    1.15 +    int ret, c, socket = 0, show_perm = 0;
    1.16 +    struct xs_handle *xsh;
    1.17  
    1.18  #define PAD 2
    1.19  
    1.20 @@ -110,12 +104,15 @@ int main(int argc, char *argv[])
    1.21      if (!ret)
    1.22          max_width = ws.ws_col - PAD;
    1.23  
    1.24 -    while (0 < (c = getopt(argc, argv, "p"))) {
    1.25 +    while (0 < (c = getopt(argc, argv, "ps"))) {
    1.26          switch (c) {
    1.27          case 'p':
    1.28              show_perm = 1;
    1.29              max_width -= 16;
    1.30              break;
    1.31 +        case 's':
    1.32 +            socket = 1;
    1.33 +            break;
    1.34          case ':':
    1.35          case '?':
    1.36          default:
    1.37 @@ -124,6 +121,10 @@ int main(int argc, char *argv[])
    1.38          }
    1.39      }
    1.40  
    1.41 +    xsh = socket ? xs_daemon_open() : xs_domain_open();
    1.42 +    if (xsh == NULL)
    1.43 +        err(1, socket ? "xs_daemon_open" : "xs_domain_open");
    1.44 +
    1.45      print_dir(xsh, (argc - optind) == 1 ? argv[optind] : "/", 0, show_perm);
    1.46  
    1.47      return 0;