summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2006-10-10 21:25:54 +0000
committerJeremy Katz <katzj@redhat.com>2006-10-10 21:25:54 +0000
commitf76d6ac77102b8240a36c701a32748fa8ee6c5f6 (patch)
tree9ffe7e2207bf37984f34d613270c53cfa569c5bb /isys
parent97b7598200636d12032e2cc04e040cd85c0295e2 (diff)
downloadanaconda-f76d6ac77102b8240a36c701a32748fa8ee6c5f6.tar.gz
anaconda-f76d6ac77102b8240a36c701a32748fa8ee6c5f6.tar.xz
anaconda-f76d6ac77102b8240a36c701a32748fa8ee6c5f6.zip
2006-10-10 Jeremy Katz <katzj@redhat.com>
* lang-table: Add Telugu (#207428) * isys/eddsupport.c: Update from Rez Kabir AT dell to support specifying bios drive as long as a drive matches the signature and to fix problems with medium-less devices (#207331)
Diffstat (limited to 'isys')
-rw-r--r--isys/eddsupport.c98
1 files changed, 35 insertions, 63 deletions
diff --git a/isys/eddsupport.c b/isys/eddsupport.c
index 0615f2fc1..267fa1d93 100644
--- a/isys/eddsupport.c
+++ b/isys/eddsupport.c
@@ -43,6 +43,7 @@
#define HASH_TABLE_SIZE 17
+
struct diskMapEntry{
uint32_t key;
char *diskname;
@@ -64,9 +65,8 @@ static int insertHashItem(struct diskMapTable *, struct diskMapEntry *);
static struct diskMapEntry* lookupHashItem(struct diskMapTable *, uint32_t);
static int addToHashTable(struct diskMapTable *, uint32_t , char *);
static struct device ** createDiskList();
-static int mapBiosDisks(struct diskMapTable * , const char *);
+static int mapBiosDisks(struct device ** , const char *);
static int readDiskSig(char *, uint32_t *);
-static struct diskMapTable* uniqueSignatureExists(struct device **);
static int readMbrSig(char *, uint32_t *);
/* This is the top level function that creates a disk list present in the
@@ -77,7 +77,6 @@ static int readMbrSig(char *, uint32_t *);
int probeBiosDisks() {
struct device ** devices = NULL;
- struct diskMapTable *diskSigToName;
devices = createDiskList();
if(!devices){
@@ -87,18 +86,11 @@ int probeBiosDisks() {
return -1;
}
- if(!(diskSigToName = uniqueSignatureExists(devices))) {
-#ifdef STANDALONE
- fprintf(stderr, "WARNING: Unique disk signatures don't exist\n");
-#endif
- return -1;
- } else {
- if(!mapBiosDisks(diskSigToName, EDD_DIR)){
+ if(!mapBiosDisks(devices, EDD_DIR)){
#ifdef STANDALONE
fprintf(stderr, "WARNING: couldn't map BIOS disks\n");
#endif
return -1;
- }
}
return 0;
}
@@ -108,44 +100,6 @@ static struct device ** createDiskList(){
return probeDevices (CLASS_HD, BUS_UNSPEC, PROBE_ALL);
}
-static struct diskMapTable * uniqueSignatureExists(struct device **devices) {
- uint32_t current_sig, headsig;
- struct device **devhead, **devlist;
- int i;
- struct diskMapTable *hashTable;
-
- hashTable = initializeHashTable(HASH_TABLE_SIZE);
- if(!hashTable){
-#ifdef STANDALONE
- fprintf(stderr, "Error initializing diskSigToName table\n");
-#endif
- return NULL;
- }
-
- for (devhead = devices, i = 0; (*devhead) != NULL; devhead++, i++) {
- if (!(*devhead)->device)
- continue;
- if (readDiskSig((*devhead)->device, &headsig) < 0) {
- return NULL;
- }
-
- for (devlist = devhead + 1; (*devlist) != NULL; devlist++) {
- if (!(*devlist)->device) continue;
- if (readDiskSig((*devlist)->device, &current_sig) < 0)
- return NULL;
-
- if (headsig == current_sig)
- return NULL;
- }
-
- if(!addToHashTable(hashTable, headsig, (*devhead)->device))
- return NULL;
- }
-
- return hashTable;
-}
-
-
static int readDiskSig(char *device, uint32_t *disksig) {
int fd, rc;
@@ -154,12 +108,12 @@ static int readDiskSig(char *device, uint32_t *disksig) {
}
fd = open("/tmp/biosdev", O_RDONLY);
- if ((fd < 0) && (errno != -ENOMEDIUM)) {
-#ifdef STANDALONE
- fprintf(stderr, "Error opening devce %s: %s\n ", device,
+ if (fd < 0) {
+#ifdef STANDALONE
+ fprintf(stderr, "Error opening device %s: %s\n ", device,
strerror(errno));
-#endif
- return -1;
+#endif
+ return -errno;
}
rc = lseek(fd, MBRSIG_OFFSET, SEEK_SET);
@@ -188,13 +142,13 @@ static int readDiskSig(char *device, uint32_t *disksig) {
return 0;
}
-static int mapBiosDisks(struct diskMapTable* hashTable,const char *path) {
+static int mapBiosDisks(struct device** devices,const char *path) {
DIR *dirHandle;
struct dirent *entry;
char * sigFileName;
- uint32_t mbrSig, biosNum;
- struct diskMapEntry *hashItem;
- int ret;
+ uint32_t mbrSig, biosNum, currentSig;
+ struct device **currentDev, **foundDisk;
+ int i, rc, ret;
dirHandle = opendir(path);
if(!dirHandle){
@@ -222,13 +176,31 @@ static int mapBiosDisks(struct diskMapTable* hashTable,const char *path) {
sigFileName = malloc(strlen(path) + strlen(entry->d_name) + 20);
sprintf(sigFileName, "%s/%s/%s", path, entry->d_name, SIG_FILE);
if (readMbrSig(sigFileName, &mbrSig) == 0) {
- hashItem = lookupHashItem(hashTable, mbrSig);
- if (!hashItem)
- return 0;
+
+ for (currentDev = devices, i = 0, foundDisk=NULL; (*currentDev) != NULL && i<2; currentDev++) {
+ if (!(*currentDev)->device)
+ continue;
+
+ if ((rc=readDiskSig((*currentDev)->device, &currentSig)) < 0){
+ if (rc == -ENOMEDIUM)
+ continue;
+ return 0;
+ }
+
+
+ if (mbrSig == currentSig){
+ foundDisk=currentDev;
+ i++;
+ }
+ }
+
+ if (i==1){
if(!addToHashTable(mbrSigToName, (uint32_t)biosNum,
- hashItem->diskname))
+ (*foundDisk)->device))
return 0;
- }
+ }
+ }
+
}
closedir(dirHandle);
return 1;