From owner-freebsd-current Tue Jun 27 8: 5:20 2000 Delivered-To: freebsd-current@freebsd.org Received: from cartier.cirx.org (cartier.cirx.org [211.72.15.243]) by hub.freebsd.org (Postfix) with ESMTP id 3D12D37C152 for ; Tue, 27 Jun 2000 08:05:03 -0700 (PDT) (envelope-from clive@cartier.cirx.org) Received: (from clive@localhost) by cartier.cirx.org (8.9.3/8.9.3) id XAA21221 for current@FreeBSD.ORG; Tue, 27 Jun 2000 23:04:57 +0800 (CST) (envelope-from clive) Date: Tue, 27 Jun 2000 23:04:56 +0800 From: Clive Lin To: FreeBSD current Subject: let badsect recog IFCHR in 5.0-C Message-ID: <20000627230456.A18587@cartier.cirx.org> Reply-To: Clive Lin Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline User-Agent: Mutt/1.2i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=bdiff --- 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; --wRRV7LY7NUeQGEoC-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message