Displaying 14 results from an estimated 14 matches for "s_lnk".
2017 Jul 14
0
[PATCH 03/27] daemon: Reimplement ‘file’ API in OCaml.
...:(sprintf "file: %s" path) in
+
+ let statbuf = Chroot.f chroot lstat path in
+ match statbuf.st_kind with
+ | S_DIR -> "directory"
+ | S_CHR -> "character device"
+ | S_BLK -> "block device"
+ | S_FIFO -> "FIFO"
+ | S_LNK -> "symbolic link"
+ | S_SOCK -> "socket"
+ | S_REG ->
+ (* Regular file, so now run [file] on it. *)
+ let out = command "file" ["-zb"; sysroot // path] in
+
+ (* We need to remove the trailing \n from output of file(1).
+...
2017 Jul 14
0
[PATCH 07/27] daemon: Reimplement ‘is_dir’, ‘is_file’ and ‘is_symlink’ APIs in OCaml.
...f "is_dir: %s" path) in
+ Chroot.f chroot get_kind (path, followsymlinks) = Some S_DIR
+
+and is_symlink path =
+ let sysroot = Sysroot.sysroot () in
+ let chroot = Chroot.create sysroot ~name:(sprintf "is_symlink: %s" path) in
+ Chroot.f chroot get_kind (path, false) = Some S_LNK
+
+and get_kind (path, followsymlinks) =
+ let statfun = if followsymlinks then stat else lstat in
+ try
+ let statbuf = statfun path in
+ Some statbuf.st_kind
+ with
+ Unix_error ((ENOENT|ENOTDIR), _, _) ->
+ None (* File doesn't exist => return None *)
diff --git a/dae...
2017 Jun 03
3
[PATCH 0/3]: daemon: Reimplement ‘file’ API in OCaml.
This patch series is just FYI at the moment. However it
does pass the tests.
The daemon is a self-contained program. We don't need to write it all
in C. Writing parts of it in OCaml would make it simpler and less
error-prone. In particular if the daemon was written in a more sane
programming language then we could move the inspection code to run
entirely inside the appliance, which would
2017 Jul 14
45
[PATCH 00/27] Reimplement many daemon APIs in OCaml.
Previously posted as part of the mega utilities/inspection
series here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00232.html
What I've done is to extract just the parts related to rewriting
daemon APIs in OCaml, rebase them on top of the current master, fix a
few things, and recompile and test everything.
Rich.
2017 Jun 03
12
[PATCH v2 00/12] Allow APIs to be implemented in OCaml.
Version 1 was here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00003.html
This patch series reimplements a few more APIs in OCaml, including
some very important core APIs like ?list_filesystems? and ?mount?.
All the tests pass after this.
The selection of APIs that I have moved may look a little random, but
in fact they are all APIs consumed by the inspection code (and some
more
2015 Mar 31
0
[PATCH] WIP: New virt-dib tool
...e_tool ?(param = "--version") tool =
+ if not (check_tool ~param tool) then
+ error (f_"%s needed but not found (or '%s %s' could not be run)") tool tool param
+
+let is_file_or_link file =
+ try
+ match (Unix.stat file).Unix.st_kind with
+ | Unix.S_REG | Unix.S_LNK -> true
+ | _ -> false
+ with Unix.Unix_error _ -> false
+
+let do_cp src dest =
+ let cmd = sprintf "cp -t %s -a %s" (Filename.quote dest) (Filename.quote src) in
+ run_command cmd
+
+let ensure_trailing_newline str =
+ if String.length str > 0 && str.[String.l...
2017 Jun 05
19
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
v2 was here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00008.html
This series gets as far as a working (and faster) reimplementation of
‘guestfs_list_filesystems’.
I also have another patch series on top of this one which reimplements
the inspection APIs inside the daemon, but that needs a bit more work
still, since inspection turns out to be a very large piece of code.
Rich.
2017 Jul 27
23
[PATCH v3 00/23] Reimplement many daemon APIs in OCaml.
I think this fixes everything mentioned:
- Added the Optgroups module as suggested.
- Remove command temporary files.
- Replace command ~flags with ?fold_stdout_on_stderr.
- Nest _with_mounted function.
- Rebase & retest.
Rich.
2014 Feb 25
2
[PATCH supermin v4] Supermin 5 rewrite.
.... Symlinks to not-yet-existing directories are
+ * handled by adding the target directory into the list before the
+ * symlink.
+ *)
+and munge files =
+ let files = List.sort compare files in
+
+ let rec stat_is_dir dir =
+ try (stat dir).st_kind = S_DIR with Unix_error _ -> false
+ and is_lnk_to_dir dir =
+ try stat_is_dir dir && (lstat dir).st_kind = S_LNK
+ with Unix_error _ -> false
+ in
+
+ let insert_dir, dir_seen =
+ let h = Hashtbl.create (List.length files) in
+ let insert_dir dir = Hashtbl.replace h dir true in
+ let dir_seen dir = Hashtbl.mem h dir...
2017 Jul 21
27
[PATCH v2 00/23] Reimplement many daemon APIs in OCaml.
v1 was posted here:
https://www.redhat.com/archives/libguestfs/2017-July/msg00098.html
This series now depends on two small patches which I posted separately:
https://www.redhat.com/archives/libguestfs/2017-July/msg00207.html
https://www.redhat.com/archives/libguestfs/2017-July/msg00209.html
v1 -> v2:
- Previously changes to generator/daemon.ml were made incrementally
through the patch
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of:
https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html
[PATCH 00/12] Refactor utility functions.
plus:
https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
with the second patches rebased on top of the utility refactoring, and
some other adjustments and extensions.
This passes
2017 Jun 19
29
[PATCH v7 00/29] Reimplement inspection in the daemon.
v6 was posted here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html
and this requires the utilities refactoring posted here:
https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html
Inspection is now complete[*], although not very well tested. I'm
intending to compare the output of many guests using old & new
virt-inspector to see if I can find any
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5:
https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html
Since v5, this now implements inspection almost completely for Linux
and Windows guests.
Rich.
2017 Jun 21
45
[PATCH v8 00/42] Refactor utilities and reimplement inspection.
v7 was:
https://www.redhat.com/archives/libguestfs/2017-June/msg00169.html
https://www.redhat.com/archives/libguestfs/2017-June/msg00184.html
I believe this addresses all comments received so far.
Also it now passes a test where I compared about 100 disk images
processed with old and new virt-inspector binaries. The output is
identical in all cases except one which is caused by a bug in blkid