Lines Matching +full:min +full:- +full:len
1 // SPDX-License-Identifier: GPL-2.0-only
14 * kvm_stats_read() - Common function to read from the binary statistics
28 * +-------------+
30 * +-------------+
32 * +-------------+
34 * +-------------+
36 * +-------------+
41 * and some other necessary information. This is a one-time work for the
43 * 2. Read id string from its offset. This is a one-time work for the lifecycle
46 * descriptors. This is a one-time work for the lifecycle of the
57 ssize_t len; in kvm_stats_read() local
67 size_desc = header->num_desc * sizeof(*desc); in kvm_stats_read()
69 len = KVM_STATS_NAME_SIZE + size_header + size_desc + size_stats - pos; in kvm_stats_read()
70 len = min(len, remain); in kvm_stats_read()
71 if (len <= 0) in kvm_stats_read()
73 remain = len; in kvm_stats_read()
83 copylen = size_header - pos; in kvm_stats_read()
84 copylen = min(copylen, remain); in kvm_stats_read()
88 return -EFAULT; in kvm_stats_read()
89 remain -= copylen; in kvm_stats_read()
103 copylen = header->id_offset + KVM_STATS_NAME_SIZE - pos; in kvm_stats_read()
104 copylen = min(copylen, remain); in kvm_stats_read()
106 src = id + pos - header->id_offset; in kvm_stats_read()
108 return -EFAULT; in kvm_stats_read()
109 remain -= copylen; in kvm_stats_read()
119 * (header->header.desc_offset + size_desc) causing copylen <= 0. in kvm_stats_read()
121 copylen = header->desc_offset + size_desc - pos; in kvm_stats_read()
122 copylen = min(copylen, remain); in kvm_stats_read()
124 src = (void *)desc + pos - header->desc_offset; in kvm_stats_read()
126 return -EFAULT; in kvm_stats_read()
127 remain -= copylen; in kvm_stats_read()
133 copylen = header->data_offset + size_stats - pos; in kvm_stats_read()
134 copylen = min(copylen, remain); in kvm_stats_read()
136 src = stats + pos - header->data_offset; in kvm_stats_read()
138 return -EFAULT; in kvm_stats_read()
143 return len; in kvm_stats_read()