Re: Closing enbd devices

[email protected] (Peter T. Breuer)
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
Dag Sverre Seljebotn <[email protected]> wrote:
> Thanks a lot for the information on how to disable the signature
> requirement, it does give me a working solution. However not a perfect
> one:
> 
> - The signature stuff is nice to have _while the connection is supposed
> to stay up_. I want closing down an nbd device to be a conscious
> decision done by the removable media service, the ability to reconnect
> is great to have.

Well, if you want to control it separately, you'll have to add an ioctl
or an extra function to the list of proc commands in procfns[]. That
line I quoted does the trick. You should see plenty of examples of how
to add ioctls or proc commands in the code. I'll be glad to help you.

> Perhaps, if the kernel needs the device present, it would be possible to
> keep it open from the kernel side, but report it closed to userspace?

The words open/closed are just labels. They don't mean anything much in
themselves. Open simply indicates that the device in question has gone
through setup, comnnection, etc. It is relatively difficult to get it
back to a clean state safely becuase of various races and the
difficulty of knowing if one really means to .. but I guess an explicit
close (i.e. back to initial state) can be done.

> implementation-wise. I am a coder but I have never touched kernel source
> more than briefly. Please enlighten me!

Well, I already said what needs to be done. Put that line I gave in a
new ioctl or a proc command. That will wipe the signature.

You might try the proc command first, since you don't need aything.
Just add your new entry to procfns[]. Model it on some of the other
functions in that table.

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.