Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / vol / test / nicreate.c
blob7863c05f1642387174b6d592e028912702a35502
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 /* nicreate
11 * Test "inode" creation in the user space file system.
14 #include <afsconfig.h>
15 #include <afs/param.h>
18 #ifdef AFS_NAMEI_ENV
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <errno.h>
22 #include <fcntl.h>
23 #include <fcntl.h>
24 #include <sys/stat.h>
25 #include <lock.h>
26 #include <afs/afsutil.h>
27 #include "nfs.h"
28 #include <afs/afsint.h>
29 #include "ihandle.h"
30 #include "vnode.h"
31 #include "volume.h"
32 #include "viceinode.h"
33 #include "voldefs.h"
34 #include "partition.h"
35 #include <dirent.h>
36 #include <afs/afs_assert.h>
39 char *prog = "nicreate";
40 IHandle_t *GetLinkHandle(char *part, int volid);
42 void
43 Usage(void)
45 printf("Usage: %s partition RWvolid p1 p2 p3 p4\n", prog);
46 exit(1);
49 main(int ac, char **av)
51 char *part;
52 int volid;
53 int p1, p2, p3, p4;
54 IHandle_t lh, *lhp;
55 Inode ino;
57 if (ac != 7)
58 Usage();
60 part = av[1];
61 volid = atoi(av[2]);
62 p1 = atoi(av[3]);
63 p2 = atoi(av[4]);
64 p3 = atoi(av[5]);
65 p4 = atoi(av[6]);
67 if (p2 == -1 && p3 == VI_LINKTABLE)
68 lhp = NULL;
69 else {
70 lhp = GetLinkHandle(part, volid);
71 if (!lhp) {
72 perror("Getting link handle.\n");
73 exit(1);
77 ino = namei_icreate(lhp, part, p1, p2, p3, p4);
78 if (!VALID_INO(ino)) {
79 perror("namei_icreate");
80 } else {
81 printf("Returned inode %s\n", PrintInode(NULL, ino));
85 #endif /* AFS_NAMEI_ENV */