udev-builtin-blkid.c revision 3e2147858f21943d5f4a781c60f33ac22c6096ed
/*
* probe disks for filesystems and partitions
*
* Copyright (C) 2011 Kay Sievers <kay.sievers@vrfy.org>
* Copyright (C) 2011 Karel Zak <kzak@redhat.com>
*
* 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 program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include "udev.h"
{
char s[265];
s[0] = '\0';
blkid_safe_string(value, s, sizeof(s));
blkid_encode_string(value, s, sizeof(s));
blkid_safe_string(value, s, sizeof(s));
blkid_encode_string(value, s, sizeof(s));
blkid_safe_string(value, s, sizeof(s));
blkid_encode_string(value, s, sizeof(s));
blkid_encode_string(value, s, sizeof(s));
blkid_encode_string(value, s, sizeof(s));
}
}
{
int rc;
return -1;
/*
* check if the small disk is partitioned, if yes then
* don't probe for filesystems.
*/
if (rc < 0)
return rc; /* -1 = error, 1 = nothing, 0 = succes */
return 0; /* partition table detected */
}
return blkid_do_safeprobe(pr);
}
{
bool noraid = false;
int fd = -1;
const char *data;
const char *name;
int nvals;
int i;
int err = 0;
{}
};
for (;;) {
int option;
if (option == -1)
break;
switch (option) {
case 'o':
break;
case 'R':
noraid = true;
break;
}
}
pr = blkid_new_probe();
if (!pr) {
return EXIT_FAILURE;
}
if (noraid)
if (fd < 0) {
goto out;
}
if (err < 0)
goto out;
if (err < 0)
goto out;
for (i = 0; i < nvals; i++) {
continue;
}
out:
if (fd > 0)
if (err < 0)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
const struct udev_builtin udev_builtin_blkid = {
.name = "blkid",
.cmd = builtin_blkid,
.help = "filesystem and partition probing",
.run_once = true,
};