From 0f3ac480c76d4574b9274de22784e76fd627ad6a Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 25 Jan 2003 18:44:33 -0500 Subject: [PATCH] devname.c: Add support for EVMS to the blkid library. --- lib/blkid/ChangeLog | 2 ++ lib/blkid/devname.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index af99d46..cddfb50 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,5 +1,7 @@ 2003-01-25 Theodore Ts'o + * devname.c: Add support for EVMS + * blkid.h, cache.c, dev.c, devname.c, devno.c, probe.c, probe.h, read.c, resolve.c, save.c, tag.c: Fix gcc -Wall nits. diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c index cbbf50d..e1c2c1d 100644 --- a/lib/blkid/devname.c +++ b/lib/blkid/devname.c @@ -2,7 +2,7 @@ * devname.c - get a dev by its device inode name * * Copyright (C) Andries Brouwer - * Copyright (C) 1999, 2000, 2001 Theodore Ts'o + * Copyright (C) 1999, 2000, 2001, 2002, 2003 Theodore Ts'o * Copyright (C) 2001 Andreas Dilger * * %Begin-Header% @@ -234,6 +234,34 @@ exit: } #endif +#define PROC_EVMS_VOLUMES "/proc/evms/volumes" + +static int +evms_probe_all(blkid_cache **cache) +{ + char line[100]; + int ma, mi, sz, num = 0; + FILE *procpt; + char device[110]; + + procpt = fopen(PROC_EVMS_VOLUMES, "r"); + if (!procpt) + return 0; + while (fgets(line, sizeof(line), procpt)) { + if (sscanf (line, " %d %d %d %*s %*s %[^\n ]", + &ma, &mi, &sz, device) != 4) + continue; + + DBG(printf("Checking partition %s (%d, %d)\n", + device, ma, mi)); + + probe_one(*cache, device, ma, mi, sz << 10); + num++; + } + fclose(procpt); + return num; +} + /* * Read the device data for all available block devices in the system. */ @@ -255,6 +283,9 @@ int blkid_probe_all(blkid_cache **cache) time(0) - (*cache)->bic_time < BLKID_PROBE_INTERVAL) return 0; + if (evms_probe_all(cache)) + goto finish; + #ifdef VG_DIR lvm_probe_all(cache); #endif @@ -333,6 +364,7 @@ int blkid_probe_all(blkid_cache **cache) } fclose(proc); +finish: (*cache)->bic_time = time(0); (*cache)->bic_flags |= BLKID_BIC_FL_PROBED; -- 1.8.3.1