]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/lsblk.h
8817314afd9da1378f90b0a2258809c3ed1b868e
2 * Copyright (C) 2010-2018 Red Hat, Inc. All rights reserved.
3 * Written by Milan Broz <mbroz@redhat.com>
4 * Karel Zak <kzak@redhat.com>
6 #ifndef UTIL_LINUX_LSBLK_H
7 #define UTIL_LINUX_LSBLK_H
11 #include <sys/statvfs.h>
13 #include <libsmartcols.h>
18 #define LSBLK_DEBUG_INIT (1 << 1)
19 #define LSBLK_DEBUG_FILTER (1 << 2)
20 #define LSBLK_DEBUG_DEV (1 << 3)
21 #define LSBLK_DEBUG_CXT (1 << 4)
22 #define LSBLK_DEBUG_ALL 0xFFFF
24 UL_DEBUG_DECLARE_MASK(lsblk
);
25 #define DBG(m, x) __UL_DBG(lsblk, LSBLK_DEBUG_, m, x)
26 #define ON_DBG(m, x) __UL_DBG_CALL(lsblk, LSBLK_DEBUG_, m, x)
28 #define UL_DEBUG_CURRENT_MASK UL_DEBUG_MASK(lsblk)
32 struct libscols_table
*table
; /* output table */
33 struct libscols_column
*sort_col
;/* sort output by this column */
37 int flags
; /* LSBLK_* */
39 unsigned int all_devices
:1; /* print all devices, including empty */
40 unsigned int bytes
:1; /* print SIZE in bytes */
41 unsigned int inverse
:1; /* print inverse dependencies */
42 unsigned int nodeps
:1; /* don't print slaves/holders */
43 unsigned int scsi
:1; /* print only device with HCTL (SCSI) */
44 unsigned int paths
:1; /* print devnames with "/dev" prefix */
45 unsigned int sort_hidden
:1; /* sort column not between output columns */
46 unsigned int force_tree_order
:1;/* sort lines by parent->tree relation */
49 extern struct lsblk
*lsblk
; /* global handler */
52 struct blkdev_cxt
*parent
;
54 struct libscols_line
*scols_line
;
57 char *name
; /* kernel name in /sys/block */
58 char *dm_name
; /* DM name (dm/block) */
60 char *filename
; /* path to device node */
62 struct path_cxt
*sysfs
;
64 int partition
; /* is partition? TRUE/FALSE */
66 int probed
; /* already probed */
67 char *fstype
; /* detected fs, NULL or "?" if cannot detect */
68 char *uuid
; /* filesystem UUID (or stack uuid) */
69 char *ptuuid
; /* partition table UUID */
70 char *pttype
; /* partition table type */
71 char *label
; /* filesystem label */
72 char *parttype
; /* partition type UUID */
73 char *partuuid
; /* partition UUID */
74 char *partlabel
; /* partition label */
75 char *partflags
; /* partition flags */
76 char *wwn
; /* storage WWN */
77 char *serial
; /* disk serial number */
78 char *model
; /* disk model */
80 char *mountpoint
; /* device mountpoint */
81 struct statvfs fsstat
; /* statvfs() result */
83 int npartitions
; /* # of partitions this device has */
84 int nholders
; /* # of devices mapped directly to this device
85 * /sys/block/.../holders */
86 int nslaves
; /* # of devices this device maps to */
87 int maj
, min
; /* devno */
88 int discard
; /* supports discard */
90 uint64_t size
; /* device size */
92 unsigned int is_mounted
: 1;
96 extern void lsblk_mnt_init(void);
97 extern void lsblk_mnt_deinit(void);
99 extern char *lsblk_device_get_mountpoint(struct blkdev_cxt
*cxt
);
101 #endif /* UTIL_LINUX_LSBLK_H */