From owner-freebsd-questions@FreeBSD.ORG Wed Nov 5 06:39:45 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A49F8572 for ; Wed, 5 Nov 2014 06:39:45 +0000 (UTC) Received: from exprod7og123.obsmtp.com (exprod7og123.obsmtp.com [64.18.2.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16F0A7D5 for ; Wed, 5 Nov 2014 06:39:44 +0000 (UTC) Received: from mail-wg0-f50.google.com ([74.125.82.50]) (using TLSv1) by exprod7ob123.postini.com ([64.18.6.12]) with SMTP ID DSNKVFnGLwnIjduneytwILivq5A24Ctf67ky@postini.com; Tue, 04 Nov 2014 22:39:45 PST Received: by mail-wg0-f50.google.com with SMTP id z12so112999wgg.23 for ; Tue, 04 Nov 2014 22:39:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=NUJCAx35K7biGQ5LQyWrTjJYG5ODUvbmzI4UaYsBcM4=; b=c8BB/f4tw1fzA+m9tn997PgUADIstRUdbsWMNW9bk3GtvhOL75u5/JXRK5zsvod6Pd D0m+IF0G3JJ4bpyf6Z1A3G1z8YjSWFCU6ihRxcQC0qyBUJRYgV51p/ym51lBN2Bkx11O r5a+1TP8RPS3b/9RkO1uemNb+Z7uiyrZzazZ4aSPYRELaITPvF3N9HcD5lGDTHMSq2Fe MdjEUeGF4eJzgtIR15yEFPdjttDaVDPxKUj/UJYdWYo5nAWSM5wfcZr9gh1dub/jvA0d Eq9L//f1jCJw5RHfDBY3Ks9eJW3Qt69ZDMrX9sSHD8/43+8FZ/YFljY1TY1RvbTIsTd/ yaGw== X-Gm-Message-State: ALoCoQmUkN//8a9r0YG130dAioIxxdMaod6OZuSqCVljLb9gYp5jyKDiT3zajw3PqhwOzGJTHCVD1IcIYOpSmd/Sxrm7lmxbyAEZWoSY1EplJl+vXwDyRhM9XdivYfpl1toCEjjFP4s7cG/PaywB+xGhct3A/LiWpw/QKOQMw4Md3aUyJ4vFdJg= X-Received: by 10.180.207.77 with SMTP id lu13mr3425797wic.12.1415169583204; Tue, 04 Nov 2014 22:39:43 -0800 (PST) X-Received: by 10.180.207.77 with SMTP id lu13mr3425779wic.12.1415169583057; Tue, 04 Nov 2014 22:39:43 -0800 (PST) From: Sibananda Sahu References: In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQNa5s5W0kWsy8xn8LVBabuf4+sv+AF03wk0mTAOiYA= Date: Wed, 5 Nov 2014 12:09:41 +0530 Message-ID: <1ab03c9bac878f437b205786d8304bd3@mail.gmail.com> Subject: RE: Open file descriptor reference count implementation in driver To: JD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 06:39:45 -0000 Hi JD, Thanks for the reply. I have grepped the whole source code in head and did not find any driver code is using the si_refcount or si_usecount. Precisely I am working on driver. I have tested by using both the variables and observed that the si_refcount shows how many times a file descriptor has been opened. Looks like this variable is incremented when an FD is opened and decremented when the same FD is closed. But the si_usecount shows the number of open FD currently opened. Let=E2=80=99s say some app has come and opened a file but did not closed an= d exited. At this point the si_refcount shows 1 but the si_usecount shows 0. These are my observations yet. If you can point me some drivers using this reference count logic without using the si_refcount and si_usecount variables, that would be a great help= . Thanks, Sibananda Sahu *From:* JD [mailto:jd1008@gmail.com] *Sent:* Wednesday, November 05, 2014 6:16 AM *To:* Sibananda Sahu *Subject:* Re: Open file descriptor reference count implementation in drive= r Why dont you look at how other device drivers are using the refcount and user count? There plenty of examples in the source code. On Mon, Nov 3, 2014 at 11:58 PM, Sibananda Sahu < sibananda.sahu@avagotech.com> wrote: Hi, Can anybody suggest how can I implement the Open file descriptor reference count in a freebsd driver??? I have looked up at certain places in the cdev structure(sys/conf.h) and found two integer values: Int si_refcount; Int si_usecount; I think these are the stuffs useful for me. Can somebody explain what are the significance of the above mentioned integer values inside the cdev structure? Any help would be greatly appreciated. Thanks, Sibananda Sahu _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org= "