-
Notifications
You must be signed in to change notification settings - Fork 298
tools: Rename IPC functions to reduce misleading #6
base: master
Are you sure you want to change the base?
Conversation
In the Linux kernel source tree, there is one code formater script called Lindent. One blog: Lindent – amazing script for lazy C coder Another discussion on Lindent suggest us to use
By the way, perhaps I should just follow other kernel developers' current coding style. As an old phrase says "When in Rome, do as Romans do"... |
The function name like ipc_get_device() is a little bit misleading. To make the code more readable for new developers, here are some suggestions: * Rename ipc_get_device(&dev) to ipc_fetch_conf(&conf) because it only fetches the runtime configuations from kernel. * Funtion prototype ipc_set_device(struct wgdevice *dev) is changed to ipc_set_device(const struct wgdevice *newconf). Change the following IPC function names and parameters which used to be confusing: * ipc_set_device(dev) => ipc_set_device(newconf) * ipc_get_device(dev, interface) => ipc_fetch_conf(conf, interface) * kernel_set_device(dev) => kernel_set_device(newconf) * kernel_get_device(device, interface) => kernel_fetch_conf(conf, interface) * userspace_set_device(dev) => userspace_set_device(newconf) * userspace_get_device(out, interface) => userspace_fetch_conf(out, interface) Renamed local variable/parameter symbols: * In showconf_main(), show_main(): device => conf * In ipc_fetch_conf(), kernel_fetch_conf(), userspace_fetch_conf(): dev => conf * In ipc_set_device(), kernel_set_device(), userspace_set_device(): dev => newconf Added function: * free_conf(struct wgdevice *conf) Changed function prototypes: * int ipc_set_device(struct wgdevice *) => int ipc_set_device(const struct wgdevice *newconf) * int kernel_set_device(struct wgdevice *) => int kernel_set_device(const struct wgdevice *newconf) * int userspace_set_device(struct wgdevice *) => int userspace_set_device(const struct wgdevice *newconf) Note: This patch comes with no extra curly braces introduced. Signed-off-by: Liu Qun <[email protected]>
a163612
to
c35d63a
Compare
26f936d
to
20c713b
Compare
2a831c3
to
478b80a
Compare
814d7b7
to
a2512b1
Compare
44070b9
to
21c6bb5
Compare
6c8a36a
to
fffe613
Compare
a19c6b6
to
be09cf5
Compare
aca7328
to
c48a04f
Compare
The function name like ipc_get_device() is a little bit misleading.
To make the code more readable for new developers, here are some suggestions:
Change the following IPC function names and parameters which used to be confusing:
Renamed local variable/parameter symbols:
device => conf
dev => conf
dev => newconf
Added function:
Changed function prototypes:
=> int ipc_set_device(const struct wgdevice *newconf)
=> int kernel_set_device(const struct wgdevice *newconf)
=> int userspace_set_device(const struct wgdevice *newconf)
Note: This patch comes with no extra curly braces introduced.
-- Liu Qun