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

« back to all changes in this revision

Viewing changes to shlibs/mount/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 <stdlib.h>
15
 
#include <stdarg.h>
16
 
 
17
 
#include "mountP.h"
18
 
 
19
 
int libmount_debug_mask;
20
 
 
21
 
/**
22
 
 * mnt_init_debug:
23
 
 * @mask: debug mask (0xffff to enable full debuging)
24
 
 *
25
 
 * If the @mask is not specified then this function reads
26
 
 * LIBMOUNT_DEBUG environment variable to get the mask.
27
 
 *
28
 
 * Already initialized debugging stuff cannot be changed. It does not
29
 
 * have effect to call this function twice.
30
 
 */
31
 
void mnt_init_debug(int mask)
32
 
{
33
 
        if (libmount_debug_mask & MNT_DEBUG_INIT)
34
 
                return;
35
 
        if (!mask) {
36
 
                char *str = getenv("LIBMOUNT_DEBUG");
37
 
                if (str)
38
 
                        libmount_debug_mask = strtoul(str, 0, 0);
39
 
        } else
40
 
                libmount_debug_mask = mask;
41
 
 
42
 
        if (libmount_debug_mask)
43
 
                printf("libmount: debug mask set to 0x%04x.\n",
44
 
                                libmount_debug_mask);
45
 
        libmount_debug_mask |= MNT_DEBUG_INIT;
46
 
}