From owner-freebsd-hackers@freebsd.org Mon Dec 16 20:00:26 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 898BA1CD6BE for ; Mon, 16 Dec 2019 20:00:26 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47cBvt340vz4GNN; Mon, 16 Dec 2019 20:00:26 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm1-x32b.google.com with SMTP id d73so638397wmd.1; Mon, 16 Dec 2019 12:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Ywit5cX5LQkdxQzpZcRMOuq1eeiTF7B4OLXDkx4rIuQ=; b=mdPw2bX1IVW2bmQ1R9DkK/YOW7NYgfZLka7bxeAPhbjD9hBYVmNxdY0O8g+1Wxj6Uk peNi3+7Bg59Kn2Avmm2Xj1ICwFg4Lk6hm8QTKPEWc96cHhyT9rdQHrNVx/YjCS+2dR/O 31pBGPzJ4iBx+Pu08qIW8jmhOY/5INqLFjk1i3xeUSLP+a6yageXzMz8m/jSWdkrI/ws Qlc7b/2LjjOrbnuqdDWDxXyn9xv0o1yvffAPnNr0aZcGrCEi99sZjyPZygXx8SQG1BpQ CdrBTUbQ0VEPT1QYfD06eEW/+RR4e4/CyBVFCUvTFmFYNlubiYUBKNNO+U2BC5xvNia+ 1m7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Ywit5cX5LQkdxQzpZcRMOuq1eeiTF7B4OLXDkx4rIuQ=; b=o08Z0NIqg1kax9VWpXMMbVGNuMury3CcYCBIl8cXBJhj4BOSDcRYp3YUhkiRJMN/ya Y8dbXun1Wi8CSL7e01FdTP0txEQ6Lt+Ai/DQvcj3h+VmXfCD3c0ZPidHRftzKXWKOc/O Ad4k20pKtX1983+EjhrzJQCc76HV1e6CVMuiRdjpjkec07Do5zXmGaG6g6mAvb9+y//G McQtdctBAYF40IK2/OSOlFeDVK2ymFdmimkaRcSNB2qd6O5ew+tCS0KHuXog6vpehg63 5ef/GgRI7Y40BkEQ80xxMNHPPhNLQf0lU1TMnOjQ5zYRehmj1w+rlgZGYB/XRxBThfdr PnCg== X-Gm-Message-State: APjAAAUVITwKU76ML9d9sY411/DN46KKgqS0lkhXInKzkT5ZNLmlAHB2 /ulokkhoRrX2EGqzy1yKSPtIq+Gt X-Google-Smtp-Source: APXvYqzMtMMOlhCMOhoRkZM8UzdTLzrE6el+JWjPZ8CPNxC8EGRbzjphijyEXFyxecxswUpN9JB61Q== X-Received: by 2002:a05:600c:2290:: with SMTP id 16mr820751wmf.93.1576526424027; Mon, 16 Dec 2019 12:00:24 -0800 (PST) Received: from ernst.home (p5B02358A.dip0.t-ipconnect.de. [91.2.53.138]) by smtp.gmail.com with ESMTPSA id 16sm487986wmi.0.2019.12.16.12.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2019 12:00:23 -0800 (PST) Date: Mon, 16 Dec 2019 21:00:16 +0100 From: Gary Jennejohn To: Ian Lepore Cc: "Kenneth M. Glassey" , "freebsd-hackers@FreeBSD.org" Subject: Re: How to compile 'struct module' usage? Message-ID: <20191216210016.15480d75@ernst.home> In-Reply-To: <4073d95a738cb52eba5c3426e767b7ac701e42cd.camel@freebsd.org> References: <4073d95a738cb52eba5c3426e767b7ac701e42cd.camel@freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47cBvt340vz4GNN X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2019 20:00:26 -0000 On Mon, 16 Dec 2019 11:01:16 -0700 Ian Lepore wrote: > On Mon, 2019-12-16 at 17:26 +0000, Kenneth M. Glassey wrote: > > Hello, I am doing some fiddling on a driver port and I am > > encountering > > a compilation error "incomplete definition of type struct module" > > concerning lines in the port source that access members of struct > > module, > > such as module->name. Looking into the issue, it seems that struct > > module > > is not defined in the headers, at least not in sys/module.h, but I > > did see > > some definitions in *.c files elsewhere. > > > > To check whether this was a problem specifically due to this driver, > > I > > made a simple module following one of the tutorials online and it > > compiled > > fine. I then added a line that accessed module->name and I got the > > compilation error. > > > > So how do we build a module to allow the use of the members of struct > > module? Is the struct module definition supposed to be constructed at > > compile time, and if so, how? Or is it verboten to access members of > > that > > struct? > > > > Thanks! > > > > Kenneth > > > > The definition of struct module is private by design. You need to use > the existing accessor functions such as module_getname(), > module_file(), etc (which are likely not well-documented anywhere, but > can be found in kern_module.c). > This is useful information, especially because the C-code _is_ the only documentation. There's a module_setspecific(), would be nice if there were also a module_getspecific(). But it looks like module_setspecific() is only there for kern_syscall_module_handler(). -- Gary Jennejohn