From owner-svn-soc-all@FreeBSD.ORG Wed Jul 4 09:47:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D0EAE106566C for ; Wed, 4 Jul 2012 09:47:42 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 04 Jul 2012 09:47:42 +0000 Date: Wed, 04 Jul 2012 09:47:42 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120704094742.D0EAE106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238943 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 09:47:45 -0000 Author: oleksandr Date: Wed Jul 4 09:47:42 2012 New Revision: 238943 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238943 Log: fix style of return operator, add copyright, delete some unnecessary comments and funtion, add snprinf function, change vrele to udf_dispose_node in udf_release_system_nodes Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -521,7 +523,7 @@ *extres = ump->sparable_packet_size - lb_rel; return (0); case UDF_VTOP_TYPE_META : -printf("Metadata Partition Translated\n"); + /* printf("Metadata Partition Translated\n"); */ /* we have to look into the file's allocation descriptors */ /* use metadatafile allocation mutex */ @@ -668,7 +670,7 @@ ("Translate file extent " "failed: can't seek location\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); @@ -715,7 +717,7 @@ &t_ad, &transsec32, &translen); if (error) { UDF_UNLOCK_NODE(udf_node, 0); - return error; + return (error); } *lsector = transsec32; *maxblks = MIN(ext_remain, translen); @@ -724,12 +726,12 @@ DPRINTF(TRANSLATE, ("Translate file extend " "failed: bad flags %x\n", flags)); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -757,7 +759,7 @@ int slot, addr_type, icbflags; if (!udf_node) - return ENOENT; + return (ENOENT); KASSERT(num_lb > 0, "num_lb > 0"); @@ -779,7 +781,7 @@ if (addr_type == UDF_ICB_INTERN_ALLOC) { *map = UDF_TRANS_INTERN; UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } /* find first overlapping extent */ @@ -798,7 +800,7 @@ ("Translate file extent " "failed: can't seek location\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); flags = UDF_EXT_FLAGS(len); @@ -833,7 +835,7 @@ ("Translate file extent " "failed: past eof\n")); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } len = le32toh(s_ad.len); @@ -877,7 +879,7 @@ transsec = transsec32; if (error) { UDF_UNLOCK_NODE(udf_node, 0); - return error; + return (error); } while (overlap && num_lb && translen) { *map++ = transsec; @@ -890,7 +892,7 @@ ("Translate file extent " "failed: bad flags %x\n", flags)); UDF_UNLOCK_NODE(udf_node, 0); - return EINVAL; + return (EINVAL); } } if (num_lb == 0) @@ -902,7 +904,7 @@ } UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } #if 0 @@ -968,7 +970,7 @@ free(blob, M_UDFTEMP); *lbnumres = lb_num; - return 0; + return (0); } @@ -1107,7 +1109,7 @@ } DPRINTF(RESERVE, ("\tfound %d sequential free bits in bitmap\n", seq_free)); - return seq_free; + return (seq_free); } /* --------------------------------------------------------------------- */ @@ -1210,7 +1212,7 @@ } mutex_exit(&ump->allocate_mutex); - return error; + return (error); } @@ -1390,7 +1392,7 @@ #endif mutex_exit(&ump->allocate_mutex); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -1589,14 +1591,14 @@ /* scale down if needed and bail out when out of space */ if (to_trunc >= meta_free_lbs) - return num_lb; + return (num_lb); /* check extent of bits marked free at the end of the map */ bitmap = &ump->metadata_unalloc_bits; to_trunc = udf_bitmap_check_trunc_free(bitmap, to_trunc); to_trunc = unit * (to_trunc / unit); /* round down again */ if (to_trunc == 0) - return num_lb; + return (num_lb); DPRINTF(RESERVE, ("\ttruncating %d lbs from the metadata bitmap\n", to_trunc)); @@ -1658,8 +1660,8 @@ mutex_enter(&ump->allocate_mutex); if (to_trunc > num_lb) - return 0; - return num_lb - to_trunc; + return (0); + return (num_lb - to_trunc); } @@ -1802,16 +1804,16 @@ /* defines same space */ if (a1_flags != a2_flags) - return 1; + return (1); if (a1_flags != UDF_EXT_FREE) { /* the same partition */ if (a1_part != a2_part) - return 1; + return (1); /* a2 is successor of a1 */ if (a1_lbnum * lb_size + a1_len != a2_lbnum * lb_size) - return 1; + return (1); } /* merge as most from a2 if possible */ @@ -1825,10 +1827,10 @@ a2->loc.lb_num = le32toh(a2_lbnum); if (a2_len > 0) - return 1; + return (1); /* there is space over to merge */ - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2247,7 +2249,7 @@ *l_ad_p = le32toh(l_ad); } - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2779,7 +2781,7 @@ KASSERT(new_inflen == orig_inflen + size_diff); KASSERT(new_lbrec == orig_lbrec); KASSERT(new_lbrec == 0); - return 0; + return (0); } DPRINTF(ALLOC, ("\tCONVERT from internal\n")); @@ -2948,7 +2950,7 @@ KASSERT(new_inflen == orig_inflen + size_diff); KASSERT(new_lbrec == orig_lbrec); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -3051,7 +3053,7 @@ KASSERT(new_lbrec == orig_lbrec); KASSERT(new_lbrec == 0); - return 0; + return (0); } /* setup node cleanup extents copy space */ @@ -3210,7 +3212,7 @@ KASSERT(new_inflen == 0); KASSERT(new_lbrec == 0); - return 0; + return (0); } printf("UDF_SHRINK_NODE: could convert to internal alloc!\n"); @@ -3290,6 +3292,6 @@ KASSERT(new_inflen == orig_inflen - size_diff); - return error; + return (error); } #endif Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_filenames.c Wed Jul 4 09:47:42 2012 (r238943) @@ -44,20 +44,20 @@ if ((ch & 0xFFFFFF80) == 0) { if (*rrem < 1) - return 0; + return (0); n = 1; rp[0] = ch & 0x7F; } else if ((ch & 0xFFFFF800) == 0) { if (*rrem < 2) - return 0; + return (0); n = 2; rp[0] = 0xC0 | (ch >> 6); rp[1] = 0x80 | (0x3F & ch); } else if ((ch & 0xFFFF0000) == 0) { if (*rrem < 3) - return 0; + return (0); n = 3; rp[0] = 0xE0 | (ch >> 12); @@ -65,7 +65,7 @@ rp[2] = 0x80 | (0x3F & ch); } else if ((ch & 0xFFE00000) == 0) { if (*rrem < 4) - return 0; + return (0); n = 4; rp[0] = 0xF0 | (ch >> 18); @@ -74,12 +74,12 @@ rp[3] = 0x80 | (0x3F & ch); } else { /* do not convert points above 21 bits. */ - return 0; + return (0); } *rrem -= n; *result += n; - return n; + return (n); } static void Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c Wed Jul 4 09:47:42 2012 (r238943) @@ -53,7 +53,7 @@ while (n-- > 0) crc = crc_table[(crc>>8 ^ *s++) & 0xff] ^ (crc<<8); - return crc; + return (crc); } /* UNICODE Checksum */ @@ -69,7 +69,7 @@ crc = crc_table[(crc>>8 ^ (*s>>8)) & 0xff] ^ (crc<<8); crc = crc_table[(crc>>8 ^ (*s++ & 0xff)) & 0xff] ^ (crc<<8); } - return crc; + return (crc); } @@ -89,7 +89,7 @@ checksum += *data++; } - return checksum; + return (checksum); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2007, 2008 Reinoud Zandijk * All rights reserved. * @@ -282,13 +284,13 @@ if (addr_type == UDF_ICB_INTERN_ALLOC) { numb = min(length, file_size - fileblkoff); memcpy(blob, pos + fileblkoff, numb); - return error; + return (error); } while (length) { error = udf_bmap_translate(unode, fileblk, &lsect, &numlsect); if (error) - return error; + return (error); if (lsect == UDF_TRANS_ZERO) { numb = min(length, sector_size * numlsect - fileblkoff); @@ -297,14 +299,14 @@ blob += numb; fileblkoff = 0; } else if (lsect == UDF_TRANS_INTERN) { - return EDOOFUS; + return (EDOOFUS); } else { while (numlsect > 0) { if ((error = bread(devvp, lsect*blkinsect, sector_size, NOCRED, &bp)) != 0) { if (buf != NULL) brelse(bp); - return error; + return (error); } numb = min(length, sector_size - fileblkoff); @@ -344,7 +346,7 @@ &bp)) != 0) { if (buf != NULL) brelse(bp); - return error; + return (error); } bcopy(bp->b_data, blob, sector_size); @@ -440,7 +442,7 @@ /* return no error but with no dscrptr */ /* dispose first block */ free(dst, mtype); - return 0; + return (0); } } /* calculate descriptor size */ @@ -457,7 +459,7 @@ new_dst = realloc(dst, dscrlen, mtype, M_WAITOK); if (new_dst == NULL) { free(dst, mtype); - return ENOMEM; + return (ENOMEM); } dst = new_dst; @@ -475,7 +477,7 @@ } *dstp = dst; - return error; + return (error); } @@ -567,7 +569,7 @@ error = biowait(buf); putiobuf(buf); - return error; + return (error); } @@ -610,7 +612,7 @@ error = biowait(buf); putiobuf(buf); - return error; + return (error); } @@ -654,7 +656,7 @@ /* do the write and return no error */ udf_write_phys_buf(ump, what, buf); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -678,7 +680,7 @@ error = (strategy->create_logvol_dscr)(&args); *dscrptr = args.dscr; - return error; + return (error); } @@ -714,7 +716,7 @@ error = (strategy->read_logvol_dscr)(&args); *dscrptr = args.dscr; - return error; + return (error); } @@ -734,7 +736,7 @@ args.waitfor = waitfor; error = (strategy->write_logvol_dscr)(&args); - return error; + return (error); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -55,43 +57,8 @@ /* --------------------------------------------------------------------- */ -//#ifdef DEBUG #if 1 -#if 0 -static void -udf_dumpblob(boid *blob, uint32_t dlen) -{ - int i, j; - - printf("blob = %p\n", blob); - printf("dump of %d bytes\n", dlen); - - for (i = 0; i < dlen; i+ = 16) { - printf("%04x ", i); - for (j = 0; j < 16; j++) { - if (i+j < dlen) { - printf("%02x ", blob[i+j]); - } else { - printf(" "); - } - } - for (j = 0; j < 16; j++) { - if (i+j < dlen) { - if (blob[i+j]>32 && blob[i+j]! = 127) { - printf("%c", blob[i+j]); - } else { - printf("."); - } - } - } - printf("\n"); - } - printf("\n"); - Debugger(); -} -#endif - static void udf_dump_discinfo(struct udf_mount *ump) { @@ -112,8 +79,7 @@ printf("\tfst on last ses %d\n", di->first_track_last_session); printf("\tlst on last ses %d\n", di->last_track_last_session); printf("\tlink block penalty %d\n", di->link_block_penalty); -/* TODO: find analog function in Freebsd */ -// snprintb(bits, sizeof(bits), MMC_DFLAGS_FLAGBITS, di->disc_flags); + snprintf(bits, sizeof(bits), "%b\n", di->disc_flags, MMC_DFLAGS_FLAGBITS); printf("\tdisc flags %s\n", bits); printf("\tdisc id %x\n", di->disc_id); printf("\tdisc barcode %"PRIx64"\n", di->disc_barcode); @@ -121,11 +87,12 @@ printf("\tnum sessions %d\n", di->num_sessions); printf("\tnum tracks %d\n", di->num_tracks); -// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cur); + snprintf(bits, sizeof(bits), "%b\n", (int) di->mmc_cur, MMC_CAP_FLAGBITS); printf("\tcapabilities cur %s\n", bits); -// snprintb(bits, sizeof(bits), MMC_CAP_FLAGBITS, di->mmc_cap); + snprintf(bits, sizeof(bits), "%b\n", (int) di->mmc_cap, MMC_CAP_FLAGBITS); printf("\tcapabilities cap %s\n", bits); } + #if 0 static void udf_dump_trackinfo(struct mmc_trackinfo *trackinfo) @@ -135,11 +102,11 @@ if ((udf_verbose & UDF_DEBUG_VOLUMES) == 0) return; - printf("Trackinfo for track %d:\n", trackinfo->tracknr); + printf("Trackinfo for track %d:\n", trackinfo->tracknr); printf("\tsessionnr %d\n", trackinfo->sessionnr); printf("\ttrack mode %d\n", trackinfo->track_mode); printf("\tdata mode %d\n", trackinfo->data_mode); -// snprintb(bits, sizeof(bits), MMC_TRACKINFO_FLAGBITS, trackinfo->flags); + snprintf(bits, sizeof(bits), "%b\n", trackinfo->flags, MMC_TRACKINFO_FLAGBITS); printf("\tflags %s\n", bits); printf("\ttrack start %d\n", trackinfo->track_start); @@ -149,6 +116,7 @@ printf("\ttrack size %d\n", trackinfo->track_size); printf("\tlast recorded block %d\n", trackinfo->last_recorded); } + #endif #else #define udf_dump_discinfo(a); @@ -178,12 +146,7 @@ udf_dump_discinfo(ump); return (0); } -#if 0 - /* disc partition support */ - error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, td); - if (error) - return (ENODEV); -#endif + /* set up a disc info profile for partitions */ di->mmc_profile = 0x01; /* disc type */ di->mmc_class = MMC_CLASS_DISC; @@ -2061,7 +2024,7 @@ } check_name = "*UDF Metadata Partition"; if (strncmp(map_name, check_name, len) == 0) { - printf("*UDF Metadata Partition\n"); + /* printf("*UDF Metadata Partition\n"); */ pmap_type = UDF_VTOP_TYPE_META; n_meta++; ump->node_part = log_part; @@ -3374,7 +3337,6 @@ udf_read_rootdirs(struct udf_mount *ump) { union dscrptr *dscr; - /* struct udf_args *args = &ump->mount_args; */ struct mount *mp; struct vnode *rootdir_node, *streamdir_node; struct long_ad fsd_loc, *dir_loc; @@ -3463,7 +3425,7 @@ if (error) return (ENOENT); - /* aparently it read in fine */ + /* apparently it read in fine */ /* * Try the system stream directory; not very likely in the ones we @@ -3471,14 +3433,13 @@ */ dir_loc = &ump->fileset_desc->streamdir_icb; if (le32toh(dir_loc->len)) { - printf("udf_read_rootdirs: streamdir defined "); ino = udf_get_node_id(dir_loc); error = udf_vget(mp, ino, LK_EXCLUSIVE, &streamdir_node); if (error) { - printf("but error in streamdir reading\n"); + printf("udf_read_rootdirs: streamdir defined: but error in streamdir reading\n"); } else { - printf("but ignored\n"); /* + * printf("udf_read_rootdirs: streamdir defined: but ignored"); * TODO process streamdir `baddies' i.e. files we dont * want if R/W */ @@ -3519,8 +3480,6 @@ } ino = (blkn + 1) | (part << 29); - //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); - //printf("udf_get_node_id -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino); return (ino); } @@ -3538,8 +3497,6 @@ icbptr->loc.lb_num = htole32(blkn); icbptr->loc.part_num = htole16(part); - //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); - //printf("udf_get_node_longad -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino2); return (0); } Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -27,16 +29,16 @@ #include #include #include -#include /* needed by malloc.h */ +#include #include -#include /* printf */ -#include /* needed by namei.h */ +#include +#include #include -#include /* thread */ +#include #include #include -#include /* dev_ref */ -#include /* MODULE_VERSION */ +#include +#include #include #include #include @@ -129,15 +131,15 @@ /* VAT partition support */ if (ump->vat_node) - vrele(ump->vat_node->vnode); + udf_dispose_node(ump->vat_node); /* Metadata partition support */ if (ump->metadata_node) - vrele(ump->metadata_node->vnode); + udf_dispose_node(ump->metadata_node); if (ump->metadatamirror_node) - vrele(ump->metadatamirror_node->vnode); + udf_dispose_node(ump->metadatamirror_node); if (ump->metadatabitmap_node) - vrele(ump->metadatabitmap_node->vnode); + udf_dispose_node(ump->metadatabitmap_node); /* This flush should NOT write anything nor allow any node to remain */ if ((error = vflush(ump->vfs_mountp, 0, 0, curthread))) Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Wed Jul 4 07:42:12 2012 (r238942) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Wed Jul 4 09:47:42 2012 (r238943) @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2012 Oleksandr Dudinskyi + * Copyright (c) 2012 Will DeVries * Copyright (c) 2006, 2008 Reinoud Zandijk * All rights reserved. * @@ -31,14 +33,14 @@ #include #include #include -#include /* printf, bzero, etc */ -#include /* componentname */ -#include /* buf */ +#include +#include +#include #include #include #include #include -#include /* udf_pathconf */ +#include #include #include "ecma167-udf.h" @@ -888,7 +890,7 @@ } /* --------------------------------------------------------------------- */ -/* This is finished */ + static int udf_getattr(struct vop_getattr_args *ap) {