From owner-freebsd-hackers@freebsd.org Tue Nov 10 07:54:18 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1940EA2A654 for ; Tue, 10 Nov 2015 07:54:18 +0000 (UTC) (envelope-from radovanovic@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4C6D127F for ; Tue, 10 Nov 2015 07:54:17 +0000 (UTC) (envelope-from radovanovic@gmail.com) Received: by wmww144 with SMTP id w144so63876922wmw.0 for ; Mon, 09 Nov 2015 23:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=P6xbWbeuBtRUB/H/8C5y3taZMlnvnUoxsVECiy0Eg5s=; b=Y2RQ/93X/dM1w710yJyyIOSP7L0Se7Ifhsw5UkeZRjZIAG44YQO4M2Lj75KOVF/CYy ul386I9MVQqQnS9/MIoI1SP8fuX0SmeCdGHTTzNPceaqc+Rz1+Ocai0FwrInuQE27rV2 J644TMGkcyqdFfRHTSwTCw94DLSow2naLxTic8LVJcXvrqyM271LFx7y53NAF5uS50dK lr9KENXPx/CsQR6cYk/2wxd08O0HkiC55gGbJJvh2+W9yxhCwXXP4CFmJtocmACAb+G5 LMQPryPT3GCsybITKmiwvHZumJ1t6zw5sulyl1uVxnL/B1fpoHnciShzoYgDYE5jL2LR 1OGw== X-Received: by 10.194.7.97 with SMTP id i1mr2552907wja.87.1447142055256; Mon, 09 Nov 2015 23:54:15 -0800 (PST) Received: from zmaj.softwarehood.com (93-87-243-129.dynamic.isp.telekom.rs. [93.87.243.129]) by smtp.googlemail.com with ESMTPSA id c1sm2033174wjf.19.2015.11.09.23.54.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Nov 2015 23:54:14 -0800 (PST) Message-ID: <5641A2A5.7070909@gmail.com> Date: Tue, 10 Nov 2015 08:54:13 +0100 From: Ivan Radovanovic User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130812 Thunderbird/17.0.8 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Subject: Detecting new file name after receiving kevent's NOTE_RENAME Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2015 07:54:18 -0000 What is the best practice for discovering new file name after receiving kevent(2) NOTE_RENAME on its descriptor? At the moment I am storing fileno from dirent(5) structure together with descriptor and name, and when I receive NOTE_RENAME I re-read directory and use it (fileno) to discover new name, but this obviously requires re-reading entire directory on each NOTE_RENAME. I am wondering is there some more clever way to get this new name (kernel is obviously aware of it, otherwise it couldn't notify descriptor about rename)? Kind regards, Ivan