The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #102 from avsm/add-attrs

add filesystem attributes display to urstat

authored by

Thomas Leonard and committed by
GitHub
97c6a636 35f4f4e3

+20 -2
+20 -2
vendor/opam/uring/tests/urstat.ml
··· 9 9 (tm.Unix.tm_year + 1900) (tm.Unix.tm_mon + 1) tm.Unix.tm_mday 10 10 tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec 11 11 nsec 12 - 12 + 13 13 let get_completion_and_print uring = 14 14 let (fname, buf), _ = 15 15 match Uring.wait uring with ··· 17 17 | None -> failwith "retry" 18 18 in 19 19 let kind = S.kind buf in 20 + let amask = S.attributes_mask buf in 21 + let attrs = S.attributes buf in 22 + let pp_attr f (a,s) = 23 + try 24 + if S.Attr.check ~mask:amask attrs a then 25 + Format.fprintf f "%s:on " s 26 + else 27 + Format.fprintf f "%s:off " s 28 + with Invalid_argument _ -> 29 + Format.fprintf f "%s:unsup " s 30 + in 20 31 let opt_symlink = match kind with 21 32 `Symbolic_link -> Printf.sprintf " -> %s" (Unix.readlink fname) (* TODO no readlink in io_uring? *) 22 33 | _ -> "" in 23 - Format.printf " File: %s%s\n Size: %Lu\t\tBlocks: %Lu\tIO Block: %Lu\t %a\nDevice: %Lu\tInode: %Lu\tLinks: %Lu\nAccess: (%04o/TODO)\tUid: (%Lu/TODO)\tGid: (%Lu/TODO)\nAccess: %a\nModify: %a\nChange: %a\n Birth: %a\n%!" 34 + Format.printf " File: %s%s\n Size: %Lu\t\tBlocks: %Lu\tIO Block: %Lu\t %a\nDevice: %Lu\tInode: %Lu\tLinks: %Lu\nAccess: (%04o/TODO)\tUid: (%Lu/TODO)\tGid: (%Lu/TODO)\nAccess: %a\nModify: %a\nChange: %a\n Birth: %a\nAttrs : %a %a %a %a %a %a %a\n%!" 24 35 fname opt_symlink 25 36 (S.size buf) 26 37 (S.blocks buf) ··· 32 43 pp_time (S.mtime_sec buf, S.mtime_nsec buf) 33 44 pp_time (S.ctime_sec buf, S.ctime_nsec buf) 34 45 pp_time (S.btime_sec buf, S.btime_nsec buf) 46 + pp_attr (S.Attr.compressed, "compressed") 47 + pp_attr (S.Attr.immutable, "immutable") 48 + pp_attr (S.Attr.append, "append") 49 + pp_attr (S.Attr.nodump, "nodump") 50 + pp_attr (S.Attr.encrypted, "encrypted") 51 + pp_attr (S.Attr.verity, "verity") 52 + pp_attr (S.Attr.dax, "dax") 35 53 36 54 let submit_stat_request fname buf uring = 37 55 let mask = S.Mask.(basic_stats + btime) in