Date: Wed, 5 Nov 2014 12:09:41 +0530 From: Sibananda Sahu <sibananda.sahu@avagotech.com> To: JD <jd1008@gmail.com> Cc: freebsd-questions@freebsd.org Subject: RE: Open file descriptor reference count implementation in driver Message-ID: <1ab03c9bac878f437b205786d8304bd3@mail.gmail.com> In-Reply-To: <CAN2YBg78ucj2hBGHye9UN3-QFB0gT-o=dd4iynGet_sWZ5ABpQ@mail.gmail.com> References: <c1241e563944d7ec496c6c235f420b21@mail.gmail.com> <CAN2YBg78ucj2hBGHye9UN3-QFB0gT-o=dd4iynGet_sWZ5ABpQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <mrsas(4)> 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= "
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1ab03c9bac878f437b205786d8304bd3>