MCPcopy Create free account
hub / github.com/coreutils/coreutils / get_field_values

Function get_field_values

src/df.c:928–963  ·  view source on GitHub ↗

Obtain the block values BV and inode values IV from the file system usage FSU. */

Source from the content-addressed store, hash-verified

926/* Obtain the block values BV and inode values IV
927 from the file system usage FSU. */
928static void
929get_field_values (struct field_values_t *bv,
930 struct field_values_t *iv,
931 const struct fs_usage *fsu)
932{
933 /* Inode values. */
934 iv->input_units = iv->output_units = 1;
935 iv->total = fsu->fsu_files;
936 iv->available = iv->available_to_root = fsu->fsu_ffree;
937 iv->negate_available = false;
938
939 iv->used = UINTMAX_MAX;
940 iv->negate_used = false;
941 if (known_value (iv->total) && known_value (iv->available_to_root))
942 {
943 iv->used = iv->total - iv->available_to_root;
944 iv->negate_used = (iv->total < iv->available_to_root);
945 }
946
947 /* Block values. */
948 bv->input_units = fsu->fsu_blocksize;
949 bv->output_units = output_block_size;
950 bv->total = fsu->fsu_blocks;
951 bv->available = fsu->fsu_bavail;
952 bv->available_to_root = fsu->fsu_bfree;
953 bv->negate_available = (fsu->fsu_bavail_top_bit_set
954 && known_value (fsu->fsu_bavail));
955
956 bv->used = UINTMAX_MAX;
957 bv->negate_used = false;
958 if (known_value (bv->total) && known_value (bv->available_to_root))
959 {
960 bv->used = bv->total - bv->available_to_root;
961 bv->negate_used = (bv->total < bv->available_to_root);
962 }
963}
964
965/* Add block and inode values to grand total. */
966static void

Callers 1

get_devFunction · 0.85

Calls 1

known_valueFunction · 0.85

Tested by

no test coverage detected