Re: Clarification regarding design of a device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi :)

On Fri, May 6, 2011 at 01:36, mindentropy <mindentropy@xxxxxxxxx> wrote:
>
> Sounds silly but how do I get access to the file descriptor?

to the best I know, kernel assign it for you and you access it from
the give file structure. For example, look at open handler
fs/proc/cpuinfo.c. You will see these:
static int cpuinfo_open(struct inode *inode, struct file *file)

Ok, I revise, perhaps not filedescriptor, but file structure itself.

> Also If I make the user create a session for an operation similar to this
> paper
> http://www.usenix.org/event/usenix03/tech/full_papers/keromytis/keromytis_html/node8.html#SECTION00042000000000000000,
> should I remove the read, write operations and do all operations using ioctl
> commands i.e. reading the user buffer etc?
>

There's a plus and minus of simply using ioctl for all read and write.
IMHO, ioctls are needed if you need various "sub command" toward the
device file, i.e if I took KVM for example: to setup new guest
structure, to ask for memory and so on. So, if you don't really need
to do such "extra" things, I believe it's better to still use
read/write handler for read/write operation.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux