From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 2D73A1B383 for ; Wed, 1 Nov 2017 22:42:10 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id a2so4090046lfh.11 for ; Wed, 01 Nov 2017 14:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oXjputVWjblysV33TFTGwuTPXXpnbsyijSFl2+4euG8=; b=AgHoGcES+gUud2jW+pYjQcIm2SQqaHJOH+RiTmRpZoWOrhI1a2SKKiFHOxukf0Ldtc cqiBzercA+iVRijf7o4v4EciLr9JP4/9KUjVKVwWzHwUIlDuMCvtBJAYFR4VXXsWe+gI 94P8hDodzuQlzvX4GrehATVPV0Wa5m163mwZlPrmnj7UGD6OTEuOJXRN6W5yF2LKRpUq VPBmE+Bipr3ypKElvKE6GBx7CTGhAZPkrsg4ithTEubqviGQX9CPaPDoJnF3ow4zcagI Lng5dkNyrnTn34QSdI9h3ylgvzW8giHO8icUziadlN5zkCN65fZdKtyTjf0W9gUC/hgL lp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oXjputVWjblysV33TFTGwuTPXXpnbsyijSFl2+4euG8=; b=ojFDTbPMvNFmVZwDsP1e7l0amNYMkblC+dneReylxKOH/6dFvClDlnYhIXVNPGzM3l szPVzjhezxOgME6W5aCoZlfTlSzVv8trl8X965Yu3giwFixLCD9cNqO/qgyox6NjGYJp mUxBEwWRBu2YPkmx6ck+h6Onr4fp82Ruo1wkA9NW7+EjPn7GsStKpUH/DyRV8R1LFGik tzgB8pLlWX3/vmXeoCxuGL/2LzpaaSN5MsgxH58EBNB1KcIdr1kxsD3Zwyyx+L0OZVgS e5nwY7bvALezx5m4IJpTwcZThS9vTK1bYeXIjSXAXrW9w/66LOzG41Y0O1nh/u7paV+H O2lA== X-Gm-Message-State: AMCzsaUgYY5a8HAP/v4Fxs7H9Wo3G3pBUTY5k/z7AYYwS++kAXiJ/CuG 3mPAefLVwzK8mmhZZ46l10EH+Q== X-Google-Smtp-Source: ABhQp+SPYxTboWH6bACMdV97wDonVaE25zy/H8GtVgKliM02wjMv7nGyVxgIeMWUloMsTX80W3u6yw== X-Received: by 10.46.14.25 with SMTP id 25mr537865ljo.120.1509572529663; Wed, 01 Nov 2017 14:42:09 -0700 (PDT) Received: from shemminger-XPS-13-9360 (static-92-33-18-3.sme.bredbandsbolaget.se. [92.33.18.3]) by smtp.gmail.com with ESMTPSA id c132sm268390lfe.37.2017.11.01.14.42.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2017 14:42:09 -0700 (PDT) Date: Wed, 1 Nov 2017 22:41:44 +0100 From: Stephen Hemminger To: Jeff Guo Cc: bruce.richardson@intel.com, ferruh.yigit@intel.com, gaetan.rivet@6wind.com, thomas@monjalon.net, konstantin.ananyev@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, jingjing.wu@intel.com, dev@dpdk.org, helin.zhang@intel.com Message-ID: <20171101224144.7e0854bf@shemminger-XPS-13-9360> In-Reply-To: <1509567405-27439-2-git-send-email-jia.guo@intel.com> References: <1505880732-16539-3-git-send-email-jia.guo@intel.com> <1509567405-27439-1-git-send-email-jia.guo@intel.com> <1509567405-27439-2-git-send-email-jia.guo@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 1/2] eal: add uevent monitor for hot plug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2017 21:42:10 -0000 On Thu, 2 Nov 2017 04:16:44 +0800 Jeff Guo wrote: > + > +static int > +dev_uev_parse(const char *buf, struct rte_eal_uevent *event) > +{ > + char action[RTE_EAL_UEVENT_MSG_LEN]; > + char subsystem[RTE_EAL_UEVENT_MSG_LEN]; > + char dev_path[RTE_EAL_UEVENT_MSG_LEN]; > + char pci_slot_name[RTE_EAL_UEVENT_MSG_LEN]; > + int i = 0; > + > + memset(action, 0, RTE_EAL_UEVENT_MSG_LEN); > + memset(subsystem, 0, RTE_EAL_UEVENT_MSG_LEN); > + memset(dev_path, 0, RTE_EAL_UEVENT_MSG_LEN); > + memset(pci_slot_name, 0, RTE_EAL_UEVENT_MSG_LEN); > + > + while (i < RTE_EAL_UEVENT_MSG_LEN) { Might be simpler, safer, clearer to use rte_strsplit here. And then have a table of fields rather than open coding the parsing. > + for (; i < RTE_EAL_UEVENT_MSG_LEN; i++) { > + if (*buf) > + break; > + buf++; > + } > + if (!strncmp(buf, "libudev", 7)) { > + buf += 7; > + i += 7; > + event->group = UEV_MONITOR_UDEV; > + } > + if (!strncmp(buf, "ACTION=", 7)) { > + buf += 7; > + i += 7; > + snprintf(action, sizeof(action), "%s", buf); > + } else if (!strncmp(buf, "DEVPATH=", 8)) { > + buf += 8; > + i += 8; > + snprintf(dev_path, sizeof(dev_path), "%s", buf); > + } else if (!strncmp(buf, "SUBSYSTEM=", 10)) { > + buf += 10; > + i += 10; > + snprintf(subsystem, sizeof(subsystem), "%s", buf); > + } else if (!strncmp(buf, "PCI_SLOT_NAME=", 14)) { > + buf += 14; > + i += 14; > + snprintf(pci_slot_name, sizeof(subsystem), "%s", buf); > + } > + for (; i < RTE_EAL_UEVENT_MSG_LEN; i++) { > + if (*buf == '\0') > + break; > + buf++; > + } > + } > + > + if (!strncmp(subsystem, "pci", 3)) > + event->subsystem = UEV_SUBSYSTEM_PCI; > + if (!strncmp(action, "add", 3)) > + event->type = RTE_EAL_DEV_EVENT_ADD; > + if (!strncmp(action, "remove", 6)) > + event->type = RTE_EAL_DEV_EVENT_REMOVE; > + event->devname = pci_slot_name; > + > + return 0; Function always returns 0, why is it not void?