~ubuntu-branches/ubuntu/dapper/linux-ntfs/dapper

« back to all changes in this revision

Viewing changes to libntfs/bootsect.c

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2005-11-08 20:20:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20051108202023-dpn4lutm8o0div8g
Tags: 1.12.1-1
* New upstream release (closes: #332930):
  - Fixed lots of memory leaks in the tools.
  - ntfsmount now uses the new API, and it has several fixes.
  - Support journals which have been modified by chkdsk.
  - New API for creating hard links, index handling, high-level creation and
    deletion of files and directories.
  - New utility ntfscmp (make extra) which compares two NTFS volumes and
    tell the differences. It's used for development, debugging, testing, etc.
  - Added robustness to several tools.
  - ntfsclone: fix saving by sectors during --rescue.
  - ntfsmount: Add 'locale' option and change interface to 'ntfsmount device
    mount_point'.
  - Fixed problem with kernel 2.4 and mkntfs.
  - Change ALL utilities to display the libntfs version they are running on.
    This should make debugging easier in the case that people are running
    mismatched utilities/library.
* This new release fixes problems with libfuse 2.4.0 (closes: #336357).
* Fixed a lot of typos in the manpages, kindly submitted by A Costa. Thanks!
  (closes: #336143, #336144, #336145, #336147, #336148).
* Fixed a couple of typos by me.
* debian/control: The SONAME of libntfs was bumped. Created new package
  (libntfs8) and removed the old one.
* debian/copyright: Updated the FSF postal address.
* Added debian/ntfsprogs.links in order to ship mkfs.ntfs and
  mount.ntfs-fuse.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project.
3
3
 *
4
 
 * Copyright (c) 2000-2004 Anton Altaparmakov
 
4
 * Copyright (c) 2000-2005 Anton Altaparmakov
 
5
 * Copyright (c)      2005 Yura Pakhuchiy
5
6
 *
6
7
 * This program/include file is free software; you can redistribute it and/or
7
8
 * modify it under the terms of the GNU General Public License as published
21
22
 
22
23
#include "config.h"
23
24
 
 
25
#ifdef HAVE_STDIO_H
24
26
#include <stdio.h>
 
27
#endif
 
28
#ifdef HAVE_STDLIB_H
25
29
#include <stdlib.h>
 
30
#endif
 
31
#ifdef HAVE_STRING_H
26
32
#include <string.h>
 
33
#endif
 
34
#ifdef HAVE_ERRNO_H
27
35
#include <errno.h>
 
36
#endif
28
37
 
29
38
#include "compat.h"
30
39
 
213
222
         * illegal, thus signed char is actually ok!
214
223
         */
215
224
        c = bs->clusters_per_mft_record;
216
 
        Dprintf("ClusterSize = 0x%x\n", vol->cluster_size);
 
225
        Dprintf("ClusterSize = 0x%x\n", (unsigned)vol->cluster_size);
217
226
        Dprintf("ClusterSizeBits = %u\n", vol->cluster_size_bits);
218
227
        Dprintf("ClustersPerMftRecord = 0x%x\n", c);
219
228
        /*
225
234
        if (c < 0)
226
235
                vol->mft_record_size = 1 << -c;
227
236
        else
228
 
                vol->mft_record_size = vol->cluster_size * c;
 
237
                vol->mft_record_size = c << vol->cluster_size_bits;
229
238
        if (vol->mft_record_size & (vol->mft_record_size - 1)) {
230
239
                Dprintf("Error: %s is not a valid NTFS partition! "
231
240
                                "mft_record_size is not a power of 2.\n",
233
242
                return -1;
234
243
        }
235
244
        vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1;
236
 
        Dprintf("MftRecordSize = 0x%x\n", vol->mft_record_size);
 
245
        Dprintf("MftRecordSize = 0x%x\n", (unsigned)vol->mft_record_size);
237
246
        Dprintf("MftRecordSizeBits = %u\n", vol->mft_record_size_bits);
 
247
        /* Same as above for INDX record. */
 
248
        c = bs->clusters_per_index_record;
 
249
        Dprintf("ClustersPerINDXRecord = 0x%x\n", c);
 
250
        if (c < 0)
 
251
                vol->indx_record_size = 1 << -c;
 
252
        else
 
253
                vol->indx_record_size = c << vol->cluster_size_bits;
 
254
        vol->indx_record_size_bits = ffs(vol->indx_record_size) - 1;
 
255
        Dprintf("INDXRecordSize = 0x%x\n", (unsigned)vol->indx_record_size);
 
256
        Dprintf("INDXRecordSizeBits = %u\n", vol->indx_record_size_bits);
238
257
        /*
239
258
         * Work out the size of the MFT mirror in number of mft records. If the
240
259
         * cluster size is less than or equal to the size taken by four mft