Date: Wed, 2 Aug 2006 06:51:36 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 103000 for review Message-ID: <200608020651.k726pacq010894@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103000 Change 103000 by jb@jb_freebsd2 on 2006/08/02 06:51:30 Sync this file to the version in the dtrace tree. Affected files ... .. //depot/projects/kmacy_sun4v_stable/src/lib/libstand/ufs.c#2 edit Differences ... ==== //depot/projects/kmacy_sun4v_stable/src/lib/libstand/ufs.c#2 (text+ko) ==== @@ -92,6 +92,10 @@ #define COMPAT_UFS /* DUX has old format file systems */ #endif +/* +#define DEBUG 1 +*/ + static int ufs_open(const char *path, struct open_file *f); static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static int ufs_close(struct open_file *f); @@ -111,6 +115,7 @@ ufs_readdir }; +#if defined(__sparc64__) && defined(T1_SIMULATOR) typedef int32_t daddr32_t; typedef int32_t time32_t; typedef unsigned char uchar_t; @@ -238,6 +243,7 @@ uchar_t fs_space[1]; /* list of blocks for each rotation */ /* actually longer */ }; +#endif /* * In-core open file. @@ -277,6 +283,7 @@ * i_number. */ +#if defined(DEBUG) && DEBUG > 1 static void hdump(uint8_t *bp, int size) { int i; @@ -311,6 +318,7 @@ printf(" : %s\n", tmp); } } +#endif /* @@ -330,10 +338,12 @@ 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. @@ -580,7 +590,7 @@ file_block = lblkno(fs, fp->f_seekp); file_size = DIP(fp, di_size); block_size = sblksize(fs, file_size, file_block); -#if 0 +#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); @@ -589,11 +599,13 @@ 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) { block_size=8192; printf("FORCE ROUND block_size\n"); } -#if 0 +#endif +#ifdef DEBUG printf("\tfp->f_buf_blkno = 0x%lx\n", fp->f_buf_blkno); #endif if (file_block != fp->f_buf_blkno) { @@ -603,7 +615,7 @@ rc = block_map(f, file_block, &disk_block); if (rc) return (rc); -#if 0 +#ifdef DEBUG printf("\tblock_map : disk_block = 0x%lx\n", disk_block); #endif if (disk_block == 0) { @@ -611,7 +623,7 @@ fp->f_buf_size = block_size; } else { twiddle(); -#if 0 +#ifdef DEBUG printf("\tcalling dev_strategy for block read fsbtodb[0x%lx]=0x%lx\n", disk_block, fsbtodb(fs, disk_block)); #endif @@ -620,10 +632,12 @@ block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); -#if 0 +#ifdef DEBUG printf("\treturned from block read with 0x%lx bytes\n", fp->f_buf_size); +#if DEBUG > 1 hdump(fp->f_buf, fp->f_buf_size); #endif +#endif } fp->f_buf_blkno = file_block; @@ -646,6 +660,7 @@ return (0); } +#if defined(__sparc64__) && defined(T1_SIMULATOR) static void test_disk(struct open_file *f) { @@ -666,14 +681,15 @@ if (rc || read_size != 512) printf("strategy failed\n"); -#if 0 +#if defined(DEBUG) && DEBUG > 1 printf("%04d\n", i); hdump(buf, 512); -#endif - +#endif + } } +#endif static int search_directory(name, f, inumber_p) @@ -688,11 +704,11 @@ size_t buf_size; int namlen, length; int rc; -#if 0 +#if defined(__sparc64__) && defined(T1_SIMULATOR) test_disk(f); #endif length = strlen(name); -#if 0 +#ifdef DEBUG printf("search_directory: name=%s\n", name); #endif fp->f_seekp = 0; @@ -701,18 +717,18 @@ rc = buf_read_file(f, &buf, &buf_size); if (rc) return (rc); -#if 0 +#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; -#if 0 +#if defined(DEBUG) && DEBUG > 1 hdump(buf, buf_size); #endif while (dp < edp) { -#if 0 +#ifdef DEBUG printf("\tdirent# %d (dp=0x%llx edp=0x%llx\n", i, (uint64_t)dp, (uint64_t)edp); #endif @@ -724,7 +740,7 @@ else #endif namlen = dp->d_namlen; -#if 0 +#ifdef DEBUG printf("namlen: %d dp->d_name: %s\n", namlen, dp->d_name); #endif if (namlen == length && @@ -743,11 +759,12 @@ } 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; -#if 0 +#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", @@ -763,7 +780,7 @@ fsp->fs_qfmask = ((uint64_t)sfs.fs_qfmask.val[0]) << 32 | sfs.fs_qfmask.val[1]; } - +#endif @@ -811,7 +828,7 @@ -#if 0 +#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", @@ -829,7 +846,7 @@ rc = EINVAL; goto out; } -#if 1 +#if defined(__sparc64__) && defined(T1_SIMULATOR) map_sblock(fs); #endif /* @@ -852,7 +869,7 @@ goto out; } -#if 0 +#ifdef DEBUG printf("read root inode \n"); #endif cp = path = strdup(upath); @@ -901,8 +918,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608020651.k726pacq010894>