flat assembler
Message board for the users of flat assembler.

Index > OS Construction > read/write/ioctl

Author
Thread Post new topic Reply to topic
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
what is the sense of distinguishing read/write/ioctl in device io?
why bother with read/write?

both linux and windows have this problem.
under windows, everything is accomplished by IRP requests.

why not define 'standard read' for ioctl code XX, standard write for code YY, and so on?

it would simplify kernel vrey much!

ok under windows they must maintain backward compatibility, but linux? why this isnt changed?
Post 25 Apr 2010, 15:14
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
yep.

for me the problem is not given.

i have two types of functions:
f.disk
f.disk use only a bios compatible code to say, read, or write.

f.DOSfile
f.DOSfile is separated for the moment, f.read and f.save.
both use the same parameter structure, then, i just have to change call pointer and have a read, or a write.

maybe the differenciation between R/W is because it is completely a different operation.

as an analogy, take a book, read it
or write it... what is the harder to do?
for machine it is the same, read is easy and not dangerous.
write is.
Post 25 Apr 2010, 16:44
View user's profile Send private message Visit poster's website Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
im talking about exactly same processing of it.

in windows, driver has DispatchXXX functions wich handle IRPs. write/read/ioctl is the same irp! only code differ, so dispatch function also must be diffrent.

why not make it only ioctl, and in ioctl handler lookup table to just jump to proper handler?

its few instructions more, and makes things much simplier.
Post 25 Apr 2010, 17:25
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
you can do it.

you should define an api for your "IOCTL" function that brings the possibility to support both R and W.
Post 25 Apr 2010, 19:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.