]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Add file_id_str_buf()
authorVolker Lendecke <vl@samba.org>
Mon, 2 Sep 2019 17:04:25 +0000 (19:04 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Sep 2019 23:14:30 +0000 (23:14 +0000)
file_id_string() without talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/file_id.c
source3/lib/file_id.h

index 21f22ffbf3bec3dcae927fe94243e1800cc920ba..b2cf313b81f529db6055ced2d50fc54948b2be59 100644 (file)
@@ -39,6 +39,17 @@ const char *file_id_string_tos(const struct file_id *id)
        return file_id_string(talloc_tos(), id);
 }
 
+char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst)
+{
+       snprintf(dst->buf,
+                sizeof(dst->buf),
+                "%"PRIu64":%"PRIu64":%"PRIu64,
+                fid.devid,
+                fid.inode,
+                fid.extid);
+       return dst->buf;
+}
+
 /*
   an allocated string for a file_id structure
  */
index ddcaea6c94df9d8431c8a864361d88edc17c9353..c001199a35b911df1248d97399c0e0bd28486758 100644 (file)
 /* The following definitions come from lib/file_id.c  */
 
 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
+
+/*
+ * strlen("18446744073709551615")=20 times 3 plus 2 colons plus trailing 0
+ */
+struct file_id_buf { char buf[63]; };
+char *file_id_str_buf(struct file_id fid, struct file_id_buf *dst);
+
 /*
   a static-like (on talloc_tos()) string for a file_id structure
  */