misc: Fix various typos
Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
This commit is contained in:
parent
d35df4db5b
commit
9e93004171
|
@ -529,7 +529,7 @@ static int is_freespace(struct cfdisk *cf, size_t i)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* converts libfdisk FDISK_ASKTYPE_MENU to cfdisk menu and returns user's
|
/* converts libfdisk FDISK_ASKTYPE_MENU to cfdisk menu and returns user's
|
||||||
* responseback to libfdisk
|
* response back to libfdisk
|
||||||
*/
|
*/
|
||||||
static int ask_menu(struct fdisk_ask *ask, struct cfdisk *cf)
|
static int ask_menu(struct fdisk_ask *ask, struct cfdisk *cf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -681,7 +681,7 @@ static int generic_menu_cb(struct fdisk_context **cxt0,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is fdisk frontend for GPT specific libfdisk functions that
|
* This is fdisk frontend for GPT specific libfdisk functions that
|
||||||
* are not expported by generic libfdisk API.
|
* are not exported by generic libfdisk API.
|
||||||
*/
|
*/
|
||||||
static int gpt_menu_cb(struct fdisk_context **cxt0,
|
static int gpt_menu_cb(struct fdisk_context **cxt0,
|
||||||
const struct menu *menu __attribute__((__unused__)),
|
const struct menu *menu __attribute__((__unused__)),
|
||||||
|
@ -777,7 +777,7 @@ static int gpt_menu_cb(struct fdisk_context **cxt0,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is fdisk frontend for MBR specific libfdisk functions that
|
* This is fdisk frontend for MBR specific libfdisk functions that
|
||||||
* are not expported by generic libfdisk API.
|
* are not exported by generic libfdisk API.
|
||||||
*/
|
*/
|
||||||
static int dos_menu_cb(struct fdisk_context **cxt0,
|
static int dos_menu_cb(struct fdisk_context **cxt0,
|
||||||
const struct menu *menu __attribute__((__unused__)),
|
const struct menu *menu __attribute__((__unused__)),
|
||||||
|
@ -942,7 +942,7 @@ static int sgi_menu_cb(struct fdisk_context **cxt0,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is fdisk frontend for BSD specific libfdisk functions that
|
* This is fdisk frontend for BSD specific libfdisk functions that
|
||||||
* are not expported by generic libfdisk API.
|
* are not exported by generic libfdisk API.
|
||||||
*/
|
*/
|
||||||
static int bsd_menu_cb(struct fdisk_context **cxt0,
|
static int bsd_menu_cb(struct fdisk_context **cxt0,
|
||||||
const struct menu *menu __attribute__((__unused__)),
|
const struct menu *menu __attribute__((__unused__)),
|
||||||
|
|
|
@ -736,7 +736,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
|
||||||
fputs(_(" -L, --color[=<when>] colorize output (auto, always or never)\n"), out);
|
fputs(_(" -L, --color[=<when>] colorize output (auto, always or never)\n"), out);
|
||||||
fprintf(out,
|
fprintf(out,
|
||||||
" %s\n", USAGE_COLORS_DEFAULT);
|
" %s\n", USAGE_COLORS_DEFAULT);
|
||||||
fputs(_(" -l, --list display partitions end exit\n"), out);
|
fputs(_(" -l, --list display partitions and exit\n"), out);
|
||||||
fputs(_(" -o, --output <list> output columns\n"), out);
|
fputs(_(" -o, --output <list> output columns\n"), out);
|
||||||
fputs(_(" -t, --type <type> recognize specified partition table type only\n"), out);
|
fputs(_(" -t, --type <type> recognize specified partition table type only\n"), out);
|
||||||
fputs(_(" -u, --units[=<unit>] display units: 'cylinders' or 'sectors' (default)\n"), out);
|
fputs(_(" -u, --units[=<unit>] display units: 'cylinders' or 'sectors' (default)\n"), out);
|
||||||
|
|
|
@ -89,7 +89,7 @@ static const char *really_wanted[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal structure for mount tabel entries.
|
* Internal structure for mount table entries.
|
||||||
*/
|
*/
|
||||||
struct fsck_fs_data
|
struct fsck_fs_data
|
||||||
{
|
{
|
||||||
|
@ -490,7 +490,7 @@ static void load_fs_info(void)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let's follow libmount defauls if $FSTAB_FILE is not specified
|
* Let's follow libmount defaults if $FSTAB_FILE is not specified
|
||||||
*/
|
*/
|
||||||
path = getenv("FSTAB_FILE");
|
path = getenv("FSTAB_FILE");
|
||||||
|
|
||||||
|
@ -1279,7 +1279,7 @@ static int check_all(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is for the bone-headed user who enters the root
|
* This is for the bone-headed user who enters the root
|
||||||
* filesystem twice. Skip root will skep all root entries.
|
* filesystem twice. Skip root will skip all root entries.
|
||||||
*/
|
*/
|
||||||
if (skip_root) {
|
if (skip_root) {
|
||||||
mnt_reset_iter(itr, MNT_ITER_FORWARD);
|
mnt_reset_iter(itr, MNT_ITER_FORWARD);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 09.11.91 - made the first rudimetary functions
|
* 09.11.91 - made the first rudimentary functions
|
||||||
*
|
*
|
||||||
* 10.11.91 - updated, does checking, no repairs yet.
|
* 10.11.91 - updated, does checking, no repairs yet.
|
||||||
* Sent out to the mailing-list for testing.
|
* Sent out to the mailing-list for testing.
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 19.04.92 - Had to start over again from this old version, as a
|
* 19.04.92 - Had to start over again from this old version, as a
|
||||||
* kernel bug ate my enhanced fsck in february.
|
* kernel bug ate my enhanced fsck in February.
|
||||||
*
|
*
|
||||||
* 28.02.93 - added support for different directory entry sizes..
|
* 28.02.93 - added support for different directory entry sizes..
|
||||||
*
|
*
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
#define ROOT_INO 1
|
#define ROOT_INO 1
|
||||||
#define YESNO_LENGTH 64
|
#define YESNO_LENGTH 64
|
||||||
|
|
||||||
/* Global variables used in minix_programs.h inline fuctions */
|
/* Global variables used in minix_programs.h inline functions */
|
||||||
int fs_version = 1;
|
int fs_version = 1;
|
||||||
char *super_block_buffer;
|
char *super_block_buffer;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Old version would die on largish filesystems. Change to mmap the
|
* Old version would die on largish filesystems. Change to mmap the
|
||||||
* files one by one instaed of all simultaneously. - aeb, 2002-11-01
|
* files one by one instead of all simultaneously. - aeb, 2002-11-01
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
#define DEFAULT_FS_VERSION 1
|
#define DEFAULT_FS_VERSION 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables used in minix_programs.h inline fuctions
|
* Global variables used in minix_programs.h inline functions
|
||||||
*/
|
*/
|
||||||
int fs_version = DEFAULT_FS_VERSION;
|
int fs_version = DEFAULT_FS_VERSION;
|
||||||
char *super_block_buffer;
|
char *super_block_buffer;
|
||||||
|
@ -571,7 +571,7 @@ static void setup_tables(const struct fs_control *ctl) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform a test of a block; return the number of
|
* Perform a test of a block; return the number of
|
||||||
* blocks readable/writeable.
|
* blocks readable/writable.
|
||||||
*/
|
*/
|
||||||
static size_t do_check(const struct fs_control *ctl, char * buffer, int try, unsigned int current_block) {
|
static size_t do_check(const struct fs_control *ctl, char * buffer, int try, unsigned int current_block) {
|
||||||
ssize_t got;
|
ssize_t got;
|
||||||
|
@ -767,7 +767,7 @@ int main(int argc, char ** argv)
|
||||||
case '1':
|
case '1':
|
||||||
fs_version = 1;
|
fs_version = 1;
|
||||||
break;
|
break;
|
||||||
case 'v': /* kept for backwards compatiblitly */
|
case 'v': /* kept for backwards compatibility */
|
||||||
warnx(_("-v is ambiguous, use '-2' instead"));
|
warnx(_("-v is ambiguous, use '-2' instead"));
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case '2':
|
case '2':
|
||||||
|
|
|
@ -124,7 +124,7 @@ static void set_uuid_and_label(const struct mkswap_control *ctl)
|
||||||
warnx(_("Label was truncated."));
|
warnx(_("Label was truncated."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* report resuls */
|
/* report results */
|
||||||
if (ctl->uuid || ctl->opt_label) {
|
if (ctl->uuid || ctl->opt_label) {
|
||||||
if (ctl->opt_label)
|
if (ctl->opt_label)
|
||||||
printf("LABEL=%s, ", ctl->hdr->volume_name);
|
printf("LABEL=%s, ", ctl->hdr->volume_name);
|
||||||
|
|
|
@ -101,7 +101,7 @@ struct sfdisk {
|
||||||
struct fdisk_partition *orig_pa; /* -N <partno> before the change */
|
struct fdisk_partition *orig_pa; /* -N <partno> before the change */
|
||||||
|
|
||||||
unsigned int verify : 1, /* call fdisk_verify_disklabel() */
|
unsigned int verify : 1, /* call fdisk_verify_disklabel() */
|
||||||
quiet : 1, /* suppres extra messages */
|
quiet : 1, /* suppress extra messages */
|
||||||
interactive : 1, /* running on tty */
|
interactive : 1, /* running on tty */
|
||||||
noreread : 1, /* don't check device is in use */
|
noreread : 1, /* don't check device is in use */
|
||||||
force : 1, /* do also stupid things */
|
force : 1, /* do also stupid things */
|
||||||
|
@ -866,7 +866,7 @@ static int command_delete(struct sfdisk *sf, int argc, char **argv)
|
||||||
if (sf->backup)
|
if (sf->backup)
|
||||||
backup_partition_table(sf, devname);
|
backup_partition_table(sf, devname);
|
||||||
|
|
||||||
/* delate all */
|
/* delete all */
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
size_t nparts = fdisk_get_npartitions(sf->cxt);
|
size_t nparts = fdisk_get_npartitions(sf->cxt);
|
||||||
for (i = 0; i < nparts; i++) {
|
for (i = 0; i < nparts; i++) {
|
||||||
|
@ -907,7 +907,7 @@ static int command_reorder(struct sfdisk *sf, int argc, char **argv)
|
||||||
if (sf->backup)
|
if (sf->backup)
|
||||||
backup_partition_table(sf, devname);
|
backup_partition_table(sf, devname);
|
||||||
|
|
||||||
if (fdisk_reorder_partitions(sf->cxt) == 1) /* unchnaged */
|
if (fdisk_reorder_partitions(sf->cxt) == 1) /* unchanged */
|
||||||
rc = fdisk_deassign_device(sf->cxt, 1);
|
rc = fdisk_deassign_device(sf->cxt, 1);
|
||||||
else
|
else
|
||||||
rc = write_changes(sf);
|
rc = write_changes(sf);
|
||||||
|
@ -1782,7 +1782,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
|
||||||
fputs(_(" -J, --json <dev> dump partition table in JSON format\n"), out);
|
fputs(_(" -J, --json <dev> dump partition table in JSON format\n"), out);
|
||||||
fputs(_(" -g, --show-geometry [<dev> ...] list geometry of all or specified devices\n"), out);
|
fputs(_(" -g, --show-geometry [<dev> ...] list geometry of all or specified devices\n"), out);
|
||||||
fputs(_(" -l, --list [<dev> ...] list partitions of each device\n"), out);
|
fputs(_(" -l, --list [<dev> ...] list partitions of each device\n"), out);
|
||||||
fputs(_(" -F, --list-free [<dev> ...] list unpartitions free areas of each device\n"), out);
|
fputs(_(" -F, --list-free [<dev> ...] list unpartitioned free areas of each device\n"), out);
|
||||||
fputs(_(" -r, --reorder <dev> fix partitions order (by start offset)\n"), out);
|
fputs(_(" -r, --reorder <dev> fix partitions order (by start offset)\n"), out);
|
||||||
fputs(_(" -s, --show-size [<dev> ...] list sizes of all or specified devices\n"), out);
|
fputs(_(" -s, --show-size [<dev> ...] list sizes of all or specified devices\n"), out);
|
||||||
fputs(_(" -T, --list-types print the recognized types (see -X)\n"), out);
|
fputs(_(" -T, --list-types print the recognized types (see -X)\n"), out);
|
||||||
|
@ -1816,7 +1816,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
|
||||||
fputs(_(" -o, --output <list> output columns\n"), out);
|
fputs(_(" -o, --output <list> output columns\n"), out);
|
||||||
fputs(_(" -q, --quiet suppress extra info messages\n"), out);
|
fputs(_(" -q, --quiet suppress extra info messages\n"), out);
|
||||||
fputs(_(" -w, --wipe <mode> wipe signatures (auto, always or never)\n"), out);
|
fputs(_(" -w, --wipe <mode> wipe signatures (auto, always or never)\n"), out);
|
||||||
fputs(_(" -W, --wipe-partitons <mode> wipe signatures from new partitions (auto, always or never)\n"), out);
|
fputs(_(" -W, --wipe-partitions <mode> wipe signatures from new partitions (auto, always or never)\n"), out);
|
||||||
fputs(_(" -X, --label <name> specify label type (dos, gpt, ...)\n"), out);
|
fputs(_(" -X, --label <name> specify label type (dos, gpt, ...)\n"), out);
|
||||||
fputs(_(" -Y, --label-nested <name> specify nested label type (dos, bsd)\n"), out);
|
fputs(_(" -Y, --label-nested <name> specify nested label type (dos, bsd)\n"), out);
|
||||||
fputs(USAGE_SEPARATOR, out);
|
fputs(USAGE_SEPARATOR, out);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#define UL_COLOR_WHITE "\033[1;37m"
|
#define UL_COLOR_WHITE "\033[1;37m"
|
||||||
|
|
||||||
|
|
||||||
/* maximal lenght of human readable name of ESC seq. */
|
/* maximal length of human readable name of ESC seq. */
|
||||||
#define UL_COLORNAME_MAXSZ 32
|
#define UL_COLORNAME_MAXSZ 32
|
||||||
|
|
||||||
extern const char *color_sequence_from_colorname(const char *str);
|
extern const char *color_sequence_from_colorname(const char *str);
|
||||||
|
|
|
@ -66,7 +66,7 @@ extern int __cpuset_count_s(size_t setsize, const cpu_set_t *set);
|
||||||
#define cpuset_nbits(setsize) (8 * (setsize))
|
#define cpuset_nbits(setsize) (8 * (setsize))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The @idx parametr returns an index of the first mask from @ary array where
|
* The @idx parameter returns an index of the first mask from @ary array where
|
||||||
* the @cpu is set.
|
* the @cpu is set.
|
||||||
*
|
*
|
||||||
* Returns: 0 if found, otherwise 1.
|
* Returns: 0 if found, otherwise 1.
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* subsystem names (e.g. "LIBMOUNT_DEBUG=options,tab"). In this case is
|
* subsystem names (e.g. "LIBMOUNT_DEBUG=options,tab"). In this case is
|
||||||
* necessary to define mask names array. This functionality is optional.
|
* necessary to define mask names array. This functionality is optional.
|
||||||
*
|
*
|
||||||
* It's stringly recommended to use UL_* macros to define/declare/use
|
* It's strongly recommended to use UL_* macros to define/declare/use
|
||||||
* the debug stuff.
|
* the debug stuff.
|
||||||
*
|
*
|
||||||
* See disk-utils/cfdisk.c: cfdisk_init_debug() for programs debug
|
* See disk-utils/cfdisk.c: cfdisk_init_debug() for programs debug
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* plymouth-ctrl.h Header file for communcations with plymouthd
|
* plymouth-ctrl.h Header file for communications with plymouthd
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016 SUSE Linux GmbH, All rights reserved.
|
* Copyright (c) 2016 SUSE Linux GmbH, All rights reserved.
|
||||||
* Copyright (c) 2016 Werner Fink <werner@suse.de>
|
* Copyright (c) 2016 Werner Fink <werner@suse.de>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unfortunately, Linux kernel hedeader file <linux/magic.h> is incomplete
|
* Unfortunately, Linux kernel header file <linux/magic.h> is incomplete
|
||||||
* mess and kernel returns by statfs f_type many numbers that are nowhere
|
* mess and kernel returns by statfs f_type many numbers that are nowhere
|
||||||
* specified (in API).
|
* specified (in API).
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,7 +97,7 @@ extern int sysfs_scsi_path_contains(struct sysfs_cxt *cxt, const char *pattern);
|
||||||
*
|
*
|
||||||
* Linux kernel linux/drivers/base/core.c: device_get_devnode()
|
* Linux kernel linux/drivers/base/core.c: device_get_devnode()
|
||||||
* defines a replacement of '!' in the /sys device name by '/' in the
|
* defines a replacement of '!' in the /sys device name by '/' in the
|
||||||
* /dev device name. This helper replaces all ocurrences of '!' in
|
* /dev device name. This helper replaces all occurrences of '!' in
|
||||||
* @name by '/' to convert from /sys to /dev.
|
* @name by '/' to convert from /sys to /dev.
|
||||||
*/
|
*/
|
||||||
static inline void sysfs_devname_sys_to_dev(char *name)
|
static inline void sysfs_devname_sys_to_dev(char *name)
|
||||||
|
|
|
@ -253,7 +253,7 @@ int blkdev_is_misaligned(int fd)
|
||||||
if (ioctl(fd, BLKALIGNOFF, &aligned) < 0)
|
if (ioctl(fd, BLKALIGNOFF, &aligned) < 0)
|
||||||
return 0; /* probably kernel < 2.6.32 */
|
return 0; /* probably kernel < 2.6.32 */
|
||||||
/*
|
/*
|
||||||
* Note that kernel returns -1 as alignement offset if no compatible
|
* Note that kernel returns -1 as alignment offset if no compatible
|
||||||
* sizes and alignments exist for stacked devices
|
* sizes and alignments exist for stacked devices
|
||||||
*/
|
*/
|
||||||
return aligned != 0 ? 1 : 0;
|
return aligned != 0 ? 1 : 0;
|
||||||
|
|
|
@ -67,7 +67,7 @@ static int is_dm_devname(char *canonical, char **name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function does not cannonicalize the path! It just prepends CWD before a
|
* This function does not canonicalize the path! It just prepends CWD before a
|
||||||
* relative path. If the path is no relative than returns NULL. The path does
|
* relative path. If the path is no relative than returns NULL. The path does
|
||||||
* not have to exist.
|
* not have to exist.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -265,7 +265,7 @@ static int colors_readdir(struct ul_color_ctl *cc, const char *dirname)
|
||||||
&tk_term, &tk_termsz, &type) != 0)
|
&tk_term, &tk_termsz, &type) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* count teoretical score before we check names to avoid
|
/* count theoretical score before we check names to avoid
|
||||||
* unnecessary strcmp() */
|
* unnecessary strcmp() */
|
||||||
if (tk_name)
|
if (tk_name)
|
||||||
score += 20;
|
score += 20;
|
||||||
|
@ -400,7 +400,7 @@ static int cn_sequence(const char *str, char **seq)
|
||||||
*out++ = '#'; /* Hash mark */
|
*out++ = '#'; /* Hash mark */
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
*out++ = '?'; /* Qestion mark */
|
*out++ = '?'; /* Question mark */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*out++ = *in;
|
*out++ = *in;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* order from highest-order term to lowest-order term. UARTs transmit
|
* order from highest-order term to lowest-order term. UARTs transmit
|
||||||
* characters in order from LSB to MSB. By storing the CRC this way,
|
* characters in order from LSB to MSB. By storing the CRC this way,
|
||||||
* we hand it to the UART in the order low-byte to high-byte; the UART
|
* we hand it to the UART in the order low-byte to high-byte; the UART
|
||||||
* sends each low-bit to hight-bit; and the result is transmission bit
|
* sends each low-bit to high-bit; and the result is transmission bit
|
||||||
* by bit from highest- to lowest-order term without requiring any bit
|
* by bit from highest- to lowest-order term without requiring any bit
|
||||||
* shuffling on our part. Reception works similarly.
|
* shuffling on our part. Reception works similarly.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This is callback solution for systems without nl_langinfo(), this function
|
* This is callback solution for systems without nl_langinfo(), this function
|
||||||
* returns hardcoded and on locale setting independed value.
|
* returns hardcoded and on locale setting indepndent value.
|
||||||
*
|
*
|
||||||
* See langinfo.h man page for more details.
|
* See langinfo.h man page for more details.
|
||||||
*
|
*
|
||||||
|
|
|
@ -857,7 +857,7 @@ int loopcxt_get_backing_inode(struct loopdev_cxt *lc, ino_t *ino)
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
* - kernels < 3.2 support partitioned loop devices and PT scanning
|
* - kernels < 3.2 support partitioned loop devices and PT scanning
|
||||||
* only if max_part= module paremeter is non-zero
|
* only if max_part= module parameter is non-zero
|
||||||
*
|
*
|
||||||
* - kernels >= 3.2 always support partitioned loop devices
|
* - kernels >= 3.2 always support partitioned loop devices
|
||||||
*
|
*
|
||||||
|
@ -889,7 +889,7 @@ int loopmod_supports_partscan(void)
|
||||||
* @lc: context
|
* @lc: context
|
||||||
*
|
*
|
||||||
* Returns: 1 if the partscan flags is set *or* (for old kernels) partitions
|
* Returns: 1 if the partscan flags is set *or* (for old kernels) partitions
|
||||||
* scannig is enabled for all loop devices.
|
* scanning is enabled for all loop devices.
|
||||||
*/
|
*/
|
||||||
int loopcxt_is_partscan(struct loopdev_cxt *lc)
|
int loopcxt_is_partscan(struct loopdev_cxt *lc)
|
||||||
{
|
{
|
||||||
|
@ -1168,7 +1168,7 @@ static int loopcxt_check_size(struct loopdev_cxt *lc, int file_fd)
|
||||||
|
|
||||||
if (expected_size != size) {
|
if (expected_size != size) {
|
||||||
DBG(CXT, ul_debugobj(lc, "warning: loopdev and expected "
|
DBG(CXT, ul_debugobj(lc, "warning: loopdev and expected "
|
||||||
"size dismatch (%ju/%ju)",
|
"size mismatch (%ju/%ju)",
|
||||||
size, expected_size));
|
size, expected_size));
|
||||||
|
|
||||||
if (loopcxt_set_capacity(lc)) {
|
if (loopcxt_set_capacity(lc)) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* plymouth-ctrl.c Simply communcations with plymouthd
|
* plymouth-ctrl.c Simply communications with plymouthd
|
||||||
* to avoid forked sub processes and/or
|
* to avoid forked sub processes and/or
|
||||||
* misssed plymouth send commands tool
|
* missed plymouth send commands tool
|
||||||
* due a plymouthd replacment.
|
* due a plymouthd replacement.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016 SUSE Linux GmbH, All rights reserved.
|
* Copyright (c) 2016 SUSE Linux GmbH, All rights reserved.
|
||||||
* Copyright (c) 2016 Werner Fink <werner@suse.de>
|
* Copyright (c) 2016 Werner Fink <werner@suse.de>
|
||||||
|
|
|
@ -44,7 +44,7 @@ static int do_scale_by_power (uintmax_t *x, int base, int power)
|
||||||
* for example:
|
* for example:
|
||||||
* 10KB = 10000
|
* 10KB = 10000
|
||||||
*
|
*
|
||||||
* The optinal 'power' variable returns number associated with used suffix
|
* The optional 'power' variable returns number associated with used suffix
|
||||||
* {K,M,G,T,P,E,Z,Y} = {1,2,3,4,5,6,7,8}.
|
* {K,M,G,T,P,E,Z,Y} = {1,2,3,4,5,6,7,8}.
|
||||||
*
|
*
|
||||||
* The function also supports decimal point, for example:
|
* The function also supports decimal point, for example:
|
||||||
|
|
|
@ -623,7 +623,7 @@ static char *get_subsystem(char *chain, char *buf, size_t bufsz)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns complete path to the device, the patch contains all all sybsystems
|
* Returns complete path to the device, the patch contains all all subsystems
|
||||||
* used for the device.
|
* used for the device.
|
||||||
*/
|
*/
|
||||||
char *sysfs_get_devchain(struct sysfs_cxt *cxt, char *buf, size_t bufsz)
|
char *sysfs_get_devchain(struct sysfs_cxt *cxt, char *buf, size_t bufsz)
|
||||||
|
@ -741,7 +741,7 @@ static int get_dm_wholedisk(struct sysfs_cxt *cxt, char *diskname,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns by @diskdevno whole disk device devno and (optionaly) by
|
* Returns by @diskdevno whole disk device devno and (optionally) by
|
||||||
* @diskname the whole disk device name.
|
* @diskname the whole disk device name.
|
||||||
*/
|
*/
|
||||||
int sysfs_devno_to_wholedisk(dev_t dev, char *diskname,
|
int sysfs_devno_to_wholedisk(dev_t dev, char *diskname,
|
||||||
|
@ -758,7 +758,7 @@ int sysfs_devno_to_wholedisk(dev_t dev, char *diskname,
|
||||||
/*
|
/*
|
||||||
* Extra case for partitions mapped by device-mapper.
|
* Extra case for partitions mapped by device-mapper.
|
||||||
*
|
*
|
||||||
* All regualar partitions (added by BLKPG ioctl or kernel PT
|
* All regular partitions (added by BLKPG ioctl or kernel PT
|
||||||
* parser) have the /sys/.../partition file. The partitions
|
* parser) have the /sys/.../partition file. The partitions
|
||||||
* mapped by DM don't have such file, but they have "part"
|
* mapped by DM don't have such file, but they have "part"
|
||||||
* prefix in DM UUID.
|
* prefix in DM UUID.
|
||||||
|
|
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[])
|
||||||
devname = argv[1];
|
devname = argv[1];
|
||||||
pr = blkid_new_probe_from_filename(devname);
|
pr = blkid_new_probe_from_filename(devname);
|
||||||
if (!pr)
|
if (!pr)
|
||||||
err(EXIT_FAILURE, "%s: faild to create a new libblkid probe",
|
err(EXIT_FAILURE, "%s: failed to create a new libblkid probe",
|
||||||
devname);
|
devname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[])
|
||||||
devname = argv[1];
|
devname = argv[1];
|
||||||
pr = blkid_new_probe_from_filename(devname);
|
pr = blkid_new_probe_from_filename(devname);
|
||||||
if (!pr)
|
if (!pr)
|
||||||
err(EXIT_FAILURE, "%s: faild to create a new libblkid probe",
|
err(EXIT_FAILURE, "%s: failed to create a new libblkid probe",
|
||||||
devname);
|
devname);
|
||||||
/* Binary interface */
|
/* Binary interface */
|
||||||
ls = blkid_probe_get_partitions(pr);
|
ls = blkid_probe_get_partitions(pr);
|
||||||
|
|
|
@ -32,7 +32,7 @@ int main(int argc, char *argv[])
|
||||||
devname = argv[1];
|
devname = argv[1];
|
||||||
pr = blkid_new_probe_from_filename(devname);
|
pr = blkid_new_probe_from_filename(devname);
|
||||||
if (!pr)
|
if (!pr)
|
||||||
err(EXIT_FAILURE, "%s: faild to create a new libblkid probe",
|
err(EXIT_FAILURE, "%s: failed to create a new libblkid probe",
|
||||||
devname);
|
devname);
|
||||||
|
|
||||||
/* enable topology probing */
|
/* enable topology probing */
|
||||||
|
|
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[])
|
||||||
devname = argv[1];
|
devname = argv[1];
|
||||||
pr = blkid_new_probe_from_filename(devname);
|
pr = blkid_new_probe_from_filename(devname);
|
||||||
if (!pr)
|
if (!pr)
|
||||||
err(EXIT_FAILURE, "%s: faild to create a new libblkid probe",
|
err(EXIT_FAILURE, "%s: failed to create a new libblkid probe",
|
||||||
devname);
|
devname);
|
||||||
/*
|
/*
|
||||||
* Binary interface
|
* Binary interface
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct blkid_struct_dev
|
||||||
struct list_head bid_devs; /* All devices in the cache */
|
struct list_head bid_devs; /* All devices in the cache */
|
||||||
struct list_head bid_tags; /* All tags for this device */
|
struct list_head bid_tags; /* All tags for this device */
|
||||||
blkid_cache bid_cache; /* Dev belongs to this cache */
|
blkid_cache bid_cache; /* Dev belongs to this cache */
|
||||||
char *bid_name; /* Device real pathn (as used in cache) */
|
char *bid_name; /* Device real path (as used in cache) */
|
||||||
char *bid_xname; /* Device path as used by application (maybe symlink..) */
|
char *bid_xname; /* Device path as used by application (maybe symlink..) */
|
||||||
char *bid_type; /* Preferred device TYPE */
|
char *bid_type; /* Preferred device TYPE */
|
||||||
int bid_pri; /* Device priority */
|
int bid_pri; /* Device priority */
|
||||||
|
@ -187,7 +187,7 @@ struct blkid_struct_probe
|
||||||
unsigned int blkssz; /* sector size (BLKSSZGET ioctl) */
|
unsigned int blkssz; /* sector size (BLKSSZGET ioctl) */
|
||||||
mode_t mode; /* struct stat.sb_mode */
|
mode_t mode; /* struct stat.sb_mode */
|
||||||
|
|
||||||
int flags; /* private libray flags */
|
int flags; /* private library flags */
|
||||||
int prob_flags; /* always zeroized by blkid_do_*() */
|
int prob_flags; /* always zeroized by blkid_do_*() */
|
||||||
|
|
||||||
uint64_t wipe_off; /* begin of the wiped area */
|
uint64_t wipe_off; /* begin of the wiped area */
|
||||||
|
@ -405,7 +405,7 @@ extern int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
|
||||||
uint64_t *offset, const struct blkid_idmag **res)
|
uint64_t *offset, const struct blkid_idmag **res)
|
||||||
__attribute__((nonnull(1)));
|
__attribute__((nonnull(1)));
|
||||||
|
|
||||||
/* returns superblok according to 'struct blkid_idmag' */
|
/* returns superblock according to 'struct blkid_idmag' */
|
||||||
#define blkid_probe_get_sb(_pr, _mag, type) \
|
#define blkid_probe_get_sb(_pr, _mag, type) \
|
||||||
((type *) blkid_probe_get_buffer((_pr),\
|
((type *) blkid_probe_get_buffer((_pr),\
|
||||||
(_mag)->kboff << 10, sizeof(type)))
|
(_mag)->kboff << 10, sizeof(type)))
|
||||||
|
|
|
@ -86,7 +86,7 @@ char *blkid_get_cache_filename(struct blkid_config *conf)
|
||||||
* @cache: pointer to return cache handler
|
* @cache: pointer to return cache handler
|
||||||
* @filename: path to the cache file or NULL for the default path
|
* @filename: path to the cache file or NULL for the default path
|
||||||
*
|
*
|
||||||
* Allocates and initialize librray cache handler.
|
* Allocates and initialize library cache handler.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success or number less than zero in case of error.
|
* Returns: 0 on success or number less than zero in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -107,10 +107,10 @@ void blkid_debug_dump_dev(blkid_dev dev)
|
||||||
*
|
*
|
||||||
* These routines do not expose the list.h implementation, which are a
|
* These routines do not expose the list.h implementation, which are a
|
||||||
* contamination of the namespace, and which force us to reveal far, far
|
* contamination of the namespace, and which force us to reveal far, far
|
||||||
* too much of our internal implemenation. I'm not convinced I want
|
* too much of our internal implementation. I'm not convinced I want
|
||||||
* to keep list.h in the long term, anyway. It's fine for kernel
|
* to keep list.h in the long term, anyway. It's fine for kernel
|
||||||
* programming, but performance is not the #1 priority for this
|
* programming, but performance is not the #1 priority for this
|
||||||
* library, and I really don't like the tradeoff of type-safety for
|
* library, and I really don't like the trade-off of type-safety for
|
||||||
* performance for this application. [tytso:20030125.2007EST]
|
* performance for this application. [tytso:20030125.2007EST]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
|
||||||
/* try canonicalize the name */
|
/* try canonicalize the name */
|
||||||
if (!dev && (cn = canonicalize_path(devname))) {
|
if (!dev && (cn = canonicalize_path(devname))) {
|
||||||
if (strcmp(cn, devname) != 0) {
|
if (strcmp(cn, devname) != 0) {
|
||||||
DBG(DEVNAME, ul_debug("search cannonical %s", cn));
|
DBG(DEVNAME, ul_debug("search canonical %s", cn));
|
||||||
list_for_each(p, &cache->bic_devs) {
|
list_for_each(p, &cache->bic_devs) {
|
||||||
tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
|
tmp = list_entry(p, struct blkid_struct_dev, bid_devs);
|
||||||
if (strcmp(tmp->bid_name, cn))
|
if (strcmp(tmp->bid_name, cn))
|
||||||
|
|
|
@ -128,7 +128,7 @@ int blkid_send_uevent(const char *devname, const char *action)
|
||||||
DBG(EVALUATE, ul_debug("write failed: %s", uevent));
|
DBG(EVALUATE, ul_debug("write failed: %s", uevent));
|
||||||
}
|
}
|
||||||
DBG(EVALUATE, ul_debug("%s: send uevent %s",
|
DBG(EVALUATE, ul_debug("%s: send uevent %s",
|
||||||
uevent, rc == 0 ? "SUCCES" : "FAILED"));
|
uevent, rc == 0 ? "SUCCESS" : "FAILED"));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/**
|
/**
|
||||||
* SECTION: init
|
* SECTION: init
|
||||||
* @title: Library initialization
|
* @title: Library initialization
|
||||||
* @short_description: initialize debuging
|
* @short_description: initialize debugging
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -23,7 +23,7 @@ UL_DEBUG_DEFINE_MASKNAMES(libblkid) =
|
||||||
{ "config", BLKID_DEBUG_CONFIG, "config file utils" },
|
{ "config", BLKID_DEBUG_CONFIG, "config file utils" },
|
||||||
{ "dev", BLKID_DEBUG_DEV, "device utils" },
|
{ "dev", BLKID_DEBUG_DEV, "device utils" },
|
||||||
{ "devname", BLKID_DEBUG_DEVNAME, "/proc/partitions evaluation" },
|
{ "devname", BLKID_DEBUG_DEVNAME, "/proc/partitions evaluation" },
|
||||||
{ "devno", BLKID_DEBUG_DEVNO, "convertions to device name" },
|
{ "devno", BLKID_DEBUG_DEVNO, "conversions to device name" },
|
||||||
{ "evaluate", BLKID_DEBUG_EVALUATE, "tags resolving" },
|
{ "evaluate", BLKID_DEBUG_EVALUATE, "tags resolving" },
|
||||||
{ "help", BLKID_DEBUG_HELP, "this help" },
|
{ "help", BLKID_DEBUG_HELP, "this help" },
|
||||||
{ "lowprobe", BLKID_DEBUG_LOWPROBE, "superblock/raids/partitions probing" },
|
{ "lowprobe", BLKID_DEBUG_LOWPROBE, "superblock/raids/partitions probing" },
|
||||||
|
@ -37,7 +37,7 @@ UL_DEBUG_DEFINE_MASKNAMES(libblkid) =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blkid_init_debug:
|
* blkid_init_debug:
|
||||||
* @mask: debug mask (0xffff to enable full debuging)
|
* @mask: debug mask (0xffff to enable full debugging)
|
||||||
*
|
*
|
||||||
* If the @mask is not specified then this function reads
|
* If the @mask is not specified then this function reads
|
||||||
* LIBBLKID_DEBUG environment variable to get the mask.
|
* LIBBLKID_DEBUG environment variable to get the mask.
|
||||||
|
|
|
@ -191,11 +191,11 @@ static int probe_dos_pt(blkid_probe pr,
|
||||||
snprintf(idstr, sizeof(idstr), "%08x", id);
|
snprintf(idstr, sizeof(idstr), "%08x", id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well, all checks pass, it's MS-DOS partiton table
|
* Well, all checks pass, it's MS-DOS partition table
|
||||||
*/
|
*/
|
||||||
if (blkid_partitions_need_typeonly(pr)) {
|
if (blkid_partitions_need_typeonly(pr)) {
|
||||||
/* Non-binary interface -- caller does not ask for details
|
/* Non-binary interface -- caller does not ask for details
|
||||||
* about partitions, just set generic varibles only. */
|
* about partitions, just set generic variables only. */
|
||||||
if (id)
|
if (id)
|
||||||
blkid_partitions_strcpy_ptuuid(pr, idstr);
|
blkid_partitions_strcpy_ptuuid(pr, idstr);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct gpt_header {
|
||||||
|
|
||||||
uint64_t my_lba; /* location of this header copy */
|
uint64_t my_lba; /* location of this header copy */
|
||||||
uint64_t alternate_lba; /* location of the other header copy */
|
uint64_t alternate_lba; /* location of the other header copy */
|
||||||
uint64_t first_usable_lba; /* lirst usable LBA for partitions */
|
uint64_t first_usable_lba; /* first usable LBA for partitions */
|
||||||
uint64_t last_usable_lba; /* last usable LBA for partitions */
|
uint64_t last_usable_lba; /* last usable LBA for partitions */
|
||||||
|
|
||||||
efi_guid_t disk_guid; /* disk UUID */
|
efi_guid_t disk_guid; /* disk UUID */
|
||||||
|
@ -155,7 +155,7 @@ static int last_lba(blkid_probe pr, uint64_t *lba)
|
||||||
* (due DOS PT limitations).
|
* (due DOS PT limitations).
|
||||||
*
|
*
|
||||||
* Note that the PMBR detection is optional (enabled by default) and could be
|
* Note that the PMBR detection is optional (enabled by default) and could be
|
||||||
* disabled by BLKID_PARTS_FOPCE_GPT flag (see also blkid_paertitions_set_flags()).
|
* disabled by BLKID_PARTS_FOPCE_GPT flag (see also blkid_partitions_set_flags()).
|
||||||
*/
|
*/
|
||||||
static int is_pmbr_valid(blkid_probe pr, int *has)
|
static int is_pmbr_valid(blkid_probe pr, int *has)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ static int probe_gpt_pt(blkid_probe pr,
|
||||||
|
|
||||||
if (blkid_partitions_need_typeonly(pr)) {
|
if (blkid_partitions_need_typeonly(pr)) {
|
||||||
/* Non-binary interface -- caller does not ask for details
|
/* Non-binary interface -- caller does not ask for details
|
||||||
* about partitions, just set generic varibles only. */
|
* about partitions, just set generic variables only. */
|
||||||
blkid_partitions_set_ptuuid(pr, (unsigned char *) &guid);
|
blkid_partitions_set_ptuuid(pr, (unsigned char *) &guid);
|
||||||
return BLKID_PROBE_OK;
|
return BLKID_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ const struct blkid_idinfo gpt_pt_idinfo =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It would be possible to check for DOS signature (0xAA55), but
|
* It would be possible to check for DOS signature (0xAA55), but
|
||||||
* unfortunately almost all EFI GPT implemenations allow to optionaly
|
* unfortunately almost all EFI GPT implementations allow to optionally
|
||||||
* skip the legacy MBR. We follows this behavior and MBR is optional.
|
* skip the legacy MBR. We follows this behavior and MBR is optional.
|
||||||
* See is_valid_pmbr().
|
* See is_valid_pmbr().
|
||||||
*
|
*
|
||||||
|
|
|
@ -139,7 +139,7 @@ static int probe_mac_pt(blkid_probe pr,
|
||||||
|
|
||||||
if (be32_to_cpu(p->map_count) != nblks) {
|
if (be32_to_cpu(p->map_count) != nblks) {
|
||||||
DBG(LOWPROBE, ul_debug(
|
DBG(LOWPROBE, ul_debug(
|
||||||
"mac: inconsisten map_count in partition map, "
|
"mac: inconsistent map_count in partition map, "
|
||||||
"entry[0]: %d, entry[%d]: %d",
|
"entry[0]: %d, entry[%d]: %d",
|
||||||
nblks, i - 1,
|
nblks, i - 1,
|
||||||
be32_to_cpu(p->map_count)));
|
be32_to_cpu(p->map_count)));
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
*
|
*
|
||||||
* pr = blkid_new_probe_from_filename(devname);
|
* pr = blkid_new_probe_from_filename(devname);
|
||||||
* if (!pr)
|
* if (!pr)
|
||||||
* err("%s: faild to open device", devname);
|
* err("%s: failed to open device", devname);
|
||||||
*
|
*
|
||||||
* blkid_probe_enable_partitions(pr, TRUE);
|
* blkid_probe_enable_partitions(pr, TRUE);
|
||||||
* blkid_do_fullprobe(pr);
|
* blkid_do_fullprobe(pr);
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
*
|
*
|
||||||
* pr = blkid_new_probe_from_filename(devname);
|
* pr = blkid_new_probe_from_filename(devname);
|
||||||
* if (!pr)
|
* if (!pr)
|
||||||
* err("%s: faild to open device", devname);
|
* err("%s: failed to open device", devname);
|
||||||
*
|
*
|
||||||
* ls = blkid_probe_get_partitions(pr);
|
* ls = blkid_probe_get_partitions(pr);
|
||||||
* nparts = blkid_partlist_numof_partitions(ls);
|
* nparts = blkid_partlist_numof_partitions(ls);
|
||||||
|
@ -183,7 +183,7 @@ struct blkid_struct_partition {
|
||||||
|
|
||||||
int partno; /* partition number */
|
int partno; /* partition number */
|
||||||
char uuid[37]; /* UUID (when supported by PT), e.g GPT */
|
char uuid[37]; /* UUID (when supported by PT), e.g GPT */
|
||||||
unsigned char name[128]; /* Partition in UTF8 name (when supporte by PT), e.g. Mac */
|
unsigned char name[128]; /* Partition in UTF8 name (when supported by PT), e.g. Mac */
|
||||||
|
|
||||||
blkid_parttable tab; /* partition table */
|
blkid_parttable tab; /* partition table */
|
||||||
};
|
};
|
||||||
|
@ -429,7 +429,7 @@ static blkid_partition new_partition(blkid_partlist ls, blkid_parttable tab)
|
||||||
|
|
||||||
if (ls->nparts + 1 > ls->nparts_max) {
|
if (ls->nparts + 1 > ls->nparts_max) {
|
||||||
/* Linux kernel has DISK_MAX_PARTS=256, but it's too much for
|
/* Linux kernel has DISK_MAX_PARTS=256, but it's too much for
|
||||||
* generic Linux machine -- let start with 32 partititions.
|
* generic Linux machine -- let start with 32 partitions.
|
||||||
*/
|
*/
|
||||||
void *tmp = realloc(ls->parts, (ls->nparts_max + 32) *
|
void *tmp = realloc(ls->parts, (ls->nparts_max + 32) *
|
||||||
sizeof(struct blkid_struct_partition));
|
sizeof(struct blkid_struct_partition));
|
||||||
|
@ -871,7 +871,7 @@ done:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blkid_known_pttype:
|
* blkid_known_pttype:
|
||||||
* @pttype: partiton name
|
* @pttype: partition name
|
||||||
*
|
*
|
||||||
* Returns: 1 for known or 0 for unknown partition type.
|
* Returns: 1 for known or 0 for unknown partition type.
|
||||||
*/
|
*/
|
||||||
|
@ -990,7 +990,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno
|
||||||
if (!ls)
|
if (!ls)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
DBG(LOWPROBE, ul_debug("triyng to convert devno 0x%llx to partition",
|
DBG(LOWPROBE, ul_debug("trying to convert devno 0x%llx to partition",
|
||||||
(long long) devno));
|
(long long) devno));
|
||||||
|
|
||||||
if (sysfs_init(&sysfs, devno, NULL)) {
|
if (sysfs_init(&sysfs, devno, NULL)) {
|
||||||
|
@ -1031,7 +1031,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno
|
||||||
/*
|
/*
|
||||||
* Partition mapped by kpartx does not provide "start" offset
|
* Partition mapped by kpartx does not provide "start" offset
|
||||||
* in /sys, but if we know partno and size of the partition
|
* in /sys, but if we know partno and size of the partition
|
||||||
* that we can probably make the releation bettween the device
|
* that we can probably make the relation between the device
|
||||||
* and an entry in partition table.
|
* and an entry in partition table.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ls->nparts; i++) {
|
for (i = 0; i < ls->nparts; i++) {
|
||||||
|
@ -1163,7 +1163,7 @@ const char *blkid_parttable_get_type(blkid_parttable tab)
|
||||||
* blkid_parttable_get_parent:
|
* blkid_parttable_get_parent:
|
||||||
* @tab: partition table
|
* @tab: partition table
|
||||||
*
|
*
|
||||||
* Returns: parent for nexted partitition tables or NULL.
|
* Returns: parent for nested partition tables or NULL.
|
||||||
*/
|
*/
|
||||||
blkid_partition blkid_parttable_get_parent(blkid_parttable tab)
|
blkid_partition blkid_parttable_get_parent(blkid_parttable tab)
|
||||||
{
|
{
|
||||||
|
@ -1176,7 +1176,7 @@ blkid_partition blkid_parttable_get_parent(blkid_parttable tab)
|
||||||
*
|
*
|
||||||
* Note the position is relative to begin of the device as defined by
|
* Note the position is relative to begin of the device as defined by
|
||||||
* blkid_probe_set_device() for primary partition table, and relative
|
* blkid_probe_set_device() for primary partition table, and relative
|
||||||
* to parental partition for nested patition tables.
|
* to parental partition for nested partition tables.
|
||||||
*
|
*
|
||||||
* <informalexample>
|
* <informalexample>
|
||||||
* <programlisting>
|
* <programlisting>
|
||||||
|
@ -1379,8 +1379,8 @@ const char *blkid_partition_get_uuid(blkid_partition par)
|
||||||
* blkid_partition_get_partno:
|
* blkid_partition_get_partno:
|
||||||
* @par: partition
|
* @par: partition
|
||||||
*
|
*
|
||||||
* Returns: proposed partitin number (e.g. 'N' from sda'N') or -1 in case of
|
* Returns: proposed partition number (e.g. 'N' from sda'N') or -1 in case of
|
||||||
* error. Note that the number is generate by library independenly on your OS.
|
* error. Note that the number is generate by library independently on your OS.
|
||||||
*/
|
*/
|
||||||
int blkid_partition_get_partno(blkid_partition par)
|
int blkid_partition_get_partno(blkid_partition par)
|
||||||
{
|
{
|
||||||
|
@ -1393,14 +1393,14 @@ int blkid_partition_get_partno(blkid_partition par)
|
||||||
*
|
*
|
||||||
* Be careful if you _not_ probe whole disk:
|
* Be careful if you _not_ probe whole disk:
|
||||||
*
|
*
|
||||||
* 1) the offset is usully relative to begin of the disk -- but if you probe a
|
* 1) the offset is usually relative to begin of the disk -- but if you probe a
|
||||||
* fragment of the disk only -- then the offset could be still relative to
|
* fragment of the disk only -- then the offset could be still relative to
|
||||||
* the begin of the disk rather that relative to the fragment.
|
* the begin of the disk rather that relative to the fragment.
|
||||||
*
|
*
|
||||||
* 2) the offset for nested partitions could be releative to parent (e.g. Solaris)
|
* 2) the offset for nested partitions could be relative to parent (e.g. Solaris)
|
||||||
* _or_ relative to the begin of the whole disk (e.g. bsd).
|
* _or_ relative to the begin of the whole disk (e.g. bsd).
|
||||||
*
|
*
|
||||||
* You don't have to care about such details if you proble whole disk. In such
|
* You don't have to care about such details if you probe whole disk. In such
|
||||||
* a case libblkid always returns the offset relative to the begin of the disk.
|
* a case libblkid always returns the offset relative to the begin of the disk.
|
||||||
*
|
*
|
||||||
* Returns: start of the partition (in 512-sectors).
|
* Returns: start of the partition (in 512-sectors).
|
||||||
|
@ -1418,7 +1418,7 @@ blkid_loff_t blkid_partition_get_start(blkid_partition par)
|
||||||
* library always returns full size of the partition. If you want add
|
* library always returns full size of the partition. If you want add
|
||||||
* the partition to the Linux system (BLKPG_ADD_PARTITION ioctl) you
|
* the partition to the Linux system (BLKPG_ADD_PARTITION ioctl) you
|
||||||
* need to reduce the size of the partition to 1 or 2 blocks. The
|
* need to reduce the size of the partition to 1 or 2 blocks. The
|
||||||
* rest of the partition has to be unaccessible for mkfs or mkswap
|
* rest of the partition has to be inaccessible for mkfs or mkswap
|
||||||
* programs, we need a small space for boot loaders only.
|
* programs, we need a small space for boot loaders only.
|
||||||
*
|
*
|
||||||
* For some unknown reason this (safe) practice is not to used for
|
* For some unknown reason this (safe) practice is not to used for
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* offset (start) of the slice is always relatively to the primary dos
|
* offset (start) of the slice is always relatively to the primary dos
|
||||||
* partition.
|
* partition.
|
||||||
*
|
*
|
||||||
* Note that Solaris-SPARC uses entire disk with a different partitionning
|
* Note that Solaris-SPARC uses entire disk with a different partitioning
|
||||||
* scheme.
|
* scheme.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ static int probe_solaris_pt(blkid_probe pr,
|
||||||
const struct blkid_idmag *mag __attribute__((__unused__)))
|
const struct blkid_idmag *mag __attribute__((__unused__)))
|
||||||
{
|
{
|
||||||
struct solaris_vtoc *l; /* disk label */
|
struct solaris_vtoc *l; /* disk label */
|
||||||
struct solaris_slice *p; /* partitsion */
|
struct solaris_slice *p; /* partition */
|
||||||
blkid_parttable tab = NULL;
|
blkid_parttable tab = NULL;
|
||||||
blkid_partition parent;
|
blkid_partition parent;
|
||||||
blkid_partlist ls;
|
blkid_partlist ls;
|
||||||
|
|
|
@ -69,7 +69,7 @@ static int probe_sun_pt(blkid_probe pr,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* So that old Linux-Sun partitions continue to work,
|
* So that old Linux-Sun partitions continue to work,
|
||||||
* alow the VTOC to be used under the additional condition ...
|
* allow the VTOC to be used under the additional condition ...
|
||||||
*/
|
*/
|
||||||
use_vtoc = use_vtoc || !(l->vtoc.sanity || l->vtoc.version || l->vtoc.nparts);
|
use_vtoc = use_vtoc || !(l->vtoc.sanity || l->vtoc.version || l->vtoc.nparts);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* GNU Lesser General Public License.
|
* GNU Lesser General Public License.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* The intersting information about unixware PT:
|
* The interesting information about unixware PT:
|
||||||
* - Linux kernel / partx
|
* - Linux kernel / partx
|
||||||
* - vtoc(7) SCO UNIX command man page
|
* - vtoc(7) SCO UNIX command man page
|
||||||
* - evms source code (http://evms.sourceforge.net/)
|
* - evms source code (http://evms.sourceforge.net/)
|
||||||
|
|
|
@ -165,7 +165,7 @@ blkid_probe blkid_new_probe(void)
|
||||||
* Clone @parent, the new clone shares all, but except:
|
* Clone @parent, the new clone shares all, but except:
|
||||||
*
|
*
|
||||||
* - probing result
|
* - probing result
|
||||||
* - bufferes if another device (or offset) is set to the prober
|
* - buffers if another device (or offset) is set to the prober
|
||||||
*/
|
*/
|
||||||
blkid_probe blkid_clone_probe(blkid_probe parent)
|
blkid_probe blkid_clone_probe(blkid_probe parent)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,7 @@ void blkid_probe_chain_reset_values(blkid_probe pr, struct blkid_chain *chn)
|
||||||
if (!pr || list_empty(&pr->values))
|
if (!pr || list_empty(&pr->values))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DBG(LOWPROBE, ul_debug("reseting %s values", chn->driver->name));
|
DBG(LOWPROBE, ul_debug("Resetting %s values", chn->driver->name));
|
||||||
|
|
||||||
list_for_each_safe(p, pnext, &pr->values) {
|
list_for_each_safe(p, pnext, &pr->values) {
|
||||||
struct blkid_prval *v = list_entry(p,
|
struct blkid_prval *v = list_entry(p,
|
||||||
|
@ -667,7 +667,7 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr, uint64_t off, uint64_t len
|
||||||
pr->off + off - pr->parent->off, len);
|
pr->off + off - pr->parent->off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try buffers we already have in memmory */
|
/* try buffers we already have in memory */
|
||||||
list_for_each(p, &pr->buffers) {
|
list_for_each(p, &pr->buffers) {
|
||||||
struct blkid_bufinfo *x =
|
struct blkid_bufinfo *x =
|
||||||
list_entry(p, struct blkid_bufinfo, bufs);
|
list_entry(p, struct blkid_bufinfo, bufs);
|
||||||
|
@ -703,7 +703,7 @@ static void blkid_probe_reset_buffer(blkid_probe pr)
|
||||||
if (!pr || list_empty(&pr->buffers))
|
if (!pr || list_empty(&pr->buffers))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DBG(BUFFER, ul_debug("reseting probing buffers pr=%p", pr));
|
DBG(BUFFER, ul_debug("Resetting probing buffers pr=%p", pr));
|
||||||
|
|
||||||
while (!list_empty(&pr->buffers)) {
|
while (!list_empty(&pr->buffers)) {
|
||||||
struct blkid_bufinfo *bf = list_entry(pr->buffers.next,
|
struct blkid_bufinfo *bf = list_entry(pr->buffers.next,
|
||||||
|
@ -1112,7 +1112,7 @@ int blkid_do_probe(blkid_probe pr)
|
||||||
*
|
*
|
||||||
* This function erases the current signature detected by @pr. The @pr has to
|
* This function erases the current signature detected by @pr. The @pr has to
|
||||||
* be open in O_RDWR mode, BLKID_SUBLKS_MAGIC or/and BLKID_PARTS_MAGIC flags
|
* be open in O_RDWR mode, BLKID_SUBLKS_MAGIC or/and BLKID_PARTS_MAGIC flags
|
||||||
* has to be enabled (if you want to errase also superblock with broken check
|
* has to be enabled (if you want to erase also superblock with broken check
|
||||||
* sums then use BLKID_SUBLKS_BADCSUM too).
|
* sums then use BLKID_SUBLKS_BADCSUM too).
|
||||||
*
|
*
|
||||||
* After successful signature removing the @pr prober will be moved one step
|
* After successful signature removing the @pr prober will be moved one step
|
||||||
|
@ -1238,7 +1238,7 @@ int blkid_do_wipe(blkid_probe pr, int dryrun)
|
||||||
* continue;
|
* continue;
|
||||||
*
|
*
|
||||||
* // convert ostr to the real offset by off = strtoll(ostr, NULL, 10);
|
* // convert ostr to the real offset by off = strtoll(ostr, NULL, 10);
|
||||||
* // use your stuff to errase @len bytes at the @off
|
* // use your stuff to erase @len bytes at the @off
|
||||||
* ....
|
* ....
|
||||||
*
|
*
|
||||||
* // retry the last probing to check for backup superblocks ..etc.
|
* // retry the last probing to check for backup superblocks ..etc.
|
||||||
|
@ -1296,13 +1296,13 @@ int blkid_probe_step_back(blkid_probe pr)
|
||||||
*
|
*
|
||||||
* This is string-based NAME=value interface only.
|
* This is string-based NAME=value interface only.
|
||||||
*
|
*
|
||||||
* Note about suberblocks chain -- the function does not check for filesystems
|
* Note about superblocks chain -- the function does not check for filesystems
|
||||||
* when a RAID signature is detected. The function also does not check for
|
* when a RAID signature is detected. The function also does not check for
|
||||||
* collision between RAIDs. The first detected RAID is returned. The function
|
* collision between RAIDs. The first detected RAID is returned. The function
|
||||||
* checks for collision between partition table and RAID signature -- it's
|
* checks for collision between partition table and RAID signature -- it's
|
||||||
* recommended to enable partitions chain together with superblocks chain.
|
* recommended to enable partitions chain together with superblocks chain.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, 1 if nothing is detected, -2 if ambivalen result is
|
* Returns: 0 on success, 1 if nothing is detected, -2 if ambivalent result is
|
||||||
* detected and -1 on case of error.
|
* detected and -1 on case of error.
|
||||||
*/
|
*/
|
||||||
int blkid_do_safeprobe(blkid_probe pr)
|
int blkid_do_safeprobe(blkid_probe pr)
|
||||||
|
@ -1988,7 +1988,7 @@ int blkid_probe_is_wiped(blkid_probe pr, struct blkid_chain **chn, uint64_t off,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to use any area -- if the area has been previously wiped then the
|
* Try to use any area -- if the area has been previously wiped then the
|
||||||
* previous probing result should be ignored (reseted).
|
* previous probing result should be ignored (reset).
|
||||||
*/
|
*/
|
||||||
void blkid_probe_use_wiper(blkid_probe pr, uint64_t off, uint64_t size)
|
void blkid_probe_use_wiper(blkid_probe pr, uint64_t off, uint64_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct gfs2_sb {
|
||||||
char sb_locktable[GFS_LOCKNAME_LEN];
|
char sb_locktable[GFS_LOCKNAME_LEN];
|
||||||
|
|
||||||
struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
|
struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
|
||||||
struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
|
struct gfs2_inum __pad4; /* Was license inode in gfs1 */
|
||||||
uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */
|
uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ const struct blkid_idinfo highpoint37x_idinfo = {
|
||||||
.probefunc = probe_highpoint37x,
|
.probefunc = probe_highpoint37x,
|
||||||
.magics = {
|
.magics = {
|
||||||
/*
|
/*
|
||||||
* Superblok offset: 4608 bytes (9 sectors)
|
* Superblock offset: 4608 bytes (9 sectors)
|
||||||
* Magic string offset within superblock: 32 bytes
|
* Magic string offset within superblock: 32 bytes
|
||||||
*
|
*
|
||||||
* kboff = (4608 + 32) / 1024
|
* kboff = (4608 + 32) / 1024
|
||||||
|
|
|
@ -221,7 +221,7 @@ int probe_iso9660(blkid_probe pr, const struct blkid_idmag *mag)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not a Boot record, lets see if its supplemntary volume descriptor */
|
/* Not a Boot record, lets see if its supplementary volume descriptor */
|
||||||
iso = (struct iso_volume_descriptor *) boot;
|
iso = (struct iso_volume_descriptor *) boot;
|
||||||
|
|
||||||
if (iso->vd_type != ISO_VD_SUPPLEMENTARY) {
|
if (iso->vd_type != ISO_VD_SUPPLEMENTARY) {
|
||||||
|
@ -236,8 +236,8 @@ int probe_iso9660(blkid_probe pr, const struct blkid_idmag *mag)
|
||||||
blkid_probe_set_version(pr, "Joliet Extension");
|
blkid_probe_set_version(pr, "Joliet Extension");
|
||||||
|
|
||||||
/* Is the Joliet (UTF16BE) label equal to the label in
|
/* Is the Joliet (UTF16BE) label equal to the label in
|
||||||
* the PVD? If yes, use PVD label. The Jolied version
|
* the PVD? If yes, use PVD label. The Joliet version
|
||||||
* of the label could be trimed (because UTF16..).
|
* of the label could be trimmed (because UTF16..).
|
||||||
*/
|
*/
|
||||||
if (ascii_eq_utf16be(label, iso->volume_id, 32))
|
if (ascii_eq_utf16be(label, iso->volume_id, 32))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct mdp1_super_block {
|
||||||
uint8_t pad2[64-57]; /* set to 0 when writing */
|
uint8_t pad2[64-57]; /* set to 0 when writing */
|
||||||
|
|
||||||
/* array state information - 64 bytes */
|
/* array state information - 64 bytes */
|
||||||
uint64_t utime; /* 40 bits second, 24 btes microseconds */
|
uint64_t utime; /* 40 bits second, 24 bits microseconds */
|
||||||
uint64_t events; /* incremented when superblock updated */
|
uint64_t events; /* incremented when superblock updated */
|
||||||
uint64_t resync_offset; /* data before this offset (from data_offset) known to be in sync */
|
uint64_t resync_offset; /* data before this offset (from data_offset) known to be in sync */
|
||||||
uint32_t sb_csum; /* checksum up to dev_roles[max_dev] */
|
uint32_t sb_csum; /* checksum up to dev_roles[max_dev] */
|
||||||
|
|
|
@ -113,7 +113,7 @@ static int probe_lvm2(blkid_probe pr, const struct blkid_idmag *mag)
|
||||||
blkid_probe_set_version(pr, mag->magic);
|
blkid_probe_set_version(pr, mag->magic);
|
||||||
|
|
||||||
/* LVM (pvcreate) wipes begin of the device -- let's remember this
|
/* LVM (pvcreate) wipes begin of the device -- let's remember this
|
||||||
* to resolve conflicts bettween LVM and partition tables, ...
|
* to resolve conflicts between LVM and partition tables, ...
|
||||||
*/
|
*/
|
||||||
blkid_probe_set_wiper(pr, 0, 8 * 1024);
|
blkid_probe_set_wiper(pr, 0, 8 * 1024);
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
*
|
*
|
||||||
* @SBMAGIC_OFFSET: offset of SBMAGIC
|
* @SBMAGIC_OFFSET: offset of SBMAGIC
|
||||||
*
|
*
|
||||||
* @FSSIZE: size of filessystem [not-implemented yet]
|
* @FSSIZE: size of filesystem [not-implemented yet]
|
||||||
*
|
*
|
||||||
* @SYSTEM_ID: ISO9660 system identifier
|
* @SYSTEM_ID: ISO9660 system identifier
|
||||||
*
|
*
|
||||||
|
@ -294,7 +294,7 @@ int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage)
|
||||||
* blkid_known_fstype:
|
* blkid_known_fstype:
|
||||||
* @fstype: filesystem name
|
* @fstype: filesystem name
|
||||||
*
|
*
|
||||||
* Returns: 1 for known filesytems, or 0 for unknown filesystem.
|
* Returns: 1 for known filesystems, or 0 for unknown filesystem.
|
||||||
*/
|
*/
|
||||||
int blkid_known_fstype(const char *fstype)
|
int blkid_known_fstype(const char *fstype)
|
||||||
{
|
{
|
||||||
|
@ -410,7 +410,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all cheks passed */
|
/* all checks passed */
|
||||||
if (chn->flags & BLKID_SUBLKS_TYPE)
|
if (chn->flags & BLKID_SUBLKS_TYPE)
|
||||||
rc = blkid_probe_set_value(pr, "TYPE",
|
rc = blkid_probe_set_value(pr, "TYPE",
|
||||||
(unsigned char *) id->name,
|
(unsigned char *) id->name,
|
||||||
|
@ -440,7 +440,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the same function as blkid_do_probe(), but returns only one result
|
* This is the same function as blkid_do_probe(), but returns only one result
|
||||||
* (cannot be used in while()) and checks for ambivalen results (more
|
* (cannot be used in while()) and checks for ambivalent results (more
|
||||||
* filesystems on the device) -- in such case returns -2.
|
* filesystems on the device) -- in such case returns -2.
|
||||||
*
|
*
|
||||||
* The function does not check for filesystems when a RAID or crypto signature
|
* The function does not check for filesystems when a RAID or crypto signature
|
||||||
|
@ -509,7 +509,7 @@ static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The RAID device could be partitioned. The problem are RAID1 devices
|
* The RAID device could be partitioned. The problem are RAID1 devices
|
||||||
* where the partition table is visible from underlaying devices. We
|
* where the partition table is visible from underlying devices. We
|
||||||
* have to ignore such partition tables.
|
* have to ignore such partition tables.
|
||||||
*/
|
*/
|
||||||
if (chn->idx >= 0 && idinfos[chn->idx]->usage & BLKID_USAGE_RAID)
|
if (chn->idx >= 0 && idinfos[chn->idx]->usage & BLKID_USAGE_RAID)
|
||||||
|
@ -713,7 +713,7 @@ int blkid_probe_sprintf_uuid(blkid_probe pr, unsigned char *uuid,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* function to set UUIDs that are in suberblocks stored as strings */
|
/* function to set UUIDs that are in superblocks stored as strings */
|
||||||
int blkid_probe_strncpy_uuid(blkid_probe pr, unsigned char *str, size_t len)
|
int blkid_probe_strncpy_uuid(blkid_probe pr, unsigned char *str, size_t len)
|
||||||
{
|
{
|
||||||
struct blkid_chain *chn = blkid_probe_get_chain(pr);
|
struct blkid_chain *chn = blkid_probe_get_chain(pr);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
|
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
|
||||||
*
|
*
|
||||||
* This is written from sratch according to Linux kernel fs/sysv/super.c file.
|
* This is written from scratch according to Linux kernel fs/sysv/super.c file.
|
||||||
* It seems that sysv probing code in libvolume_id and also in the original
|
* It seems that sysv probing code in libvolume_id and also in the original
|
||||||
* blkid is useless.
|
* blkid is useless.
|
||||||
*
|
*
|
||||||
|
|
|
@ -107,7 +107,7 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type)
|
||||||
/*
|
/*
|
||||||
* Set a tag on an existing device.
|
* Set a tag on an existing device.
|
||||||
*
|
*
|
||||||
* If value is NULL, then delete the tagsfrom the device.
|
* If value is NULL, then delete the tags from the device.
|
||||||
*/
|
*/
|
||||||
int blkid_set_tag(blkid_dev dev, const char *name,
|
int blkid_set_tag(blkid_dev dev, const char *name,
|
||||||
const char *value, const int vlength)
|
const char *value, const int vlength)
|
||||||
|
@ -252,10 +252,10 @@ errout:
|
||||||
*
|
*
|
||||||
* These routines do not expose the list.h implementation, which are a
|
* These routines do not expose the list.h implementation, which are a
|
||||||
* contamination of the namespace, and which force us to reveal far, far
|
* contamination of the namespace, and which force us to reveal far, far
|
||||||
* too much of our internal implemenation. I'm not convinced I want
|
* too much of our internal implementation. I'm not convinced I want
|
||||||
* to keep list.h in the long term, anyway. It's fine for kernel
|
* to keep list.h in the long term, anyway. It's fine for kernel
|
||||||
* programming, but performance is not the #1 priority for this
|
* programming, but performance is not the #1 priority for this
|
||||||
* library, and I really don't like the tradeoff of type-safety for
|
* library, and I really don't like the trade-off of type-safety for
|
||||||
* performance for this application. [tytso:20030125.2007EST]
|
* performance for this application. [tytso:20030125.2007EST]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Evms topology
|
* Evms topology
|
||||||
* -- this is fallback for old systems where the toplogy information is not
|
* -- this is fallback for old systems where the topology information is not
|
||||||
* exported by sysfs
|
* exported by sysfs
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Karel Zak <kzak@redhat.com>
|
* Copyright (C) 2009 Karel Zak <kzak@redhat.com>
|
||||||
|
|
|
@ -28,7 +28,7 @@ static struct topology_val {
|
||||||
/* /sys/dev/block/<maj>:<min>/<ATTR> */
|
/* /sys/dev/block/<maj>:<min>/<ATTR> */
|
||||||
const char *attr;
|
const char *attr;
|
||||||
|
|
||||||
/* functions to set probing resut */
|
/* functions to set probing result */
|
||||||
int (*set_ulong)(blkid_probe, unsigned long);
|
int (*set_ulong)(blkid_probe, unsigned long);
|
||||||
int (*set_int)(blkid_probe, int);
|
int (*set_int)(blkid_probe, int);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ static int probe_sysfs_tp(blkid_probe pr,
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (!disk) {
|
if (!disk) {
|
||||||
/*
|
/*
|
||||||
* Read atrributes from "disk" if the current
|
* Read attributes from "disk" if the current
|
||||||
* device is a partition.
|
* device is a partition.
|
||||||
*/
|
*/
|
||||||
disk = blkid_probe_get_wholedisk_devno(pr);
|
disk = blkid_probe_get_wholedisk_devno(pr);
|
||||||
|
|
|
@ -128,10 +128,10 @@ int blkid_probe_enable_topology(blkid_probe pr, int enable)
|
||||||
*
|
*
|
||||||
* WARNING: the returned object will be overwritten by the next
|
* WARNING: the returned object will be overwritten by the next
|
||||||
* blkid_probe_get_topology() call for the same @pr. If you want to
|
* blkid_probe_get_topology() call for the same @pr. If you want to
|
||||||
* use more blkid_topopogy objects in the same time you have to create
|
* use more blkid_topology objects in the same time you have to create
|
||||||
* more blkid_probe handlers (see blkid_new_probe()).
|
* more blkid_probe handlers (see blkid_new_probe()).
|
||||||
*
|
*
|
||||||
* Returns: blkid_topopogy, or NULL in case of error.
|
* Returns: blkid_topology, or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
blkid_topology blkid_probe_get_topology(blkid_probe pr)
|
blkid_topology blkid_probe_get_topology(blkid_probe pr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ int blkid_parse_version_string(const char *ver_string)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* blkid_get_library_version:
|
* blkid_get_library_version:
|
||||||
* @ver_string: returns relese version (!= SONAME version)
|
* @ver_string: returns release version (!= SONAME version)
|
||||||
* @date_string: returns date
|
* @date_string: returns date
|
||||||
*
|
*
|
||||||
* Returns: release version code.
|
* Returns: release version code.
|
||||||
|
|
|
@ -215,7 +215,7 @@ static void recount_geometry(struct fdisk_context *cxt)
|
||||||
*
|
*
|
||||||
* The difference between fdisk_override_geometry() and fdisk_save_user_geometry()
|
* The difference between fdisk_override_geometry() and fdisk_save_user_geometry()
|
||||||
* is that saved user geometry is persistent setting and it's applied always
|
* is that saved user geometry is persistent setting and it's applied always
|
||||||
* when device is assigned to the context or device properties are reseted.
|
* when device is assigned to the context or device properties are reset.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, < 0 on error.
|
* Returns: 0 on success, < 0 on error.
|
||||||
*/
|
*/
|
||||||
|
@ -287,7 +287,7 @@ int fdisk_save_user_geometry(struct fdisk_context *cxt,
|
||||||
* fdisk_save_user_sector_size:
|
* fdisk_save_user_sector_size:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @phy: physical sector size
|
* @phy: physical sector size
|
||||||
* @log: logicla sector size
|
* @log: logical sector size
|
||||||
*
|
*
|
||||||
* Save user defined sector sizes to use it for partitioning.
|
* Save user defined sector sizes to use it for partitioning.
|
||||||
*
|
*
|
||||||
|
@ -331,7 +331,7 @@ int fdisk_apply_user_device_properties(struct fdisk_context *cxt)
|
||||||
if (!cxt)
|
if (!cxt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
DBG(CXT, ul_debugobj(cxt, "appling user device properties"));
|
DBG(CXT, ul_debugobj(cxt, "applying user device properties"));
|
||||||
|
|
||||||
if (cxt->user_pyh_sector)
|
if (cxt->user_pyh_sector)
|
||||||
cxt->phy_sector_size = cxt->user_pyh_sector;
|
cxt->phy_sector_size = cxt->user_pyh_sector;
|
||||||
|
@ -403,7 +403,7 @@ int fdisk_reset_device_properties(struct fdisk_context *cxt)
|
||||||
if (!cxt)
|
if (!cxt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
DBG(CXT, ul_debugobj(cxt, "*** reseting device properties"));
|
DBG(CXT, ul_debugobj(cxt, "*** resetting device properties"));
|
||||||
|
|
||||||
fdisk_zeroize_device_properties(cxt);
|
fdisk_zeroize_device_properties(cxt);
|
||||||
fdisk_discover_topology(cxt);
|
fdisk_discover_topology(cxt);
|
||||||
|
@ -546,7 +546,7 @@ static fdisk_sector_t topology_get_first_lba(struct fdisk_context *cxt)
|
||||||
* a2) alignment offset
|
* a2) alignment offset
|
||||||
* a1) or physical sector (minimal_io_size, aka "grain")
|
* a1) or physical sector (minimal_io_size, aka "grain")
|
||||||
*
|
*
|
||||||
* b) or default to 1MiB (2048 sectrors, Windows Vista default)
|
* b) or default to 1MiB (2048 sectors, Windows Vista default)
|
||||||
*
|
*
|
||||||
* c) or for very small devices use 1 phy.sector
|
* c) or for very small devices use 1 phy.sector
|
||||||
*/
|
*/
|
||||||
|
@ -608,7 +608,7 @@ int fdisk_reset_alignment(struct fdisk_context *cxt)
|
||||||
if (!cxt)
|
if (!cxt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
DBG(CXT, ul_debugobj(cxt, "reseting alignment..."));
|
DBG(CXT, ul_debugobj(cxt, "resetting alignment..."));
|
||||||
|
|
||||||
/* default */
|
/* default */
|
||||||
cxt->grain = topology_get_grain(cxt);
|
cxt->grain = topology_get_grain(cxt);
|
||||||
|
@ -619,7 +619,7 @@ int fdisk_reset_alignment(struct fdisk_context *cxt)
|
||||||
if (cxt->label && cxt->label->op->reset_alignment)
|
if (cxt->label && cxt->label->op->reset_alignment)
|
||||||
rc = cxt->label->op->reset_alignment(cxt);
|
rc = cxt->label->op->reset_alignment(cxt);
|
||||||
|
|
||||||
DBG(CXT, ul_debugobj(cxt, "alignment reseted to: "
|
DBG(CXT, ul_debugobj(cxt, "alignment reset to: "
|
||||||
"first LBA=%ju, last LBA=%ju, grain=%lu [rc=%d]",
|
"first LBA=%ju, last LBA=%ju, grain=%lu [rc=%d]",
|
||||||
(uintmax_t) cxt->first_lba, (uintmax_t) cxt->last_lba,
|
(uintmax_t) cxt->first_lba, (uintmax_t) cxt->last_lba,
|
||||||
cxt->grain, rc));
|
cxt->grain, rc));
|
||||||
|
|
|
@ -62,7 +62,7 @@ void fdisk_reset_ask(struct fdisk_ask *ask)
|
||||||
* fdisk_ref_ask:
|
* fdisk_ref_ask:
|
||||||
* @ask: ask instance
|
* @ask: ask instance
|
||||||
*
|
*
|
||||||
* Incremparts reference counter.
|
* Increments reference counter.
|
||||||
*/
|
*/
|
||||||
void fdisk_ref_ask(struct fdisk_ask *ask)
|
void fdisk_ref_ask(struct fdisk_ask *ask)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ void fdisk_ref_ask(struct fdisk_ask *ask)
|
||||||
* fdisk_unref_ask:
|
* fdisk_unref_ask:
|
||||||
* @ask: ask instance
|
* @ask: ask instance
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @ask is automatically
|
* Decrements reference counter, on zero the @ask is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*/
|
*/
|
||||||
void fdisk_unref_ask(struct fdisk_ask *ask)
|
void fdisk_unref_ask(struct fdisk_ask *ask)
|
||||||
|
@ -318,7 +318,7 @@ int fdisk_ask_number_is_relative(struct fdisk_ask *ask)
|
||||||
*
|
*
|
||||||
* Inform libfdisk that user specified number in relative notation rather than
|
* Inform libfdisk that user specified number in relative notation rather than
|
||||||
* by explicit number. This info allows to fdisk do some optimization (e.g.
|
* by explicit number. This info allows to fdisk do some optimization (e.g.
|
||||||
* align end of partiton, etc.)
|
* align end of partition, etc.)
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error
|
* Returns: 0 on success, <0 on error
|
||||||
*/
|
*/
|
||||||
|
@ -467,7 +467,7 @@ int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew)
|
||||||
|
|
||||||
if (!rc && !wantnew && num->low == num->hig) {
|
if (!rc && !wantnew && num->low == num->hig) {
|
||||||
if (num->low > 0) {
|
if (num->low > 0) {
|
||||||
/* only one existing partiton, don't ask, return the number */
|
/* only one existing partition, don't ask, return the number */
|
||||||
fdisk_ask_number_set_result(ask, num->low);
|
fdisk_ask_number_set_result(ask, num->low);
|
||||||
fdisk_info(cxt, _("Selected partition %ju"), num->low);
|
fdisk_info(cxt, _("Selected partition %ju"), num->low);
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ int fdisk_ask_string(struct fdisk_context *cxt,
|
||||||
* @query: question string
|
* @query: question string
|
||||||
* @result: returns 0 (no) or 1 (yes)
|
* @result: returns 0 (no) or 1 (yes)
|
||||||
*
|
*
|
||||||
* Hight-level API to ask Yes/No questions
|
* High-level API to ask Yes/No questions
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error
|
* Returns: 0 on success, <0 on error
|
||||||
*/
|
*/
|
||||||
|
@ -919,7 +919,7 @@ static int do_vprint(struct fdisk_context *cxt, int errnum, int type,
|
||||||
* fdisk_info:
|
* fdisk_info:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @fmt: printf-like formatted string
|
* @fmt: printf-like formatted string
|
||||||
* @...: variable parametrs
|
* @...: variable parameters
|
||||||
*
|
*
|
||||||
* High-level API to print info messages,
|
* High-level API to print info messages,
|
||||||
*
|
*
|
||||||
|
@ -941,7 +941,7 @@ int fdisk_info(struct fdisk_context *cxt, const char *fmt, ...)
|
||||||
* fdisk_info:
|
* fdisk_info:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @fmt: printf-like formatted string
|
* @fmt: printf-like formatted string
|
||||||
* @...: variable parametrs
|
* @...: variable parameters
|
||||||
*
|
*
|
||||||
* High-level API to print warning message (errno expected)
|
* High-level API to print warning message (errno expected)
|
||||||
*
|
*
|
||||||
|
|
|
@ -191,7 +191,7 @@ static int bsd_probe_label(struct fdisk_context *cxt)
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (cxt->parent)
|
if (cxt->parent)
|
||||||
rc = bsd_assign_dos_partition(cxt); /* nested BSD partiotn table */
|
rc = bsd_assign_dos_partition(cxt); /* nested BSD partition table */
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = bsd_readlabel(cxt);
|
rc = bsd_readlabel(cxt);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
|
@ -524,7 +524,7 @@ static int bsd_get_disklabel_item(struct fdisk_context *cxt, struct fdisk_labeli
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (item->id < __FDISK_NLABELITEMS)
|
if (item->id < __FDISK_NLABELITEMS)
|
||||||
rc = 1; /* unssupported generic item */
|
rc = 1; /* unsupported generic item */
|
||||||
else
|
else
|
||||||
rc = 2; /* out of range */
|
rc = 2; /* out of range */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -206,7 +206,7 @@ void fdisk_ref_context(struct fdisk_context *cxt)
|
||||||
* If no @name specified then returns the current context label.
|
* If no @name specified then returns the current context label.
|
||||||
*
|
*
|
||||||
* The label is allocated and maintained within the context #cxt. There is
|
* The label is allocated and maintained within the context #cxt. There is
|
||||||
* nothing like reference counting for labels, you cannot delallocate the
|
* nothing like reference counting for labels, you cannot deallocate the
|
||||||
* label.
|
* label.
|
||||||
*
|
*
|
||||||
* Returns: label struct or NULL in case of error.
|
* Returns: label struct or NULL in case of error.
|
||||||
|
@ -613,7 +613,7 @@ int fdisk_assign_device(struct fdisk_context *cxt,
|
||||||
if (fdisk_read_firstsector(cxt) < 0)
|
if (fdisk_read_firstsector(cxt) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* detect labels and apply labes specific stuff (e.g geomery)
|
/* detect labels and apply labels specific stuff (e.g geometry)
|
||||||
* to the context */
|
* to the context */
|
||||||
fdisk_probe_labels(cxt);
|
fdisk_probe_labels(cxt);
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ void fdisk_unref_context(struct fdisk_context *cxt)
|
||||||
/**
|
/**
|
||||||
* fdisk_enable_details:
|
* fdisk_enable_details:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @enable: true/flase
|
* @enable: true/false
|
||||||
*
|
*
|
||||||
* Enables or disables "details" display mode. This function has effect to
|
* Enables or disables "details" display mode. This function has effect to
|
||||||
* fdisk_partition_to_string() function.
|
* fdisk_partition_to_string() function.
|
||||||
|
@ -761,7 +761,7 @@ int fdisk_is_details(struct fdisk_context *cxt)
|
||||||
/**
|
/**
|
||||||
* fdisk_enable_listonly:
|
* fdisk_enable_listonly:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @enable: true/flase
|
* @enable: true/false
|
||||||
*
|
*
|
||||||
* Just list partition only, don't care about another details, mistakes, ...
|
* Just list partition only, don't care about another details, mistakes, ...
|
||||||
*
|
*
|
||||||
|
@ -795,7 +795,7 @@ int fdisk_is_listonly(struct fdisk_context *cxt)
|
||||||
* This is pure shit, unfortunately for example Sun addresses begin of the
|
* This is pure shit, unfortunately for example Sun addresses begin of the
|
||||||
* partition by cylinders...
|
* partition by cylinders...
|
||||||
*
|
*
|
||||||
* Returns: 0 on succes, <0 on error.
|
* Returns: 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
int fdisk_set_unit(struct fdisk_context *cxt, const char *str)
|
int fdisk_set_unit(struct fdisk_context *cxt, const char *str)
|
||||||
{
|
{
|
||||||
|
@ -961,7 +961,7 @@ fdisk_sector_t fdisk_get_first_lba(struct fdisk_context *cxt)
|
||||||
* @lba: first possible logical sector for data
|
* @lba: first possible logical sector for data
|
||||||
*
|
*
|
||||||
* It's strongly recommended to use the default library setting. The first LBA
|
* It's strongly recommended to use the default library setting. The first LBA
|
||||||
* is always reseted by fdisk_assign_device(), fdisk_override_geometry()
|
* is always reset by fdisk_assign_device(), fdisk_override_geometry()
|
||||||
* and fdisk_reset_alignment(). This is very low level function and library
|
* and fdisk_reset_alignment(). This is very low level function and library
|
||||||
* does not check if your setting makes any sense.
|
* does not check if your setting makes any sense.
|
||||||
*
|
*
|
||||||
|
@ -999,7 +999,7 @@ fdisk_sector_t fdisk_get_last_lba(struct fdisk_context *cxt)
|
||||||
* @lba: last possible logical sector
|
* @lba: last possible logical sector
|
||||||
*
|
*
|
||||||
* It's strongly recommended to use the default library setting. The last LBA
|
* It's strongly recommended to use the default library setting. The last LBA
|
||||||
* is always reseted by fdisk_assign_device(), fdisk_override_geometry() and
|
* is always reset by fdisk_assign_device(), fdisk_override_geometry() and
|
||||||
* fdisk_reset_alignment().
|
* fdisk_reset_alignment().
|
||||||
*
|
*
|
||||||
* The default is number of sectors on the device, but maybe modified by the
|
* The default is number of sectors on the device, but maybe modified by the
|
||||||
|
@ -1076,7 +1076,7 @@ const char *fdisk_get_devname(struct fdisk_context *cxt)
|
||||||
* fdisk_get_devfd:
|
* fdisk_get_devfd:
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
*
|
*
|
||||||
* Retruns: device file descriptor.
|
* Returns: device file descriptor.
|
||||||
*/
|
*/
|
||||||
int fdisk_get_devfd(struct fdisk_context *cxt)
|
int fdisk_get_devfd(struct fdisk_context *cxt)
|
||||||
{
|
{
|
||||||
|
|
|
@ -404,7 +404,7 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum)
|
||||||
if (!pe)
|
if (!pe)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
DBG(LABEL, ul_debug("DOS: delete partiton %zu (max=%zu)", partnum,
|
DBG(LABEL, ul_debug("DOS: delete partition %zu (max=%zu)", partnum,
|
||||||
cxt->label->nparts_max));
|
cxt->label->nparts_max));
|
||||||
|
|
||||||
l = self_label(cxt);
|
l = self_label(cxt);
|
||||||
|
@ -743,7 +743,7 @@ static int dos_reset_alignment(struct fdisk_context *cxt)
|
||||||
|
|
||||||
/* overwrite necessary stuff by DOS deprecated stuff */
|
/* overwrite necessary stuff by DOS deprecated stuff */
|
||||||
if (is_dos_compatible(cxt)) {
|
if (is_dos_compatible(cxt)) {
|
||||||
DBG(LABEL, ul_debug("DOS: reseting alignemnt for DOS-comaptiblem PT"));
|
DBG(LABEL, ul_debug("DOS: resetting alignment for DOS-compatible PT"));
|
||||||
if (cxt->geom.sectors)
|
if (cxt->geom.sectors)
|
||||||
cxt->first_lba = cxt->geom.sectors; /* usually 63 */
|
cxt->first_lba = cxt->geom.sectors; /* usually 63 */
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ static int get_start_from_user( struct fdisk_context *cxt,
|
||||||
{
|
{
|
||||||
assert(start);
|
assert(start);
|
||||||
|
|
||||||
/* try to use tepmlate from 'pa' */
|
/* try to use template from 'pa' */
|
||||||
if (pa && pa->start_follow_default)
|
if (pa && pa->start_follow_default)
|
||||||
*start = dflt;
|
*start = dflt;
|
||||||
|
|
||||||
|
@ -1529,7 +1529,7 @@ static int dos_add_partition(struct fdisk_context *cxt,
|
||||||
|
|
||||||
/* pa specifies that extended partition is wanted */
|
/* pa specifies that extended partition is wanted */
|
||||||
} else if (pa && pa->type && IS_EXTENDED(pa->type->code)) {
|
} else if (pa && pa->type && IS_EXTENDED(pa->type->code)) {
|
||||||
DBG(LABEL, ul_debug("DOS: pa template %p: add extened", pa));
|
DBG(LABEL, ul_debug("DOS: pa template %p: add extended", pa));
|
||||||
if (l->ext_offset) {
|
if (l->ext_offset) {
|
||||||
fdisk_warnx(cxt, _("Extended partition already exists."));
|
fdisk_warnx(cxt, _("Extended partition already exists."));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1703,7 +1703,7 @@ static int write_sector(struct fdisk_context *cxt, fdisk_sector_t secno,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG(LABEL, ul_debug("DOS: writting to sector %ju", (uintmax_t) secno));
|
DBG(LABEL, ul_debug("DOS: writing to sector %ju", (uintmax_t) secno));
|
||||||
|
|
||||||
if (write(cxt->dev_fd, buf, cxt->sector_size) != (ssize_t) cxt->sector_size)
|
if (write(cxt->dev_fd, buf, cxt->sector_size) != (ssize_t) cxt->sector_size)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
@ -1734,7 +1734,7 @@ static int dos_write_disklabel(struct fdisk_context *cxt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mbr_changed) {
|
if (mbr_changed) {
|
||||||
DBG(LABEL, ul_debug("DOS: MBR changed, writting"));
|
DBG(LABEL, ul_debug("DOS: MBR changed, writing"));
|
||||||
mbr_set_magic(cxt->firstsector);
|
mbr_set_magic(cxt->firstsector);
|
||||||
rc = write_sector(cxt, 0, cxt->firstsector);
|
rc = write_sector(cxt, 0, cxt->firstsector);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
@ -1859,7 +1859,7 @@ static int dos_get_disklabel_item(struct fdisk_context *cxt, struct fdisk_labeli
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (item->id < __FDISK_NLABELITEMS)
|
if (item->id < __FDISK_NLABELITEMS)
|
||||||
rc = 1; /* unssupported generic item */
|
rc = 1; /* unsupported generic item */
|
||||||
else
|
else
|
||||||
rc = 2; /* out of range */
|
rc = 2; /* out of range */
|
||||||
break;
|
break;
|
||||||
|
@ -2096,7 +2096,7 @@ again:
|
||||||
*nxt->pt_entry = tmp;
|
*nxt->pt_entry = tmp;
|
||||||
|
|
||||||
/* Recount starts according to EBR offsets, the absolute
|
/* Recount starts according to EBR offsets, the absolute
|
||||||
* address tas to be still the same! */
|
* address still has to be the same! */
|
||||||
dos_partition_set_start(cur->pt_entry, nxt_start - cur->offset);
|
dos_partition_set_start(cur->pt_entry, nxt_start - cur->offset);
|
||||||
dos_partition_set_start(nxt->pt_entry, cur_start - nxt->offset);
|
dos_partition_set_start(nxt->pt_entry, cur_start - nxt->offset);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "libfdisk.h"
|
#include "libfdisk.h"
|
||||||
|
|
||||||
#include "nls.h" /* temporary before dialog API will be implamented */
|
#include "nls.h" /* temporary before dialog API will be implemented */
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -246,7 +246,7 @@ struct fdisk_field {
|
||||||
int flags; /* FDISK_FIELDFL_* */
|
int flags; /* FDISK_FIELDFL_* */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* note that the defauls is to display a column always */
|
/* note that the defaults is to display a column always */
|
||||||
enum {
|
enum {
|
||||||
FDISK_FIELDFL_DETAIL = (1 << 1), /* only display if fdisk_is_details() */
|
FDISK_FIELDFL_DETAIL = (1 << 1), /* only display if fdisk_is_details() */
|
||||||
FDISK_FIELDFL_EYECANDY = (1 << 2), /* don't display if fdisk_is_details() */
|
FDISK_FIELDFL_EYECANDY = (1 << 2), /* don't display if fdisk_is_details() */
|
||||||
|
@ -336,7 +336,7 @@ struct fdisk_ask {
|
||||||
} str;
|
} str;
|
||||||
/* FDISK_ASKTYPE_MENU */
|
/* FDISK_ASKTYPE_MENU */
|
||||||
struct ask_menu {
|
struct ask_menu {
|
||||||
int dfl; /* default meni item */
|
int dfl; /* default menu item */
|
||||||
int result;
|
int result;
|
||||||
struct ask_menuitem *first;
|
struct ask_menuitem *first;
|
||||||
} menu;
|
} menu;
|
||||||
|
@ -362,7 +362,7 @@ struct fdisk_context {
|
||||||
unsigned int readonly : 1, /* don't write to the device */
|
unsigned int readonly : 1, /* don't write to the device */
|
||||||
display_in_cyl_units : 1, /* for obscure labels */
|
display_in_cyl_units : 1, /* for obscure labels */
|
||||||
display_details : 1, /* expert display mode */
|
display_details : 1, /* expert display mode */
|
||||||
protect_bootbits : 1, /* don't zeroize fll irst sector */
|
protect_bootbits : 1, /* don't zeroize first sector */
|
||||||
listonly : 1; /* list partition, nothing else */
|
listonly : 1; /* list partition, nothing else */
|
||||||
|
|
||||||
char *collision; /* name of already existing FS/PT */
|
char *collision; /* name of already existing FS/PT */
|
||||||
|
@ -373,7 +373,7 @@ struct fdisk_context {
|
||||||
/* alignment */
|
/* alignment */
|
||||||
unsigned long grain; /* alignment unit */
|
unsigned long grain; /* alignment unit */
|
||||||
fdisk_sector_t first_lba; /* recommended begin of the first partition */
|
fdisk_sector_t first_lba; /* recommended begin of the first partition */
|
||||||
fdisk_sector_t last_lba; /* recomennded end of last partition */
|
fdisk_sector_t last_lba; /* recommended end of last partition */
|
||||||
|
|
||||||
/* geometry */
|
/* geometry */
|
||||||
fdisk_sector_t total_sectors; /* in logical sectors */
|
fdisk_sector_t total_sectors; /* in logical sectors */
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* @title: Field
|
* @title: Field
|
||||||
* @short_description: description of the partition fields
|
* @short_description: description of the partition fields
|
||||||
*
|
*
|
||||||
* The fdisk fields are static user-freindly descriptions of the partition. The
|
* The fdisk fields are static user-friendly descriptions of the partition. The
|
||||||
* fields are used to avoid label specific stuff in the functions that list disk
|
* fields are used to avoid label specific stuff in the functions that list disk
|
||||||
* partitions (e.g. fdisk -l). The field Id is the same as Id for fdisk_partition_to_string().
|
* partitions (e.g. fdisk -l). The field Id is the same as Id for fdisk_partition_to_string().
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
* </informalexample>
|
* </informalexample>
|
||||||
*
|
*
|
||||||
* This example lists all information about the first partition. It will work
|
* This example lists all information about the first partition. It will work
|
||||||
* for MBR as well as for GPT because fields are not hardcoded in the execmple.
|
* for MBR as well as for GPT because fields are not hardcoded in the example.
|
||||||
*
|
*
|
||||||
* See also fdisk_label_get_field_by_name(), fdisk_label_get_fields_ids_all()
|
* See also fdisk_label_get_field_by_name(), fdisk_label_get_fields_ids_all()
|
||||||
* and fdisk_label_get_fields_ids().
|
* and fdisk_label_get_fields_ids().
|
||||||
|
|
|
@ -674,7 +674,7 @@ static int gpt_mknew_header(struct fdisk_context *cxt,
|
||||||
|
|
||||||
/* According to EFI standard it's valid to count all the first
|
/* According to EFI standard it's valid to count all the first
|
||||||
* sector into header size, but some tools may have a problem
|
* sector into header size, but some tools may have a problem
|
||||||
* to accept it, so use the header without the zerozied area.
|
* to accept it, so use the header without the zeroed area.
|
||||||
* This does not have any impact to CRC, etc. --kzak Jan-2015
|
* This does not have any impact to CRC, etc. --kzak Jan-2015
|
||||||
*/
|
*/
|
||||||
header->size = cpu_to_le32(sizeof(struct gpt_header)
|
header->size = cpu_to_le32(sizeof(struct gpt_header)
|
||||||
|
@ -712,7 +712,7 @@ static int gpt_mknew_header(struct fdisk_context *cxt,
|
||||||
/*
|
/*
|
||||||
* Checks if there is a valid protective MBR partition table.
|
* Checks if there is a valid protective MBR partition table.
|
||||||
* Returns 0 if it is invalid or failure. Otherwise, return
|
* Returns 0 if it is invalid or failure. Otherwise, return
|
||||||
* GPT_MBR_PROTECTIVE or GPT_MBR_HYBRID, depeding on the detection.
|
* GPT_MBR_PROTECTIVE or GPT_MBR_HYBRID, depending on the detection.
|
||||||
*/
|
*/
|
||||||
static int valid_pmbr(struct fdisk_context *cxt)
|
static int valid_pmbr(struct fdisk_context *cxt)
|
||||||
{
|
{
|
||||||
|
@ -876,7 +876,7 @@ static inline uint32_t gpt_entryarr_count_crc32(struct gpt_header *header, struc
|
||||||
/*
|
/*
|
||||||
* Recompute header and partition array 32bit CRC checksums.
|
* Recompute header and partition array 32bit CRC checksums.
|
||||||
* This function does not fail - if there's corruption, then it
|
* This function does not fail - if there's corruption, then it
|
||||||
* will be reported when checksuming it again (ie: probing or verify).
|
* will be reported when checksumming it again (ie: probing or verify).
|
||||||
*/
|
*/
|
||||||
static void gpt_recompute_crc(struct gpt_header *header, struct gpt_entry *ents)
|
static void gpt_recompute_crc(struct gpt_header *header, struct gpt_entry *ents)
|
||||||
{
|
{
|
||||||
|
@ -1121,7 +1121,7 @@ static int gpt_get_disklabel_item(struct fdisk_context *cxt, struct fdisk_labeli
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (item->id < __FDISK_NLABELITEMS)
|
if (item->id < __FDISK_NLABELITEMS)
|
||||||
rc = 1; /* unssupported generic item */
|
rc = 1; /* unsupported generic item */
|
||||||
else
|
else
|
||||||
rc = 2; /* out of range */
|
rc = 2; /* out of range */
|
||||||
break;
|
break;
|
||||||
|
@ -1171,7 +1171,7 @@ static uint32_t check_too_big_partitions(struct gpt_header *header,
|
||||||
* Check if a partition ends before it begins
|
* Check if a partition ends before it begins
|
||||||
* Returns the faulting partition number, otherwise 0.
|
* Returns the faulting partition number, otherwise 0.
|
||||||
*/
|
*/
|
||||||
static uint32_t check_start_after_end_paritions(struct gpt_header *header,
|
static uint32_t check_start_after_end_partitions(struct gpt_header *header,
|
||||||
struct gpt_entry *ents)
|
struct gpt_entry *ents)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -1930,7 +1930,7 @@ err1:
|
||||||
/*
|
/*
|
||||||
* Verify data integrity and report any found problems for:
|
* Verify data integrity and report any found problems for:
|
||||||
* - primary and backup header validations
|
* - primary and backup header validations
|
||||||
* - paritition validations
|
* - partition validations
|
||||||
*/
|
*/
|
||||||
static int gpt_verify_disklabel(struct fdisk_context *cxt)
|
static int gpt_verify_disklabel(struct fdisk_context *cxt)
|
||||||
{
|
{
|
||||||
|
@ -2012,7 +2012,7 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt)
|
||||||
ptnum);
|
ptnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptnum = check_start_after_end_paritions(gpt->pheader, gpt->ents);
|
ptnum = check_start_after_end_partitions(gpt->pheader, gpt->ents);
|
||||||
if (ptnum) {
|
if (ptnum) {
|
||||||
nerror++;
|
nerror++;
|
||||||
fdisk_warnx(cxt, _("Partition %u ends before it starts."),
|
fdisk_warnx(cxt, _("Partition %u ends before it starts."),
|
||||||
|
|
|
@ -28,7 +28,7 @@ UL_DEBUG_DEFINE_MASKNAMES(libfdisk) =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fdisk_init_debug:
|
* fdisk_init_debug:
|
||||||
* @mask: debug mask (0xffff to enable full debuging)
|
* @mask: debug mask (0xffff to enable full debugging)
|
||||||
*
|
*
|
||||||
* If the @mask is not specified then this function reads
|
* If the @mask is not specified then this function reads
|
||||||
* LIBFDISK_DEBUG environment variable to get the mask.
|
* LIBFDISK_DEBUG environment variable to get the mask.
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct fdisk_labelitem *fdisk_new_labelitem(void)
|
||||||
* fdisk_ref_labelitem:
|
* fdisk_ref_labelitem:
|
||||||
* @li: label item
|
* @li: label item
|
||||||
*
|
*
|
||||||
* Incremparts reference counter.
|
* Increments reference counter.
|
||||||
*
|
*
|
||||||
* Since: v2.29
|
* Since: v2.29
|
||||||
*/
|
*/
|
||||||
|
@ -85,7 +85,7 @@ int fdisk_reset_labelitem(struct fdisk_labelitem *li)
|
||||||
* fdisk_unref_labelitem:
|
* fdisk_unref_labelitem:
|
||||||
* @li: label item
|
* @li: label item
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @li is automatically
|
* Decrements reference counter, on zero the @li is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*
|
*
|
||||||
* Since: v2.29
|
* Since: v2.29
|
||||||
|
@ -215,7 +215,7 @@ static int test_listitems(struct fdisk_test *ts, int argc, char *argv[])
|
||||||
printf("%s: %ju\n", name, num);
|
printf("%s: %ju\n", name, num);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: /* item unssuported by label -- ignore */
|
case 1: /* item unsuported by label -- ignore */
|
||||||
rc = 0;
|
rc = 0;
|
||||||
break;
|
break;
|
||||||
case 2: /* end (out of range) */
|
case 2: /* end (out of range) */
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* fdisk_unref_context() only.
|
* fdisk_unref_context() only.
|
||||||
*
|
*
|
||||||
* Anyway, all label drives share in-memory first sector. The function
|
* Anyway, all label drives share in-memory first sector. The function
|
||||||
* fdisk_create_disklabel() overwrites thi in-memory sector. But it's possible that
|
* fdisk_create_disklabel() overwrites this in-memory sector. But it's possible that
|
||||||
* label driver also uses another buffers, for example GPT reads more sectors
|
* label driver also uses another buffers, for example GPT reads more sectors
|
||||||
* from the device.
|
* from the device.
|
||||||
*
|
*
|
||||||
|
@ -293,7 +293,7 @@ int fdisk_verify_disklabel(struct fdisk_context *cxt)
|
||||||
* The function requires enabled "details" by fdisk_enable_details().
|
* The function requires enabled "details" by fdisk_enable_details().
|
||||||
*
|
*
|
||||||
* It's recommended to use fdisk_get_disklabel_item() if you need better
|
* It's recommended to use fdisk_get_disklabel_item() if you need better
|
||||||
* control on output and formmatting.
|
* control on output and formatting.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, otherwise, a corresponding error.
|
* Returns: 0 on success, otherwise, a corresponding error.
|
||||||
*/
|
*/
|
||||||
|
@ -336,7 +336,7 @@ int fdisk_list_disklabel(struct fdisk_context *cxt)
|
||||||
*
|
*
|
||||||
* Creates a new disk label of type @name. If @name is NULL, then it will
|
* Creates a new disk label of type @name. If @name is NULL, then it will
|
||||||
* create a default system label type, either SUN or DOS. The function
|
* create a default system label type, either SUN or DOS. The function
|
||||||
* automaticaly switches the current label driver to @name. The function
|
* automatically switches the current label driver to @name. The function
|
||||||
* fdisk_get_label() returns the current label driver.
|
* fdisk_get_label() returns the current label driver.
|
||||||
*
|
*
|
||||||
* The function modifies in-memory data only.
|
* The function modifies in-memory data only.
|
||||||
|
@ -392,7 +392,7 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name)
|
||||||
* GPT is composed from two items, PMBR and GPT, n=0 return offset to PMBR and n=1
|
* GPT is composed from two items, PMBR and GPT, n=0 return offset to PMBR and n=1
|
||||||
* return offset to GPT. For more details see 'D' expert fdisk command.
|
* return offset to GPT. For more details see 'D' expert fdisk command.
|
||||||
*
|
*
|
||||||
* Returns: 0 on succes, <0 on error, 1 no more items.
|
* Returns: 0 on success, <0 on error, 1 no more items.
|
||||||
*/
|
*/
|
||||||
int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, const char **name,
|
int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, const char **name,
|
||||||
uint64_t *offset, size_t *size)
|
uint64_t *offset, size_t *size)
|
||||||
|
@ -445,7 +445,7 @@ int fdisk_get_disklabel_id(struct fdisk_context *cxt, char **id)
|
||||||
* until it returns error or 2, the result in @item should be ignored when
|
* until it returns error or 2, the result in @item should be ignored when
|
||||||
* function returns 1. Don't forget to use fdisk_reset_labelitem() or fdisk_unref_labelitem().
|
* function returns 1. Don't forget to use fdisk_reset_labelitem() or fdisk_unref_labelitem().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, < 0 on error, 1 on unssupported item, 2 @id out of range
|
* Returns: 0 on success, < 0 on error, 1 on unsupported item, 2 @id out of range
|
||||||
*/
|
*/
|
||||||
int fdisk_get_disklabel_item(struct fdisk_context *cxt, int id, struct fdisk_labelitem *item)
|
int fdisk_get_disklabel_item(struct fdisk_context *cxt, int id, struct fdisk_labelitem *item)
|
||||||
{
|
{
|
||||||
|
@ -574,7 +574,7 @@ void fdisk_deinit_label(struct fdisk_label *lb)
|
||||||
* @changed: 0/1
|
* @changed: 0/1
|
||||||
*
|
*
|
||||||
* Marks in-memory data as changed, to force fdisk_write_disklabel() to write
|
* Marks in-memory data as changed, to force fdisk_write_disklabel() to write
|
||||||
* to device. This should be unnecessar by default, the library keeps track
|
* to device. This should be unnecessary by default, the library keeps track
|
||||||
* about changes.
|
* about changes.
|
||||||
*/
|
*/
|
||||||
void fdisk_label_set_changed(struct fdisk_label *lb, int changed)
|
void fdisk_label_set_changed(struct fdisk_label *lb, int changed)
|
||||||
|
|
|
@ -106,7 +106,7 @@ static struct fdisk_partition *__copy_partition(struct fdisk_partition *o)
|
||||||
* fdisk_ref_partition:
|
* fdisk_ref_partition:
|
||||||
* @pa: partition pointer
|
* @pa: partition pointer
|
||||||
*
|
*
|
||||||
* Incremparts reference counter.
|
* Increments reference counter.
|
||||||
*/
|
*/
|
||||||
void fdisk_ref_partition(struct fdisk_partition *pa)
|
void fdisk_ref_partition(struct fdisk_partition *pa)
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ void fdisk_ref_partition(struct fdisk_partition *pa)
|
||||||
* fdisk_unref_partition:
|
* fdisk_unref_partition:
|
||||||
* @pa: partition pointer
|
* @pa: partition pointer
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @pa is automatically
|
* Decrements reference counter, on zero the @pa is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*/
|
*/
|
||||||
void fdisk_unref_partition(struct fdisk_partition *pa)
|
void fdisk_unref_partition(struct fdisk_partition *pa)
|
||||||
|
@ -345,7 +345,7 @@ int fdisk_partition_size_explicit(struct fdisk_partition *pa, int enable)
|
||||||
/**
|
/**
|
||||||
* fdisk_partition_set_partno:
|
* fdisk_partition_set_partno:
|
||||||
* @pa: partition
|
* @pa: partition
|
||||||
* @num: partitin number (0 is the first partition, maximal is SIZE_MAX-1)
|
* @num: partition number (0 is the first partition, maximal is SIZE_MAX-1)
|
||||||
*
|
*
|
||||||
* Note that zero is valid partno too. Use fdisk_partition_unset_partno() to
|
* Note that zero is valid partno too. Use fdisk_partition_unset_partno() to
|
||||||
* undefine the partno.
|
* undefine the partno.
|
||||||
|
@ -444,7 +444,7 @@ int fdisk_partition_partno_follow_default(struct fdisk_partition *pa, int enable
|
||||||
* @pa: partition
|
* @pa: partition
|
||||||
* @type: partition type
|
* @type: partition type
|
||||||
*
|
*
|
||||||
* Sets parititon type.
|
* Sets partition type.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error.
|
* Returns: 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
|
@ -808,7 +808,7 @@ done:
|
||||||
* For example
|
* For example
|
||||||
* <informalexample>
|
* <informalexample>
|
||||||
* <programlisting>
|
* <programlisting>
|
||||||
* struct fdisk_parition *pa;
|
* struct fdisk_partition *pa;
|
||||||
*
|
*
|
||||||
* fdisk_get_partition(cxt, 0, &pa);
|
* fdisk_get_partition(cxt, 0, &pa);
|
||||||
* fdisk_partition_to_string(pa, FDISK_FIELD_UUID, &data);
|
* fdisk_partition_to_string(pa, FDISK_FIELD_UUID, &data);
|
||||||
|
@ -1310,7 +1310,7 @@ int fdisk_wipe_partition(struct fdisk_context *cxt, size_t partno, int enable)
|
||||||
* @pa: template for the partition (or NULL)
|
* @pa: template for the partition (or NULL)
|
||||||
* @partno: NULL or returns new partition number
|
* @partno: NULL or returns new partition number
|
||||||
*
|
*
|
||||||
* If @pa is not specified or any @pa item is missiong the libfdisk will ask by
|
* If @pa is not specified or any @pa item is missing the libfdisk will ask by
|
||||||
* fdisk_ask_ API.
|
* fdisk_ask_ API.
|
||||||
*
|
*
|
||||||
* Adds a new partition to disklabel.
|
* Adds a new partition to disklabel.
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct fdisk_parttype *fdisk_new_parttype(void)
|
||||||
* fdisk_ref_parttype:
|
* fdisk_ref_parttype:
|
||||||
* @t: partition type
|
* @t: partition type
|
||||||
*
|
*
|
||||||
* Incremparts reference counter for allocated types
|
* Increments reference counter for allocated types
|
||||||
*/
|
*/
|
||||||
void fdisk_ref_parttype(struct fdisk_parttype *t)
|
void fdisk_ref_parttype(struct fdisk_parttype *t)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ void fdisk_ref_parttype(struct fdisk_parttype *t)
|
||||||
* fdisk_unref_parttype
|
* fdisk_unref_parttype
|
||||||
* @t: partition pointer
|
* @t: partition pointer
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @t is automatically
|
* Decrements reference counter, on zero the @t is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*/
|
*/
|
||||||
void fdisk_unref_parttype(struct fdisk_parttype *t)
|
void fdisk_unref_parttype(struct fdisk_parttype *t)
|
||||||
|
@ -95,7 +95,7 @@ int fdisk_parttype_set_name(struct fdisk_parttype *t, const char *str)
|
||||||
/**
|
/**
|
||||||
* fdisk_parttype_set_typestr:
|
* fdisk_parttype_set_typestr:
|
||||||
* @t: partition type
|
* @t: partition type
|
||||||
* @str: type identificator (e.g. GUID for GPT)
|
* @str: type identifier (e.g. GUID for GPT)
|
||||||
*
|
*
|
||||||
* Sets type string to allocated partition type, for static types
|
* Sets type string to allocated partition type, for static types
|
||||||
* it returns -EINVAL. Don't use this function for MBR, see
|
* it returns -EINVAL. Don't use this function for MBR, see
|
||||||
|
@ -123,7 +123,7 @@ int fdisk_parttype_set_typestr(struct fdisk_parttype *t, const char *str)
|
||||||
/**
|
/**
|
||||||
* fdisk_parttype_set_code:
|
* fdisk_parttype_set_code:
|
||||||
* @t: partition type
|
* @t: partition type
|
||||||
* @code: type identificator (e.g. MBR type codes)
|
* @code: type identifier (e.g. MBR type codes)
|
||||||
*
|
*
|
||||||
* Sets type code to allocated partition type, for static types it returns
|
* Sets type code to allocated partition type, for static types it returns
|
||||||
* -EINVAL. Don't use this function for GPT, see fdisk_parttype_set_typestr().
|
* -EINVAL. Don't use this function for GPT, see fdisk_parttype_set_typestr().
|
||||||
|
@ -291,7 +291,7 @@ struct fdisk_parttype *fdisk_copy_parttype(const struct fdisk_parttype *type)
|
||||||
* @lb: label
|
* @lb: label
|
||||||
* @str: string to parse from
|
* @str: string to parse from
|
||||||
*
|
*
|
||||||
* Parses partition type from @str according to the label. Thefunction returns
|
* Parses partition type from @str according to the label. The function returns
|
||||||
* a pointer to static table of the partition types, or newly allocated
|
* a pointer to static table of the partition types, or newly allocated
|
||||||
* partition type for unknown types (see fdisk_parttype_is_unknown(). It's
|
* partition type for unknown types (see fdisk_parttype_is_unknown(). It's
|
||||||
* safe to call fdisk_unref_parttype() for all results.
|
* safe to call fdisk_unref_parttype() for all results.
|
||||||
|
@ -397,7 +397,7 @@ const char *fdisk_parttype_get_name(const struct fdisk_parttype *t)
|
||||||
*
|
*
|
||||||
* Checks for example result from fdisk_label_parse_parttype().
|
* Checks for example result from fdisk_label_parse_parttype().
|
||||||
*
|
*
|
||||||
* Returns: 1 is type is "unknonw" or 0.
|
* Returns: 1 is type is "unknown" or 0.
|
||||||
*/
|
*/
|
||||||
int fdisk_parttype_is_unknown(const struct fdisk_parttype *t)
|
int fdisk_parttype_is_unknown(const struct fdisk_parttype *t)
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,7 +133,7 @@ done:
|
||||||
* fdisk_ref_script:
|
* fdisk_ref_script:
|
||||||
* @dp: script pointer
|
* @dp: script pointer
|
||||||
*
|
*
|
||||||
* Incremparts reference counter.
|
* Increments reference counter.
|
||||||
*/
|
*/
|
||||||
void fdisk_ref_script(struct fdisk_script *dp)
|
void fdisk_ref_script(struct fdisk_script *dp)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ static void fdisk_reset_script(struct fdisk_script *dp)
|
||||||
* fdisk_unref_script:
|
* fdisk_unref_script:
|
||||||
* @dp: script pointer
|
* @dp: script pointer
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @dp is automatically
|
* Decrements reference counter, on zero the @dp is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*/
|
*/
|
||||||
void fdisk_unref_script(struct fdisk_script *dp)
|
void fdisk_unref_script(struct fdisk_script *dp)
|
||||||
|
@ -656,7 +656,7 @@ static int write_file_sfdisk(struct fdisk_script *dp, FILE *f)
|
||||||
* @dp: script
|
* @dp: script
|
||||||
* @f: output file
|
* @f: output file
|
||||||
*
|
*
|
||||||
* Writes script @dp to the ile @f.
|
* Writes script @dp to the file @f.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error.
|
* Returns: 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
|
@ -714,7 +714,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s)
|
||||||
|| strcmp(name, "first-lba") == 0
|
|| strcmp(name, "first-lba") == 0
|
||||||
|| strcmp(name, "last-lba") == 0
|
|| strcmp(name, "last-lba") == 0
|
||||||
|| strcmp(name, "table-length") == 0) {
|
|| strcmp(name, "table-length") == 0) {
|
||||||
; /* whatever is posssible */
|
; /* whatever is possible */
|
||||||
} else
|
} else
|
||||||
goto done; /* unknown header */
|
goto done; /* unknown header */
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s)
|
||||||
|
|
||||||
} else if (!strncasecmp(p, "type=", 5) ||
|
} else if (!strncasecmp(p, "type=", 5) ||
|
||||||
|
|
||||||
!strncasecmp(p, "Id=", 3)) { /* backward compatiility */
|
!strncasecmp(p, "Id=", 3)) { /* backward compatibility */
|
||||||
char *type;
|
char *type;
|
||||||
|
|
||||||
p += (*p == 'I' ? 3 : 5); /* "Id=" or "type=" */
|
p += (*p == 'I' ? 3 : 5); /* "Id=" or "type=" */
|
||||||
|
@ -1059,7 +1059,7 @@ static int parse_line_valcommas(struct fdisk_script *dp, char *s)
|
||||||
if (*p == ',' || *p == ';' || alone_sign(sign, p)) {
|
if (*p == ',' || *p == ';' || alone_sign(sign, p)) {
|
||||||
fdisk_partition_end_follow_default(pa, 1);
|
fdisk_partition_end_follow_default(pa, 1);
|
||||||
if (sign == TK_PLUS)
|
if (sign == TK_PLUS)
|
||||||
/* alone '+' means use all possible space, elone '-' means nothing */
|
/* '+' alone means use all possible space, '-' alone means nothing */
|
||||||
pa->resize = FDISK_RESIZE_ENLARGE;
|
pa->resize = FDISK_RESIZE_ENLARGE;
|
||||||
} else {
|
} else {
|
||||||
int pow = 0;
|
int pow = 0;
|
||||||
|
@ -1174,7 +1174,7 @@ static int fdisk_script_read_buffer(struct fdisk_script *dp, char *s)
|
||||||
* @fn_fgets: callback function
|
* @fn_fgets: callback function
|
||||||
*
|
*
|
||||||
* The library uses fgets() function to read the next line from the script.
|
* The library uses fgets() function to read the next line from the script.
|
||||||
* This default maybe overrided to another function. Note that the function has
|
* This default maybe overridden by another function. Note that the function has
|
||||||
* to return the line terminated by \n (for example readline(3) removes \n).
|
* to return the line terminated by \n (for example readline(3) removes \n).
|
||||||
*
|
*
|
||||||
* Return: 0 on success, <0 on error
|
* Return: 0 on success, <0 on error
|
||||||
|
@ -1327,7 +1327,7 @@ struct fdisk_script *fdisk_get_script(struct fdisk_context *cxt)
|
||||||
* @cxt: context
|
* @cxt: context
|
||||||
* @dp: script
|
* @dp: script
|
||||||
*
|
*
|
||||||
* Associte context @cxt with script @dp and creates a new empty disklabel.
|
* Associate context @cxt with script @dp and creates a new empty disklabel.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error.
|
* Returns: 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -300,7 +300,7 @@ static int sgi_get_disklabel_item(struct fdisk_context *cxt, struct fdisk_labeli
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (item->id < __FDISK_NLABELITEMS)
|
if (item->id < __FDISK_NLABELITEMS)
|
||||||
rc = 1; /* unssupported generic item */
|
rc = 1; /* unsupported generic item */
|
||||||
else
|
else
|
||||||
rc = 2; /* out of range */
|
rc = 2; /* out of range */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static struct fdisk_parttype sun_parttypes[] = {
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* return poiter buffer with on-disk data */
|
/* return pointer buffer with on-disk data */
|
||||||
static inline struct sun_disklabel *self_disklabel(struct fdisk_context *cxt)
|
static inline struct sun_disklabel *self_disklabel(struct fdisk_context *cxt)
|
||||||
{
|
{
|
||||||
assert(cxt);
|
assert(cxt);
|
||||||
|
@ -783,7 +783,7 @@ static int sun_get_disklabel_item(struct fdisk_context *cxt, struct fdisk_labeli
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (item->id < __FDISK_NLABELITEMS)
|
if (item->id < __FDISK_NLABELITEMS)
|
||||||
rc = 1; /* unssupported generic item */
|
rc = 1; /* unsupported generic item */
|
||||||
else
|
else
|
||||||
rc = 2; /* out of range */
|
rc = 2; /* out of range */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct fdisk_table *fdisk_new_table(void)
|
||||||
* fdisk_reset_table:
|
* fdisk_reset_table:
|
||||||
* @tb: tab pointer
|
* @tb: tab pointer
|
||||||
*
|
*
|
||||||
* Removes all entries (partitions) from the table. The parititons with zero
|
* Removes all entries (partitions) from the table. The partitions with zero
|
||||||
* reference count will be deallocated. This function does not modify partition
|
* reference count will be deallocated. This function does not modify partition
|
||||||
* table.
|
* table.
|
||||||
*
|
*
|
||||||
|
@ -65,7 +65,7 @@ int fdisk_reset_table(struct fdisk_table *tb)
|
||||||
* fdisk_ref_table:
|
* fdisk_ref_table:
|
||||||
* @tb: table pointer
|
* @tb: table pointer
|
||||||
*
|
*
|
||||||
* Incremparts reference counter.
|
* Increments reference counter.
|
||||||
*/
|
*/
|
||||||
void fdisk_ref_table(struct fdisk_table *tb)
|
void fdisk_ref_table(struct fdisk_table *tb)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ void fdisk_ref_table(struct fdisk_table *tb)
|
||||||
* fdisk_unref_table:
|
* fdisk_unref_table:
|
||||||
* @tb: table pointer
|
* @tb: table pointer
|
||||||
*
|
*
|
||||||
* De-incremparts reference counter, on zero the @tb is automatically
|
* Descrements reference counter, on zero the @tb is automatically
|
||||||
* deallocated.
|
* deallocated.
|
||||||
*/
|
*/
|
||||||
void fdisk_unref_table(struct fdisk_table *tb)
|
void fdisk_unref_table(struct fdisk_table *tb)
|
||||||
|
@ -682,7 +682,7 @@ int fdisk_table_wrong_order(struct fdisk_table *tb)
|
||||||
* Add partitions from table @tb to the in-memory disk label. See
|
* Add partitions from table @tb to the in-memory disk label. See
|
||||||
* fdisk_add_partition(), fdisk_delete_all_partitions(). The partitions
|
* fdisk_add_partition(), fdisk_delete_all_partitions(). The partitions
|
||||||
* that does not define start (or does not follow the default start)
|
* that does not define start (or does not follow the default start)
|
||||||
* are ingored.
|
* are ignored.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, <0 on error.
|
* Returns: 0 on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -311,10 +311,10 @@ static PyObject *Context_enable_fork(ContextObjext *self, PyObject *args, PyObje
|
||||||
|
|
||||||
#define Context_disable_canonicalize_HELP "disable_canonicalize(disable)\n\n" \
|
#define Context_disable_canonicalize_HELP "disable_canonicalize(disable)\n\n" \
|
||||||
"Enable/disable paths canonicalization and tags evaluation. The libmount context\n" \
|
"Enable/disable paths canonicalization and tags evaluation. The libmount context\n" \
|
||||||
"canonicalies paths when search in fstab and when prepare source and target paths\n" \
|
"canonicalizes paths when searching fstab and when preparing source and target paths\n" \
|
||||||
"for mount(2) syscall.\n" \
|
"for mount(2) syscall.\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"This fuction has effect to the private (within context) fstab instance only\n" \
|
"This function has effect to the private (within context) fstab instance only\n" \
|
||||||
"(see Cxt.fstab).\n" \
|
"(see Cxt.fstab).\n" \
|
||||||
"Returns self or raises an exception in case of an error."
|
"Returns self or raises an exception in case of an error."
|
||||||
static PyObject *Context_disable_canonicalize(ContextObjext *self, PyObject *args, PyObject *kwds)
|
static PyObject *Context_disable_canonicalize(ContextObjext *self, PyObject *args, PyObject *kwds)
|
||||||
|
@ -1074,11 +1074,11 @@ static PyObject *Context_helper_setopt(ContextObjext *self, PyObject *args, PyOb
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Context_init_helper_HELP "init_helper(action, flags)\n\n" \
|
#define Context_init_helper_HELP "init_helper(action, flags)\n\n" \
|
||||||
"This function infors libmount that used from [u]mount.type helper.\n" \
|
"This function informs libmount that it is used from [u]mount.type helper.\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"The function also calls Cxt.disable_helpers() to avoid recursive\n" \
|
"The function also calls Cxt.disable_helpers() to avoid calling\n" \
|
||||||
"mount.type helpers calling. It you really want to call another\n" \
|
"mount.type helpers recursively. If you really want to call another\n" \
|
||||||
"mount.type helper from your helper than you have to explicitly enable this\n" \
|
"mount.type helper from your helper then you have to explicitly enable this\n" \
|
||||||
"feature by:\n" \
|
"feature by:\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"Cxt.disable_helpers(False);\n" \
|
"Cxt.disable_helpers(False);\n" \
|
||||||
|
|
|
@ -609,7 +609,7 @@ static PyMethodDef Fs_methods[] = {
|
||||||
|
|
||||||
static void Fs_destructor(FsObject *self)
|
static void Fs_destructor(FsObject *self)
|
||||||
{
|
{
|
||||||
DBG(FS, pymnt_debug_h(self->fs, "destrutor py-obj: %p, py-refcnt=%d",
|
DBG(FS, pymnt_debug_h(self->fs, "destructor py-obj: %p, py-refcnt=%d",
|
||||||
self, (int) ((PyObject *) self)->ob_refcnt));
|
self, (int) ((PyObject *) self)->ob_refcnt));
|
||||||
mnt_unref_fs(self->fs);
|
mnt_unref_fs(self->fs);
|
||||||
PyFree(self);
|
PyFree(self);
|
||||||
|
@ -748,7 +748,7 @@ PyObject *PyObjectResultFs(struct libmnt_fs *fs)
|
||||||
return (PyObject *) result;
|
return (PyObject *) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creating an encapsualing object: increment the refcount, so that code
|
/* Creating an encapsulating object: increment the refcount, so that code
|
||||||
* such as tab.next_fs() doesn't call the destructor, which would free
|
* such as tab.next_fs() doesn't call the destructor, which would free
|
||||||
* our fs struct as well
|
* our fs struct as well
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -130,7 +130,7 @@ char *pystos(PyObject *pys)
|
||||||
"Please note that none of the classes' attributes may be deleted.\n" \
|
"Please note that none of the classes' attributes may be deleted.\n" \
|
||||||
"This is not a complete mapping to the libmount C API, nor is it\n" \
|
"This is not a complete mapping to the libmount C API, nor is it\n" \
|
||||||
"attempting to be one.\n" "Iterator functions only allow forward\n" \
|
"attempting to be one.\n" "Iterator functions only allow forward\n" \
|
||||||
"iteration for now. Contex.get_{user_,}mflags() differs from the C API\n" \
|
"iteration for now. Context.get_{user_,}mflags() differs from the C API\n" \
|
||||||
"and returns the flags directly. Fs.get_tag() differs from the C API\n" \
|
"and returns the flags directly. Fs.get_tag() differs from the C API\n" \
|
||||||
"and returns a (tag, value) tuple. Every attribute is \"filtered\"" \
|
"and returns a (tag, value) tuple. Every attribute is \"filtered\"" \
|
||||||
"through appropriate getters/setters, no values are set directly."
|
"through appropriate getters/setters, no values are set directly."
|
||||||
|
|
|
@ -546,7 +546,7 @@ void Table_unref(struct libmnt_table *tab)
|
||||||
|
|
||||||
static void Table_destructor(TableObject *self)
|
static void Table_destructor(TableObject *self)
|
||||||
{
|
{
|
||||||
DBG(TAB, pymnt_debug_h(self->tab, "destrutor py-obj: %p, py-refcnt=%d",
|
DBG(TAB, pymnt_debug_h(self->tab, "destructor py-obj: %p, py-refcnt=%d",
|
||||||
self, (int) ((PyObject *) self)->ob_refcnt));
|
self, (int) ((PyObject *) self)->ob_refcnt));
|
||||||
Table_unref(self->tab);
|
Table_unref(self->tab);
|
||||||
self->tab = NULL;
|
self->tab = NULL;
|
||||||
|
@ -686,7 +686,7 @@ PyObject *PyObjectResultTab(struct libmnt_table *tab)
|
||||||
return (PyObject *) result;
|
return (PyObject *) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creating an encapsualing object: increment the refcount, so that
|
/* Creating an encapsulating object: increment the refcount, so that
|
||||||
* code such as: cxt.get_fstab() doesn't call the destructor, which
|
* code such as: cxt.get_fstab() doesn't call the destructor, which
|
||||||
* would free our tab struct as well
|
* would free our tab struct as well
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the key defines the order in the tree, and so it also defines (optimal)
|
* the key defines the order in the tree, and so it also defines (optimal)
|
||||||
* block layout. objectid corresonds to the inode number. The flags
|
* block layout. objectid corresponds with the inode number. The flags
|
||||||
* tells us things about the object, and is a kind of stream selector.
|
* tells us things about the object, and is a kind of stream selector.
|
||||||
* so for a given inode, keys with flags of 1 might refer to the inode
|
* so for a given inode, keys with flags of 1 might refer to the inode
|
||||||
* data, flags of 2 may point to file data in the btree and flags == 3
|
* data, flags of 2 may point to file data in the btree and flags == 3
|
||||||
|
|
|
@ -214,7 +214,7 @@ static int context_init_paths(struct libmnt_context *cxt, int writable)
|
||||||
if (!writable)
|
if (!writable)
|
||||||
return 0; /* only paths wanted */
|
return 0; /* only paths wanted */
|
||||||
if (mnt_context_is_nomtab(cxt))
|
if (mnt_context_is_nomtab(cxt))
|
||||||
return 0; /* write mode overrided by mount -n */
|
return 0; /* write mode overridden by mount -n */
|
||||||
if (cxt->flags & MNT_FL_TABPATHS_CHECKED)
|
if (cxt->flags & MNT_FL_TABPATHS_CHECKED)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ int mnt_context_get_optsmode(struct libmnt_context *cxt)
|
||||||
* canonicalizes paths when searching in fstab and when preparing source and target paths
|
* canonicalizes paths when searching in fstab and when preparing source and target paths
|
||||||
* for mount(2) syscall.
|
* for mount(2) syscall.
|
||||||
*
|
*
|
||||||
* This fuction has an effect on the private (within context) fstab instance only
|
* This function has an effect on the private (within context) fstab instance only
|
||||||
* (see mnt_context_set_fstab()). If you want to use an external fstab then you
|
* (see mnt_context_set_fstab()). If you want to use an external fstab then you
|
||||||
* need to manage your private struct libmnt_cache (see mnt_table_set_cache(fstab,
|
* need to manage your private struct libmnt_cache (see mnt_table_set_cache(fstab,
|
||||||
* NULL).
|
* NULL).
|
||||||
|
@ -686,7 +686,7 @@ int mnt_context_is_loopdel(struct libmnt_context *cxt)
|
||||||
*
|
*
|
||||||
* The mount context uses private @fs by default. This function allows to
|
* The mount context uses private @fs by default. This function allows to
|
||||||
* overwrite the private @fs with an external instance. This function
|
* overwrite the private @fs with an external instance. This function
|
||||||
* increments @fs reference counter (and deincrement reference counter of the
|
* increments @fs reference counter (and decrement reference counter of the
|
||||||
* old fs).
|
* old fs).
|
||||||
*
|
*
|
||||||
* The @fs will be modified by mnt_context_set_{source,target,options,fstype}
|
* The @fs will be modified by mnt_context_set_{source,target,options,fstype}
|
||||||
|
@ -766,7 +766,7 @@ void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt)
|
||||||
* Note that libmount does not interpret "nofail" (MNT_MS_NOFAIL)
|
* Note that libmount does not interpret "nofail" (MNT_MS_NOFAIL)
|
||||||
* mount option. The real return code is always returned, when
|
* mount option. The real return code is always returned, when
|
||||||
* the device does not exist then it's usually MNT_ERR_NOSOURCE
|
* the device does not exist then it's usually MNT_ERR_NOSOURCE
|
||||||
* from libmount or ENOENT, ENOTDIR, ENOTBLK, ENXIO from moun(2).
|
* from libmount or ENOENT, ENOTDIR, ENOTBLK, ENXIO from mount(2).
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, negative number in case of error.
|
* Returns: 0 on success, negative number in case of error.
|
||||||
*/
|
*/
|
||||||
|
@ -1191,7 +1191,7 @@ int mnt_context_set_tables_errcb(struct libmnt_context *cxt,
|
||||||
/**
|
/**
|
||||||
* mnt_context_set_cache:
|
* mnt_context_set_cache:
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @cache: cache instance or nULL
|
* @cache: cache instance or NULL
|
||||||
*
|
*
|
||||||
* The mount context maintains a private struct libmnt_cache by default. This
|
* The mount context maintains a private struct libmnt_cache by default. This
|
||||||
* function allows to overwrite the private cache with an external instance.
|
* function allows to overwrite the private cache with an external instance.
|
||||||
|
@ -1248,7 +1248,7 @@ struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt)
|
||||||
* mnt_context_set_passwd_cb:
|
* mnt_context_set_passwd_cb:
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @get: callback to get password
|
* @get: callback to get password
|
||||||
* @release: callback to release (delallocate) password
|
* @release: callback to release (deallocate) password
|
||||||
*
|
*
|
||||||
* Sets callbacks for encryption password (e.g encrypted loopdev). This
|
* Sets callbacks for encryption password (e.g encrypted loopdev). This
|
||||||
* function is deprecated (encrypted loops are no longer supported).
|
* function is deprecated (encrypted loops are no longer supported).
|
||||||
|
@ -1275,7 +1275,7 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt,
|
||||||
* interrupted by signal or signals have to be ignored when the lock is locked.
|
* interrupted by signal or signals have to be ignored when the lock is locked.
|
||||||
*
|
*
|
||||||
* The default behavior is to ignore all signals (except SIGALRM and
|
* The default behavior is to ignore all signals (except SIGALRM and
|
||||||
* SIGTRAP for mtab udate) when the lock is locked. If this behavior
|
* SIGTRAP for mtab update) when the lock is locked. If this behavior
|
||||||
* is unacceptable, then use:
|
* is unacceptable, then use:
|
||||||
*
|
*
|
||||||
* lc = mnt_context_get_lock(cxt);
|
* lc = mnt_context_get_lock(cxt);
|
||||||
|
@ -1349,7 +1349,7 @@ int mnt_context_set_mflags(struct libmnt_context *cxt, unsigned long flags)
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @flags: returns MS_* mount flags
|
* @flags: returns MS_* mount flags
|
||||||
*
|
*
|
||||||
* Converts mount options string to MS_* flags and bitewise-OR the result with
|
* Converts mount options string to MS_* flags and bitwise-OR the result with
|
||||||
* the already defined flags (see mnt_context_set_mflags()).
|
* the already defined flags (see mnt_context_set_mflags()).
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, negative number in case of error.
|
* Returns: 0 on success, negative number in case of error.
|
||||||
|
@ -1406,7 +1406,7 @@ int mnt_context_set_user_mflags(struct libmnt_context *cxt, unsigned long flags)
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @flags: returns mount flags
|
* @flags: returns mount flags
|
||||||
*
|
*
|
||||||
* Converts mount options string to MNT_MS_* flags and bitewise-OR the result
|
* Converts mount options string to MNT_MS_* flags and bitwise-OR the result
|
||||||
* with the already defined flags (see mnt_context_set_user_mflags()).
|
* with the already defined flags (see mnt_context_set_user_mflags()).
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, negative number in case of error.
|
* Returns: 0 on success, negative number in case of error.
|
||||||
|
@ -2440,7 +2440,7 @@ static int test_mount(struct libmnt_test *ts, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == idx + 1)
|
if (argc == idx + 1)
|
||||||
/* mount <mountpont>|<device> */
|
/* mount <mountpoint>|<device> */
|
||||||
mnt_context_set_target(cxt, argv[idx++]);
|
mnt_context_set_target(cxt, argv[idx++]);
|
||||||
|
|
||||||
else if (argc == idx + 2) {
|
else if (argc == idx + 2) {
|
||||||
|
@ -2500,7 +2500,7 @@ static int test_umount(struct libmnt_test *ts, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == idx + 1) {
|
if (argc == idx + 1) {
|
||||||
/* mount <mountpont>|<device> */
|
/* mount <mountpoint>|<device> */
|
||||||
mnt_context_set_target(cxt, argv[idx++]);
|
mnt_context_set_target(cxt, argv[idx++]);
|
||||||
} else {
|
} else {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
|
@ -2542,7 +2542,7 @@ static int test_flags(struct libmnt_test *ts, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == idx + 1)
|
if (argc == idx + 1)
|
||||||
/* mount <mountpont>|<device> */
|
/* mount <mountpoint>|<device> */
|
||||||
mnt_context_set_target(cxt, argv[idx++]);
|
mnt_context_set_target(cxt, argv[idx++]);
|
||||||
|
|
||||||
rc = mnt_context_prepare_mount(cxt);
|
rc = mnt_context_prepare_mount(cxt);
|
||||||
|
|
|
@ -378,7 +378,7 @@ static int generate_helper_optstr(struct libmnt_context *cxt, char **optstr)
|
||||||
* However, if you call mount.<type> as root, then the helper follows
|
* However, if you call mount.<type> as root, then the helper follows
|
||||||
* the command line. If there is (for example) "user,exec" in fstab,
|
* the command line. If there is (for example) "user,exec" in fstab,
|
||||||
* then we have to manually append the "exec" back to the options
|
* then we have to manually append the "exec" back to the options
|
||||||
* string, bacause there is nothing like MS_EXEC (we only have
|
* string, because there is nothing like MS_EXEC (we only have
|
||||||
* MS_NOEXEC in mount flags and we don't care about the original
|
* MS_NOEXEC in mount flags and we don't care about the original
|
||||||
* mount string in libmount for VFS options).
|
* mount string in libmount for VFS options).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -164,7 +164,7 @@ err:
|
||||||
* stored in context->utab and deallocated by mnt_free_context().
|
* stored in context->utab and deallocated by mnt_free_context().
|
||||||
*
|
*
|
||||||
* This function exists to avoid (if possible) /proc/self/mountinfo usage, so
|
* This function exists to avoid (if possible) /proc/self/mountinfo usage, so
|
||||||
* don't use thigs like mnt_resolve_target(), mnt_context_get_mtab() etc here.
|
* don't use things like mnt_resolve_target(), mnt_context_get_mtab() etc here.
|
||||||
* See lookup_umount_fs() for more details.
|
* See lookup_umount_fs() for more details.
|
||||||
*/
|
*/
|
||||||
static int has_utab_entry(struct libmnt_context *cxt, const char *target)
|
static int has_utab_entry(struct libmnt_context *cxt, const char *target)
|
||||||
|
|
|
@ -731,7 +731,7 @@ static char *merge_optstr(const char *vfs, const char *fs)
|
||||||
* @fs: fstab/mtab/mountinfo entry pointer
|
* @fs: fstab/mtab/mountinfo entry pointer
|
||||||
*
|
*
|
||||||
* Merges all mount options (VFS, FS and userspace) to one options string
|
* Merges all mount options (VFS, FS and userspace) to one options string
|
||||||
* and returns the result. This function does not modigy @fs.
|
* and returns the result. This function does not modify @fs.
|
||||||
*
|
*
|
||||||
* Returns: pointer to string (can be freed by free(3)) or NULL in case of error.
|
* Returns: pointer to string (can be freed by free(3)) or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,7 +27,7 @@ UL_DEBUG_DEFINE_MASKNAMES(libmount) =
|
||||||
{ "locks", MNT_DEBUG_LOCKS, "mtab and utab locking" },
|
{ "locks", MNT_DEBUG_LOCKS, "mtab and utab locking" },
|
||||||
{ "loop", MNT_DEBUG_LOOP, "loop devices routines" },
|
{ "loop", MNT_DEBUG_LOOP, "loop devices routines" },
|
||||||
{ "options", MNT_DEBUG_OPTIONS, "mount options parsing" },
|
{ "options", MNT_DEBUG_OPTIONS, "mount options parsing" },
|
||||||
{ "tab", MNT_DEBUG_TAB, "fstab, mtab, mounninfo routines" },
|
{ "tab", MNT_DEBUG_TAB, "fstab, mtab, mountinfo routines" },
|
||||||
{ "update", MNT_DEBUG_UPDATE, "mtab, utab updates" },
|
{ "update", MNT_DEBUG_UPDATE, "mtab, utab updates" },
|
||||||
{ "utils", MNT_DEBUG_UTILS, "misc library utils" },
|
{ "utils", MNT_DEBUG_UTILS, "misc library utils" },
|
||||||
{ "monitor", MNT_DEBUG_MONITOR, "mount tables monitor" },
|
{ "monitor", MNT_DEBUG_MONITOR, "mount tables monitor" },
|
||||||
|
|
|
@ -508,11 +508,11 @@ failed:
|
||||||
*
|
*
|
||||||
* 1. create linkfile (e.g. /etc/mtab~.$PID)
|
* 1. create linkfile (e.g. /etc/mtab~.$PID)
|
||||||
* 2. link linkfile --> lockfile (e.g. /etc/mtab~.$PID --> /etc/mtab~)
|
* 2. link linkfile --> lockfile (e.g. /etc/mtab~.$PID --> /etc/mtab~)
|
||||||
* 3. a) link() success: setups F_SETLK lock (see fcnlt(2))
|
* 3. a) link() success: setups F_SETLK lock (see fcntl(2))
|
||||||
* b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2.
|
* b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2.
|
||||||
*
|
*
|
||||||
* Note that when the lock is used by mnt_update_table() interface then libmount
|
* Note that when the lock is used by mnt_update_table() interface then libmount
|
||||||
* uses flock() for private library file /run/mount/utab. The fcnlt(2) is used only
|
* uses flock() for private library file /run/mount/utab. The fcntl(2) is used only
|
||||||
* for backwardly compatible stuff like /etc/mtab.
|
* for backwardly compatible stuff like /etc/mtab.
|
||||||
*
|
*
|
||||||
* Returns: 0 on success or negative number in case of error (-ETIMEOUT is case
|
* Returns: 0 on success or negative number in case of error (-ETIMEOUT is case
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
* @mountflags: (see MS_* macros in linux/fs.h)
|
* @mountflags: (see MS_* macros in linux/fs.h)
|
||||||
*
|
*
|
||||||
* @mountdata: (usully a comma separated string of options)
|
* @mountdata: (usually a comma separated string of options)
|
||||||
*
|
*
|
||||||
* The libmount uses options-map(s) to describe mount options.
|
* The libmount uses options-map(s) to describe mount options.
|
||||||
*
|
*
|
||||||
|
@ -182,7 +182,7 @@ static const struct libmnt_optmap userspace_opts_map[] =
|
||||||
* MNT_LINUX_MAP - Linux kernel fs-independent mount options
|
* MNT_LINUX_MAP - Linux kernel fs-independent mount options
|
||||||
* (usually MS_* flags, see linux/fs.h)
|
* (usually MS_* flags, see linux/fs.h)
|
||||||
*
|
*
|
||||||
* MNT_USERSPACE_MAP - userpace mount(8) specific mount options
|
* MNT_USERSPACE_MAP - userspace mount(8) specific mount options
|
||||||
* (e.g user=, _netdev, ...)
|
* (e.g user=, _netdev, ...)
|
||||||
*
|
*
|
||||||
* Returns: static built-in libmount map.
|
* Returns: static built-in libmount map.
|
||||||
|
|
|
@ -152,7 +152,7 @@ void mnt_unref_table(struct libmnt_table *tb)
|
||||||
* Deallocates the table. This function does not care about reference count. Don't
|
* Deallocates the table. This function does not care about reference count. Don't
|
||||||
* use this function directly -- it's better to use use mnt_unref_table().
|
* use this function directly -- it's better to use use mnt_unref_table().
|
||||||
*
|
*
|
||||||
* The table entries (filesystems) are unrefrenced by mnt_reset_table() and
|
* The table entries (filesystems) are unreferenced by mnt_reset_table() and
|
||||||
* cache by mnt_unref_cache().
|
* cache by mnt_unref_cache().
|
||||||
*/
|
*/
|
||||||
void mnt_free_table(struct libmnt_table *tb)
|
void mnt_free_table(struct libmnt_table *tb)
|
||||||
|
@ -359,7 +359,7 @@ int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm)
|
||||||
* same cache between more threads -- currently the cache does not provide any
|
* same cache between more threads -- currently the cache does not provide any
|
||||||
* locking method.
|
* locking method.
|
||||||
*
|
*
|
||||||
* This function increments cache reference counter. It's recomented to use
|
* This function increments cache reference counter. It's recommended to use
|
||||||
* mnt_unref_cache() after mnt_table_set_cache() if you want to keep the cache
|
* mnt_unref_cache() after mnt_table_set_cache() if you want to keep the cache
|
||||||
* referenced by @tb only.
|
* referenced by @tb only.
|
||||||
*
|
*
|
||||||
|
@ -690,7 +690,7 @@ static int mnt_table_move_parent(struct libmnt_table *tb, int oldid, int newid)
|
||||||
* backward mode iterator).
|
* backward mode iterator).
|
||||||
*
|
*
|
||||||
* @MNT_UNIQ_FORWARD: remove later mounted filesystems
|
* @MNT_UNIQ_FORWARD: remove later mounted filesystems
|
||||||
* @MNT_UNIQ_KEEPTREE: keep parent->id relation ship stil valid
|
* @MNT_UNIQ_KEEPTREE: keep parent->id relationship still valid
|
||||||
*
|
*
|
||||||
* Returns: negative number in case of error, or 0 o success.
|
* Returns: negative number in case of error, or 0 o success.
|
||||||
*/
|
*/
|
||||||
|
@ -871,7 +871,7 @@ struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, const char *pat
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* non-canonicaled path in struct libmnt_table
|
/* non-canonical path in struct libmnt_table
|
||||||
* -- note that mountpoint in /proc/self/mountinfo is already
|
* -- note that mountpoint in /proc/self/mountinfo is already
|
||||||
* canonicalized by the kernel
|
* canonicalized by the kernel
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -591,7 +591,7 @@ static int kernel_fs_postparse(struct libmnt_table *tb,
|
||||||
rc = __mnt_fs_set_source_ptr(fs, real);
|
rc = __mnt_fs_set_source_ptr(fs, real);
|
||||||
|
|
||||||
} else if (rc == 1) {
|
} else if (rc == 1) {
|
||||||
/* mnt_guess_system_root() returns 1 if not able to conver to
|
/* mnt_guess_system_root() returns 1 if not able to convert to
|
||||||
* the real devname; ignore this problem */
|
* the real devname; ignore this problem */
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1069,7 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
|
||||||
assert(tb);
|
assert(tb);
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
DBG(TAB, ul_debugobj(tb, "%s reuested as mtab", filename));
|
DBG(TAB, ul_debugobj(tb, "%s requested as mtab", filename));
|
||||||
|
|
||||||
#ifdef USE_LIBMOUNT_SUPPORT_MTAB
|
#ifdef USE_LIBMOUNT_SUPPORT_MTAB
|
||||||
if (mnt_has_regular_mtab(&filename, NULL)) {
|
if (mnt_has_regular_mtab(&filename, NULL)) {
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search for @name kernel command parametr.
|
* Search for @name kernel command parameter.
|
||||||
*
|
*
|
||||||
* Returns newly allocated string with a parameter argument if the @name is
|
* Returns newly allocated string with a parameter argument if the @name is
|
||||||
* specified as "name=" or returns pointer to @name or returns NULL if not
|
* specified as "name=" or returns pointer to @name or returns NULL if not
|
||||||
|
|
|
@ -40,7 +40,7 @@ static void setup_columns(struct libscols_table *tb)
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output columns");
|
err(EXIT_FAILURE, "failed to create output columns");
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct libscols_line *add_line(struct libscols_table *tb, size_t i)
|
static struct libscols_line *add_line(struct libscols_table *tb, size_t i)
|
||||||
|
@ -62,7 +62,7 @@ static struct libscols_line *add_line(struct libscols_table *tb, size_t i)
|
||||||
return ln;
|
return ln;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output line");
|
err(EXIT_FAILURE, "failed to create output line");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
tb = scols_new_table();
|
tb = scols_new_table();
|
||||||
if (!tb)
|
if (!tb)
|
||||||
err(EXIT_FAILURE, "faild to create output table");
|
err(EXIT_FAILURE, "failed to create output table");
|
||||||
|
|
||||||
setup_columns(tb);
|
setup_columns(tb);
|
||||||
gettimeofday(&last, NULL);
|
gettimeofday(&last, NULL);
|
||||||
|
|
|
@ -33,7 +33,7 @@ static void setup_columns(struct libscols_table *tb)
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output columns");
|
err(EXIT_FAILURE, "failed to create output columns");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_line(struct libscols_table *tb, const char *name, const char *data)
|
static void add_line(struct libscols_table *tb, const char *name, const char *data)
|
||||||
|
@ -49,7 +49,7 @@ static void add_line(struct libscols_table *tb, const char *name, const char *da
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output line");
|
err(EXIT_FAILURE, "failed to create output line");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
tb = scols_new_table();
|
tb = scols_new_table();
|
||||||
if (!tb)
|
if (!tb)
|
||||||
err(EXIT_FAILURE, "faild to create output table");
|
err(EXIT_FAILURE, "failed to create output table");
|
||||||
|
|
||||||
scols_table_enable_colors(tb, 1);
|
scols_table_enable_colors(tb, 1);
|
||||||
setup_columns(tb);
|
setup_columns(tb);
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void setup_columns(struct libscols_table *tb, int notree)
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output columns");
|
err(EXIT_FAILURE, "failed to create output columns");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a new line to @tb, the content is based on @st */
|
/* add a new line to @tb, the content is based on @st */
|
||||||
|
@ -104,7 +104,7 @@ fail:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read all entrines from directory addressed by @fd */
|
/* read all entries from directory addressed by @fd */
|
||||||
static int add_children(struct libscols_table *tb,
|
static int add_children(struct libscols_table *tb,
|
||||||
struct libscols_line *ln,
|
struct libscols_line *ln,
|
||||||
int fd)
|
int fd)
|
||||||
|
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
tb = scols_new_table();
|
tb = scols_new_table();
|
||||||
if (!tb)
|
if (!tb)
|
||||||
err(EXIT_FAILURE, "faild to create output table");
|
err(EXIT_FAILURE, "failed to create output table");
|
||||||
|
|
||||||
while((c = getopt_long(argc, argv, "ciJlnprS:E:", longopts, NULL)) != -1) {
|
while((c = getopt_long(argc, argv, "ciJlnprS:E:", longopts, NULL)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ static void setup_columns(struct libscols_table *tb)
|
||||||
return;
|
return;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output columns");
|
err(EXIT_FAILURE, "failed to create output columns");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *gen_text(const char *prefix, const char *sub_prefix, char *buf, size_t sz)
|
static char *gen_text(const char *prefix, const char *sub_prefix, char *buf, size_t sz)
|
||||||
|
@ -76,7 +76,7 @@ static struct libscols_line * add_line( struct libscols_table *tb,
|
||||||
return ln;
|
return ln;
|
||||||
fail:
|
fail:
|
||||||
scols_unref_table(tb);
|
scols_unref_table(tb);
|
||||||
err(EXIT_FAILURE, "faild to create output line");
|
err(EXIT_FAILURE, "failed to create output line");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
tb = scols_new_table();
|
tb = scols_new_table();
|
||||||
if (!tb)
|
if (!tb)
|
||||||
err(EXIT_FAILURE, "faild to create output table");
|
err(EXIT_FAILURE, "failed to create output table");
|
||||||
|
|
||||||
scols_table_enable_colors(tb, 1);
|
scols_table_enable_colors(tb, 1);
|
||||||
setup_columns(tb);
|
setup_columns(tb);
|
||||||
|
|
|
@ -156,7 +156,7 @@ struct libscols_table {
|
||||||
unsigned int ascii :1, /* don't use unicode */
|
unsigned int ascii :1, /* don't use unicode */
|
||||||
colors_wanted :1, /* enable colors */
|
colors_wanted :1, /* enable colors */
|
||||||
is_term :1, /* isatty() */
|
is_term :1, /* isatty() */
|
||||||
maxout :1, /* maximalize output */
|
maxout :1, /* maximize output */
|
||||||
header_printed :1, /* header already printed */
|
header_printed :1, /* header already printed */
|
||||||
no_headings :1, /* don't print header */
|
no_headings :1, /* don't print header */
|
||||||
no_linesep :1, /* don't print line separator */
|
no_linesep :1, /* don't print line separator */
|
||||||
|
|
|
@ -108,7 +108,7 @@ int scols_symbols_set_right(struct libscols_symbols *sb, const char *str)
|
||||||
* @sb: a pointer to a struct libscols_symbols instance
|
* @sb: a pointer to a struct libscols_symbols instance
|
||||||
* @str: a string which will represent the symbols which wraps title output
|
* @str: a string which will represent the symbols which wraps title output
|
||||||
*
|
*
|
||||||
* The current implemetation uses only the first byte from the padding string.
|
* The current implementation uses only the first byte from the padding string.
|
||||||
* A multibyte chars are not supported yet.
|
* A multibyte chars are not supported yet.
|
||||||
*
|
*
|
||||||
* Returns: 0, a negative value in case of an error.
|
* Returns: 0, a negative value in case of an error.
|
||||||
|
@ -124,7 +124,7 @@ int scols_symbols_set_title_padding(struct libscols_symbols *sb, const char *str
|
||||||
* scols_copy_symbols:
|
* scols_copy_symbols:
|
||||||
* @sb: a pointer to a struct libscols_symbols instance
|
* @sb: a pointer to a struct libscols_symbols instance
|
||||||
*
|
*
|
||||||
* Returns: a newly allocated copy of the @sb symbol group or NULL in caes of an error.
|
* Returns: a newly allocated copy of the @sb symbol group or NULL in case of an error.
|
||||||
*/
|
*/
|
||||||
struct libscols_symbols *scols_copy_symbols(const struct libscols_symbols *sb)
|
struct libscols_symbols *scols_copy_symbols(const struct libscols_symbols *sb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2014 Karel Zak <kzak@redhat.com>
|
* Copyright (C) 2010-2014 Karel Zak <kzak@redhat.com>
|
||||||
* Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
|
* Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
|
||||||
* Copytight (C) 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
* Copyright (C) 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||||
*
|
*
|
||||||
* This file may be redistributed under the terms of the
|
* This file may be redistributed under the terms of the
|
||||||
* GNU Lesser General Public License.
|
* GNU Lesser General Public License.
|
||||||
|
@ -375,7 +375,7 @@ FILE *scols_table_get_stream(struct libscols_table *tb)
|
||||||
* If necessary then libsmartcols use all terminal width, the @reduce setting
|
* If necessary then libsmartcols use all terminal width, the @reduce setting
|
||||||
* provides extra space (for example for borders in ncurses applications).
|
* provides extra space (for example for borders in ncurses applications).
|
||||||
*
|
*
|
||||||
* The @reduce must be smaller than terminal width, otherwise it's sillently
|
* The @reduce must be smaller than terminal width, otherwise it's silently
|
||||||
* ignored. The reduction is not applied when STDOUT_FILENO is not terminal.
|
* ignored. The reduction is not applied when STDOUT_FILENO is not terminal.
|
||||||
*
|
*
|
||||||
* Returns: 0, a negative value in case of an error.
|
* Returns: 0, a negative value in case of an error.
|
||||||
|
@ -702,7 +702,7 @@ int scols_table_set_symbols(struct libscols_table *tb,
|
||||||
* @tb: table
|
* @tb: table
|
||||||
* @enable: 1 or 0
|
* @enable: 1 or 0
|
||||||
*
|
*
|
||||||
* Enable/disable line separator printing. This is usefull if you want to
|
* Enable/disable line separator printing. This is useful if you want to
|
||||||
* re-printing the same line more than once (e.g. progress bar). Don't use it
|
* re-printing the same line more than once (e.g. progress bar). Don't use it
|
||||||
* if you're not sure.
|
* if you're not sure.
|
||||||
*
|
*
|
||||||
|
|
|
@ -210,7 +210,7 @@ static int has_pending_data(struct libscols_table *tb)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print padding or asci-art instead of data of @cl */
|
/* print padding or ASCII-art instead of data of @cl */
|
||||||
static void print_empty_cell(struct libscols_table *tb,
|
static void print_empty_cell(struct libscols_table *tb,
|
||||||
struct libscols_column *cl,
|
struct libscols_column *cl,
|
||||||
struct libscols_line *ln, /* optional */
|
struct libscols_line *ln, /* optional */
|
||||||
|
@ -218,7 +218,7 @@ static void print_empty_cell(struct libscols_table *tb,
|
||||||
{
|
{
|
||||||
size_t len_pad = 0; /* in screen cells as opposed to bytes */
|
size_t len_pad = 0; /* in screen cells as opposed to bytes */
|
||||||
|
|
||||||
/* generate tree asci-art rather than padding */
|
/* generate tree ASCII-art rather than padding */
|
||||||
if (ln && scols_column_is_tree(cl)) {
|
if (ln && scols_column_is_tree(cl)) {
|
||||||
if (!ln->parent) {
|
if (!ln->parent) {
|
||||||
/* only print symbols->vert if followed by child */
|
/* only print symbols->vert if followed by child */
|
||||||
|
@ -1017,7 +1017,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is core of the scols_* voodo...
|
* This is core of the scols_* voodoo...
|
||||||
*/
|
*/
|
||||||
static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf)
|
static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf)
|
||||||
{
|
{
|
||||||
|
@ -1096,7 +1096,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
|
||||||
if (!cl->is_extreme)
|
if (!cl->is_extreme)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* this column is tooo large, ignore?
|
/* this column is too large, ignore?
|
||||||
if (cl->width_max - cl->width >
|
if (cl->width_max - cl->width >
|
||||||
(tb->termwidth - width))
|
(tb->termwidth - width))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1171,7 +1171,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
|
||||||
if (cl->width == cl->width_min)
|
if (cl->width == cl->width_min)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DBG(TAB, ul_debugobj(tb, " tring to reduce: %s (width=%zu)", cl->header.data, cl->width));
|
DBG(TAB, ul_debugobj(tb, " trying to reduce: %s (width=%zu)", cl->header.data, cl->width));
|
||||||
|
|
||||||
/* truncate column with relative sizes */
|
/* truncate column with relative sizes */
|
||||||
if (cl->width_hint < 1 && cl->width > 0 && width > 0 &&
|
if (cl->width_hint < 1 && cl->width > 0 && width > 0 &&
|
||||||
|
@ -1238,14 +1238,14 @@ static size_t strlen_line(struct libscols_line *ln)
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int initialize_printting(struct libscols_table *tb, struct libscols_buffer **buf)
|
static int initialize_printing(struct libscols_table *tb, struct libscols_buffer **buf)
|
||||||
{
|
{
|
||||||
size_t bufsz, extra_bufsz = 0;
|
size_t bufsz, extra_bufsz = 0;
|
||||||
struct libscols_line *ln;
|
struct libscols_line *ln;
|
||||||
struct libscols_iter itr;
|
struct libscols_iter itr;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
DBG(TAB, ul_debugobj(tb, "initialize printting"));
|
DBG(TAB, ul_debugobj(tb, "initialize printing"));
|
||||||
|
|
||||||
if (!tb->symbols)
|
if (!tb->symbols)
|
||||||
scols_table_set_symbols(tb, NULL); /* use default */
|
scols_table_set_symbols(tb, NULL); /* use default */
|
||||||
|
@ -1324,7 +1324,7 @@ err:
|
||||||
/**
|
/**
|
||||||
* scola_table_print_range:
|
* scola_table_print_range:
|
||||||
* @tb: table
|
* @tb: table
|
||||||
* @start: first printed line or NULL to print from the beggin of the table
|
* @start: first printed line or NULL to print from the begin of the table
|
||||||
* @end: last printed line or NULL to print all from start.
|
* @end: last printed line or NULL to print all from start.
|
||||||
*
|
*
|
||||||
* If the start is the first line in the table than prints table header too.
|
* If the start is the first line in the table than prints table header too.
|
||||||
|
@ -1345,7 +1345,7 @@ int scols_table_print_range( struct libscols_table *tb,
|
||||||
|
|
||||||
DBG(TAB, ul_debugobj(tb, "printing range"));
|
DBG(TAB, ul_debugobj(tb, "printing range"));
|
||||||
|
|
||||||
rc = initialize_printting(tb, &buf);
|
rc = initialize_printing(tb, &buf);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1431,12 +1431,12 @@ int scols_print_table(struct libscols_table *tb)
|
||||||
DBG(TAB, ul_debugobj(tb, "printing"));
|
DBG(TAB, ul_debugobj(tb, "printing"));
|
||||||
|
|
||||||
if (list_empty(&tb->tb_lines)) {
|
if (list_empty(&tb->tb_lines)) {
|
||||||
DBG(TAB, ul_debugobj(tb, "ignore -- epmty table"));
|
DBG(TAB, ul_debugobj(tb, "ignore -- empty table"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tb->header_printed = 0;
|
tb->header_printed = 0;
|
||||||
rc = initialize_printting(tb, &buf);
|
rc = initialize_printing(tb, &buf);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -635,7 +635,7 @@ static int is_phantom(const struct last_control *ctl, struct utmp *ut)
|
||||||
static void process_wtmp_file(const struct last_control *ctl,
|
static void process_wtmp_file(const struct last_control *ctl,
|
||||||
const char *filename)
|
const char *filename)
|
||||||
{
|
{
|
||||||
FILE *fp; /* Filepointer of wtmp file */
|
FILE *fp; /* File pointer of wtmp file */
|
||||||
|
|
||||||
struct utmp ut; /* Current utmp entry */
|
struct utmp ut; /* Current utmp entry */
|
||||||
struct utmplist *ulist = NULL; /* All entries */
|
struct utmplist *ulist = NULL; /* All entries */
|
||||||
|
@ -858,7 +858,7 @@ static void process_wtmp_file(const struct last_control *ctl,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
warnx("unrecogized ut_type: %d", ut.ut_type);
|
warnx("unrecognized ut_type: %d", ut.ut_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -347,7 +347,7 @@ static void chown_tty(struct login_context *cxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reads the currect terminal path and initializes cxt->tty_* variables.
|
* Reads the current terminal path and initializes cxt->tty_* variables.
|
||||||
*/
|
*/
|
||||||
static void init_tty(struct login_context *cxt)
|
static void init_tty(struct login_context *cxt)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,7 @@ static void init_tty(struct login_context *cxt)
|
||||||
tcsetattr(0, TCSANOW, &ttt);
|
tcsetattr(0, TCSANOW, &ttt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let's close file decriptors before vhangup
|
* Let's close file descriptors before vhangup
|
||||||
* https://lkml.org/lkml/2012/6/5/145
|
* https://lkml.org/lkml/2012/6/5/145
|
||||||
*/
|
*/
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
|
|
|
@ -822,7 +822,7 @@ static int get_ulist(struct lslogins_control *ctl, char *logins, char *groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
/* FIXME: this might lead to duplicit entries, although not visible
|
/* FIXME: this might lead to duplicate entries, although not visible
|
||||||
* in output, crunching a user's info multiple times is very redundant */
|
* in output, crunching a user's info multiple times is very redundant */
|
||||||
while ((g = strtok(groups, ","))) {
|
while ((g = strtok(groups, ","))) {
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
(setting argv[0] to "-su", passing -c only to certain shells, etc.).
|
(setting argv[0] to "-su", passing -c only to certain shells, etc.).
|
||||||
I don't see the point in doing that, and it's ugly.
|
I don't see the point in doing that, and it's ugly.
|
||||||
|
|
||||||
Based on an implemenation by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
Based on an implementation by David MacKenzie <djm@gnu.ai.mit.edu>. */
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -718,7 +718,7 @@ int detect_consoles(const char *device, int fallback, struct list_head *consoles
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
console:
|
console:
|
||||||
/*
|
/*
|
||||||
* Detection of devices used for Linux system consolei using
|
* Detection of devices used for Linux system console using
|
||||||
* the /proc/consoles API with kernel 2.6.38 and higher.
|
* the /proc/consoles API with kernel 2.6.38 and higher.
|
||||||
*/
|
*/
|
||||||
rc = detect_consoles_from_proc(consoles);
|
rc = detect_consoles_from_proc(consoles);
|
||||||
|
|
|
@ -498,7 +498,7 @@ static struct passwd *getrootpwent(int try_manually)
|
||||||
warnx(_("%s: no entry for root"), _PATH_SHADOW_PASSWD);
|
warnx(_("%s: no entry for root"), _PATH_SHADOW_PASSWD);
|
||||||
*pwd.pw_passwd = '\0';
|
*pwd.pw_passwd = '\0';
|
||||||
}
|
}
|
||||||
/* locked accont passwords are valid too */
|
/* locked account passwords are valid too */
|
||||||
if (!locked_account_password(pwd.pw_passwd) && !valid(pwd.pw_passwd)) {
|
if (!locked_account_password(pwd.pw_passwd) && !valid(pwd.pw_passwd)) {
|
||||||
warnx(_("%s: root password garbled"), _PATH_SHADOW_PASSWD);
|
warnx(_("%s: root password garbled"), _PATH_SHADOW_PASSWD);
|
||||||
*pwd.pw_passwd = '\0';
|
*pwd.pw_passwd = '\0';
|
||||||
|
@ -911,7 +911,7 @@ int main(int argc, char **argv)
|
||||||
reconnect = detect_consoles(tty, STDIN_FILENO, &consoles);
|
reconnect = detect_consoles(tty, STDIN_FILENO, &consoles);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If previous stdin was not the speified tty and therefore reconnected
|
* If previous stdin was not the specified tty and therefore reconnected
|
||||||
* to the specified tty also reconnect stdout and stderr.
|
* to the specified tty also reconnect stdout and stderr.
|
||||||
*/
|
*/
|
||||||
if (reconnect) {
|
if (reconnect) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue