From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 7 04:58:27 2005 Return-Path: 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 0FAB016A4CE for ; Mon, 7 Feb 2005 04:58:27 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6164743D2D for ; Mon, 7 Feb 2005 04:58:25 +0000 (GMT) (envelope-from joseph.koshy@gmail.com) Received: by rproxy.gmail.com with SMTP id z35so669894rne for ; Sun, 06 Feb 2005 20:58:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=oj4iCmlCzu46AMDj/GXbekSjG2zTmhrdAV8T/VSj+hhYMxiNQvicW9tYJoQup4x8XcqcWsWy3wN/dDNu0Yx6sVs3z5RGQvaYTNJZbydBn+u+5vipoyvssCvlviJdZ/wdVypQVvOemKMVgaiUUcFGDcU9UXJ6AhYgM8JYkdM8H9s= Received: by 10.38.96.29 with SMTP id t29mr179822rnb; Sun, 06 Feb 2005 20:58:23 -0800 (PST) Received: by 10.38.209.12 with HTTP; Sun, 6 Feb 2005 20:58:23 -0800 (PST) Message-ID: <84dead720502062058551f61c2@mail.gmail.com> Date: Mon, 7 Feb 2005 04:58:23 +0000 From: Joseph Koshy To: Ashwin Chandra In-Reply-To: <4206008F.2060100@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <001301c50c3e$1a8003b0$58e243a4@ash> <4206008F.2060100@freebsd.org> cc: freebsd-hackers@freebsd.org Subject: Re: Opening and wriiting to file in Kern X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joseph Koshy List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2005 04:58:27 -0000 > If you mist do this, the general set of steps are: > > 1. use namei() to convert a pathname to a vnode > 2. Use vn_open(), vn_rdwr(), and vn_close() to operate on the vnode. > 3. Observe proper vnode locking and reference counting with vref(), > vn_lock(), and vput() Take a look at "sys/kern/kern_ktrace.c" or "sys/kern/kern_alq.c" for a template. -- FreeBSD Volunteer, http://people.freebsd.org/~jkoshy