From owner-freebsd-arch@freebsd.org Mon Oct 26 14:56:49 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 289F54471F7 for ; Mon, 26 Oct 2020 14:56:49 +0000 (UTC) (envelope-from khng@freebsdfoundation.org) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CKdG81dy9z4LXd for ; Mon, 26 Oct 2020 14:56:47 +0000 (UTC) (envelope-from khng@freebsdfoundation.org) Received: by mail-lf1-x12a.google.com with SMTP id a9so12466291lfc.7 for ; Mon, 26 Oct 2020 07:56:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=2cNlkQomvnd00t/oQfNsFDzn7wuwqLVi2eU9EQnqCys=; b=jwrXWdG3Ctj+Rm1VZl8guuVKF5hUwJ0EG2ggKiJJMwkXPgrLXh3zTu39BLG13hcyLV kyzCIem5ySHHK5xw8D6zEo9dZH6w4mU285QAo2DJYXAxOAr+C6FkPN874Vg5MPQ+YfOj hrI7IHL23SvhOaLdmLEIKgXzwQ7vFRoEJlVeIHX2P6gtLY+yWrbv/nS2XW+Sw40CKnNe GCY9RqeAt0wedAVssg8+/m3MftomLw3KEl8xmIF8iahOnBFgIA9gnuoN9Vd7or5lxKEK 4ViNuUok6yulaOUdiLc7kO+qL2xbUd8+KQFsh7m0TXC9seCSbk7cnf4erYpbelKTnMeo GU8w== X-Gm-Message-State: AOAM530xSxTdA/ag9TE/V3W1p5L/LbVbilokEE8yOcs0DmBFlkJ+lKLI cxhD2AV20ITZTxOrr6zoCA/Rt7sj279KsWLBNu/wU9FDOPTpZWsh X-Google-Smtp-Source: ABdhPJw6iDAcnOkqVKkbBy9UPH8+TP1OhccW5dTyCOcdln4f3pWFcPpVQmBtLacaT1t1twgnyGiEWATZr5S3ypJpPGI= X-Received: by 2002:a19:84d3:: with SMTP id g202mr5620323lfd.346.1603724205456; Mon, 26 Oct 2020 07:56:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ka Ho Ng Date: Mon, 26 Oct 2020 22:56:34 +0800 Message-ID: Subject: Re: Draft IOCTL commands on sndstat To: freebsd-arch@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CKdG81dy9z4LXd X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.09 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.019]; R_DKIM_ALLOW(-0.20)[freebsdfoundation.org:s=gfnp-20170908]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arch@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_TRACE(0.00)[freebsdfoundation.org:+]; DMARC_POLICY_ALLOW(-0.50)[freebsdfoundation.org,quarantine]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::12a:from]; NEURAL_HAM_SHORT(-0.07)[-0.074]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-arch]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2020 14:56:49 -0000 Meanwhile, I was thinking if things sound better that we create another label called `nameunit` to hold something like pcm0, and prepend /dev/ to existing `devnode` string. By doing so, callers only need to directly use the `devnode` string to open the node without the hassle of snprintf/asprintf. Here is a piece of code to enumerate audio devices without error checking with `nameunit` label added: https://gist.github.com/khng300/b9b3ccc86c24691273dc36c85066e2dd Ka Ho On Thu, Oct 22, 2020 at 1:55 AM Ka Ho Ng wrote: > > Hi all, > > I have proposed a set of IOCTLs on sndstat. The IOCTLs are nvlist-based, > and the goal of these IOCTLs aims at eliminating text parsing as a > generic user space API. > Here is the link to the differential: > https://reviews.freebsd.org/D26884. A piece of sample code > is also provided to demonstrate the usage of the IOCTLs. > > Regards, > Ka Ho