From: Karel Zak Date: Wed, 3 Dec 2008 13:37:46 +0000 (+0100) Subject: blkid: cleanup starts of probing files X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c863b7517ccd71e6bd4904ac54b3834a20094bb;p=util-linux blkid: cleanup starts of probing files * libblkid was and is licensed under LGPL The GPL comment in some files was unwished mistake (copy & past the start of files from my other project....). * add information about inspiration by libvolume_id * rename *_meta to _metadata * rename *_off to off * use sizeof() rather than some magic constants * remove unnecessary #includes Signed-off-by: Karel Zak --- diff --git a/libs/blkid/src/probers/adaptec_raid.c b/libs/blkid/src/probers/adaptec_raid.c index ccf56ddf..5e8b3a75 100644 --- a/libs/blkid/src/probers/adaptec_raid.c +++ b/libs/blkid/src/probers/adaptec_raid.c @@ -1,29 +1,21 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2006 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" -struct adaptec_meta { +struct adaptec_metadata { uint32_t b0idcode; uint8_t lunsave[8]; uint16_t sdtype; @@ -80,26 +72,25 @@ struct adaptec_meta { #define AD_SIGNATURE "DPTM" #define AD_MAGIC 0x37FC4D1E - static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct adaptec_meta *ad; + uint64_t off; + struct adaptec_metadata *ad; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200)-1) * 0x200; - ad = (struct adaptec_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); + off = ((pr->size / 0x200)-1) * 0x200; + ad = (struct adaptec_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct adaptec_metadata)); if (!ad) return -1; - if (memcmp(ad->smagic, AD_SIGNATURE, sizeof(AD_SIGNATURE)) != 0) return -1; - if (ad->b0idcode != be32_to_cpu(AD_MAGIC)) return -1; - if (blkid_probe_sprintf_version(pr, "%u", ad->resver) != 0) return -1; diff --git a/libs/blkid/src/probers/cramfs.c b/libs/blkid/src/probers/cramfs.c index caf13881..0ea124b3 100644 --- a/libs/blkid/src/probers/cramfs.c +++ b/libs/blkid/src/probers/cramfs.c @@ -1,24 +1,18 @@ /* + * Copyright (C) 1999 by Andries Brouwer + * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o + * Copyright (C) 2001 by Andreas Dilger + * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak - * Copyright (C) 2004-2007 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include #include #include -#include -#include #include #include "blkidP.h" diff --git a/libs/blkid/src/probers/ddf_raid.c b/libs/blkid/src/probers/ddf_raid.c index 894c73be..1e82281f 100644 --- a/libs/blkid/src/probers/ddf_raid.c +++ b/libs/blkid/src/probers/ddf_raid.c @@ -1,18 +1,12 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2007 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -35,14 +29,17 @@ struct ddf_header { static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t ddf_off; + uint64_t off; struct ddf_header *ddf; if (pr->size < 0x10000) return -1; - ddf_off = ((pr->size / 0x200) - 1) * 0x200; - ddf = (struct ddf_header *) blkid_probe_get_buffer(pr, ddf_off, 0x200); + off = ((pr->size / 0x200) - 1) * 0x200; + ddf = (struct ddf_header *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct ddf_header)); if (!ddf) return -1; if (ddf->signature != cpu_to_be32(DDF_HEADER)) diff --git a/libs/blkid/src/probers/ext.c b/libs/blkid/src/probers/ext.c index 83c4a433..5adb9cb2 100644 --- a/libs/blkid/src/probers/ext.c +++ b/libs/blkid/src/probers/ext.c @@ -3,17 +3,9 @@ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include diff --git a/libs/blkid/src/probers/gfs.c b/libs/blkid/src/probers/gfs.c index 1581ecb7..17358ef0 100644 --- a/libs/blkid/src/probers/gfs.c +++ b/libs/blkid/src/probers/gfs.c @@ -1,35 +1,22 @@ /* - * Copyright (C) 1999, 2001 by Andries Brouwer + * Copyright (C) 1999 by Andries Brouwer * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o + * Copyright (C) 2001 by Andreas Dilger + * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" /* Common gfs/gfs2 constants: */ -#define GFS_MAGIC 0x01161970 -#define GFS_DEFAULT_BSIZE 4096 -#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) -#define GFS_METATYPE_SB 1 -#define GFS_FORMAT_SB 100 #define GFS_LOCKNAME_LEN 64 /* gfs1 constants: */ diff --git a/libs/blkid/src/probers/hfs.c b/libs/blkid/src/probers/hfs.c index 9e1e6324..6224d378 100644 --- a/libs/blkid/src/probers/hfs.c +++ b/libs/blkid/src/probers/hfs.c @@ -5,22 +5,13 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include #include #include -#include -#include #include #include "blkidP.h" diff --git a/libs/blkid/src/probers/highpoint_raid.c b/libs/blkid/src/probers/highpoint_raid.c index 8d9de70f..3ced45ae 100644 --- a/libs/blkid/src/probers/highpoint_raid.c +++ b/libs/blkid/src/probers/highpoint_raid.c @@ -1,18 +1,12 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2007 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -21,7 +15,7 @@ #include "blkidP.h" -struct hpt45x_meta { +struct hpt45x_metadata { uint32_t magic; }; @@ -34,20 +28,20 @@ struct hpt45x_meta { static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag) { - const uint8_t *buf; - struct hpt45x_meta *hpt; - uint64_t meta_off; + struct hpt45x_metadata *hpt; + uint64_t off; uint32_t magic; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 11) * 0x200; - buf = blkid_probe_get_buffer(pr, meta_off, 0x200); - if (buf == NULL) + off = ((pr->size / 0x200) - 11) * 0x200; + hpt = (struct hpt45x_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct hpt45x_metadata)); + if (!hpt) return -1; - - hpt = (struct hpt45x_meta *) buf; magic = le32_to_cpu(hpt->magic); if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) return -1; diff --git a/libs/blkid/src/probers/hpfs.c b/libs/blkid/src/probers/hpfs.c index 801e6bc1..2f5f0d19 100644 --- a/libs/blkid/src/probers/hpfs.c +++ b/libs/blkid/src/probers/hpfs.c @@ -1,19 +1,12 @@ /* - * Copyright (C) 1999, 2001 by Andries Brouwer - * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -48,7 +41,7 @@ struct hpfs_boot_block uint8_t magic[2]; }; -struct hpfs_super +struct hpfs_super_block { uint8_t magic[4]; uint8_t magic1[4]; @@ -67,13 +60,13 @@ struct hpfs_spare_super static int probe_hpfs(blkid_probe pr, const struct blkid_idmag *mag) { - struct hpfs_super *hs; + struct hpfs_super_block *hs; struct hpfs_spare_super *hss; struct hpfs_boot_block *hbb; uint8_t version; /* super block */ - hs = blkid_probe_get_sb(pr, mag, struct hpfs_super); + hs = blkid_probe_get_sb(pr, mag, struct hpfs_super_block); if (!hs) return -1; version = hs->version; diff --git a/libs/blkid/src/probers/iso9660.c b/libs/blkid/src/probers/iso9660.c index 441b3206..759b6aea 100644 --- a/libs/blkid/src/probers/iso9660.c +++ b/libs/blkid/src/probers/iso9660.c @@ -5,23 +5,16 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired also by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" @@ -75,7 +68,7 @@ static int probe_iso9660(blkid_probe pr, const struct blkid_idmag *mag) struct iso_volume_descriptor *iso; unsigned char label[32]; int i; - int vd_offset; + int off; if (strcmp(mag->magic, "CDROM") == 0) return probe_iso9660_hsfs(pr, mag); @@ -87,13 +80,13 @@ static int probe_iso9660(blkid_probe pr, const struct blkid_idmag *mag) memcpy(label, iso->volume_id, sizeof(label)); /* Joliet Extension */ - vd_offset = ISO_VD_OFFSET; + off = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { uint8_t svd_label[64]; iso = (struct iso_volume_descriptor *) blkid_probe_get_buffer(pr, - vd_offset, + off, sizeof(struct iso_volume_descriptor)); if (iso == NULL || iso->vd_type == ISO_VD_END) @@ -113,7 +106,7 @@ static int probe_iso9660(blkid_probe pr, const struct blkid_idmag *mag) blkid_probe_set_version(pr, "Joliet Extension"); goto has_label; } - vd_offset += ISO_SECTOR_SIZE; + off += ISO_SECTOR_SIZE; } /* Joliet not found, let use standard iso label */ diff --git a/libs/blkid/src/probers/isw_raid.c b/libs/blkid/src/probers/isw_raid.c index 58804e07..f9ae7453 100644 --- a/libs/blkid/src/probers/isw_raid.c +++ b/libs/blkid/src/probers/isw_raid.c @@ -1,18 +1,12 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2005 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -21,7 +15,7 @@ #include "blkidP.h" -struct isw_meta { +struct isw_metadata { uint8_t sig[32]; uint32_t check_sum; uint32_t mpb_size; @@ -34,24 +28,21 @@ struct isw_meta { static int probe_iswraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct isw_meta *isw; + uint64_t off; + struct isw_metadata *isw; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 2) * 0x200; - - if (pr->size < 0x10000) - return -1; - - isw = (struct isw_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); + off = ((pr->size / 0x200) - 2) * 0x200; + isw = (struct isw_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct isw_metadata)); if (!isw) return -1; - if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) return -1; - if (blkid_probe_sprintf_version(pr, "%6s", &isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0) return -1; diff --git a/libs/blkid/src/probers/jfs.c b/libs/blkid/src/probers/jfs.c index 6e61d94f..5d9b39ac 100644 --- a/libs/blkid/src/probers/jfs.c +++ b/libs/blkid/src/probers/jfs.c @@ -5,17 +5,9 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -49,13 +41,10 @@ static int probe_jfs(blkid_probe pr, const struct blkid_idmag *mag) js = blkid_probe_get_sb(pr, mag, struct jfs_super_block); if (!js) return -1; - if (le32_to_cpu(js->js_bsize) != (1 << le16_to_cpu(js->js_l2bsize))) return 1; - if (le32_to_cpu(js->js_pbsize) != (1 << le16_to_cpu(js->js_l2pbsize))) return 1; - if ((le16_to_cpu(js->js_l2bsize) - le16_to_cpu(js->js_l2pbsize)) != le16_to_cpu(js->js_l2bfactor)) return 1; diff --git a/libs/blkid/src/probers/jmicron_raid.c b/libs/blkid/src/probers/jmicron_raid.c index fb12077c..ae852f8f 100644 --- a/libs/blkid/src/probers/jmicron_raid.c +++ b/libs/blkid/src/probers/jmicron_raid.c @@ -1,30 +1,22 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2006 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include #include #include -#include -#include #include #include "blkidP.h" - -struct jmicron_meta { +struct jm_metadata { int8_t signature[2]; uint8_t minor_version; uint8_t major_version; @@ -35,21 +27,21 @@ struct jmicron_meta { static int probe_jmraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct jmicron_meta *jm; + uint64_t off; + struct jm_metadata *jm; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 1) * 0x200; - jm = (struct jmicron_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); + off = ((pr->size / 0x200) - 1) * 0x200; + jm = (struct jm_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct jm_metadata)); if (!jm) return -1; - if (memcmp(jm->signature, JM_SIGNATURE, sizeof(JM_SIGNATURE) - 1) != 0) return -1; - - if (blkid_probe_sprintf_version(pr, "%u.%u", jm->major_version, jm->minor_version) != 0) return -1; diff --git a/libs/blkid/src/probers/linux_raid.c b/libs/blkid/src/probers/linux_raid.c index 163c770d..e21ac0a7 100644 --- a/libs/blkid/src/probers/linux_raid.c +++ b/libs/blkid/src/probers/linux_raid.c @@ -1,24 +1,16 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2004 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" @@ -65,7 +57,9 @@ static int probe_raid0(blkid_probe pr, off_t off) if (pr->size < 0x10000) return -1; mdp0 = (struct mdp0_super_block *) - blkid_probe_get_buffer(pr, off, 0x800); + blkid_probe_get_buffer(pr, + off, + sizeof(struct mdp0_super_block)); if (!mdp0) return -1; @@ -110,7 +104,9 @@ static int probe_raid1(blkid_probe pr, off_t off) struct mdp1_super_block *mdp1; mdp1 = (struct mdp1_super_block *) - blkid_probe_get_buffer(pr, off, 0x800); + blkid_probe_get_buffer(pr, + off, + sizeof(struct mdp1_super_block)); if (!mdp1) return -1; if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) @@ -119,7 +115,8 @@ static int probe_raid1(blkid_probe pr, off_t off) return -1; if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0) return -1; - if (blkid_probe_set_label(pr, mdp1->set_name, sizeof(mdp1->set_name)) != 0) + if (blkid_probe_set_label(pr, mdp1->set_name, + sizeof(mdp1->set_name)) != 0) return -1; return 0; diff --git a/libs/blkid/src/probers/lsi_raid.c b/libs/blkid/src/probers/lsi_raid.c index 207ed849..d9ac4e12 100644 --- a/libs/blkid/src/probers/lsi_raid.c +++ b/libs/blkid/src/probers/lsi_raid.c @@ -1,16 +1,11 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2005 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include @@ -21,7 +16,7 @@ #include "blkidP.h" -struct lsi_meta { +struct lsi_metadata { uint8_t sig[6]; }; @@ -30,14 +25,17 @@ struct lsi_meta { static int probe_lsiraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct lsi_meta *lsi; + uint64_t off; + struct lsi_metadata *lsi; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 1) * 0x200; - lsi = (struct lsi_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); + off = ((pr->size / 0x200) - 1) * 0x200; + lsi = (struct lsi_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct lsi_metadata)); if (!lsi) return -1; diff --git a/libs/blkid/src/probers/luks.c b/libs/blkid/src/probers/luks.c index 7ded56d5..37023685 100644 --- a/libs/blkid/src/probers/luks.c +++ b/libs/blkid/src/probers/luks.c @@ -1,16 +1,11 @@ /* - * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include diff --git a/libs/blkid/src/probers/lvm.c b/libs/blkid/src/probers/lvm.c index 3dea6d9e..c0990ca2 100644 --- a/libs/blkid/src/probers/lvm.c +++ b/libs/blkid/src/probers/lvm.c @@ -5,17 +5,9 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -26,8 +18,6 @@ #include "blkidP.h" -/* TODO: add lvm1 support -- magic string detection required only */ - #define LVM2_ID_LEN 32 struct lvm2_pv_label_header { diff --git a/libs/blkid/src/probers/minix.c b/libs/blkid/src/probers/minix.c index 09d45437..b29b9a42 100644 --- a/libs/blkid/src/probers/minix.c +++ b/libs/blkid/src/probers/minix.c @@ -5,15 +5,8 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include "blkidP.h" @@ -35,7 +28,6 @@ static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag) return 0; } - const struct blkid_idinfo minix_idinfo = { .name = "minix", diff --git a/libs/blkid/src/probers/ntfs.c b/libs/blkid/src/probers/ntfs.c index 5802c5c6..cadbd720 100644 --- a/libs/blkid/src/probers/ntfs.c +++ b/libs/blkid/src/probers/ntfs.c @@ -5,23 +5,14 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include #include #include -#include -#include #include #include "blkidP.h" diff --git a/libs/blkid/src/probers/nvidia_raid.c b/libs/blkid/src/probers/nvidia_raid.c index 654fd7d0..76361763 100644 --- a/libs/blkid/src/probers/nvidia_raid.c +++ b/libs/blkid/src/probers/nvidia_raid.c @@ -2,28 +2,21 @@ * Copyright (C) 2008 Karel Zak * Copyright (C) 2005 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" -struct nvidia_meta { +struct nv_metadata { uint8_t vendor[8]; uint32_t size; uint32_t chksum; @@ -34,14 +27,17 @@ struct nvidia_meta { static int probe_nvraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct nvidia_meta *nv; + uint64_t off; + struct nv_metadata *nv; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 2) * 0x200; - nv = (struct nvidia_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); + off = ((pr->size / 0x200) - 2) * 0x200; + nv = (struct nv_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct nv_metadata)); if (!nv) return -1; diff --git a/libs/blkid/src/probers/ocfs.c b/libs/blkid/src/probers/ocfs.c index 6b74811a..7340b4e8 100644 --- a/libs/blkid/src/probers/ocfs.c +++ b/libs/blkid/src/probers/ocfs.c @@ -3,22 +3,13 @@ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include #include #include -#include -#include #include #include "blkidP.h" @@ -52,8 +43,6 @@ struct ocfs_volume_label { #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1]) << 8)) -#define OCFS_MAGIC "OracleCFS" - struct ocfs2_super_block { unsigned char signature[8]; unsigned char s_dummy1[184]; @@ -62,22 +51,12 @@ struct ocfs2_super_block { unsigned char s_uuid[16]; }; -#define OCFS2_MIN_BLOCKSIZE 512 -#define OCFS2_MAX_BLOCKSIZE 4096 - -#define OCFS2_SUPER_BLOCK_BLKNO 2 - -#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2" - struct oracle_asm_disk_label { char dummy[32]; char dl_tag[8]; char dl_id[24]; }; -#define ORACLE_ASM_DISK_LABEL_MARKED "ORCLDISK" -#define ORACLE_ASM_DISK_LABEL_OFFSET 32 - static int probe_ocfs(blkid_probe pr, const struct blkid_idmag *mag) { unsigned char *buf; diff --git a/libs/blkid/src/probers/promise_raid.c b/libs/blkid/src/probers/promise_raid.c index e3c1b63e..29540092 100644 --- a/libs/blkid/src/probers/promise_raid.c +++ b/libs/blkid/src/probers/promise_raid.c @@ -1,18 +1,12 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2005 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -23,7 +17,7 @@ #include "blkidP.h" -struct promise_meta { +struct promise_metadata { uint8_t sig[24]; }; @@ -41,12 +35,14 @@ static int probe_pdcraid(blkid_probe pr, const struct blkid_idmag *mag) return -1; for (i = 0; sectors[i] != 0; i++) { - uint64_t meta_off; - struct promise_meta *pdc; - - meta_off = ((pr->size / 0x200) - sectors[i]) * 0x200; - pdc = (struct promise_meta *) - blkid_probe_get_buffer(pr, meta_off, 0x200); + uint64_t off; + struct promise_metadata *pdc; + + off = ((pr->size / 0x200) - sectors[i]) * 0x200; + pdc = (struct promise_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct promise_metadata)); if (!pdc) return -1; diff --git a/libs/blkid/src/probers/reiserfs.c b/libs/blkid/src/probers/reiserfs.c index 2d27e11c..1a2e03c7 100644 --- a/libs/blkid/src/probers/reiserfs.c +++ b/libs/blkid/src/probers/reiserfs.c @@ -3,23 +3,13 @@ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include #include -#include -#include #include #include "blkidP.h" diff --git a/libs/blkid/src/probers/romfs.c b/libs/blkid/src/probers/romfs.c index 318fd56b..b5c20ab7 100644 --- a/libs/blkid/src/probers/romfs.c +++ b/libs/blkid/src/probers/romfs.c @@ -3,15 +3,8 @@ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include diff --git a/libs/blkid/src/probers/silicon_raid.c b/libs/blkid/src/probers/silicon_raid.c index d800d67a..a65d79a8 100644 --- a/libs/blkid/src/probers/silicon_raid.c +++ b/libs/blkid/src/probers/silicon_raid.c @@ -2,17 +2,12 @@ * Copyright (C) 2008 Karel Zak * Copyright (C) 2005 Kay Sievers * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ - #include #include #include @@ -23,7 +18,7 @@ #include "blkidP.h" -struct silicon_meta { +struct silicon_metadata { uint8_t unknown0[0x2E]; uint8_t ascii_version[0x36 - 0x2E]; uint8_t diskname[0x56 - 0x36]; @@ -47,16 +42,17 @@ struct silicon_meta { static int probe_silraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct silicon_meta *sil; + uint64_t off; + struct silicon_metadata *sil; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200) - 1) * 0x200; + off = ((pr->size / 0x200) - 1) * 0x200; - sil = (struct silicon_meta *) blkid_probe_get_buffer(pr, - meta_off, 0x200); + sil = (struct silicon_metadata *) + blkid_probe_get_buffer(pr, off, + sizeof(struct silicon_metadata)); if (!sil) return -1; diff --git a/libs/blkid/src/probers/swap.c b/libs/blkid/src/probers/swap.c index 6a887a8b..86eb94c6 100644 --- a/libs/blkid/src/probers/swap.c +++ b/libs/blkid/src/probers/swap.c @@ -1,13 +1,12 @@ /* - * Copyright (C) 2008 Karel Zak - * - * This is a derivative work from libvolume_id (udev) and libblkid (e2fsprogs). - * - * Copyright (C) 2004 Kay Sievers * Copyright (C) 1999 by Andries Brouwer * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o * Copyright (C) 2001 by Andreas Dilger + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2008 Karel Zak * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include diff --git a/libs/blkid/src/probers/udf.c b/libs/blkid/src/probers/udf.c index ef34bb8b..de35b1a0 100644 --- a/libs/blkid/src/probers/udf.c +++ b/libs/blkid/src/probers/udf.c @@ -5,15 +5,8 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include @@ -56,7 +49,7 @@ struct volume_structure_descriptor { uint8_t type; uint8_t id[5]; uint8_t version; -} PACKED; +}; #define UDF_VSD_OFFSET 0x8000 diff --git a/libs/blkid/src/probers/ufs.c b/libs/blkid/src/probers/ufs.c index a474bf6e..fe9870d8 100644 --- a/libs/blkid/src/probers/ufs.c +++ b/libs/blkid/src/probers/ufs.c @@ -1,19 +1,11 @@ /* - * Copyright (C) 1999 by Andries Brouwer - * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o - * Copyright (C) 2001 by Andreas Dilger - * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include diff --git a/libs/blkid/src/probers/vfat.c b/libs/blkid/src/probers/vfat.c index e3b9bb30..b12ab63a 100644 --- a/libs/blkid/src/probers/vfat.c +++ b/libs/blkid/src/probers/vfat.c @@ -5,15 +5,8 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include diff --git a/libs/blkid/src/probers/via_raid.c b/libs/blkid/src/probers/via_raid.c index cb9058da..3e74da5c 100644 --- a/libs/blkid/src/probers/via_raid.c +++ b/libs/blkid/src/probers/via_raid.c @@ -1,16 +1,11 @@ /* * Copyright (C) 2008 Karel Zak - * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Inspired by libvolume_id by + * Kay Sievers * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include @@ -23,7 +18,7 @@ #include "blkidP.h" -struct via_meta { +struct via_metadata { uint16_t signature; uint8_t version_number; struct via_array { @@ -40,36 +35,39 @@ struct via_meta { #define VIA_SIGNATURE 0xAA55 /* 8 bit checksum on first 50 bytes of metadata. */ -static uint8_t meta_checksum(struct via_meta *via) +static uint8_t via_checksum(struct via_metadata *v) { - uint8_t i = 50, sum = 0; + uint8_t i = 50, cs = 0; while (i--) - sum += ((uint8_t*) via)[i]; + cs += ((uint8_t*) v)[i]; - return sum == via->checksum; + return cs == v->checksum; } static int probe_viaraid(blkid_probe pr, const struct blkid_idmag *mag) { - uint64_t meta_off; - struct via_meta *via; + uint64_t off; + struct via_metadata *v; if (pr->size < 0x10000) return -1; - meta_off = ((pr->size / 0x200)-1) * 0x200; + off = ((pr->size / 0x200)-1) * 0x200; - via = (struct via_meta *) blkid_probe_get_buffer(pr, meta_off, 0x200); - if (!via) + v = (struct via_metadata *) + blkid_probe_get_buffer(pr, + off, + sizeof(struct via_metadata)); + if (!v) return -1; - if (le16_to_cpu(via->signature) != VIA_SIGNATURE) + if (le16_to_cpu(v->signature) != VIA_SIGNATURE) return -1; - if (via->version_number > 1) + if (v->version_number > 1) return -1; - if (!meta_checksum(via)) + if (!via_checksum(v)) return -1; - if (blkid_probe_sprintf_version(pr, "%u", via->version_number) != 0) + if (blkid_probe_sprintf_version(pr, "%u", v->version_number) != 0) return -1; return 0; } diff --git a/libs/blkid/src/probers/vxfs.c b/libs/blkid/src/probers/vxfs.c index 2a6502a3..7a27b6c9 100644 --- a/libs/blkid/src/probers/vxfs.c +++ b/libs/blkid/src/probers/vxfs.c @@ -1,34 +1,24 @@ /* - * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o - * Copyright (C) 2001 by Andreas Dilger - * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include #include "blkidP.h" -struct vxfs_super { +struct vxfs_super_block { uint32_t vs_magic; int32_t vs_version; }; static int probe_vxfs(blkid_probe pr, const struct blkid_idmag *mag) { - struct vxfs_super *vxs; + struct vxfs_super_block *vxs; - vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super); + vxs = blkid_probe_get_sb(pr, mag, struct vxfs_super_block); if (!vxs) return -1; diff --git a/libs/blkid/src/probers/xfs.c b/libs/blkid/src/probers/xfs.c index b4fe3c22..fa7914e2 100644 --- a/libs/blkid/src/probers/xfs.c +++ b/libs/blkid/src/probers/xfs.c @@ -5,15 +5,8 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2008 Karel Zak * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This file is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. */ #include diff --git a/libs/blkid/src/verify.c b/libs/blkid/src/verify.c index 4db8d7b2..dd03ab7d 100644 --- a/libs/blkid/src/verify.c +++ b/libs/blkid/src/verify.c @@ -1,10 +1,8 @@ /* * Copyright (C) 2008 Karel Zak * - * %Begin-Header% * This file may be redistributed under the terms of the * GNU Lesser General Public License. - * %End-Header% */ #include