X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fblockdev.c;h=3df1807dc53d84ff02114613107b6a7dfd4efc5a;hp=1b0185a1e43358372c74b5d6e104390b55e379e2;hb=4d900cdac8258daa2e99c6ceb2a4985154e94150;hpb=887290e949d54c6ac4c9b787231e588f84f2367c diff --git a/daemon/blockdev.c b/daemon/blockdev.c index 1b0185a..3df1807 100644 --- a/daemon/blockdev.c +++ b/daemon/blockdev.c @@ -1,5 +1,5 @@ /* libguestfs - the guestfsd daemon - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,13 +32,13 @@ * we centralize it in one call. */ static int64_t -call_blockdev (char *device, char *switc, int extraarg, int prints) +call_blockdev (const char *device, const char *switc, int extraarg, int prints) { int r; int64_t rv; char *out, *err; const char *argv[] = { - "/sbin/blockdev", + "blockdev", switc, NULL, NULL, @@ -46,8 +46,6 @@ call_blockdev (char *device, char *switc, int extraarg, int prints) }; char buf[64]; - IS_DEVICE (device, -1); - if (extraarg > 0) { snprintf (buf, sizeof buf, "%d", extraarg); argv[2] = buf; @@ -80,65 +78,65 @@ call_blockdev (char *device, char *switc, int extraarg, int prints) } int -do_blockdev_setro (char *device) +do_blockdev_setro (const char *device) { return (int) call_blockdev (device, "--setro", 0, 0); } int -do_blockdev_setrw (char *device) +do_blockdev_setrw (const char *device) { return (int) call_blockdev (device, "--setrw", 0, 0); } int -do_blockdev_getro (char *device) +do_blockdev_getro (const char *device) { return (int) call_blockdev (device, "--getro", 0, 1); } int -do_blockdev_getss (char *device) +do_blockdev_getss (const char *device) { return (int) call_blockdev (device, "--getss", 0, 1); } int -do_blockdev_getbsz (char *device) +do_blockdev_getbsz (const char *device) { return (int) call_blockdev (device, "--getbsz", 0, 1); } int -do_blockdev_setbsz (char *device, int blocksize) +do_blockdev_setbsz (const char *device, int blocksize) { if (blocksize <= 0 /* || blocksize >= what? */) { - reply_with_error ("blockdev_setbsz: blocksize must be > 0"); + reply_with_error ("blocksize must be > 0"); return -1; } return (int) call_blockdev (device, "--setbsz", blocksize, 0); } int64_t -do_blockdev_getsz (char *device) +do_blockdev_getsz (const char *device) { return call_blockdev (device, "--getsz", 0, 1); } int64_t -do_blockdev_getsize64 (char *device) +do_blockdev_getsize64 (const char *device) { return call_blockdev (device, "--getsize64", 0, 1); } int -do_blockdev_flushbufs (char *device) +do_blockdev_flushbufs (const char *device) { return call_blockdev (device, "--flushbufs", 0, 0); } int -do_blockdev_rereadpt (char *device) +do_blockdev_rereadpt (const char *device) { return call_blockdev (device, "--rereadpt", 0, 0); }