Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DRBD: Users

Modifying drbd.c and drbdsetup.c to allow retrieving device config

 

 

DRBD users RSS feed   Index | Next | Previous | View Threaded


sharpe at example

Jul 6, 2000, 9:01 AM

Post #1 of 1 (224 views)
Permalink
Modifying drbd.c and drbdsetup.c to allow retrieving device config

Hi,

I am starting to use drbd, and noticed that there was no command to
retrieve the current config of a device.

I had in mind doing something like:

drbdsetup /dev/nb0

and getting the following listed:

Device Lower-device My Addr Remote Addr Other info
/dev/nb0 /dev/hda3 some.node.com node2.node.com xxx xxx xxx

The first thing I tried was adding an IOCTL that allowed me to GET_CONFIG,
and this all works. It was such a small piece of code, and I managed to not
crash my kernel.

However, I found that the lower-device that gets returned is the file
descriptor that drbdsetup got when opening the lower device to check that
it exists before doing the SET_CONFIG IOCTL. This is not very useful.

So, I figured that I need to change drbd.c some more, and then decided that
I better make suggestions here and ask question.

What I think I want to get back is the device number, i_dev which is
available in the inode for the device special file and which drdb stashes
away.

At first, I though of overwriting lower_device in drbd_conf[minor].conf
with inode->i_dev, but this seems wrong, as the info passed in changes when
the config is retrieved.

So, it seems to me that we need to change the meaning of lower_device in
the config that is passed in via the SET_CONFIG IOCTL. It should be a dev_t.

However, this means changes in drbd.c and drbdsetup.c ...

My next problem is, even if I retrieve the device id, and split it into a
major and minor device number, how do I translate that back into
/dev/[hs]d[a-z][0-9] etc?

I think I can open /proc/devices and rummage through it looking for the
name of the major device, and then look in /dev for the device with that
minor number.

Is there a better way to translate back from major, minor to a device
special file?




Regards
-------
Richard Sharpe, sharpe [at] example
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Co-author, SAMS Teach Yourself Samba in 24 Hours
Author: First Australian 5-day, intensive, hands-on Linux SysAdmin course
Author: First Australian 2-day, intensive, hands-on Samba course

DRBD users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.