lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4886830b-73fe-47f5-9635-0f3910c8e205@intel.com>
Date: Wed, 3 Jul 2024 12:13:58 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Jiri Pirko <jiri@...nulli.us>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [RFC net-next] generate boilerplate impls such as
 devlink_resource_register()

Hi,

I have and idea that boilerplate devlink_ wrappers over devl_ functions
could be generated via short script, with the handcrafted .c code as the
only input. Take for example the following [one line] added to 
devlink/resource.c would replace the whole definition and kdoc, which 
would be placed in the generated file in about the same form as the
current code. This will be applied to all suitable functions of course.

The script will be short, but not so trivial to write it without prior
RFC. For those wondering if I don't have better things to do: yes, but
I have also some awk-time that will not be otherwise spend on more 
serious stuff anyway :)

[one line]
DEVLINK_GEN_SYMBOL_GPL(devlink_resource_register);

[removed part below]

/**
  *	devlink_resource_register - devlink resource register
  *
  *	@devlink: devlink
  *	@resource_name: resource's name
  *	@resource_size: resource's size
  *	@resource_id: resource's id
  *	@parent_resource_id: resource's parent id
  *	@size_params: size parameters
  *
  *	Generic resources should reuse the same names across drivers.
  *	Please see the generic resources list at:
  *	Documentation/networking/devlink/devlink-resource.rst
  *
  *	Context: Takes and release devlink->lock <mutex>.
  */
int devlink_resource_register(struct devlink *devlink,
			      const char *resource_name,
			      u64 resource_size,
			      u64 resource_id,
			      u64 parent_resource_id,
			      const struct devlink_resource_size_params *size_params)
{
	int err;

	devl_lock(devlink);
	err = devl_resource_register(devlink, resource_name, resource_size,
				     resource_id, parent_resource_id, size_params);
	devl_unlock(devlink);
	return err;
}
EXPORT_SYMBOL_GPL(devlink_resource_register);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ