Hi,

    Here is the diff for badsect(8) to recognize character device (IFCHR) 
rather than block device (IFBLK), since there's no block device in current.

    I don't know if there's any difference bewteen block and character
device. So, I surly don't know if this will screw up any disk. But, it
just works for me... hm.. I don't want to buy a new ata66 disk to replace
the old one, because my motherboard has only ata33 :-) 

    The old disk stores ports, src, obj, doc and some other data that could
be retrived back at any time. After makeing some large ports and the whole
doc/, I luckly see no more the HARD READ ERROR blk# ... messages. Though,
this doesn't mean this diff is right. May someone knows hard drive devices
well take a look at it ? Thanks.

Regards,
Clive
-- 
CirX - This site doesnt' exist.
9c  k9o h9 s1bg s1f, 7v  .y xqx a  sj m8r ffg1 vg5 a6 asox tmul h38 .
ant sj m8r ob ? 1fj mwby a1 tao vg5. soq df v ' .a. CirX.
--- badsect.c~  Tue Jun 27 22:30:57 2000
+++ badsect.c   Tue Jun 27 22:17:30 2000
@@ -118,11 +118,12 @@
                err(3, "%s", name);
        name_dir_end = name + strlen(name);
        while ((dp = readdir(dirp)) != NULL) {
+           if (dp->d_name[0]!='r') continue ; // look for /dev/r* only
                strcpy(name_dir_end, dp->d_name);
                if (lstat(name, &devstat) < 0)
                        err(4, "%s", name);
                if (stbuf.st_dev == devstat.st_rdev &&
-                   (devstat.st_mode & IFMT) == IFBLK)
+                   (devstat.st_mode & IFMT) == IFCHR)
                        break;
        }
        closedir(dirp);
@@ -135,8 +136,9 @@
         * Opening of a mounted on device is not allowed.
         * Attempt to open the raw device instead.
         */
-       memcpy(name_dir_end + 1, name_dir_end, strlen(name_dir_end) + 1);
-       *name_dir_end = 'r';
+       // un-needed.
+       // memcpy(name_dir_end + 1, name_dir_end, strlen(name_dir_end) + 1);
+       // *name_dir_end = 'r';
        if ((fsi = open(name, O_RDONLY)) < 0)
                err(6, "%s", name);
        fs = &sblock;

Reply via email to