1

It there a generic way to share a block or character device over network?

All related questions solved with specific answer like: if you want to share disk between host, use NFS, SMB, iSCSI, or AoE. If you want to share TV tuner or WebCam, stream them with mplayer or VLC. Or use USBIP if you want to relay local usb to another host.

But what if I want to share LPT, RS232, audio, mixer or TV tuner with capability to switch channel naturally (I mean relaying ioctl)?

I think it's a good solution for share any block or character based devices over network, to avoid various application specific solution.

Looks like it's not so difficult to achieve. The only tool doesn't included in linux "officially" is BUSE (Block device for UserSpacE).

This the only reason why this solution doesn't implemented or there is any other factor which can break functionality?

Dankó Dávid
  • 1,909
  • 1
  • 11
  • 6
  • Oh really ioctls can contains pointers which valid only in local address space... – Dankó Dávid Nov 07 '15 at 13:41
  • 2
    AT&T's Remote File Sharing (RFS) provided this capability (complete Unix file system semantics, including sharing special files, over the network). NFS proved more popular, and RFS stopped appearing in Solaris after 2.3. I don't know of any LInux ports or continuing development. I think you'll find this is easy to do 90% and very difficult to to the last 10%. – mpez0 Nov 07 '15 at 14:16

1 Answers1

1

You can share blocks with "nbd"

ls -l /dev/ | grep -e "^b"

I had succeded one to play sound over samba; it was a very long time ago, when sound was still using raw blocks (before ALSA became popular). So, samba may still work for some kind of things. IIRC, I have also been able to read CDROMs directly via samba, but from memory, writing CD failed.

I have no solution for chars.

LPT can not be shared over network because it uses DMA.

UART (serial) can, using NBD. You may need to locally mess the configuration of port; but the stream can travel over nbd.

For sound, before Alsa, Samba did it. There are various recent projects handling it; dmix hardly does it, but try JACK, NAS, Pulseaudio.

TV tuner, try samba, but expect a failure. Instead of trying to share the video device node, you would better try to share the USB device; in particular, "USB Wireless" project has implementations on Linux that can handle encapsulation over ethernet. Or USBIP. Sharing the device node if much harder.

Same answer for webcam, unless you try to share the video stream (vlc, mplayer, ffmpeg ...)