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

« back to all changes in this revision

Viewing changes to libmount/src/init.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
 * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
 
3
 *
 
4
 * This file may be redistributed under the terms of the
 
5
 * GNU Lesser General Public License.
 
6
 */
 
7
 
 
8
/**
 
9
 * SECTION: init
 
10
 * @title: Library initialization
 
11
 * @short_description: initialize debuging
 
12
 */
 
13
 
 
14
#include <stdarg.h>
 
15
 
 
16
#include "mountP.h"
 
17
 
 
18
int libmount_debug_mask;
 
19
 
 
20
/**
 
21
 * mnt_init_debug:
 
22
 * @mask: debug mask (0xffff to enable full debuging)
 
23
 *
 
24
 * If the @mask is not specified then this function reads
 
25
 * LIBMOUNT_DEBUG environment variable to get the mask.
 
26
 *
 
27
 * Already initialized debugging stuff cannot be changed. It does not
 
28
 * have effect to call this function twice.
 
29
 */
 
30
void mnt_init_debug(int mask)
 
31
{
 
32
        if (libmount_debug_mask & MNT_DEBUG_INIT)
 
33
                return;
 
34
        if (!mask) {
 
35
                char *str = getenv("LIBMOUNT_DEBUG");
 
36
                if (str)
 
37
                        libmount_debug_mask = strtoul(str, 0, 0);
 
38
        } else
 
39
                libmount_debug_mask = mask;
 
40
 
 
41
        if (libmount_debug_mask)
 
42
                printf("libmount: debug mask set to 0x%04x.\n",
 
43
                                libmount_debug_mask);
 
44
        libmount_debug_mask |= MNT_DEBUG_INIT;
 
45
}