4 * Print whether the file start block is stripe-aligned.
6 * Copyright (c) 2010 Eric Sandeen <sandeen@sandeen.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
15 #include <sys/types.h>
19 #include <sys/ioctl.h>
21 #define FIBMAP _IO(0x00, 1) /* bmap access */
24 * If only filename given, print first block.
26 * If filename & sunit (in blocks) given, print whether we are well-aligned
29 int main(int argc, char ** argv)
33 int sunit = 0; /* in blocks */
35 unsigned int block = 0;
38 printf("Usage: %s <filename> <sunit in blocks>\n", argv[0]);
43 sunit = atoi(argv[2]);
45 fd = open(filename, O_RDONLY);
47 perror("can't open file\n");
51 ret = ioctl(fd, FIBMAP, &block);
61 printf("%s: Start block %u not multiple of sunit %u\n",
62 filename, block, sunit);
65 printf("%s: well-aligned\n", filename);