From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 21 19:10:45 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F1DB16A41F for ; Thu, 21 Jul 2005 19:10:45 +0000 (GMT) (envelope-from igor.shmukler@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB6DD43D75 for ; Thu, 21 Jul 2005 19:10:33 +0000 (GMT) (envelope-from igor.shmukler@gmail.com) Received: by zproxy.gmail.com with SMTP id o1so36706nzf for ; Thu, 21 Jul 2005 12:10:31 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=q10kAIOoB6TwJY4GAkJr8JZoP+J3yc3jJhvVzLMocW4Iv53buKmTDRFgU011N9HrKmyjMS/auwTz5bVomvAAphHCpFT+VnJM/ZEqkUdZzKYOnfv/+EBetyRiYeJfr1Qs8cj6A6EVudB4/AeV1SUXjn5CUnSh7TIfPQahtfId5Yo= Received: by 10.36.129.16 with SMTP id b16mr1235566nzd; Thu, 21 Jul 2005 12:10:30 -0700 (PDT) Received: by 10.36.119.12 with HTTP; Thu, 21 Jul 2005 12:10:30 -0700 (PDT) Message-ID: <6533c1c9050721121030016b7d@mail.gmail.com> Date: Thu, 21 Jul 2005 15:10:30 -0400 From: Igor Shmukler To: fs@freebsd.org, hackers@freebsd.org, dillon@apollo.backplane.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Mailman-Approved-At: Fri, 22 Jul 2005 13:24:23 +0000 Cc: Subject: per file lock list X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Igor Shmukler List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2005 19:10:45 -0000 Hi, We have a question: how to get all POSIX locks for a given file? As far as I know, existing API does not allow to retrieve all file locks. Therefore, we need to use kernel internal structures to get all applied locks. Unfortunately, a head of list with file locks is attached to inode rather then vnode. As result, it is much harder to get the lock list head due to the need to know exact inode type that is hidden behind the vnode. Of course, the problem could be resolved in a hackish way: we may get the address of VOP_ADVLOCK() method and compare it with all known FS methods, that handles this VOP operation: (ufs_advlock, etc.) and therefore apply a proper type cast to vnode->v_data to get valid inode. However, this would be a last resort. So the question: is there an elegant way to get the lock list for a given f= ile? Thank you in advance.