~ubuntu-branches/ubuntu/lucid/loop-aes-utils/lucid-security

« back to all changes in this revision

Viewing changes to partx/partx.c

  • Committer: Bazaar Package Importer
  • Author(s): Max Vozeler
  • Date: 2009-07-06 02:08:18 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090706020818-11pxao7bhgjenfv9
Tags: 2.15.1~rc1-2
Disable ncurses (--without-ncurses), not used in
mount/. Fixes FTBFS (closes: #535676).

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <linux/compiler.h>
43
43
#endif
44
44
#include <linux/blkpg.h>
45
 
#define BLKGETSIZE _IO(0x12,96)    /* return device size */
 
45
 
 
46
#include "blkdev.h"
46
47
 
47
48
#include "partx.h"
48
49
#include "crc32.h"
99
100
int
100
101
main(int argc, char **argv){
101
102
        int fd, fd2, c, i, j, k, n;
102
 
        long size;
 
103
        unsigned long long size;
103
104
        struct hd_geometry g;
104
105
        struct slice all;
105
106
        struct blkpg_ioctl_arg a;
240
241
        }
241
242
        all.start = g.start;
242
243
 
243
 
        if(ioctl(fd2, BLKGETSIZE, &size)) {
244
 
                perror("BLKGETSIZE");
 
244
        if (blkdev_get_sectors(fd2, &size) != 0) {
 
245
                perror("partx");
245
246
                exit(1);
246
247
        }
247
 
        all.size = size;
 
248
        all.size = (unsigned int) size;
248
249
 
249
250
        if (verbose)
250
251
                printf("device %s: start %d size %d\n",
350
351
static
351
352
struct block {
352
353
        unsigned int secnr;
353
 
        char *block;
 
354
        unsigned char *block;
354
355
        struct block *next;
355
356
} *blockhead;
356
357
 
357
 
char *
 
358
unsigned char *
358
359
getblock(int fd, unsigned int secnr) {
359
360
        struct block *bp;
360
361
 
367
368
        bp->secnr = secnr;
368
369
        bp->next = blockhead;
369
370
        blockhead = bp;
370
 
        bp->block = (char *) xmalloc(1024);
 
371
        bp->block = (unsigned char *) xmalloc(1024);
371
372
        if (read(fd, bp->block, 1024) != 1024) {
372
373
                fprintf(stderr, "read error, sector %d\n", secnr);
373
374
                bp->block = NULL;