From: <ga...@us...> - 2009-01-21 13:22:10
|
Revision: 4895 http://jnode.svn.sourceforge.net/jnode/?rev=4895&view=rev Author: galatnm Date: 2009-01-21 11:45:39 +0000 (Wed, 21 Jan 2009) Log Message: ----------- Style fixes. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-01-21 11:22:57 UTC (rev 4894) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HFSPlusDirectory.java 2009-01-21 11:45:39 UTC (rev 4895) @@ -35,42 +35,50 @@ } @Override - protected final FSEntry createDirectoryEntry(final String name) throws IOException { + protected final FSEntry createDirectoryEntry(final String name) + throws IOException { if (!canWrite()) { throw new ReadOnlyFileSystemException(); } - Superblock volumeHeader = ((HfsPlusFileSystem) getFileSystem()).getVolumeHeader(); - + Superblock volumeHeader = ((HfsPlusFileSystem) getFileSystem()) + .getVolumeHeader(); + Calendar now = Calendar.getInstance(); now.setTime(new Date()); - int macDate = (int) HFSUtils.getDate(now.getTimeInMillis() / 1000, true); - + int macDate = (int) HFSUtils + .getDate(now.getTimeInMillis() / 1000, true); + HFSUnicodeString dirName = new HFSUnicodeString(name); - CatalogThread thread = new CatalogThread(HfsPlusConstants.RECORD_TYPE_FOLDER_THREAD,this.folder.getFolderId(),dirName); - + CatalogThread thread = new CatalogThread( + HfsPlusConstants.RECORD_TYPE_FOLDER_THREAD, this.folder + .getFolderId(), dirName); + CatalogFolder newFolder = new CatalogFolder(); - newFolder.setFolderId(new CatalogNodeId(volumeHeader.getNextCatalogId())); + newFolder + .setFolderId(new CatalogNodeId(volumeHeader.getNextCatalogId())); newFolder.setCreateDate(macDate); newFolder.setContentModDate(macDate); newFolder.setAttrModDate(macDate); log.debug("New catalog folder :\n" + newFolder.toString()); - + CatalogKey key = new CatalogKey(this.folder.getFolderId(), dirName); log.debug("New catalog key :\n" + key.toString()); - - + LeafRecord folderRecord = new LeafRecord(key, newFolder.getBytes()); log.debug("New record folder :\n" + folderRecord.toString()); - - HFSPlusEntry newEntry = new HFSPlusEntry((HfsPlusFileSystem) getFileSystem(), null, this, name, folderRecord); + + HFSPlusEntry newEntry = new HFSPlusEntry( + (HfsPlusFileSystem) getFileSystem(), null, this, name, + folderRecord); volumeHeader.setFolderCount(volumeHeader.getFolderCount() + 1); log.debug("New volume header :\n" + volumeHeader.toString()); - + return newEntry; } @Override - protected final FSEntry createFileEntry(final String name) throws IOException { + protected final FSEntry createFileEntry(final String name) + throws IOException { throw new ReadOnlyFileSystemException(); } @@ -83,12 +91,16 @@ @Override protected final FSEntryTable readEntries() throws IOException { List<FSEntry> pathList = new LinkedList<FSEntry>(); - LeafRecord[] records = ((HfsPlusFileSystem) getFileSystem()).getCatalog().getRecords(folder.getFolderId()); + LeafRecord[] records = ((HfsPlusFileSystem) getFileSystem()) + .getCatalog().getRecords(folder.getFolderId()); for (LeafRecord rec : records) { if (rec.getType() == HfsPlusConstants.RECORD_TYPE_FOLDER || rec.getType() == HfsPlusConstants.RECORD_TYPE_FILE) { - String name = ((CatalogKey) rec.getKey()).getNodeName().getUnicodeString(); - HFSPlusEntry e = new HFSPlusEntry((HfsPlusFileSystem) getFileSystem(), null, this, name, rec); + String name = ((CatalogKey) rec.getKey()).getNodeName() + .getUnicodeString(); + HFSPlusEntry e = new HFSPlusEntry( + (HfsPlusFileSystem) getFileSystem(), null, this, name, + rec); pathList.add(e); } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-21 11:22:57 UTC (rev 4894) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java 2009-01-21 11:45:39 UTC (rev 4895) @@ -31,8 +31,8 @@ * @param type * @throws FileSystemException */ - public HfsPlusFileSystem(final Device device, final boolean readOnly, final HfsPlusFileSystemType type) - throws FileSystemException { + public HfsPlusFileSystem(final Device device, final boolean readOnly, + final HfsPlusFileSystemType type) throws FileSystemException { super(device, readOnly, type); } @@ -45,15 +45,19 @@ log.debug("Superblock informations:\n" + sb.toString()); if (!sb.isAttribute(HfsPlusConstants.HFSPLUS_VOL_UNMNT_BIT)) { - log.info(getDevice().getId() + " Filesystem has not been cleanly unmounted, mounting it readonly"); + log + .info(getDevice().getId() + + " Filesystem has not been cleanly unmounted, mounting it readonly"); setReadOnly(true); } if (sb.isAttribute(HfsPlusConstants.HFSPLUS_VOL_SOFTLOCK_BIT)) { - log.info(getDevice().getId() + " Filesystem is marked locked, mounting it readonly"); + log.info(getDevice().getId() + + " Filesystem is marked locked, mounting it readonly"); setReadOnly(true); } if (sb.isAttribute(HfsPlusConstants.HFSPLUS_VOL_JOURNALED_BIT)) { - log.info(getDevice().getId() + log + .info(getDevice().getId() + " Filesystem is journaled, write access is not supported. Mounting it readonly"); setReadOnly(true); } @@ -65,7 +69,8 @@ } @Override - protected final FSDirectory createDirectory(final FSEntry entry) throws IOException { + protected final FSDirectory createDirectory(final FSEntry entry) + throws IOException { HFSPlusEntry e = (HFSPlusEntry) entry; return new HFSPlusDirectory(e); } @@ -85,28 +90,34 @@ log.debug("Root entry : No record found."); return null; } + /* * (non-Javadoc) + * * @see org.jnode.fs.FileSystem#getFreeSpace() */ public final long getFreeSpace() { return sb.getFreeBlocks() * sb.getBlockSize(); } + /* * (non-Javadoc) + * * @see org.jnode.fs.FileSystem#getTotalSpace() */ public final long getTotalSpace() { return sb.getTotalBlocks() * sb.getBlockSize(); } + /* * (non-Javadoc) + * * @see org.jnode.fs.FileSystem#getUsableSpace() */ public final long getUsableSpace() { return -1; } - + public final Catalog getCatalog() { return catalog; } @@ -124,13 +135,15 @@ public void create(HFSPlusParams params) throws FileSystemException { sb = new Superblock(this, true); try { - params.initializeDefaultsValues(this.getApi().getLength(), this.getFSApi().getSectorSize()); + params.initializeDefaultsValues(this.getApi().getLength(), this + .getFSApi().getSectorSize()); sb.create(params); - //--- - long volumeBlockUsed = sb.getTotalBlocks() - sb.getFreeBlocks() - ((sb.getBlockSize() == 512)?2:1); - //--- + // --- + long volumeBlockUsed = sb.getTotalBlocks() - sb.getFreeBlocks() + - ((sb.getBlockSize() == 512) ? 2 : 1); + // --- log.debug("Write allocation bitmap bits to disk."); - //--- + // --- log.debug("Write volume header to disk."); this.getApi().write(1024, ByteBuffer.wrap(sb.getBytes())); flush(); Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java 2009-01-21 11:22:57 UTC (rev 4894) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogFolder.java 2009-01-21 11:45:39 UTC (rev 4895) @@ -40,30 +40,31 @@ } public final void setFolderId(CatalogNodeId folderId) { - System.arraycopy(folderId.getBytes(), 0, data, 8, folderId.getBytes().length); + System.arraycopy(folderId.getBytes(), 0, data, 8, + folderId.getBytes().length); } public final int getCreateDate() { return BigEndian.getInt32(data, 12); } - public void setCreateDate(int time){ + public void setCreateDate(int time) { BigEndian.setInt32(data, 12, time); } public final int getContentModDate() { return BigEndian.getInt32(data, 16); } - - public void setContentModDate(int time){ + + public void setContentModDate(int time) { BigEndian.setInt32(data, 16, time); } public final int getAttrModDate() { return BigEndian.getInt32(data, 20); } - - public void setAttrModDate(int time){ + + public void setAttrModDate(int time) { BigEndian.setInt32(data, 20, time); } @@ -76,11 +77,16 @@ s.append("Record type: ").append(getRecordType()).append("\n"); s.append("Valence: ").append(getValence()).append("\n"); s.append("Folder ID: ").append(getFolderId().getId()).append("\n"); - s.append("Creation Date :").append(HFSUtils.printDate(getCreateDate(), "EEE MMM d HH:mm:ss yyyy")).append("\n"); - s.append("Content Mod Date :").append(HFSUtils.printDate(getContentModDate(), "EEE MMM d HH:mm:ss yyyy")) - .append("\n"); - s.append("Attr Mod Date :").append(HFSUtils.printDate(getAttrModDate(), "EEE MMM d HH:mm:ss yyyy")).append( - "\n"); + s.append("Creation Date :").append( + HFSUtils.printDate(getCreateDate(), "EEE MMM d HH:mm:ss yyyy")) + .append("\n"); + s.append("Content Mod Date :").append( + HFSUtils.printDate(getContentModDate(), + "EEE MMM d HH:mm:ss yyyy")).append("\n"); + s.append("Attr Mod Date :") + .append( + HFSUtils.printDate(getAttrModDate(), + "EEE MMM d HH:mm:ss yyyy")).append("\n"); return s.toString(); } } Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2009-01-21 11:22:57 UTC (rev 4894) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2009-01-21 11:45:39 UTC (rev 4895) @@ -6,9 +6,9 @@ import org.jnode.util.BigEndian; public class CatalogKey extends AbstractKey { - - public final static int MAXIMUM_KEY_LENGTH = 516; - + + public static final int MAXIMUM_KEY_LENGTH = 516; + private int keyLength; private CatalogNodeId parentID; private HFSUnicodeString nodeName; @@ -61,7 +61,8 @@ if (o instanceof CatalogKey) { CatalogKey ck = (CatalogKey) o; if (getParentId().getId() == ck.getParentId().getId()) { - return nodeName.getUnicodeString().compareTo(ck.getNodeName().getUnicodeString()); + return nodeName.getUnicodeString().compareTo( + ck.getNodeName().getUnicodeString()); } else if (getParentId().getId() < ck.getParentId().getId()) { return -1; } else { @@ -76,7 +77,10 @@ StringBuffer s = new StringBuffer(); s.append("Key length: ").append(getKeyLength()).append(" "); s.append("Parent ID: ").append(getParentId().getId()).append(" "); - s.append("Node name: ").append((getNodeName() != null) ? getNodeName().getUnicodeString() : ""); + s.append("Node name: ") + .append( + (getNodeName() != null) ? getNodeName() + .getUnicodeString() : ""); return s.toString(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |