Control: tags -1 = moreinfo
On Mon, Dec 10, 2012 at 12:16:46AM +0000, Bhushan Jain wrote:
> Hi Frank,
> Attached is the patch integrating dmcrypt-get-device functionality with code
> in eject.c.
> Please let me know if you have any comments or suggestions on the patch.
> I have created this patch over the latest eject_2.1.5+deb1+cvs20081104-12
> version.
Hi.
I finally managed to test your patch but it didn't work for me. Two reasons:
1) a simple coding error:
+ sprintf(filename,"/sys/block/%s/dm/name",ent->d_name);
+ file = fopen(filename,"r");
+ if(fgets(name, sizeof(name), file) == 0)
+ {
[...]
+ }
+ FCLOSE(file);
+ /* Read the major:minor number for given device */
+ if(!strcmp(name,dev + devmapperlen))
This is never true. The string read by fgets (i.e. name) contains a trailing
newline.
dev does not. So the two strings never match.
+ {
2) but more importantly reading the major:minor from "dev" also doesn't work.
+ sprintf(filename,"/sys/block/%s/dev",ent->d_name);
+ file = fopen(filename,"r");
At least on my system this file always contains 254:0, not the major:minor of
the underlying device (which should be something like 8:XX usually). Does
this really work on your system?
The underlying device seems to be available in the /sys/block/dm-X/slaves/
folder though. Maybe we could read it from there?
Cheers,
Frank
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]