Gerd Hoffmann <kra...@redhat.com> writes: > Hi, > >> Now let's take another step back: a character device is just a file. >> Why can't we use plain ChardevFile for it? > > It's not.
A Unix character device is a special file. > First, the file backend allows input and output being different files, > and the input file is optional. That doesn't make sense for the > parallel/serial port case. > > Second, it's actually more than a file. The guest can change device > parameters such as the baudrate on the virtual device and qemu will > apply those changes to the host device. > > IMO it is different enough to have its own type. Special files support some special operations. I didn't propose to drop support for the special operations and treat special files exactly like regular files. I asked whether we really need a completely separate way to configure them. The argument for separate configuration is file's capability to split input and output. Okay. But why nested discriminators? regular files: type=file serial : type=port, data.type=serial parallel : type=port, data.type=parallel Simpler, and closer to existing -chardev: regular files: type=file serial : type=serial parallel : type=parallel I also dislike the pointless '"data" : {}' required by type pty and null, but I can't figure out how to express 'void' in the schema. [...]