From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 17 06:56:51 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 362131065671 for ; Thu, 17 Jul 2008 06:56:51 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.freebsd.org (Postfix) with ESMTP id E95408FC0A for ; Thu, 17 Jul 2008 06:56:50 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id 0B5C4520043 for ; Thu, 17 Jul 2008 08:29:13 +0200 (CEST) Received: from linux03.hob.de (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id A44E0FD594 for ; Thu, 17 Jul 2008 08:29:12 +0200 (CEST) From: Marc =?iso-8859-1?q?L=F6rner?= Organization: hob To: freebsd-hackers@freebsd.org Date: Thu, 17 Jul 2008 08:29:54 +0200 User-Agent: KMail/1.6.2 References: <002d01c8e79e$200078d0$60016a70$@de> In-Reply-To: <002d01c8e79e$200078d0$60016a70$@de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200807170829.55210.marc.loerner@hob.de> Subject: Re: reading a file in kernelmode X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2008 06:56:51 -0000 Hello David! On Thursday 17 July 2008 01:46, David wrote: > Hello, > > > > I'm developing a FreeBSD kernel module and I'm searching for a good > solution to open/read/close a file. > > My goal is to generate a MD5-Hash of a given file (path). > > > > Open-Syscall seems to be improper. > > > > Any ideas/solutions/examples? > Look at file kern/kern_ktrace.c at the use of vn_open in function ktrace(td, uap) and VOP_WRITE in function ktr_writerequest(struct thread *td, struct ktr_request *req) I think reading is done quite analogue to writing in case above. HTH, Marc