From owner-p4-projects@FreeBSD.ORG Fri Jul 14 20:14:17 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F1B5816A4E2; Fri, 14 Jul 2006 20:14:16 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA27D16A4DA for ; Fri, 14 Jul 2006 20:14:16 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68ADC43D45 for ; Fri, 14 Jul 2006 20:14:16 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6EKEGSS037001 for ; Fri, 14 Jul 2006 20:14:16 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6EKEGgu036998 for perforce@freebsd.org; Fri, 14 Jul 2006 20:14:16 GMT (envelope-from jb@freebsd.org) Date: Fri, 14 Jul 2006 20:14:16 GMT Message-Id: <200607142014.k6EKEGgu036998@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 101594 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2006 20:14:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=101594 Change 101594 by jb@jb_freebsd2 on 2006/07/14 20:14:13 Merge kmacy's debugging printfs. Affected files ... .. //depot/projects/dtrace/src/lib/libstand/ufs.c#4 edit Differences ... ==== //depot/projects/dtrace/src/lib/libstand/ufs.c#4 (text+ko) ==== @@ -279,7 +279,7 @@ * i_number. */ -#if defined(__sparc64__) && defined(T1_SIMULATOR) +#ifdef DEBUG static void hdump(uint8_t *bp, int size) { int i; @@ -334,6 +334,13 @@ if (fs == NULL) panic("fs == NULL"); +#ifdef DEBUG + printf("read_inode : inumber=0x%llx fsba=0x%llx dba=0x%llx\n", + (uint64_t)inumber, + (uint64_t)ino_to_fsba(fs, inumber), + (uint64_t)fsbtodb(fs, ino_to_fsba(fs, inumber)) ); +#endif + /* * Read inode and save it. */ @@ -579,6 +586,14 @@ file_block = lblkno(fs, fp->f_seekp); file_size = DIP(fp, di_size); block_size = sblksize(fs, file_size, file_block); +#ifdef DEBUG + printf("buf_read_file: fs->f_seekp=0x%llx : off=0x%lx : file_block=0x%lx : block_size=0x%llx\n", + (uint64_t)fp->f_seekp, off, file_block, (uint64_t)block_size); + printf("\tfile_size=0x%llx : fs_bsize=0x%llx\n", (uint64_t)file_size, (uint64_t)fs->fs_bsize); + printf("fragroundup[blkoff[%lld]=%lld]=%lld\n", file_size, blkoff(fs, file_size), + fragroundup(fs, blkoff(fs, file_size))); + printf("fs->fs_qbmask=%llx fs->fs_qfmask=%llx fs->fs_fmask=%lx\n", fs->fs_qbmask, fs->fs_qfmask, fs->fs_fmask); +#endif #if defined(__sparc64__) && defined(T1_SIMULATOR) if (block_size > 8192) { @@ -586,6 +601,9 @@ printf("FORCE ROUND block_size\n"); } #endif +#ifdef DEBUG + printf("\tfp->f_buf_blkno = 0x%lx\n", fp->f_buf_blkno); +#endif if (file_block != fp->f_buf_blkno) { if (fp->f_buf == (char *)0) fp->f_buf = malloc(fs->fs_bsize); @@ -593,16 +611,27 @@ rc = block_map(f, file_block, &disk_block); if (rc) return (rc); +#ifdef DEBUG + printf("\tblock_map : disk_block = 0x%lx\n", disk_block); +#endif if (disk_block == 0) { bzero(fp->f_buf, block_size); fp->f_buf_size = block_size; } else { twiddle(); +#ifdef DEBUG + printf("\tcalling dev_strategy for block read fsbtodb[0x%lx]=0x%lx\n", + disk_block, fsbtodb(fs, disk_block)); +#endif rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); +#ifdef DEBUG + printf("\treturned from block read with 0x%lx bytes\n", fp->f_buf_size); + hdump(fp->f_buf, fp->f_buf_size); +#endif } fp->f_buf_blkno = file_block; @@ -646,6 +675,11 @@ if (rc || read_size != 512) printf("strategy failed\n"); +#ifdef DEBUG + printf("%04d\n", i); + hdump(buf, 512); +#endif + } } @@ -664,17 +698,34 @@ size_t buf_size; int namlen, length; int rc; +#if defined(__sparc64__) && defined(T1_SIMULATOR) + test_disk(f); +#endif length = strlen(name); +#ifdef DEBUG + printf("search_directory: name=%s\n", name); +#endif fp->f_seekp = 0; while (fp->f_seekp < DIP(fp, di_size)) { int i; rc = buf_read_file(f, &buf, &buf_size); if (rc) return (rc); +#ifdef DEBUG + printf("scan directory entries: @ 0x%llx (size=0x%llx)\n", + (uint64_t)buf, (uint64_t)buf_size); +#endif dp = (struct direct *)buf; edp = (struct direct *)(buf + buf_size); i = 0; +#ifdef DEBUG + hdump(buf, buf_size); +#endif while (dp < edp) { +#ifdef DEBUG + printf("\tdirent# %d (dp=0x%llx edp=0x%llx\n", i, + (uint64_t)dp, (uint64_t)edp); +#endif if (dp->d_ino == (ino_t)0) goto next; #if BYTE_ORDER == LITTLE_ENDIAN @@ -683,6 +734,9 @@ else #endif namlen = dp->d_namlen; +#ifdef DEBUG + printf("namlen: %d dp->d_name: %s\n", namlen, dp->d_name); +#endif if (namlen == length && !strcmp(name, dp->d_name)) { /* found entry */ @@ -699,19 +753,33 @@ } static int sblock_try[] = SBLOCKSEARCH; - #if defined(__sparc64__) && defined(T1_SIMULATOR) #define SOLARIS_SBLOCK_CONVERT 1 void map_sblock(struct fs *fsp) { struct solaris_fs sfs = *(struct solaris_fs *)fsp; +#ifdef DEBUG + printf("fbsd fs_qfmask offset %lx solaris fs_qfmask offset %lx\n", + offsetof(struct fs, fs_qfmask), offsetof(struct solaris_fs, fs_qfmask)); + printf("fbsd fs_qbmask offset %lx solaris fs_qbmask offset %lx\n", + offsetof(struct fs, fs_qbmask), offsetof(struct solaris_fs, fs_qbmask)); + + printf(" fsp->fs_qbmask: %llx = sfs.fs_qbmask %08lx%08lx;\n", + fsp->fs_qbmask, sfs.fs_qbmask.val[0], sfs.fs_qbmask.val[1]); + printf(" fsp->fs_qfmask: %llx = sfs.fs_qfmask %08lx%08lx;\n", + fsp->fs_qfmask, sfs.fs_qfmask.val[0], sfs.fs_qfmask.val[1]); +#endif fsp->fs_qbmask = ((uint64_t)sfs.fs_qbmask.val[0]) << 32 | sfs.fs_qbmask.val[1]; fsp->fs_qfmask = ((uint64_t)sfs.fs_qfmask.val[0]) << 32 | sfs.fs_qfmask.val[1]; } #endif + + + + /* * Open a file. */ @@ -751,6 +819,15 @@ if (rc) goto out; + + + +#ifdef DEBUG + printf("fs->fs_magic: %x fs->fs_bsize: %x fs->fs_sblockloc: %lx\n", + fs->fs_magic, fs->fs_bsize, fs->fs_sblockloc); + printf("sblock_try[i]: %x buf_size %lx\n", + sblock_try[i], buf_size); +#endif if ((fs->fs_magic == FS_UFS1_MAGIC || (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_sblockloc == sblock_try[i])) && @@ -786,6 +863,9 @@ goto out; } +#ifdef DEBUG + printf("read root inode \n"); +#endif cp = path = strdup(upath); if (path == NULL) { rc = ENOMEM; @@ -832,6 +912,10 @@ * symbolic link. */ parent_inumber = inumber; +#ifdef DEBUG + printf("-- searching %s @ inode = 0x%x - found @ 0x%x\n", + ncp, parent_inumber, inumber); +#endif rc = search_directory(ncp, f, &inumber); *cp = c; if (rc)