From owner-freebsd-emulation@FreeBSD.ORG Sat Jan 6 08:12:01 2007 Return-Path: X-Original-To: freebsd-emulation@freebsd.org Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 321E716A407 for ; Sat, 6 Jan 2007 08:12:01 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.235]) by mx1.freebsd.org (Postfix) with ESMTP id DEA3513C441 for ; Sat, 6 Jan 2007 08:12:00 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: by nz-out-0506.google.com with SMTP id i11so3328382nzh for ; Sat, 06 Jan 2007 00:12:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tSZIVYwA6ZfNwmiP13ZTfrFYSDNmK0w7VmednwjTgkXhhS+eG93jFkH0f7F7CaSvxAsDr9GfYIZHd3vircsjmXKfbYVJXG+icWu77nwTPtTjIYjNQFCCtAvMNEcj1ZPFPWg5DLIEqRa1OSqpvXF8iJxx6nmNx+7g2El1SFHT8XQ= Received: by 10.65.151.6 with SMTP id d6mr2465835qbo.1168071120253; Sat, 06 Jan 2007 00:12:00 -0800 (PST) Received: by 10.65.61.1 with HTTP; Sat, 6 Jan 2007 00:12:00 -0800 (PST) Message-ID: <790a9fff0701060012x40063f48pc842510b082df5a5@mail.gmail.com> Date: Sat, 6 Jan 2007 02:12:00 -0600 From: "Scot Hetzel" To: freebsd-emulation@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: linuxolator: proc/filesystems and sysfs function implementations X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jan 2007 08:12:01 -0000 While working on the proc/filesystems implementation, I noticed that the sysfs function also returns with similar results. I have implemented all 3 options used in the sysfs function, and they seem to pass most of the LTP tests (sysfs01-04, 06). sysfs05 crashes the system when it gets to the test with an invalid address. Currently, I am having a problem in returning EFAULT on an invalid address, a condensed version of the code, where I need this check is: int linux_sysfs(struct thread *td, struct linux_sysfs_args *args) { unsigned int index; char *name; switch (args->option) { case 1: name = (char *)(uintptr_t)args->arg1; /* XXX: check if name is invalid and return EFAULT */ : /* find the index for a given name */ break; case 2: index = args->arg1; buf = (char *)(uintptr_t)args->arg2; /* XXX: check if buf is invalid and return EFAULT */ : /* find the fs name using the index */ : /* XXX: Will this return EFAULT with an invalid buf [(char *)-1]? */ error = copyout(vfsp->vfc_name, buf, len); break; case 3: /* count the number of available fs */ : break; } return (error); } This implementation is using TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) to search the filesystem list (as suggested by Kostik). I also re-implemented the patch to linprocfs to use TAILQ_FOREACH(vfsp, &vfsconf, vfc_list), and implemented the freebsd_to_linux_fs function (translates a freebsd fs name to a linux fs name) in sys/compat/linprocfs/linprocfs.c. This function is needed by the sysfs implementation, and was wondering where the translation function, and the structure it returns should be placed so that it is accessable to both implementations (linux_sysfs, and linprocfs_dofilesystems). struct l_file_system_type { const char *name; int fs_flags; }; #define FS_REQUIRES_DEV 1 static void * freebsd_to_linux_fs(char *name, struct l_file_system_type *fs) { fs->name = name; fs->fs_flags = FS_REQUIRES_DEV; : /* Does fs require a dev entry? */ : /* Translate FreeBSD -> Linux fs name */ : } Scot -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.