aajtak
aajtak

Reputation: 269

c device-driver files_ops struct fields

struct file_operations hello_fops = {
owner: THIS_MODULE,
read: hello_read,
write: hello_write,
ioctl: hello_ioctl,
open: hello_open,
release: hello_release,
};

Here what is the meaning of : after struct field i.e owner: Somewhere I 've also seen like .owner:=

Also how can I see what are the other available options for "owner". I want to give permissions to all to issue ioctl calls.

What is meaning of . here Can anybody explain this

Upvotes: 1

Views: 101

Answers (1)

ninjalj
ninjalj

Reputation: 43748

{.field=value}

is a C99-style initializer.

{field: value}

is a GCC-style initializer.

owner has nothing to do with permissions. Permissions are the normal file permissions, you may want to use an udev rule to set appropiate permissions. An ioctl call will typically require additional permissions, depending on its meaning, e.g: CAP_NET_ADMIN for some network relted ioctl's.

Upvotes: 3

Related Questions