To resource manager or not to resource manager

Hi Mario,

I was heckled by your good article about ressource managers, especially
for I2C subject. I’m writing a Modbus protocol manager. Modbus protocol,

is not so far from I2C (like every protocol). shortly:
-We address one device among 240.
-For each device, we can read/write in an area as:
*input_bits
*output_bits
*input_register
*ouput_register
*internal_register
at a specified address within the adressed area.

So we can do:
fd = open("/dev/Modbus1/slave_40/output_register", O_WR);
lseek(fd, pos, SEEK_SET);
write(fd, buffer, size);


I didn’t choose that way, I use the ressource manager to access to
several diagnosis pseudo-files like ./Modbus1/last_sended_frame for
example, and I prefered to use private messages for the protocole.

fd=open(POINT_ATTACHE, O_RDWR);

header.hdr.io_msg.type = _IO_MSG;
header.hdr.io_msg.combine_len = sizeof(header.hdr.io_msg);
header.hdr.io_msg.mgrid = _IOMGR_IO_MSG; /* resmgr identifier */
header.hdr.io_msg.subtype = MSG_PROTOCOLE;
header.msg_len = sizeof(Msg_protocole_t);

msg_envoi.num_esclave = 1;
msg_envoi.num_commande = FCT_WRITE_MOD;
msg_envoi.adr = atoi(argv[1]);
msg_envoi.nb_mots = atoi(argv[2]);
msg_envoi.buffer[0] = 0;

SETIOV(&siov[0], &header, sizeof(header_t));
SETIOV(&siov[1], &msg_envoi, sizeof(Msg_protocole_t));

MsgSendvs(fd, siov, 2, &msg_reponse, sizeof(msg_reponse));

The only reason is that I though that method was more efficient (maybe
less I/O messages) than using the resource manager way.
Could you give me your opinion on this arbitrary choice?

Thanks,
Alain.