2 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 void expect_error(int r, int err)
25 printf(" --- got error %d as expected\n", err);
27 perror(" !!! unexpected error");
30 printf(" !!! success instead of error %d as expected\n", err);
35 main(int argc, char **argv)
40 fprintf(stderr,"usage: %s <filesystem>\n",
45 fsfd = open(argv[1], O_RDONLY);
52 printf("--- xfsctl with bad output address\n");
53 #ifdef XFS_IOC_FSCOUNTS
54 expect_error(xfsctl(argv[1], fsfd, XFS_IOC_FSCOUNTS, NULL), EFAULT);
57 expect_error(syssgi(SGI_XFS_FSOPERATIONS, fsfd, XFS_FS_COUNTS, NULL, NULL), EFAULT);
63 printf("--- xfsctl with bad input address\n");
64 #ifdef XFS_IOC_SET_RESBLKS
65 expect_error(xfsctl(argv[1], fsfd, XFS_IOC_SET_RESBLKS, NULL), EFAULT);
67 #ifdef XFS_SET_RESBLKS
68 expect_error(syssgi(SGI_XFS_FSOPERATIONS, fsfd, XFS_SET_RESBLKS, NULL, NULL), EFAULT);