On Wed, Mar 25, 2015 at 05:04:46AM -0400, Chen Hanxiao wrote: > Signed-off-by: Hu Tao <[email protected]> > Signed-off-by: Chen Hanxiao <[email protected]> > --- > daemon/ls.c | 24 ++++++++++++++++++++++++ > generator/actions.ml | 7 +++++++ > src/MAX_PROC_NR | 2 +- > 3 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/daemon/ls.c b/daemon/ls.c > index d3689cd..fdacdaf 100644 > --- a/daemon/ls.c > +++ b/daemon/ls.c > @@ -148,3 +148,27 @@ do_llz (const char *path) > > return out; /* caller frees */ > } > + > +char * > +do_ls_i (const char *dir) > +{ > + int r; > + char *out; > + CLEANUP_FREE char *err = NULL; > + CLEANUP_FREE char *sdir = NULL; > + > + sdir = sysroot_path (dir); > + if (!sdir) { > + reply_with_perror ("malloc"); > + return NULL; > + } > + > + r = command (&out, &err, str_ls, "-i", sdir, NULL); > + if (r == -1) { > + reply_with_error ("%s", err); > + free (out); > + return NULL; > + } > + > + return out; /* caller frees */ > +} > diff --git a/generator/actions.ml b/generator/actions.ml > index bd654a3..edc4818 100644 > --- a/generator/actions.ml > +++ b/generator/actions.ml > @@ -12575,6 +12575,13 @@ numbered C<partnum> on device C<device>. > > It returns C<primary>, C<logical>, or C<extended>." }; > > + { defaults with > + name = "ls_i"; > + style = RString "listing", [Pathname "directory"], []; > + proc_nr = Some 455; > + shortdesc = "list the files in a directory with index number of each > file"; > + longdesc = "This list the files in a directory and print the index > number of each file."}; > +
NACK. You can already get this information through the 'lstatnslist' or 'stat' APIs, and 'ls -i' output is unstructured requiring every caller to parse it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/ _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
