/** * gs_dfd_and_name_get_all_xattrs: * @dfd: Parent directory file descriptor * @name: File name * @out_xattrs: (out): Extended attribute set * @cancellable: Cancellable * @error: Error * * Load all extended attributes for the file named @name residing in * directory @dfd. */ gboolean gs_dfd_and_name_get_all_xattrs (int dfd, const char *name, GVariant **out_xattrs, GCancellable *cancellable, GError **error) { return glnx_dfd_name_get_all_xattrs (dfd, name, out_xattrs, cancellable, error); }
/** * gs_file_get_all_xattrs: * @f: a #GFile * @out_xattrs: (out): A new #GVariant containing the extended attributes * @cancellable: Cancellable * @error: Error * * Read all extended attributes of @f in a canonical sorted order, and * set @out_xattrs with the result. * * If the filesystem does not support extended attributes, @out_xattrs * will have 0 elements, and this function will return successfully. */ gboolean gs_file_get_all_xattrs (GFile *f, GVariant **out_xattrs, GCancellable *cancellable, GError **error) { return glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (f), out_xattrs, cancellable, error); }
static gboolean get_file_checksum (OstreeDiffFlags flags, GFile *f, GFileInfo *f_info, char **out_checksum, GCancellable *cancellable, GError **error) { g_autofree char *ret_checksum = NULL; if (OSTREE_IS_REPO_FILE (f)) { ret_checksum = g_strdup (ostree_repo_file_get_checksum ((OstreeRepoFile*)f)); } else { g_autoptr(GVariant) xattrs = NULL; g_autoptr(GInputStream) in = NULL; if (!(flags & OSTREE_DIFF_FLAGS_IGNORE_XATTRS)) { if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (f), &xattrs, cancellable, error)) return FALSE; } if (g_file_info_get_file_type (f_info) == G_FILE_TYPE_REGULAR) { in = (GInputStream*)g_file_read (f, cancellable, error); if (!in) return FALSE; } g_autofree guchar *csum = NULL; if (!ostree_checksum_file_from_input (f_info, xattrs, in, OSTREE_OBJECT_TYPE_FILE, &csum, cancellable, error)) return FALSE; ret_checksum = ostree_checksum_from_bytes (csum); } ot_transfer_out_value(out_checksum, &ret_checksum); return TRUE; }