~ubuntu-branches/ubuntu/trusty/util-linux/trusty-proposed

« back to all changes in this revision

Viewing changes to libblkid/src/getsize.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2011-11-03 15:38:23 UTC
  • mto: (4.5.5 sid) (1.6.4)
  • mto: This revision was merged to the branch mainline in revision 85.
  • Revision ID: package-import@ubuntu.com-20111103153823-10sx16jprzxlhkqf
ImportĀ upstreamĀ versionĀ 2.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * getsize.c --- get the size of a partition.
 
3
 *
 
4
 * Copyright (C) 1995, 1995 Theodore Ts'o.
 
5
 * Copyright (C) 2010 Karel Zak <kzak@redhat.com>
 
6
 *
 
7
 * %Begin-Header%
 
8
 * This file may be redistributed under the terms of the
 
9
 * GNU Lesser General Public License.
 
10
 * %End-Header%
 
11
 */
 
12
 
 
13
#include <stdio.h>
 
14
#include <sys/stat.h>
 
15
#include <sys/types.h>
 
16
 
 
17
#include "blkidP.h"
 
18
 
 
19
/**
 
20
 * blkid_get_dev_size:
 
21
 * @fd: file descriptor
 
22
 *
 
23
 * Returns: size (in bytes) of the block device or size of the regular file or 0.
 
24
 */
 
25
blkid_loff_t blkid_get_dev_size(int fd)
 
26
{
 
27
        unsigned long long bytes;
 
28
 
 
29
        if (blkdev_get_size(fd, &bytes))
 
30
                return 0;
 
31
 
 
32
        return bytes;
 
33
}
 
34