Re: [PATCH 1/3] virNetDevGetFamilyId: Change signature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Monday in 2020, Michal Privoznik wrote:
Introduced in v3.8.0-rc1~96, the virNetDevGetFamilyId() gets
netlink family ID for passed family name (even though it's used
only for getting "devlink" ID). Nevertheless, the function
returns 0 on an error or if no family ID was found. This makes it
harder for a caller to distinguish these two. Change the retval
so that a negative value is returned upon error, zero is no ID
found (but no error encountered) and a positive value is returned
on successful translation.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/util/virnetdev.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index b465bdac2e..8c149c5fc5 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3057,11 +3057,15 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
 * This function supplies the devlink family id
 *
 * @family_name: the name of the family to query
+ * @family_id: family ID
 *
- * Returns family id or 0 on failure.
+ * Returns: 0 if no family was found,
+ *          1 if family was found (@family_id is set),
+ *         -1 othewise.

otherwise

 */
-static uint32_t
-virNetDevGetFamilyId(const char *family_name)
+static int
+virNetDevGetFamilyId(const char *family_name,
+                     uint32_t *family_id)
{
    struct nl_msg *nl_msg = NULL;
    struct nlmsghdr *resp = NULL;

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux