Re: Re: [PATCH 4/5] lsblk: introduce 'MQ' column

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

 





On 6/6/22 18:41, Karel Zak wrote:
On Fri, Jun 03, 2022 at 08:24:01PM +0800, zhenwei pi wrote:
+static void process_mq(struct lsblk_device *dev, char **str)
+{
+	DIR *dir;
+	struct dirent *d;
+	unsigned int queues = 0;
+
+	DBG(DEV, ul_debugobj(dev, "%s: process mq", dev->name));
+
+	dir = ul_path_opendir(dev->sysfs, "mq");
+	if (!dir) {
+		*str = xstrdup("1");
+		DBG(DEV, ul_debugobj(dev, "%s: no mq supported, use a single queue", dev->name));
+		return;
+	}
+
+	while ((d = xreaddir(dir))) {
+		if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+			continue;

  xreaddir() filters "." and "..".

  Anyway, there is a function ul_path_count_dirents() that does all the
  work. I made the change in the code.

     Karel


Hi, Karel

Thanks!

--
zhenwei pi



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux