diff options
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/docs/version.xml | 2 | ||||
-rw-r--r-- | libblkid/libblkid.3 | 4 | ||||
-rw-r--r-- | libblkid/meson.build | 32 | ||||
-rw-r--r-- | libblkid/src/config.c | 14 | ||||
-rw-r--r-- | libblkid/src/superblocks/bcache.c | 5 | ||||
-rw-r--r-- | libblkid/src/topology/ioctl.c | 76 |
6 files changed, 59 insertions, 74 deletions
diff --git a/libblkid/docs/version.xml b/libblkid/docs/version.xml index 4bdd32f..0e1a032 100644 --- a/libblkid/docs/version.xml +++ b/libblkid/docs/version.xml @@ -1 +1 @@ -2.40 +2.40.1 diff --git a/libblkid/libblkid.3 b/libblkid/libblkid.3 index 0297e27..b605d8f 100644 --- a/libblkid/libblkid.3 +++ b/libblkid/libblkid.3 @@ -4,10 +4,10 @@ .\" Generator: Asciidoctor 2.0.20 .\" Date: 2024-01-31 .\" Manual: Programmer's Manual -.\" Source: util-linux 2.40 +.\" Source: util-linux 2.40.1 .\" Language: English .\" -.TH "LIBBLKID" "3" "2024-01-31" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.TH "LIBBLKID" "3" "2024-01-31" "util\-linux 2.40.1" "Programmer\*(Aqs Manual" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 diff --git a/libblkid/meson.build b/libblkid/meson.build index 5a28bdf..73ea088 100644 --- a/libblkid/meson.build +++ b/libblkid/meson.build @@ -1,4 +1,9 @@ dir_libblkid = include_directories('.', 'src') +if not build_libblkid + blkid_dep = disabler() + blkid_static_dep = disabler() + subdir_done() +endif defs = configuration_data() defs.set('LIBBLKID_DATE', libblkid_date) @@ -131,27 +136,34 @@ if build_libblkid and not have_dirfd and not have_ddfd error('neither dirfd nor ddfd are available') endif +libblkid_link_depends = [] +libblkid_link_args = [] + +if cc.has_link_argument('-Wl,--version-script=@0@'.format(libblkid_sym_path)) + libblkid_link_depends += [libblkid_sym] + libblkid_link_args += ['-Wl,--version-script=@0@'.format(libblkid_sym_path)] +endif + lib_blkid = both_libraries( 'blkid', list_h, lib_blkid_sources, include_directories : [dir_include, dir_libblkid], - link_depends : libblkid_sym, + link_depends : libblkid_link_depends, version : libblkid_version, - link_args : ['-Wl,--version-script=@0@'.format(libblkid_sym_path)], + link_args : libblkid_link_args, link_with : lib_common, dependencies : build_libblkid ? [lib_econf] : disabler(), install : build_libblkid) blkid_dep = declare_dependency(link_with: lib_blkid, include_directories: '.') lib_blkid_static = lib_blkid.get_static_lib() +blkid_static_dep = declare_dependency(link_with: lib_blkid_static, include_directories: '.') -if build_libblkid - pkgconfig.generate(lib_blkid, - description : 'Block device id library', - subdirs : 'blkid', - version : pc_version) - if meson.version().version_compare('>=0.54.0') - meson.override_dependency('blkid', blkid_dep) - endif +pkgconfig.generate(lib_blkid, + description : 'Block device id library', + subdirs : 'blkid', + version : pc_version) +if meson.version().version_compare('>=0.54.0') + meson.override_dependency('blkid', blkid_dep) endif diff --git a/libblkid/src/config.c b/libblkid/src/config.c index 7b8b04f..66c1864 100644 --- a/libblkid/src/config.c +++ b/libblkid/src/config.c @@ -153,6 +153,8 @@ struct blkid_config *blkid_read_config(const char *filename) #else /* !HAVE_LIBECONF */ static econf_file *file = NULL; + char *line = NULL; + bool uevent = false; econf_err error; if (filename) { @@ -187,7 +189,6 @@ struct blkid_config *blkid_read_config(const char *filename) } } - bool uevent = false; if ((error = econf_getBoolValue(file, NULL, "SEND_UEVENT", &uevent))) { if (error != ECONF_NOKEY) { DBG(CONFIG, ul_debug("couldn't fetch SEND_UEVENT corrently: %s", econf_errString(error))); @@ -209,7 +210,6 @@ struct blkid_config *blkid_read_config(const char *filename) } } - char *line = NULL; if ((error = econf_getStringValue(file, NULL, "EVALUATE", &line))) { conf->nevals = 0; if (error != ECONF_NOKEY) { @@ -219,7 +219,7 @@ struct blkid_config *blkid_read_config(const char *filename) DBG(CONFIG, ul_debug("key CACHE_FILE not found, using built-in default ")); } } else { - if (*line && parse_evaluate(conf, line) == -1) + if (line && *line && parse_evaluate(conf, line) == -1) goto err; } @@ -238,8 +238,8 @@ dflt: if (f) fclose(f); #else - econf_free (file); - free (line); + econf_free(file); + free(line); #endif return conf; err: @@ -248,8 +248,8 @@ err: #ifndef HAVE_LIBECONF fclose(f); #else - econf_free (file); - free (line); + econf_free(file); + free(line); #endif return NULL; } diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index 47d9060..8ad2dc0 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -164,8 +164,6 @@ struct bcachefs_super_block { #define BCACHEFS_SECTOR_SIZE 512U /* maximum superblock size shift */ #define BCACHEFS_SB_MAX_SIZE_SHIFT 0x10U -/* maximum superblock size */ -#define BCACHEFS_SB_MAX_SIZE (1U << BCACHEFS_SB_MAX_SIZE_SHIFT) /* fields offset within super block */ #define BCACHEFS_SB_FIELDS_OFF offsetof(struct bcachefs_super_block, _start) /* tag value for members field */ @@ -360,9 +358,6 @@ static int probe_bcachefs(blkid_probe pr, const struct blkid_idmag *mag) sb_size = BCACHEFS_SB_FIELDS_OFF + BYTES(bcs); - if (sb_size > BCACHEFS_SB_MAX_SIZE) - return BLKID_PROBE_NONE; - if (bcs->layout.sb_max_size_bits > BCACHEFS_SB_MAX_SIZE_SHIFT) return BLKID_PROBE_NONE; diff --git a/libblkid/src/topology/ioctl.c b/libblkid/src/topology/ioctl.c index 3560a2f..7b15c9e 100644 --- a/libblkid/src/topology/ioctl.c +++ b/libblkid/src/topology/ioctl.c @@ -18,60 +18,38 @@ #include "topology.h" -/* - * ioctl topology values - */ -static const struct topology_val { - - long ioc; - - /* functions to set probing result */ - int (*set_ulong)(blkid_probe, unsigned long); - int (*set_int)(blkid_probe, int); - int (*set_u64)(blkid_probe, uint64_t); - -} topology_vals[] = { - { BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset }, - { BLKIOMIN, blkid_topology_set_minimum_io_size }, - { BLKIOOPT, blkid_topology_set_optimal_io_size }, - { BLKPBSZGET, blkid_topology_set_physical_sector_size }, - { BLKGETDISKSEQ, .set_u64 = blkid_topology_set_diskseq }, - /* we read BLKSSZGET in topology.c */ -}; - static int probe_ioctl_tp(blkid_probe pr, const struct blkid_idmag *mag __attribute__((__unused__))) { - size_t i; - - for (i = 0; i < ARRAY_SIZE(topology_vals); i++) { - const struct topology_val *val = &topology_vals[i]; - int rc = 1; - union { - unsigned long ul; - int i; - uint64_t u64; - } data; - - if (ioctl(pr->fd, val->ioc, &data) == -1) - goto nothing; - - if (val->set_int) - rc = val->set_int(pr, data.i); - else if (val->set_ulong) - rc = val->set_ulong(pr, data.ul); - else - rc = val->set_u64(pr, data.u64); - - if (rc) - goto err; - } + uint64_t u64; + int s32; + + if (ioctl(pr->fd, BLKALIGNOFF, &s32) == -1) + return 1; + if (blkid_topology_set_alignment_offset(pr, s32)) + return -1; + + if (ioctl(pr->fd, BLKIOMIN, &s32) == -1) + return 1; + if (blkid_topology_set_minimum_io_size(pr, s32)) + return -1; + + if (ioctl(pr->fd, BLKIOOPT, &s32) == -1) + return 1; + if (blkid_topology_set_optimal_io_size(pr, s32)) + return -1; + + if (ioctl(pr->fd, BLKPBSZGET, &s32) == -1) + return 1; + if (blkid_topology_set_physical_sector_size(pr, s32)) + return -1; + + if (ioctl(pr->fd, BLKGETDISKSEQ, &u64) == -1) + return 1; + if (blkid_topology_set_physical_sector_size(pr, u64)) + return -1; return 0; -nothing: - return 1; -err: - return -1; } const struct blkid_idinfo ioctl_tp_idinfo = |